Define Canvas::show_externals() when _DEBUG is defined.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 25 Nov 2008 01:22:17 +0000 (01:22 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 25 Nov 2008 01:22:17 +0000 (01:22 +0000)
git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2268 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/canvas.cpp
synfig-core/trunk/src/synfig/canvas.h

index 2e0144b..30697ef 100644 (file)
@@ -1392,3 +1392,19 @@ Canvas::register_external_canvas(String file_name, Handle canvas)
        if(!is_absolute_path(file_name)) file_name = get_file_path()+ETL_DIRECTORY_SEPARATOR+file_name;
        externals_[file_name] = canvas;
 }
+
+#ifdef _DEBUG
+void
+Canvas::show_externals(String file, int line, String text) const
+{
+       printf("  .----- (externals for %lx '%s')\n  |  %s:%d %s\n", ulong(this), get_name().c_str(), file.c_str(), line, text.c_str());
+       std::map<String, Handle>::iterator iter;
+       for (iter = externals_.begin(); iter != externals_.end(); iter++)
+       {
+               synfig::String first(iter->first);
+               etl::loose_handle<Canvas> second(iter->second);
+               printf("  |    %40s : %lx (%d)\n", first.c_str(), ulong(&*second), second->count());
+       }
+       printf("  `-----\n\n");
+}
+#endif // _DEBUG
index 088c2e8..d2906be 100644 (file)
@@ -543,6 +543,10 @@ public:
 
        void register_external_canvas(String file, Handle canvas);
 
+#ifdef _DEBUG
+       void show_externals(String file, int line, String text) const;
+#endif // _DEBUG
+
 private:
        void add_group_pair(String group, etl::handle<Layer> layer);
        void remove_group_pair(String group, etl::handle<Layer> layer);