X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fdock_layers.cpp;h=8fa6edeee8066bb50e7b21c33346f469a7bd3d3b;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=3cfa16685ba8740d7df1ca4ab55ed6ab443425fc;hpb=3a3c4bca3a17137bec5d7960560934b91ef4146e;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/dock_layers.cpp b/synfig-studio/trunk/src/gtkmm/dock_layers.cpp index 3cfa166..8fa6ede 100644 --- a/synfig-studio/trunk/src/gtkmm/dock_layers.cpp +++ b/synfig-studio/trunk/src/gtkmm/dock_layers.cpp @@ -1,20 +1,22 @@ -/* === S I N F G =========================================================== */ +/* === S Y N F I G ========================================================= */ /*! \file dock_layers.cpp ** \brief Template File ** -** $Id: dock_layers.cpp,v 1.2 2005/01/12 07:03:42 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007, 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 */ /* ========================================================================= */ @@ -44,13 +46,15 @@ #include "layeractionmanager.h" //#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 ========================================================= */ @@ -61,13 +65,13 @@ using namespace studio; /*static void do_nothing(reference_counter x) { - sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,x.count()); + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,x.count()); }*/ /* === M E T H O D S ======================================================= */ Dock_Layers::Dock_Layers(): - Dock_CanvasSpecific("layers",_("Layers"),Gtk::StockID("sinfg-layer")), + Dock_CanvasSpecific("layers",_("Layers"),Gtk::StockID("synfig-layer")), // layer_action_manager(0) layer_action_manager(new LayerActionManager) { @@ -75,18 +79,18 @@ Dock_Layers::Dock_Layers(): action_group_new_layers=Gtk::ActionGroup::create(); action_group_layer_ops=Gtk::ActionGroup::create(); - - std::map category_map; + + std::map category_map; // Build layer creation actions - sinfg::Layer::Book::iterator iter; - for(iter=sinfg::Layer::book().begin();iter!=sinfg::Layer::book().end();++iter) + synfig::Layer::Book::iterator iter; + for(iter=synfig::Layer::book().begin();iter!=synfig::Layer::book().end();++iter) { - sinfg::Layer::Book::value_type lyr(*iter); - - if(lyr.second.category==_("Do Not Use")) + synfig::Layer::Book::value_type lyr(*iter); + + if(lyr.second.category==CATEGORY_DO_NOT_USE) continue; - + action_group_new_layers->add(Gtk::Action::create( strprintf("layer-new-%s",lyr.first.c_str()), layer_icon(lyr.first.c_str()), @@ -101,43 +105,58 @@ Dock_Layers::Dock_Layers(): ); category_map[lyr.second.category]+=strprintf("",lyr.first.c_str()); - + //(*category_map)[lyr.second.category]->items().push_back(Gtk::Menu_Helpers::MenuElem(lyr.second.local_name, //)); } - + { Glib::RefPtr action_group_categories(Gtk::ActionGroup::create("layer-category")); - sinfg::String layer_ui_info; - - layer_ui_info+=""; + synfig::String layer_ui_info; - std::map::iterator iter; + layer_ui_info+=""; + + std::map::iterator iter; for(iter=category_map.begin();iter!=category_map.end();++iter) { layer_ui_info+=strprintf("%s",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+=""; - + layer_ui_info+=""; + 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); + } } - - - action_group_layer_ops->add( Gtk::Action::create("toolbar-layer", "Layer Ops") ); - App::ui_manager()->insert_action_group(action_group_layer_ops); + 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")) ); + App::ui_manager()->insert_action_group(action_group_layer_ops); Glib::ustring ui_info = "" " " - " " - " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -149,7 +168,7 @@ Dock_Layers::Dock_Layers(): action_group_new_layers->set_sensitive(false); - set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-layer"))); + set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-layer"))); @@ -157,37 +176,37 @@ Dock_Layers::Dock_Layers(): /* reference_counter ref_count; - sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); { sigc::signal tmp_signal; - + tmp_signal.connect( sigc::bind( sigc::ptr_fun(do_nothing), ref_count ) ); - - sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); tmp_signal(); - sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + tmp_signal.clear(); - sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + tmp_signal(); - sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); tmp_signal.connect( sigc::bind( sigc::ptr_fun(do_nothing), ref_count ) ); - sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); } - sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - assert(ref_count.count()==1); + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + assert(ref_count.count()==1); */ } @@ -206,19 +225,21 @@ Dock_Layers::init_canvas_view_vfunc(etl::loose_handle 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( sigc::hide_return( - sigc::mem_fun(*canvas_view->canvas_interface(), &sinfgapp::CanvasInterface::change_value) + sigc::mem_fun(*canvas_view->canvas_interface(), &synfigapp::CanvasInterface::change_value) ) ); - 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"), @@ -239,7 +260,7 @@ Dock_Layers::changed_canvas_view_vfunc(etl::loose_handle canvas_view if(canvas_view) { Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); - + add(*tree_view); tree_view->show(); action_group_new_layers->set_sensitive(true); @@ -259,13 +280,13 @@ Dock_Layers::changed_canvas_view_vfunc(etl::loose_handle canvas_view layer_action_manager->set_canvas_interface(0); layer_action_manager->set_layer_tree(0); } - - clear_previous(); + + clear_previous(); } } void -Dock_Layers::add_layer(sinfg::String id) +Dock_Layers::add_layer(synfig::String id) { etl::loose_handle canvas_view(get_canvas_view()); if(canvas_view)