X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Flayergrouptreestore.cpp;h=c13bbe28973cf3b1c6bbcc4263875fe34cf7b3b6;hb=63e709f66d50c124cc0ece2325f4773ac4ae7b20;hp=061f3f495f44965c4c42ef6cd4164cac5e4b617a;hpb=3a3c4bca3a17137bec5d7960560934b91ef4146e;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/layergrouptreestore.cpp b/synfig-studio/trunk/src/gtkmm/layergrouptreestore.cpp index 061f3f4..c13bbe2 100644 --- a/synfig-studio/trunk/src/gtkmm/layergrouptreestore.cpp +++ b/synfig-studio/trunk/src/gtkmm/layergrouptreestore.cpp @@ -1,20 +1,21 @@ -/* === S I N F G =========================================================== */ -/*! \file layertreestore.cpp +/* === S Y N F I G ========================================================= */ +/*! \file layergrouptreestore.cpp ** \brief Template File ** -** $Id: layergrouptreestore.cpp,v 1.2 2005/01/13 18:37:30 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** 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,27 +30,28 @@ #endif #include "layergrouptreestore.h" -#include "iconcontroler.h" +#include "iconcontroller.h" #include -#include -#include -#include +#include +#include +#include #include "app.h" #include "instance.h" -#include +#include #include "dockmanager.h" #include "dockable.h" -#include "iconcontroler.h" #include #include +#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 ========================================================= */ @@ -69,12 +71,12 @@ static LayerGroupTreeStore::Model& ModelHack() return *model; } -LayerGroupTreeStore::LayerGroupTreeStore(etl::loose_handle canvas_interface_): +LayerGroupTreeStore::LayerGroupTreeStore(etl::loose_handle canvas_interface_): Gtk::TreeStore (ModelHack()), canvas_interface_ (canvas_interface_) { - layer_icon=Gtk::Button().render_icon(Gtk::StockID("sinfg-layer"),Gtk::ICON_SIZE_SMALL_TOOLBAR); - group_icon=Gtk::Button().render_icon(Gtk::StockID("sinfg-group"),Gtk::ICON_SIZE_SMALL_TOOLBAR); + layer_icon=Gtk::Button().render_icon(Gtk::StockID("synfig-layer"),Gtk::ICON_SIZE_SMALL_TOOLBAR); + group_icon=Gtk::Button().render_icon(Gtk::StockID("synfig-group"),Gtk::ICON_SIZE_SMALL_TOOLBAR); // Connect Signals to Terminals canvas_interface()->signal_layer_status_changed().connect(sigc::mem_fun(*this,&studio::LayerGroupTreeStore::on_layer_status_changed)); @@ -93,7 +95,7 @@ LayerGroupTreeStore::LayerGroupTreeStore(etl::loose_handle&,int,const Glib:: Glib::ustring substr(x.uppercase()); Glib::ustring label((*iter)[model.label]); label=label.uppercase(); - + return label.find(substr)==Glib::ustring::npos; } Glib::RefPtr -LayerGroupTreeStore::create(etl::loose_handle canvas_interface_) +LayerGroupTreeStore::create(etl::loose_handle canvas_interface_) { return Glib::RefPtr(new LayerGroupTreeStore(canvas_interface_)); } @@ -122,11 +124,11 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int { Glib::Value x; g_value_init(x.gobj(),x.value_type()); - + if((bool)(*iter)[model.is_group]) { set layer_set(canvas_interface()->get_canvas()->get_layers_in_group((Glib::ustring)(*iter)[model.group_name])); - + x.set(LayerList(layer_set.begin(),layer_set.end())); } else if((bool)(*iter)[model.is_layer]) @@ -135,7 +137,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int layer_list.push_back((Layer::Handle)(*iter)[model.layer]); x.set(layer_list); } - + g_value_init(value.gobj(),x.value_type()); value=x; } @@ -143,7 +145,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int { Glib::Value x; g_value_init(x.gobj(),x.value_type()); - + if((bool)(*iter)[model.is_group]) { LayerList layer_list; @@ -162,7 +164,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int layer_list.push_back((Layer::Handle)(*iter)[model.layer]); x.set(layer_list); } - + g_value_init(value.gobj(),x.value_type()); value=x; } @@ -188,34 +190,30 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int { Glib::Value x; g_value_init(x.gobj(),x.value_type()); - + Glib::ustring group_name((*iter)[model.group_name]); - + // Get rid of any parent group crap while(group_name.find(GROUP_NEST_CHAR)!=Glib::ustring::npos) group_name=Glib::ustring(group_name,group_name.find(GROUP_NEST_CHAR)+1,Glib::ustring::npos); - + x.set(group_name); - + g_value_init(value.gobj(),x.value_type()); value=x; } else if((bool)(*iter)[model.is_layer]) { - sinfg::Layer::Handle layer((*iter)[model.layer]); - + synfig::Layer::Handle layer((*iter)[model.layer]); + if(!layer)return; - + Glib::Value 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()); value=x; @@ -224,7 +222,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int else if(column==model.tooltip.index()) { - sinfg::Layer::Handle layer((*iter)[model.layer]); + synfig::Layer::Handle layer((*iter)[model.layer]); if(!layer)return; @@ -233,7 +231,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int x.set(layer->get_local_name()); - + g_value_init(value.gobj(),x.value_type()); //g_value_copy(x.gobj(),value.gobj()); value=x; @@ -241,7 +239,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int else if(column==model.canvas.index()) { - sinfg::Layer::Handle layer((*iter)[model.layer]); + synfig::Layer::Handle layer((*iter)[model.layer]); if(!layer)return; @@ -250,7 +248,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int x.set(layer->get_canvas()); - + g_value_init(value.gobj(),x.value_type()); //g_value_copy(x.gobj(),value.gobj()); value=x; @@ -263,7 +261,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int if((bool)(*iter)[model.is_layer]) { - sinfg::Layer::Handle layer((*iter)[model.layer]); + synfig::Layer::Handle layer((*iter)[model.layer]); x.set(layer->active()); } else if((bool)(*iter)[model.is_group]) @@ -280,7 +278,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int } else x.set(false); - + g_value_init(value.gobj(),x.value_type()); g_value_copy(x.gobj(),value.gobj()); } @@ -292,14 +290,14 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int if((bool)(*iter)[model.is_layer]) { - sinfg::Layer::Handle layer((*iter)[model.layer]); + synfig::Layer::Handle layer((*iter)[model.layer]); if(!layer)return; //x.set(layer_icon); x.set(get_tree_pixbuf_layer(layer->get_name())); } if((bool)(*iter)[model.is_group]) x.set(group_icon); - + g_value_init(value.gobj(),x.value_type()); g_value_copy(x.gobj(),value.gobj()); } @@ -332,45 +330,45 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co Glib::Value x; g_value_init(x.gobj(),model.label.type()); g_value_copy(value.gobj(),x.gobj()); - + if((bool)(*iter)[model.is_layer]) { - sinfg::Layer::Handle layer((*iter)[model.layer]); + synfig::Layer::Handle layer((*iter)[model.layer]); if(!layer) return; - sinfg::String new_desc(x.get()); - + synfig::String new_desc(x.get()); + if(new_desc==layer->get_local_name()) - new_desc=sinfg::String(); - + new_desc=synfig::String(); + if(new_desc==layer->get_description()) return; - - sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_set_desc")); - + + synfigapp::Action::Handle action(synfigapp::Action::create("layer_set_desc")); + if(!action) return; - + action->set_param("canvas",canvas_interface()->get_canvas()); action->set_param("canvas_interface",canvas_interface()); action->set_param("layer",layer); - action->set_param("new_description",sinfg::String(x.get())); - + action->set_param("new_description",synfig::String(x.get())); + canvas_interface()->get_instance()->perform_action(action); return; } else if((bool)(*iter)[model.is_group]) { - sinfg::String group((Glib::ustring)(*iter)[model.label]); - sinfg::String new_group(x.get()); - + synfig::String group((Glib::ustring)(*iter)[model.label]); + synfig::String new_group(x.get()); + if(x.get()==group) return; Glib::ustring group_name((*iter)[model.group_name]); group=group_name; new_group.clear(); - + // Get rid of any parent group crap while(group_name.find(GROUP_NEST_CHAR)!=Glib::ustring::npos) { @@ -378,9 +376,9 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co group_name=Glib::ustring(group_name,group_name.find(GROUP_NEST_CHAR)+1,Glib::ustring::npos); } new_group+=x.get(); - - sinfg::info("Renaming group \"%s\" to \"%s\"...",group.c_str(),new_group.c_str()); - + + synfig::info("Renaming group \"%s\" to \"%s\"...",group.c_str(),new_group.c_str()); + // Check to see if this group is real or not. // If it isn't real, then renaming it is a cinch. // We know it isn't real if it doesn't have any @@ -391,16 +389,16 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co } else { - sinfgapp::Action::Handle action(sinfgapp::Action::create("group_rename")); - + synfigapp::Action::Handle action(synfigapp::Action::create("group_rename")); + if(!action) return; - + action->set_param("canvas",canvas_interface()->get_canvas()); action->set_param("canvas_interface",canvas_interface()); action->set_param("group",group); action->set_param("new_group",new_group); - + canvas_interface()->get_instance()->perform_action(action); } return; @@ -413,40 +411,40 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co Glib::Value x; g_value_init(x.gobj(),model.active.type()); g_value_copy(value.gobj(),x.gobj()); - + if((bool)(*iter)[model.is_layer]) - { - sinfg::Layer::Handle layer((*iter)[model.layer]); + { + synfig::Layer::Handle layer((*iter)[model.layer]); if(!layer)return; - - sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_activate")); - + + synfigapp::Action::Handle action(synfigapp::Action::create("layer_activate")); + if(!action) return; - + action->set_param("canvas",canvas_interface()->get_canvas()); action->set_param("canvas_interface",canvas_interface()); action->set_param("layer",layer); action->set_param("new_status",bool(x.get())); - + canvas_interface()->get_instance()->perform_action(action); return; } else if(!iter->children().empty()) { - sinfgapp::Action::PassiveGrouper group( + synfigapp::Action::PassiveGrouper group( get_canvas_interface()->get_instance().get(), String( x.get()?_("Activate "):_("Deactivate ") )+(Glib::ustring)(*iter)[model.label] ); - + Gtk::TreeModel::iterator child_iter(iter->children().begin()); - + for(;child_iter;++child_iter) (*child_iter)[model.active]=x.get(); - + Gtk::TreeStore::set_value_impl(iter,column, value); } } @@ -457,18 +455,18 @@ LayerGroupTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int co catch(std::exception x) { g_warning(x.what()); - } + } } 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)); - + return true; // return (bool)true; } @@ -477,9 +475,9 @@ bool LayerGroupTreeStore::drag_data_get_vfunc (const TreeModel::Path& path, Gtk::SelectionData& selection_data)const { if(!const_cast(this)->get_iter(path)) return false; - //sinfg::info("Dragged data of type \"%s\"",selection_data.get_data_type()); - //sinfg::info("Dragged data of target \"%s\"",gdk_atom_name(selection_data->target)); - //sinfg::info("Dragged selection=\"%s\"",gdk_atom_name(selection_data->selection)); + //synfig::info("Dragged data of type \"%s\"",selection_data.get_data_type()); + //synfig::info("Dragged data of target \"%s\"",gdk_atom_name(selection_data->target)); + //synfig::info("Dragged selection=\"%s\"",gdk_atom_name(selection_data->selection)); Gtk::TreeModel::Row row(*const_cast(this)->get_iter(path)); @@ -491,27 +489,27 @@ LayerGroupTreeStore::drag_data_get_vfunc (const TreeModel::Path& path, Gtk::Sele std::vector layers; layers.push_back(layer); - + selection_data.set("LAYER", 8, reinterpret_cast(&layers.front()), sizeof(void*)*layers.size()); return true; } else if((bool)row[model.is_group]) { - sinfg::String group((Glib::ustring)row[model.group_name]); + synfig::String group((Glib::ustring)row[model.group_name]); if(group.empty()) return false; - + selection_data.set("GROUP", 8, reinterpret_cast(&*group.begin()), sizeof(void*)*group.size()); - return true; + return true; } - + return false; } bool -LayerGroupTreeStore::drag_data_delete_vfunc (const TreeModel::Path& path) +LayerGroupTreeStore::drag_data_delete_vfunc (const TreeModel::Path& /*path*/) { return true; } @@ -522,29 +520,29 @@ LayerGroupTreeStore::row_drop_possible_vfunc (const TreeModel::Path& dest, const Gtk::TreeIter iter(const_cast(this)->get_iter(dest)); if(!iter) return false; - if(sinfg::String(selection_data.get_data_type())=="LAYER") + if(synfig::String(selection_data.get_data_type())=="LAYER") return true; - if(sinfg::String(selection_data.get_data_type())=="GROUP") + if(synfig::String(selection_data.get_data_type())=="GROUP") { - sinfg::String dest_group((Glib::ustring)(*iter)[model.group_name]); - sinfg::String src_group(reinterpret_cast(selection_data.get_data())); - //sinfg::String src_group(const_cast(selection_data.get_data())); - + synfig::String dest_group((Glib::ustring)(*iter)[model.group_name]); + synfig::String src_group(reinterpret_cast(selection_data.get_data())); + //synfig::String src_group(const_cast(selection_data.get_data())); + // Avoid putting a group inside of itself if(dest_group.size()>src_group.size() && src_group==String(dest_group,0,src_group.size())) return false; return true; } - + return false; - //sinfg::info("possible_drop -- data of type \"%s\"",selection_data.get_data_type()); - //sinfg::info("possible_drop -- data of target \"%s\"",gdk_atom_name(selection_data->target)); - //sinfg::info("possible_drop -- selection=\"%s\"",gdk_atom_name(selection_data->selection)); - + //synfig::info("possible_drop -- data of type \"%s\"",selection_data.get_data_type()); + //synfig::info("possible_drop -- data of target \"%s\"",gdk_atom_name(selection_data->target)); + //synfig::info("possible_drop -- selection=\"%s\"",gdk_atom_name(selection_data->selection)); + //Gtk::TreeModel::Row row(*get_iter(dest)); -/* if(sinfg::String(selection_data.get_data_type())=="LAYER" && (bool)true) +/* if(synfig::String(selection_data.get_data_type())=="LAYER" && (bool)true) return true; */ return false; @@ -556,30 +554,30 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons if(!get_iter(dest)) return false; // bool ret=false; //int i(0); - + Gtk::TreeModel::Row row(*get_iter(dest)); - //sinfg::info("Dropped data of type \"%s\"",selection_data.get_data_type()); - //sinfg::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target)); - //sinfg::info("Dropped selection=\"%s\"",gdk_atom_name(selection_data->selection)); - sinfgapp::Action::PassiveGrouper passive_grouper(canvas_interface()->get_instance().get(),_("Regroup")); + //synfig::info("Dropped data of type \"%s\"",selection_data.get_data_type()); + //synfig::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target)); + //synfig::info("Dropped selection=\"%s\"",gdk_atom_name(selection_data->selection)); + synfigapp::Action::PassiveGrouper passive_grouper(canvas_interface()->get_instance().get(),_("Regroup")); if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) { - sinfg::String dest_group; - + synfig::String dest_group; + dest_group=(Glib::ustring)row[model.group_name]; - + if(dest_group.empty()) return false; - if(sinfg::String(selection_data.get_data_type())=="LAYER") + if(synfig::String(selection_data.get_data_type())=="LAYER") { - sinfgapp::Action::Handle action(sinfgapp::Action::create("group_add_layers")); - + synfigapp::Action::Handle action(synfigapp::Action::create("group_add_layers")); + if(!action) return false; - + action->set_param("canvas",canvas_interface()->get_canvas()); action->set_param("canvas_interface",canvas_interface()); action->set_param("group",dest_group); @@ -588,7 +586,7 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons { Layer::Handle layer(reinterpret_cast(const_cast(selection_data.get_data()))[i]); assert(layer); - + action->set_param("layer",layer); } if(!canvas_interface()->get_instance()->perform_action(action)) @@ -598,27 +596,27 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons } return true; } - if(sinfg::String(selection_data.get_data_type())=="GROUP") + if(synfig::String(selection_data.get_data_type())=="GROUP") { - sinfg::String src_group(reinterpret_cast(selection_data.get_data())); - sinfg::String group(src_group); - + synfig::String src_group(reinterpret_cast(selection_data.get_data())); + synfig::String group(src_group); + // Get rid of any parent group crap while(group.find(GROUP_NEST_CHAR)!=Glib::ustring::npos) group=Glib::ustring(group,group.find(GROUP_NEST_CHAR)+1,Glib::ustring::npos); - + group=dest_group+GROUP_NEST_CHAR+group; - - sinfgapp::Action::Handle action(sinfgapp::Action::create("group_rename")); - + + synfigapp::Action::Handle action(synfigapp::Action::create("group_rename")); + if(!action) return false; - + action->set_param("canvas",canvas_interface()->get_canvas()); action->set_param("canvas_interface",canvas_interface()); action->set_param("group",src_group); action->set_param("new_group",group); - + if(!canvas_interface()->get_instance()->perform_action(action)) { passive_grouper.cancel(); @@ -628,13 +626,13 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons } } /* // Save the selection data - sinfgapp::SelectionManager::LayerList selected_layer_list=canvas_interface()->get_selection_manager()->get_selected_layers(); + synfigapp::SelectionManager::LayerList selected_layer_list=canvas_interface()->get_selection_manager()->get_selected_layers(); if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) { Canvas::Handle dest_canvas; Layer::Handle dest_layer; - + dest_canvas=(Canvas::Handle)(row[model.canvas]); dest_layer=(Layer::Handle)(row[model.layer]); assert(dest_canvas); @@ -643,16 +641,16 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons return false; int dest_layer_depth=dest_layer->get_depth(); - - if(sinfg::String(selection_data.get_data_type())=="LAYER")for(i=0;i(const_cast(selection_data.get_data()))[i]); assert(src); if(dest_layer==src) continue; - + // In this case, we are just moving. // if(dest_canvas==src->get_canvas()) { @@ -660,8 +658,8 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons dest_layer_depth--; if(dest_canvas==src->get_canvas() && dest_layer_depth==src->get_depth()) continue; - - sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_move")); + + synfigapp::Action::Handle action(synfigapp::Action::create("layer_move")); action->set_param("canvas",dest_canvas); action->set_param("canvas_interface",canvas_interface()); action->set_param("layer",src); @@ -669,12 +667,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; } @@ -682,11 +678,11 @@ LayerGroupTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, cons } } } - sinfg::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); - + return ret; */ return false; @@ -704,7 +700,7 @@ LayerGroupTreeStore::rebuild() rebuilding=true; etl::clock timer;timer.reset(); try { - + // Clear out the current list clear(); Canvas::Handle canvas(canvas_interface()->get_canvas()); @@ -714,15 +710,15 @@ LayerGroupTreeStore::rebuild() String group(*groups.begin()); Gtk::TreeRow row(on_group_added(group)); std::set layers(canvas->get_layers_in_group(group)); - + for(;layers.size();layers.erase(layers.begin())) { Gtk::TreeRow layer_row(*(prepend(row.children()))); Layer::Handle layer(*layers.begin()); set_row_layer(layer_row,layer); - } + } } - + // Go ahead and and add all the layers /*std::for_each( canvas_interface()->get_canvas()->rbegin(), canvas_interface()->get_canvas()->rend(), @@ -735,7 +731,7 @@ LayerGroupTreeStore::rebuild() throw; } rebuilding=false; - sinfg::info("LayerGroupTreeStore::rebuild() took %f seconds",float(timer())); + synfig::info("LayerGroupTreeStore::rebuild() took %f seconds",float(timer())); } void @@ -750,8 +746,8 @@ LayerGroupTreeStore::refresh_row(Gtk::TreeModel::Row &row) if((bool)row[model.is_layer]) { Layer::Handle layer=row[model.layer]; - - + + //if(layer->dynamic_param_list().count("z_depth")) // row[model.z_depth]=Time::begin(); } @@ -769,7 +765,7 @@ LayerGroupTreeStore::refresh_row(Gtk::TreeModel::Row &row) void -LayerGroupTreeStore::set_row_layer(Gtk::TreeRow &row,sinfg::Layer::Handle &handle) +LayerGroupTreeStore::set_row_layer(Gtk::TreeRow &row,synfig::Layer::Handle &handle) { row[model.is_layer] = true; row[model.is_group] = false; @@ -777,7 +773,7 @@ LayerGroupTreeStore::set_row_layer(Gtk::TreeRow &row,sinfg::Layer::Handle &handl } Gtk::TreeRow -LayerGroupTreeStore::on_group_added(sinfg::String group) +LayerGroupTreeStore::on_group_added(synfig::String group) { // Check to see if this group perhaps already // exists @@ -786,7 +782,7 @@ LayerGroupTreeStore::on_group_added(sinfg::String group) if(find_group_row(group, iter)) return *iter; } - + if(group.find(GROUP_NEST_CHAR)!=String::npos) { Gtk::TreeModel::Children::iterator iter; @@ -796,17 +792,17 @@ LayerGroupTreeStore::on_group_added(sinfg::String group) if(parent_name.size()) parent_name+=GROUP_NEST_CHAR; parent_name+=string(group,0,group.find(GROUP_NEST_CHAR)); - + if(!find_group_row(parent_name, iter)) iter=on_group_added(parent_name); - + group=String(group,group.find(GROUP_NEST_CHAR)+1,String::npos); }while(group.find(GROUP_NEST_CHAR)!=String::npos); if(parent_name.size()) parent_name+=GROUP_NEST_CHAR; parent_name+=group; - + if(iter) { Gtk::TreeRow row(*(prepend(iter->children()))); @@ -827,32 +823,28 @@ LayerGroupTreeStore::on_group_added(sinfg::String group) } bool -LayerGroupTreeStore::on_group_removed(sinfg::String group) +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); else return false; - + return true; } bool -LayerGroupTreeStore::on_group_changed(sinfg::String group) +LayerGroupTreeStore::on_group_changed(synfig::String /*group*/) { - //DEBUGPOINT(); return true; } void -LayerGroupTreeStore::on_group_pair_added(String group, etl::handle layer) +LayerGroupTreeStore::on_group_pair_added(synfig::String group, etl::handle layer) { if(!layer->get_canvas()) return; - //DEBUGPOINT(); Gtk::TreeModel::Children::iterator iter; if(!find_group_row(group, iter)) iter=on_group_added(group); @@ -863,22 +855,21 @@ LayerGroupTreeStore::on_group_pair_added(String group, etl::handle layer) } void -LayerGroupTreeStore::on_group_pair_removed(String group, etl::handle layer) +LayerGroupTreeStore::on_group_pair_removed(synfig::String group, etl::handle layer) { if(!layer->get_canvas()) return; - //DEBUGPOINT(); Gtk::TreeModel::Children::iterator iter; if(!find_group_row(group, iter)) return; Gtk::TreeModel::Children::iterator prev,layer_iter; - + if(!find_layer_row_(layer, layer->get_canvas(), iter->children(), layer_iter, prev)) return; - + erase(layer_iter); - + on_activity(); } @@ -897,29 +888,29 @@ LayerGroupTreeStore::on_activity() } void -LayerGroupTreeStore::on_layer_status_changed(sinfg::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)) (*iter)[model.layer]=handle; else { - sinfg::warning("Couldn't find layer to be activated in layer list. Rebuilding index..."); + synfig::warning("Couldn't find layer to be activated in layer list. Rebuilding index..."); rebuild(); } } void -LayerGroupTreeStore::on_layer_new_description(sinfg::Layer::Handle handle,sinfg::String desc) +LayerGroupTreeStore::on_layer_new_description(synfig::Layer::Handle handle,synfig::String desc) { Gtk::TreeModel::Children::iterator iter; if(find_layer_row(handle,iter)) { Gtk::TreeRow row(*iter); - - Layer::Handle layer(row[model.layer]); - + + Layer::Handle layer(row[model.layer]); + if(desc.empty()) { //row[model.label]=layer->get_local_name(); @@ -929,70 +920,69 @@ LayerGroupTreeStore::on_layer_new_description(sinfg::Layer::Handle handle,sinfg: //row[model.label]=layer->get_description(); row[model.tooltip]=layer->get_local_name(); } - else + else { rebuild(); } } bool -LayerGroupTreeStore::find_layer_row_(const sinfg::Layer::Handle &layer, sinfg::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev) +LayerGroupTreeStore::find_layer_row_(const synfig::Layer::Handle &layer, synfig::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev) { assert(layer); - + //if(layer->get_canvas()==canvas) { for(iter=prev=layers.begin(); iter && iter != layers.end(); prev=iter++) { Gtk::TreeModel::Row row = *iter; - if((bool)row[model.is_layer] && layer==(sinfg::Layer::Handle)row[model.layer]) + if((bool)row[model.is_layer] && layer==(synfig::Layer::Handle)row[model.layer]) return true; } - + iter=children().end(); - //DEBUGPOINT(); //return false; } Gtk::TreeModel::Children::iterator iter2; - + for(iter2 = layers.begin(); iter2 && iter2 != layers.end(); ++iter2) { Gtk::TreeModel::Row row = *iter2; assert((bool)true); - + if(row.children().empty()) continue; - + /*Canvas::Handle canvas((*row.children().begin())[model.canvas]); if(!canvas) continue; */ - + if(find_layer_row_(layer,canvas,iter2->children(),iter,prev)) return true; } - + iter=children().end(); return false; } bool -LayerGroupTreeStore::find_layer_row(const sinfg::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &iter) +LayerGroupTreeStore::find_layer_row(const synfig::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &iter) { Gtk::TreeModel::Children::iterator prev; return find_layer_row_(layer,canvas_interface()->get_canvas(),children(),iter,prev); } 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); } bool -LayerGroupTreeStore::find_group_row_(const sinfg::String &group, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev) +LayerGroupTreeStore::find_group_row_(const synfig::String &group, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev) { //if(layer->get_canvas()==canvas) { @@ -1002,32 +992,31 @@ LayerGroupTreeStore::find_group_row_(const sinfg::String &group, Gtk::TreeModel: if((bool)row[model.is_group] && group==(Glib::ustring)row[model.group_name]) return true; } - + iter=children().end(); - //DEBUGPOINT(); //return false; } Gtk::TreeModel::Children::iterator iter2; - + for(iter2 = layers.begin(); iter2 && iter2 != layers.end(); ++iter2) { Gtk::TreeModel::Row row = *iter2; assert((bool)true); - + if(row.children().empty()) continue; - + if(find_group_row_(group,iter2->children(),iter,prev)) return true; } - + iter=children().end(); return false; } bool -LayerGroupTreeStore::find_prev_layer_row(const sinfg::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &prev) +LayerGroupTreeStore::find_prev_layer_row(const synfig::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &prev) { Gtk::TreeModel::Children::iterator iter; if(!find_layer_row_(layer,canvas_interface()->get_canvas(),children(),iter,prev))