diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-10-20 22:21:45 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-10-20 22:21:45 +0000 |
| commit | f1e0309a7ffe42441f86def97f54aa57d86f1624 (patch) | |
| tree | 7226490a904223b0fd208c488ae157d9a92bc819 /src | |
| parent | Progress Bar workinggit add .git add . (diff) | |
| parent | Merge branch 'smartpointer_refactor' of gitlab.com:jali/inkscape (diff) | |
| download | inkscape-f1e0309a7ffe42441f86def97f54aa57d86f1624.tar.gz inkscape-f1e0309a7ffe42441f86def97f54aa57d86f1624.zip | |
Merge branch 'master' into SymbolsSearch
Diffstat (limited to 'src')
108 files changed, 248 insertions, 1384 deletions
diff --git a/src/2geom/makefile.in b/src/2geom/makefile.in deleted file mode 100644 index ca7943377..000000000 --- a/src/2geom/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) 2geom/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) 2geom/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 09d6d25d4..72d984845 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -325,7 +325,6 @@ set(inkscape_SRC guide-snapper.h help.h helper-fns.h - icon-size.h id-clash.h inkscape-version.h inkscape.h diff --git a/src/check-header-compile.in b/src/check-header-compile.in deleted file mode 100755 index 2295dcf91..000000000 --- a/src/check-header-compile.in +++ /dev/null @@ -1,47 +0,0 @@ -#! /bin/sh -# Check that each .h file has all the includes it needs. - -# Probably requires gnu find (for -printf '%P\n'). - -# This script hereby placed into the public domain. - -set -e -mydir=`dirname "$0"` -cd "$mydir" -srcdir="@srcdir@" -CXX="@CXX@" -INCLUDES="@GNOME_VFS_CFLAGS@ @POPPLER_GLIB_CFLAGS@ @INKSCAPE_CFLAGS@" -OBJEXT="@OBJEXT@" -config_h_dir=.. - -check_compile () { - (echo "#include <config.h>"; echo "#include <$1>"; echo "int header_tst_dummy;") > header-tst.cpp - $CXX -c -I. -I"$srcdir" -I$config_h_dir $INCLUDES header-tst.cpp -} - -if [ $# = 0 ]; then - for i in `find "$srcdir" \ - -name bonobo -prune \ - -o -name dom -prune \ - -o -name ecma -prune \ - -o -name render -prune \ - -o -name xpath -prune \ - -o -name '*.h' \ - \! -name gnome.h \! -name nr-type-gnome.h \! -name Livarot.h \! -name radial.h \ - \! -name '*-test.h' \ - \! -name test-helpers.h \ - \! -name PylogFormatter.h \ - \! -name TRPIFormatter.h \ - \! -name win32.h \ - \! -name '*-w32.h' \ - \! -name '*-win32.h' \ - -printf '%P\n'` - do - check_compile "$i" - done -else - for i in "$@"; do - check_compile "$i" - done -fi -rm header-tst.cpp header-tst.$OBJEXT diff --git a/src/debug/demangle.cpp b/src/debug/demangle.cpp index 1d94f0eb9..04fe80d9b 100644 --- a/src/debug/demangle.cpp +++ b/src/debug/demangle.cpp @@ -50,7 +50,7 @@ MangleCache mangle_cache; } -Util::ptr_shared<char> demangle(char const *name) { +Util::ptr_shared demangle(char const *name) { MangleCache::iterator found=mangle_cache.find(name); char const *result; diff --git a/src/debug/demangle.h b/src/debug/demangle.h index 7505d9550..c5e160caa 100644 --- a/src/debug/demangle.h +++ b/src/debug/demangle.h @@ -18,7 +18,7 @@ namespace Inkscape { namespace Debug { -Util::ptr_shared<char> demangle(char const *name); +Util::ptr_shared demangle(char const *name); } diff --git a/src/debug/event.h b/src/debug/event.h index 1cdd4f7e2..2d3751ff5 100644 --- a/src/debug/event.h +++ b/src/debug/event.h @@ -40,23 +40,23 @@ public: struct PropertyPair { public: PropertyPair() {} - PropertyPair(Util::ptr_shared<char> n, Util::ptr_shared<char> v) + PropertyPair(Util::ptr_shared n, Util::ptr_shared v) : name(n), value(v) {} - PropertyPair(char const *n, Util::ptr_shared<char> v) + PropertyPair(char const *n, Util::ptr_shared v) : name(Util::share_string(n)), value(v) {} - PropertyPair(Util::ptr_shared<char> n, char const *v) + PropertyPair(Util::ptr_shared n, char const *v) : name(n), value(Util::share_string(v)) {} PropertyPair(char const *n, char const *v) : name(Util::share_string(n)), value(Util::share_string(v)) {} - Util::ptr_shared<char> name; - Util::ptr_shared<char> value; + Util::ptr_shared name; + Util::ptr_shared value; }; static Category category() { return OTHER; } - virtual Util::ptr_shared<char> name() const=0; + virtual Util::ptr_shared name() const=0; virtual unsigned propertyCount() const=0; virtual PropertyPair property(unsigned property) const=0; diff --git a/src/debug/gc-heap.h b/src/debug/gc-heap.h index d120ddba9..0daf39487 100644 --- a/src/debug/gc-heap.h +++ b/src/debug/gc-heap.h @@ -23,7 +23,7 @@ public: int features() const { return SIZE_AVAILABLE | USED_AVAILABLE | GARBAGE_COLLECTED; } - Util::ptr_shared<char> name() const { + Util::ptr_shared name() const { return Util::share_static_string("libgc"); } Heap::Stats stats() const { diff --git a/src/debug/heap.h b/src/debug/heap.h index e1e01f022..d7d39efb9 100644 --- a/src/debug/heap.h +++ b/src/debug/heap.h @@ -36,7 +36,7 @@ public: virtual int features() const=0; - virtual Util::ptr_shared<char> name() const=0; + virtual Util::ptr_shared name() const=0; virtual Stats stats() const=0; virtual void force_collect()=0; }; diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp index 2eb81a0ba..d422b8e72 100644 --- a/src/debug/logger.cpp +++ b/src/debug/logger.cpp @@ -26,7 +26,7 @@ bool Logger::_category_mask[Event::N_CATEGORIES]; namespace { -static void write_escaped_value(std::ostream &os, Util::ptr_shared<char> value) { +static void write_escaped_value(std::ostream &os, Util::ptr_shared value) { for ( char const *current=value ; *current ; ++current ) { switch (*current) { case '&': @@ -58,7 +58,7 @@ static void write_indent(std::ostream &os, unsigned depth) { static std::ofstream log_stream; static bool empty_tag=false; -typedef std::vector<Util::ptr_shared<char>, GC::Alloc<Util::ptr_shared<char>, GC::MANUAL> > TagStack; +typedef std::vector<Util::ptr_shared, GC::Alloc<Util::ptr_shared, GC::MANUAL> > TagStack; static TagStack &tag_stack() { static TagStack stack; return stack; @@ -158,7 +158,7 @@ void Logger::init() { } void Logger::_start(Event const &event) { - Util::ptr_shared<char> name=event.name(); + Util::ptr_shared name=event.name(); if (empty_tag) { log_stream << ">\n"; @@ -185,7 +185,7 @@ void Logger::_start(Event const &event) { } void Logger::_skip() { - tag_stack().push_back(Util::ptr_shared<char>()); + tag_stack().push_back(Util::ptr_shared()); } void Logger::_finish() { diff --git a/src/debug/makefile.in b/src/debug/makefile.in deleted file mode 100644 index 542f3a999..000000000 --- a/src/debug/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) debug/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) debug/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/debug/simple-event.h b/src/debug/simple-event.h index 03ce5d326..076b9b4b5 100644 --- a/src/debug/simple-event.h +++ b/src/debug/simple-event.h @@ -26,7 +26,7 @@ namespace Debug { template <Event::Category C=Event::OTHER> class SimpleEvent : public Event { public: - explicit SimpleEvent(Util::ptr_shared<char> name) : _name(name) {} + explicit SimpleEvent(Util::ptr_shared name) : _name(name) {} explicit SimpleEvent(char const *name) : _name(Util::share_string(name)) {} // default copy @@ -34,7 +34,7 @@ public: static Category category() { return C; } - Util::ptr_shared<char> name() const { return _name; } + Util::ptr_shared name() const { return _name; } unsigned propertyCount() const { return _properties.size(); } PropertyPair property(unsigned property) const { return _properties[property]; @@ -43,21 +43,21 @@ public: void generateChildEvents() const {} protected: - void _addProperty(Util::ptr_shared<char> name, - Util::ptr_shared<char> value) + void _addProperty(Util::ptr_shared name, + Util::ptr_shared value) { _properties.push_back(PropertyPair(name, value)); } - void _addProperty(Util::ptr_shared<char> name, char const *value) { + void _addProperty(Util::ptr_shared name, char const *value) { _addProperty(name, Util::share_string(value)); } - void _addProperty(char const *name, Util::ptr_shared<char> value) { + void _addProperty(char const *name, Util::ptr_shared value) { _addProperty(Util::share_string(name), value); } void _addProperty(char const *name, char const *value) { _addProperty(Util::share_string(name), Util::share_string(value)); } - void _addProperty(Util::ptr_shared<char> name, long value) { + void _addProperty(Util::ptr_shared name, long value) { _addFormattedProperty(name, "%ld", value); } void _addProperty(char const *name, long value) { @@ -65,10 +65,10 @@ protected: } private: - Util::ptr_shared<char> _name; + Util::ptr_shared _name; std::vector<PropertyPair, GC::Alloc<PropertyPair, GC::AUTO> > _properties; - void _addFormattedProperty(Util::ptr_shared<char> name, char const *format, ...) + void _addFormattedProperty(Util::ptr_shared name, char const *format, ...) { va_list args; va_start(args, format); diff --git a/src/debug/sysv-heap.h b/src/debug/sysv-heap.h index ba8f5db83..4bde77cd8 100644 --- a/src/debug/sysv-heap.h +++ b/src/debug/sysv-heap.h @@ -23,7 +23,7 @@ public: int features() const; - Util::ptr_shared<char> name() const { + Util::ptr_shared name() const { return Util::share_static_string("standard malloc()"); } Stats stats() const; diff --git a/src/debug/timestamp.cpp b/src/debug/timestamp.cpp index 6de03a463..cdd47e881 100644 --- a/src/debug/timestamp.cpp +++ b/src/debug/timestamp.cpp @@ -19,8 +19,8 @@ namespace Inkscape { namespace Debug { -Util::ptr_shared<char> timestamp() { - Util::ptr_shared<char> result; +Util::ptr_shared timestamp() { + Util::ptr_shared result; GTimeVal timestamp; g_get_current_time(×tamp); gchar *value = g_strdup_printf( "%d.%06d", static_cast<gint>(timestamp.tv_sec), static_cast<gint>(timestamp.tv_usec) ); diff --git a/src/debug/timestamp.h b/src/debug/timestamp.h index 336ed5d0f..c145ffbc9 100644 --- a/src/debug/timestamp.h +++ b/src/debug/timestamp.h @@ -18,7 +18,7 @@ namespace Inkscape { namespace Debug { -Util::ptr_shared<char> timestamp(); +Util::ptr_shared timestamp(); } diff --git a/src/display/drawing-surface.h b/src/display/drawing-surface.h index 7bec1606a..78471649a 100644 --- a/src/display/drawing-surface.h +++ b/src/display/drawing-surface.h @@ -12,7 +12,6 @@ #ifndef SEEN_INKSCAPE_DISPLAY_DRAWING_SURFACE_H #define SEEN_INKSCAPE_DISPLAY_DRAWING_SURFACE_H -#include <boost/shared_ptr.hpp> #include <cairo.h> #include <2geom/affine.h> #include <2geom/rect.h> diff --git a/src/display/makefile.in b/src/display/makefile.in deleted file mode 100644 index 747f18e11..000000000 --- a/src/display/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) display/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) display/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/event-log.cpp b/src/event-log.cpp index 5a73b649e..41ab2f2d0 100644 --- a/src/event-log.cpp +++ b/src/event-log.cpp @@ -12,8 +12,6 @@ #include "event-log.h" #include <glibmm/i18n.h> -#include <boost/shared_ptr.hpp> -#include <boost/make_shared.hpp> #include "desktop.h" #include "inkscape.h" @@ -60,9 +58,9 @@ public: Inkscape::EventLog::CallbackMap *_callbacks; }; -void addBlocker(std::vector<boost::shared_ptr<SignalBlocker> > &blockers, sigc::connection *connection) +void addBlocker(std::vector<std::unique_ptr<SignalBlocker> > &blockers, sigc::connection *connection) { - blockers.push_back(boost::make_shared<SignalBlocker>(connection)); + blockers.emplace_back(new SignalBlocker(connection)); } @@ -98,7 +96,7 @@ public: dlg._event_list_selection->set_mode(Gtk::SELECTION_SINGLE); { - std::vector<boost::shared_ptr<SignalBlocker> > blockers; + std::vector<std::unique_ptr<SignalBlocker> > blockers; addBlocker(blockers, &(*dlg._callback_connections)[Inkscape::EventLog::CALLB_SELECTION_CHANGE]); addBlocker(blockers, &(*dlg._callback_connections)[Inkscape::EventLog::CALLB_EXPAND]); @@ -119,7 +117,7 @@ public: void collapseRow(Gtk::TreeModel::Path const &path) { - std::vector<boost::shared_ptr<SignalBlocker> > blockers; + std::vector<std::unique_ptr<SignalBlocker> > blockers; for (std::vector<DialogConnection>::iterator it(_connections.begin()); it != _connections.end(); ++it) { addBlocker(blockers, &(*it->_callback_connections)[Inkscape::EventLog::CALLB_SELECTION_CHANGE]); @@ -134,7 +132,7 @@ public: void selectRow(Gtk::TreeModel::Path const &path) { - std::vector<boost::shared_ptr<SignalBlocker> > blockers; + std::vector<std::unique_ptr<SignalBlocker> > blockers; for (std::vector<DialogConnection>::iterator it(_connections.begin()); it != _connections.end(); ++it) { addBlocker(blockers, &(*it->_callback_connections)[Inkscape::EventLog::CALLB_SELECTION_CHANGE]); @@ -152,7 +150,7 @@ public: void clearEventList(Glib::RefPtr<Gtk::TreeStore> eventListStore) { if (eventListStore) { - std::vector<boost::shared_ptr<SignalBlocker> > blockers; + std::vector<std::unique_ptr<SignalBlocker> > blockers; for (std::vector<DialogConnection>::iterator it(_connections.begin()); it != _connections.end(); ++it) { addBlocker(blockers, &(*it->_callback_connections)[Inkscape::EventLog::CALLB_SELECTION_CHANGE]); diff --git a/src/extension/implementation/makefile.in b/src/extension/implementation/makefile.in deleted file mode 100644 index d54ea1d3a..000000000 --- a/src/extension/implementation/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd ../.. && $(MAKE) extension/implementation/all - -clean %.a %.$(OBJEXT): - cd ../.. && $(MAKE) extension/implementation/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 8da56fecd..2901655f1 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -32,7 +32,6 @@ #include "extension/input.h" #include "extension/db.h" #include "inkscape.h" -#include "io/sys.h" #include "io/resource.h" #include "preferences.h" #include "script.h" @@ -398,7 +397,7 @@ ScriptDocCache::ScriptDocCache (Inkscape::UI::View::View * view) : _tempfd(0) { try { - _tempfd = Inkscape::IO::file_open_tmp(_filename, "ink_ext_XXXXXX.svg"); + _tempfd = Glib::file_open_tmp(_filename, "ink_ext_XXXXXX.svg"); } catch (...) { /// \todo Popup dialog here return; @@ -462,7 +461,7 @@ Gtk::Widget *Script::prefs_output(Inkscape::Extension::Output *module) \param filename File to open. First things first, this function needs a temporary file name. To - create on of those the function g_file_open_tmp is used with + create on of those the function Glib::file_open_tmp is used with the header of ink_ext_. The extension is then executed using the 'execute' function @@ -483,7 +482,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, std::string tempfilename_out; int tempfd_out = 0; try { - tempfd_out = Inkscape::IO::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg"); + tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg"); } catch (...) { /// \todo Popup dialog here return NULL; @@ -513,7 +512,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, mydoc->changeUriAndHrefs(filenameArg); } - // make sure we don't leak file descriptors from g_file_open_tmp + // make sure we don't leak file descriptors from Glib::file_open_tmp close(tempfd_out); unlink(tempfilename_out.c_str()); @@ -539,7 +538,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, do that eh? First things first, the document is saved to a temporary file that - is an SVG file. To get the temporary filename g_file_open_tmp is used with + is an SVG file. To get the temporary filename Glib::file_open_tmp is used with ink_ext_ as a prefix. Don't worry, this file gets deleted at the end of the function. @@ -558,7 +557,7 @@ void Script::save(Inkscape::Extension::Output *module, std::string tempfilename_in; int tempfd_in = 0; try { - tempfd_in = Inkscape::IO::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX.svg"); + tempfd_in = Glib::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX.svg"); } catch (...) { /// \todo Popup dialog here throw Inkscape::Extension::Output::save_failed(); @@ -587,7 +586,7 @@ void Script::save(Inkscape::Extension::Output *module, success = fileout.toFile(lfilename); } - // make sure we don't leak file descriptors from g_file_open_tmp + // make sure we don't leak file descriptors from Glib::file_open_tmp close(tempfd_in); // FIXME: convert to utf8 (from "filename encoding") and unlink_utf8name unlink(tempfilename_in.c_str()); @@ -609,7 +608,7 @@ void Script::save(Inkscape::Extension::Output *module, This function is a little bit trickier than the previous two. It needs two temporary files to get it's work done. Both of these - files have random names created for them using the g_file_open_temp function + files have random names created for them using the Glib::file_open_temp function with the ink_ext_ prefix in the temporary directory. Like the other functions, the temporary files are deleted at the end. @@ -667,7 +666,7 @@ void Script::effect(Inkscape::Extension::Effect *module, std::string tempfilename_out; int tempfd_out = 0; try { - tempfd_out = Inkscape::IO::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg"); + tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg"); } catch (...) { /// \todo Popup dialog here return; @@ -740,7 +739,7 @@ void Script::effect(Inkscape::Extension::Effect *module, pump_events(); - // make sure we don't leak file descriptors from g_file_open_tmp + // make sure we don't leak file descriptors from Glib::file_open_tmp close(tempfd_out); g_unlink(tempfilename_out.c_str()); diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index 94852a98e..d11283db7 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -16,13 +16,13 @@ #include <config.h> #endif +#include <glibmm/fileutils.h> #include "file.h" #include "xslt.h" #include "../extension.h" #include "../output.h" #include "extension/input.h" -#include "io/sys.h" #include "io/resource.h" #include <unistd.h> #include <cstring> @@ -175,7 +175,7 @@ void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar cons std::string tempfilename_out; int tempfd_out = 0; try { - tempfd_out = Inkscape::IO::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX"); + tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX"); } catch (...) { /// \todo Popup dialog here return; diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 3724a5e17..116364739 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -27,7 +27,6 @@ #include <signal.h> #include <errno.h> -#include <boost/scoped_ptr.hpp> #include "libnrtype/Layout-TNG.h" #include <2geom/transforms.h> @@ -517,7 +516,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) // Do the export SPDocument *document = item->document; - boost::scoped_ptr<Inkscape::Pixbuf> pb( + std::unique_ptr<Inkscape::Pixbuf> pb( sp_generate_internal_bitmap(document, NULL, bbox->min()[Geom::X], bbox->min()[Geom::Y], bbox->max()[Geom::X], bbox->max()[Geom::Y], width, height, res, res, (guint32) 0xffffff00, item )); diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 7af7927f2..26e6531dd 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -2,7 +2,6 @@ #include <gdkmm/pixbuf.h> #include <gdkmm/pixbufformat.h> -#include <boost/scoped_ptr.hpp> #include <glib/gprintf.h> #include <glibmm/i18n.h> #include "dir-util.h" @@ -65,7 +64,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) bool embed = ( link.compare( "embed" ) == 0 ); SPDocument *doc = NULL; - boost::scoped_ptr<Inkscape::Pixbuf> pb(Inkscape::Pixbuf::create_from_file(uri)); + std::unique_ptr<Inkscape::Pixbuf> pb(Inkscape::Pixbuf::create_from_file(uri)); // TODO: the pixbuf is created again from the base64-encoded attribute in SPImage. // Find a way to create the pixbuf only once. diff --git a/src/extension/internal/makefile.in b/src/extension/internal/makefile.in deleted file mode 100644 index 466309a8f..000000000 --- a/src/extension/internal/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd ../.. && $(MAKE) extension/internal/all - -clean %.a %.$(OBJEXT): - cd ../.. && $(MAKE) extension/internal/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/extension/makefile.in b/src/extension/makefile.in deleted file mode 100644 index 5f19ccaa3..000000000 --- a/src/extension/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) extension/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) extension/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/filters/makefile.in b/src/filters/makefile.in deleted file mode 100644 index 5aa76ce1b..000000000 --- a/src/filters/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) filters/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) filters/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/gc-anchored.cpp b/src/gc-anchored.cpp index 4abd44b57..3ce6eff7b 100644 --- a/src/gc-anchored.cpp +++ b/src/gc-anchored.cpp @@ -27,7 +27,7 @@ typedef Debug::SimpleEvent<Debug::Event::REFCOUNT> RefCountEvent; class BaseAnchorEvent : public RefCountEvent { public: BaseAnchorEvent(Anchored const *object, int bias, - Util::ptr_shared<char> name) + Util::ptr_shared name) : RefCountEvent(name) { _addProperty("base", Util::format("%p", Core::base(const_cast<Anchored *>(object)))); diff --git a/src/helper/makefile.in b/src/helper/makefile.in deleted file mode 100644 index 7f40f58bc..000000000 --- a/src/helper/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) helper/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) helper/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index 438a428e6..8d7202111 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -15,7 +15,6 @@ #include <config.h> #endif -#include <boost/scoped_ptr.hpp> #include <2geom/transforms.h> #include "ui/interface.h" @@ -67,7 +66,7 @@ bool sp_export_jpg_file(SPDocument *doc, gchar const *filename, unsigned width, unsigned height, double xdpi, double ydpi, unsigned long bgcolor, double quality, SPItem* item) { - boost::scoped_ptr<Inkscape::Pixbuf> pixbuf( + std::unique_ptr<Inkscape::Pixbuf> pixbuf( sp_generate_internal_bitmap(doc, filename, x0, y0, x1, y1, width, height, xdpi, ydpi, bgcolor, item)); diff --git a/src/icon-size.h b/src/icon-size.h deleted file mode 100644 index 8058e8da8..000000000 --- a/src/icon-size.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SEEN_ICON_SIZE_H -#define SEEN_ICON_SIZE_H - -/* - * Generic icon widget - * - * Author: - * Lauris Kaplinski <lauris@kaplinski.com> - * - * Copyright (C) 2002 Lauris Kaplinski - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include <gtk/gtk.h> - -namespace Inkscape { - - enum IconSize { - ICON_SIZE_INVALID = ::GTK_ICON_SIZE_INVALID, - ICON_SIZE_MENU = ::GTK_ICON_SIZE_MENU, - ICON_SIZE_SMALL_TOOLBAR = ::GTK_ICON_SIZE_SMALL_TOOLBAR, - ICON_SIZE_LARGE_TOOLBAR = ::GTK_ICON_SIZE_LARGE_TOOLBAR, - ICON_SIZE_BUTTON = ::GTK_ICON_SIZE_BUTTON, - ICON_SIZE_DND = ::GTK_ICON_SIZE_DND, - ICON_SIZE_DIALOG = ::GTK_ICON_SIZE_DIALOG, - ICON_SIZE_DECORATION - }; -} // namespace Inkscape - -#endif // SEEN_ICON_SIZE_H diff --git a/src/io/makefile.in b/src/io/makefile.in deleted file mode 100644 index 74148f11a..000000000 --- a/src/io/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) io/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) io/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/io/resource.cpp b/src/io/resource.cpp index bc6c9f7b0..c3cd9e403 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -113,10 +113,10 @@ gchar *_get_path(Domain domain, Type type, char const *filename) return path; } -Util::ptr_shared<char> get_path(Domain domain, Type type, char const *filename) +Util::ptr_shared get_path(Domain domain, Type type, char const *filename) { char *path = _get_path(domain, type, filename); - Util::ptr_shared<char> result=Util::share_string(path); + Util::ptr_shared result=Util::share_string(path); g_free(path); return result; } diff --git a/src/io/resource.h b/src/io/resource.h index d12372024..d7dd506ad 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -56,7 +56,7 @@ enum Domain { USER }; -Util::ptr_shared<char> get_path(Domain domain, Type type, +Util::ptr_shared get_path(Domain domain, Type type, char const *filename=NULL); Glib::ustring get_path_ustring(Domain domain, Type type, diff --git a/src/io/sys.cpp b/src/io/sys.cpp index 833dee437..2ff17cdc9 100644 --- a/src/io/sys.cpp +++ b/src/io/sys.cpp @@ -18,7 +18,6 @@ #include <fstream> #include <glib.h> #include <glib/gstdio.h> -#include <glibmm/fileutils.h> #include <glibmm/ustring.h> #include <gtk/gtk.h> @@ -107,26 +106,6 @@ int Inkscape::IO::mkdir_utf8name( char const *utf8name ) return retval; } -/* - * Wrapper around Glib::file_open_tmp(). - * Returns a handle to the temp file. - * name_used contains the actual name used (a raw filename, not necessarily utf8). - * - * Returns: - * A file handle (as from open()) to the file opened for reading and writing. - * The file is opened in binary mode on platforms where there is a difference. - * The file handle should be closed with close(). - * - * Note: - * On Windows Vista Glib::file_open_tmp fails with the current version of glibmm - * A special case is implemented for WIN32. This can be removed if the issue is fixed - * in future versions of glibmm - * */ -int Inkscape::IO::file_open_tmp(std::string& name_used, const std::string& prefix) -{ - return Glib::file_open_tmp(name_used, prefix); -} - bool Inkscape::IO::file_test( char const *utf8name, GFileTest test ) { bool exists = false; diff --git a/src/io/sys.h b/src/io/sys.h index 78d25afa3..e349fc09c 100644 --- a/src/io/sys.h +++ b/src/io/sys.h @@ -32,8 +32,6 @@ FILE *fopen_utf8name( char const *utf8name, char const *mode ); int mkdir_utf8name( char const *utf8name ); -int file_open_tmp( std::string& name_used, const std::string& prefix ); - bool file_test( char const *utf8name, GFileTest test ); bool file_directory_exists( char const *utf8name ); diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index 3a6cce99c..f68175055 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -40,8 +40,8 @@ public: virtual void notifyChildAdded( Node &/*node*/, Node &/*child*/, Node */*prev*/ ) {} virtual void notifyChildRemoved( Node &/*node*/, Node &/*child*/, Node */*prev*/ ) {} virtual void notifyChildOrderChanged( Node &/*node*/, Node &/*child*/, Node */*old_prev*/, Node */*new_prev*/ ) {} - virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared<char> /*old_content*/, Util::ptr_shared<char> /*new_content*/ ) {} - virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared<char> /*old_value*/, Util::ptr_shared<char> /*new_value*/ ) { + virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared /*old_content*/, Util::ptr_shared /*new_content*/ ) {} + virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared /*old_value*/, Util::ptr_shared /*new_value*/ ) { if ( name == _lockedAttr || name == _labelAttr ) { if ( _mgr && _obj ) { _mgr->_objectModified( _obj, 0 ); @@ -59,9 +59,9 @@ public: /* namespace { -Util::ptr_shared<char> stringify_node(Node const &node); +Util::ptr_shared stringify_node(Node const &node); -Util::ptr_shared<char> stringify_obj(SPObject const &obj) { +Util::ptr_shared stringify_obj(SPObject const &obj) { gchar *string; if (obj.id) { @@ -70,7 +70,7 @@ Util::ptr_shared<char> stringify_obj(SPObject const &obj) { string = g_strdup_printf("SPObject(%p) repr(%p)", &obj, obj.repr); } - Util::ptr_shared<char> result=Util::share_string(string); + Util::ptr_shared result=Util::share_string(string); g_free(string); return result; @@ -80,7 +80,7 @@ typedef Debug::SimpleEvent<Debug::Event::OTHER> DebugLayer; class DebugLayerNote : public DebugLayer { public: - DebugLayerNote(Util::ptr_shared<char> descr) + DebugLayerNote(Util::ptr_shared descr) : DebugLayer(Util::share_static_string("layer-note")) { _addProperty("descr", descr); @@ -97,7 +97,7 @@ public: class DebugLayerObj : public DebugLayer { public: - DebugLayerObj(SPObject const& obj, Util::ptr_shared<char> name) + DebugLayerObj(SPObject const& obj, Util::ptr_shared name) : DebugLayer(name) { _addProperty("layer", stringify_obj(obj)); diff --git a/src/libcroco/makefile.in b/src/libcroco/makefile.in deleted file mode 100644 index 554670f45..000000000 --- a/src/libcroco/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) libcroco/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) libcroco/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/libdepixelize/makefile.in b/src/libdepixelize/makefile.in deleted file mode 100644 index 51d020db1..000000000 --- a/src/libdepixelize/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) libdepixelize/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) libdepixelize/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/libuemf/makefile.in b/src/libuemf/makefile.in deleted file mode 100644 index f1a595e1d..000000000 --- a/src/libuemf/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) libuemf/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) libuemf/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/livarot/makefile.in b/src/livarot/makefile.in deleted file mode 100644 index f92015275..000000000 --- a/src/livarot/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) livarot/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) livarot/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/live_effects/lpe-interpolate_points.cpp b/src/live_effects/lpe-interpolate_points.cpp index 0a0bcea14..7d4c88dc1 100644 --- a/src/live_effects/lpe-interpolate_points.cpp +++ b/src/live_effects/lpe-interpolate_points.cpp @@ -51,11 +51,7 @@ Geom::PathVector LPEInterpolatePoints::doEffect_path (Geom::PathVector const & path_in) { Geom::PathVector path_out; -#if __cplusplus <= 199711L - std::auto_ptr<Geom::Interpolate::Interpolator> interpolator( Geom::Interpolate::Interpolator::create(static_cast<Geom::Interpolate::InterpolatorType>(interpolator_type.get_value())) ); -#else std::unique_ptr<Geom::Interpolate::Interpolator> interpolator( Geom::Interpolate::Interpolator::create(static_cast<Geom::Interpolate::InterpolatorType>(interpolator_type.get_value())) ); -#endif for(Geom::PathVector::const_iterator path_it = path_in.begin(); path_it != path_in.end(); ++path_it) { if (path_it->empty()) diff --git a/src/live_effects/makefile.in b/src/live_effects/makefile.in deleted file mode 100644 index 8a4da813b..000000000 --- a/src/live_effects/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) live_effects/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) live_effects/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/live_effects/parameter/makefile.in b/src/live_effects/parameter/makefile.in deleted file mode 100644 index af48c8e7a..000000000 --- a/src/live_effects/parameter/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd ../.. && $(MAKE) live_effects/parameter/all - -clean %.a %.$(OBJEXT): - cd ../.. && $(MAKE) live_effects/parameter/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/live_effects/parameter/originalitemarray.cpp b/src/live_effects/parameter/originalitemarray.cpp index 830d8aa90..f45de4ad8 100644 --- a/src/live_effects/parameter/originalitemarray.cpp +++ b/src/live_effects/parameter/originalitemarray.cpp @@ -19,7 +19,6 @@ #include <glibmm/i18n.h> #include "inkscape.h" -#include "icon-size.h" #include "ui/clipboard.h" #include "svg/svg.h" #include "svg/stringstream.h" diff --git a/src/live_effects/parameter/originalpatharray.cpp b/src/live_effects/parameter/originalpatharray.cpp index 4535b6aa5..a98c91770 100644 --- a/src/live_effects/parameter/originalpatharray.cpp +++ b/src/live_effects/parameter/originalpatharray.cpp @@ -23,7 +23,6 @@ #include <glibmm/i18n.h> #include "inkscape.h" -#include "icon-size.h" #include "ui/clipboard.h" #include "svg/svg.h" #include "svg/stringstream.h" diff --git a/src/live_effects/parameter/togglebutton.h b/src/live_effects/parameter/togglebutton.h index 4d043b340..c5f8a3c28 100644 --- a/src/live_effects/parameter/togglebutton.h +++ b/src/live_effects/parameter/togglebutton.h @@ -12,7 +12,6 @@ #include <sigc++/signal.h> #include "live_effects/parameter/parameter.h" -#include "icon-size.h" #include "ui/widget/registered-widget.h" namespace Inkscape { diff --git a/src/preferences.cpp b/src/preferences.cpp index 4d14afa93..9d5fb0639 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -76,7 +76,7 @@ public: _filter(filter) {} virtual ~PrefNodeObserver() {} - virtual void notifyAttributeChanged(XML::Node &node, GQuark name, Util::ptr_shared<char>, Util::ptr_shared<char>); + virtual void notifyAttributeChanged(XML::Node &node, GQuark name, Util::ptr_shared, Util::ptr_shared); private: Observer &_observer; Glib::ustring const _filter; @@ -561,7 +561,7 @@ Preferences::Observer::~Observer() prefs->removeObserver(*this); } -void Preferences::PrefNodeObserver::notifyAttributeChanged(XML::Node &node, GQuark name, Util::ptr_shared<char>, Util::ptr_shared<char> new_value) +void Preferences::PrefNodeObserver::notifyAttributeChanged(XML::Node &node, GQuark name, Util::ptr_shared, Util::ptr_shared new_value) { // filter out attributes we don't watch gchar const *attr_name = g_quark_to_string(name); diff --git a/src/sp-object.cpp b/src/sp-object.cpp index fc222f701..bc930a430 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -199,7 +199,7 @@ typedef Debug::SimpleEvent<Debug::Event::REFCOUNT> BaseRefCountEvent; class RefCountEvent : public BaseRefCountEvent { public: - RefCountEvent(SPObject *object, int bias, Util::ptr_shared<char> name) + RefCountEvent(SPObject *object, int bias, Util::ptr_shared name) : BaseRefCountEvent(name) { _addProperty("object", Util::format("%p", object)); diff --git a/src/sp-tref-reference.cpp b/src/sp-tref-reference.cpp index dfb8dd60b..d683e34ed 100644 --- a/src/sp-tref-reference.cpp +++ b/src/sp-tref-reference.cpp @@ -75,8 +75,8 @@ void SPTRefReference::notifyChildOrderChanged(Inkscape::XML::Node &/*node*/, Ink void SPTRefReference::notifyContentChanged(Inkscape::XML::Node &/*node*/, - Inkscape::Util::ptr_shared<char> /*old_content*/, - Inkscape::Util::ptr_shared<char> /*new_content*/) + Inkscape::Util::ptr_shared /*old_content*/, + Inkscape::Util::ptr_shared /*new_content*/) { SPObject *owner = getOwner(); @@ -87,8 +87,8 @@ void SPTRefReference::notifyContentChanged(Inkscape::XML::Node &/*node*/, void SPTRefReference::notifyAttributeChanged(Inkscape::XML::Node &/*node*/, GQuark /*name*/, - Inkscape::Util::ptr_shared<char> /*old_value*/, - Inkscape::Util::ptr_shared<char> /*new_value*/) + Inkscape::Util::ptr_shared /*old_value*/, + Inkscape::Util::ptr_shared /*new_value*/) { // Do nothing - tref only cares about textual content } diff --git a/src/sp-tref-reference.h b/src/sp-tref-reference.h index b555ace2d..516e125c1 100644 --- a/src/sp-tref-reference.h +++ b/src/sp-tref-reference.h @@ -52,11 +52,11 @@ public: virtual void notifyChildOrderChanged(Inkscape::XML::Node &node, Inkscape::XML::Node &child, Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev); virtual void notifyContentChanged(Inkscape::XML::Node &node, - Inkscape::Util::ptr_shared<char> old_content, - Inkscape::Util::ptr_shared<char> new_content); + Inkscape::Util::ptr_shared old_content, + Inkscape::Util::ptr_shared new_content); virtual void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name, - Inkscape::Util::ptr_shared<char> old_value, - Inkscape::Util::ptr_shared<char> new_value); + Inkscape::Util::ptr_shared old_value, + Inkscape::Util::ptr_shared new_value); ///////////////////////////////////////////////////////////////////// protected: diff --git a/src/svg/makefile.in b/src/svg/makefile.in deleted file mode 100644 index a906fc7c4..000000000 --- a/src/svg/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) svg/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) svg/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/trace/makefile.in b/src/trace/makefile.in deleted file mode 100644 index 8c2bfd912..000000000 --- a/src/trace/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) trace/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) trace/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/ui/cache/makefile.in b/src/ui/cache/makefile.in deleted file mode 100644 index af45adb0f..000000000 --- a/src/ui/cache/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd ../.. && $(MAKE) ui/cache/all - -clean %.a %.$(OBJEXT): - cd ../.. && $(MAKE) ui/cache/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/ui/control-manager.h b/src/ui/control-manager.h index 3f090d0bd..418591991 100644 --- a/src/ui/control-manager.h +++ b/src/ui/control-manager.h @@ -76,11 +76,7 @@ public: private: ControlManager(); -#if __cplusplus <= 199711L - std::auto_ptr<ControlManagerImpl> _impl; -#else std::unique_ptr<ControlManagerImpl> _impl; -#endif friend class ControlManagerImpl; }; diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 991139aa8..f9cd8929a 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -18,7 +18,6 @@ #endif #include <gtkmm/buttonbox.h> -#include <boost/scoped_ptr.hpp> #include <glibmm/i18n.h> #include <glibmm/timer.h> diff --git a/src/ui/dialog/makefile.in b/src/ui/dialog/makefile.in deleted file mode 100644 index 805c48aef..000000000 --- a/src/ui/dialog/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd ../.. && $(MAKE) ui/dialog/all - -clean %.a %.$(OBJEXT): - cd ../.. && $(MAKE) ui/dialog/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 49ffa38f5..b50d68239 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -148,8 +148,8 @@ public: _pnl->_objectsChanged( _obj ); } } - virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared<char> /*old_content*/, Util::ptr_shared<char> /*new_content*/ ) {} - virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared<char> /*old_value*/, Util::ptr_shared<char> /*new_value*/ ) { + virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared /*old_content*/, Util::ptr_shared /*new_content*/ ) {} + virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared /*old_value*/, Util::ptr_shared /*new_value*/ ) { if ( _pnl && _obj ) { if ( name == _lockedAttr || name == _labelAttr || name == _highlightAttr || name == _groupAttr || name == _styleAttr || name == _clipAttr || name == _maskAttr ) { _pnl->_updateObject(_obj, name == _highlightAttr); diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h index b7fd1b4f8..8ad1b15ef 100644 --- a/src/ui/dialog/objects.h +++ b/src/ui/dialog/objects.h @@ -16,7 +16,6 @@ # include <config.h> #endif -#include <boost/scoped_ptr.hpp> #include <gtkmm/box.h> #include <gtkmm/treeview.h> #include <gtkmm/treestore.h> @@ -168,7 +167,7 @@ private: Gtk::Box _blur_vbox; Gtk::Dialog _colorSelectorDialog; - boost::scoped_ptr<Inkscape::UI::SelectedColor> _selectedColor; + std::unique_ptr<Inkscape::UI::SelectedColor> _selectedColor; //Methods: diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 4d248fd09..532a8c364 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -26,7 +26,6 @@ #include "util/units.h" #include "helper/png-write.h" #include "svg/svg-color.h" -#include "io/sys.h" #include <glibmm/i18n.h> @@ -52,7 +51,7 @@ static void draw_page(GtkPrintOperation *, std::string tmp_base = "inkscape-print-png-XXXXXX"; int tmp_fd; - if ( (tmp_fd = Inkscape::IO::file_open_tmp (tmp_png, tmp_base)) >= 0) { + if ( (tmp_fd = Glib::file_open_tmp(tmp_png, tmp_base)) >= 0) { close(tmp_fd); guint32 bgcolor = 0x00000000; diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index aa453e8e8..60138fa89 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -56,8 +56,8 @@ public: }; virtual void notifyContentChanged(Inkscape::XML::Node &node, - Inkscape::Util::ptr_shared<char> old_content, - Inkscape::Util::ptr_shared<char> new_content); + Inkscape::Util::ptr_shared old_content, + Inkscape::Util::ptr_shared new_content); StyleDialog * _styleDialog; }; @@ -66,8 +66,8 @@ public: void StyleDialog::NodeObserver::notifyContentChanged( Inkscape::XML::Node &/*node*/, - Inkscape::Util::ptr_shared<char> /*old_content*/, - Inkscape::Util::ptr_shared<char> /*new_content*/ ) { + Inkscape::Util::ptr_shared /*old_content*/, + Inkscape::Util::ptr_shared /*new_content*/ ) { #ifdef DEBUG_STYLEDIALOG std::cout << "StyleDialog::NodeObserver::notifyContentChanged" << std::endl; @@ -111,8 +111,8 @@ public: virtual void notifyAttributeChanged( Inkscape::XML::Node &node, GQuark qname, - Util::ptr_shared<char> /*old_value*/, - Util::ptr_shared<char> /*new_value*/ ) { + Util::ptr_shared /*old_value*/, + Util::ptr_shared /*new_value*/ ) { if ( _styleDialog && _repr ) { // For the moment only care about attributes that are directly used in selectors. diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index d804e1f68..ae45654a7 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -106,8 +106,8 @@ public: _pnl->_objectsChanged( _obj ); } } - virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared<char> /*old_content*/, Util::ptr_shared<char> /*new_content*/ ) {} - virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared<char> /*old_value*/, Util::ptr_shared<char> /*new_value*/ ) { + virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared /*old_content*/, Util::ptr_shared /*new_content*/ ) {} + virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared /*old_value*/, Util::ptr_shared /*new_value*/ ) { if ( _pnl && _obj ) { if ( name == _labelAttr ) { _pnl->_updateObject( _obj); diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index f6a353b33..4f1e5cd6f 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -110,8 +110,7 @@ static GtkTargetEntry *completeDropTargets = 0; static int completeDropTargetsCount = 0; static bool temporarily_block_actions = false; -#define ENTRIES_SIZE(n) sizeof(n)/sizeof(n[0]) -static guint nui_drop_target_entries = ENTRIES_SIZE(ui_drop_target_entries); +static guint nui_drop_target_entries = G_N_ELEMENTS(ui_drop_target_entries); static void sp_ui_import_files(gchar *buffer); static void sp_ui_import_one_file(char const *filename); static void sp_ui_import_one_file_with_check(gpointer filename, gpointer unused); diff --git a/src/ui/makefile.in b/src/ui/makefile.in deleted file mode 100644 index f8a407592..000000000 --- a/src/ui/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) ui/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) ui/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index f122a468d..ec845b1b3 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -20,7 +20,6 @@ #include <2geom/forward.h> #include <2geom/point.h> #include <2geom/rect.h> -#include "util/accumulators.h" #include "util/unordered-containers.h" #include "ui/tool/commit-events.h" #include "ui/tool/manipulator.h" diff --git a/src/ui/tool/control-point.h b/src/ui/tool/control-point.h index 4a01b9f21..bc1f060cd 100644 --- a/src/ui/tool/control-point.h +++ b/src/ui/tool/control-point.h @@ -18,7 +18,6 @@ #include <2geom/point.h> #include "ui/control-types.h" -#include "util/accumulators.h" #include "display/sodipodi-ctrl.h" #include "enums.h" @@ -76,8 +75,6 @@ namespace UI { */ class ControlPoint : boost::noncopyable, public sigc::trackable { public: - typedef Inkscape::Util::ReverseInterruptible RInt; - typedef Inkscape::Util::Interruptible Int; /** * Enumeration representing the possible states of the control point, used to determine @@ -162,15 +159,6 @@ public: void transferGrab(ControlPoint *from, GdkEventMotion *event); /// @} - /// @name Receive notifications about control point events - /// @{ - /*sigc::signal<void, Geom::Point const &, Geom::Point &, GdkEventMotion*> signal_dragged; - sigc::signal<bool, GdkEventButton*>::accumulated<RInt> signal_clicked; - sigc::signal<bool, GdkEventButton*>::accumulated<RInt> signal_doubleclicked; - sigc::signal<bool, GdkEventMotion*>::accumulated<Int> signal_grabbed; - sigc::signal<void, GdkEventButton*> signal_ungrabbed;*/ - /// @} - /// @name Inspect the state of the control point /// @{ State state() const { return _state; } diff --git a/src/ui/tool/manipulator.h b/src/ui/tool/manipulator.h index 0f26c6de1..66b47ce98 100644 --- a/src/ui/tool/manipulator.h +++ b/src/ui/tool/manipulator.h @@ -17,7 +17,6 @@ #include <sigc++/sigc++.h> #include <glib.h> #include <gdk/gdk.h> -#include <boost/shared_ptr.hpp> #include "ui/tools/tool-base.h" class SPDesktop; @@ -76,14 +75,14 @@ template <typename T> class MultiManipulator : public PointManipulator { public: //typedef typename T::ItemType ItemType; - typedef typename std::pair<void*, boost::shared_ptr<T> > MapPair; - typedef typename std::map<void*, boost::shared_ptr<T> > MapType; + typedef typename std::pair<void*, std::shared_ptr<T> > MapPair; + typedef typename std::map<void*, std::shared_ptr<T> > MapType; MultiManipulator(SPDesktop *d, ControlPointSelection &sel) : PointManipulator(d, sel) {} void addItem(void *item) { - boost::shared_ptr<T> m(_createManipulator(item)); + std::shared_ptr<T> m(_createManipulator(item)); _mmap.insert(MapPair(item, m)); } void removeItem(void *item) { diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index f30c7e349..9cfa4ed31 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -10,7 +10,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <boost/shared_ptr.hpp> #include "node.h" #include <glibmm/i18n.h> #include "desktop.h" @@ -161,7 +160,7 @@ void MultiPathManipulator::setItems(std::set<ShapeRecord> const &s) if (sr.edit_transform != sr_new.edit_transform || sr.role != sr_new.role) { - boost::shared_ptr<PathManipulator> hold(i->second); + std::shared_ptr<PathManipulator> hold(i->second); if (sr.edit_transform != sr_new.edit_transform) hold->setControlsTransform(sr_new.edit_transform); if (sr.role != sr_new.role) { @@ -179,7 +178,7 @@ void MultiPathManipulator::setItems(std::set<ShapeRecord> const &s) for (std::set<ShapeRecord>::iterator i = shapes.begin(); i != shapes.end(); ++i) { ShapeRecord const &r = *i; if (!SP_IS_PATH(r.item) && !IS_LIVEPATHEFFECT(r.item)) continue; - boost::shared_ptr<PathManipulator> newpm(new PathManipulator(*this, (SPPath*) r.item, + std::shared_ptr<PathManipulator> newpm(new PathManipulator(*this, (SPPath*) r.item, r.edit_transform, _getOutlineColor(r.role, r.item), r.lpe_key)); newpm->showHandles(_show_handles); // always show outlines for clips and masks diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h index 4f152e0a2..742c6d421 100644 --- a/src/ui/tool/multi-path-manipulator.h +++ b/src/ui/tool/multi-path-manipulator.h @@ -77,8 +77,8 @@ public: sigc::signal<void> signal_coords_changed; /// Emitted whenever the coordinates /// shown in the status bar need updating private: - typedef std::pair<ShapeRecord, boost::shared_ptr<PathManipulator> > MapPair; - typedef std::map<ShapeRecord, boost::shared_ptr<PathManipulator> > MapType; + typedef std::pair<ShapeRecord, std::shared_ptr<PathManipulator> > MapPair; + typedef std::map<ShapeRecord, std::shared_ptr<PathManipulator> > MapType; template <typename R> void invokeForAll(R (PathManipulator::*method)()) { @@ -88,11 +88,11 @@ private: // be a valid iterator and then assign i to it. MapType::iterator next_i = i; ++next_i; - // i->second is a boost::shared_ptr so try to hold on to it so + // i->second is a std::shared_ptr so try to hold on to it so // it won't get freed prematurely by the WriteXML() method or // whatever. See https://bugs.launchpad.net/inkscape/+bug/1617615 // Applicable to empty paths. - boost::shared_ptr<PathManipulator> hold(i->second); + std::shared_ptr<PathManipulator> hold(i->second); ((hold.get())->*method)(); i = next_i; } diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index a05f0e3b9..2964b66ca 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -22,8 +22,6 @@ #include <cstddef> #include <functional> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> #include "ui/tool/selectable-control-point.h" #include "snapped-point.h" #include "ui/tool/node-types.h" @@ -357,7 +355,7 @@ private: friend class NodeList; }; -class NodeList : ListNode, boost::noncopyable, public boost::enable_shared_from_this<NodeList> { +class NodeList : ListNode, boost::noncopyable { public: typedef std::size_t size_type; typedef Node &reference; @@ -465,9 +463,9 @@ private: * List of node lists. Represents an editable path. * Editable path composed of one or more subpaths. */ -class SubpathList : public std::list< boost::shared_ptr<NodeList> > { +class SubpathList : public std::list< std::shared_ptr<NodeList> > { public: - typedef std::list< boost::shared_ptr<NodeList> > list_type; + typedef std::list< std::shared_ptr<NodeList> > list_type; SubpathList(PathManipulator &pm) : _path_manipulator(pm) {} PathManipulator &pm() { return _path_manipulator; } diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index f2899dd01..2c99e7fc8 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -68,7 +68,7 @@ public: } virtual void notifyAttributeChanged(Inkscape::XML::Node &/*node*/, GQuark attr, - Util::ptr_shared<char>, Util::ptr_shared<char>) + Util::ptr_shared, Util::ptr_shared) { // do nothing if blocked if (_blocked) return; diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 283cb610a..5fa24c23b 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -15,8 +15,6 @@ #include <memory> #include <2geom/pathvector.h> #include <2geom/affine.h> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> #include "ui/tool/node.h" #include "ui/tool/manipulator.h" #include "live_effects/lpe-bspline.h" @@ -105,7 +103,7 @@ public: static bool is_item_type(void *item); private: typedef NodeList Subpath; - typedef boost::shared_ptr<NodeList> SubpathPtr; + typedef std::shared_ptr<NodeList> SubpathPtr; void _createControlPointsFromGeometry(); diff --git a/src/ui/view/makefile.in b/src/ui/view/makefile.in deleted file mode 100644 index 0fe15637a..000000000 --- a/src/ui/view/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd ../.. && $(MAKE) ui/view/all - -clean %.a %.$(OBJEXT): - cd ../.. && $(MAKE) ui/view/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/ui/widget/makefile.in b/src/ui/widget/makefile.in deleted file mode 100644 index e479d7031..000000000 --- a/src/ui/widget/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd ../.. && $(MAKE) ui/widget/all - -clean %.a %.$(OBJEXT): - cd ../.. && $(MAKE) ui/widget/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 9332fe0f9..aea9b7e8e 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -24,7 +24,6 @@ #include <glibmm/i18n.h> #include "panel.h" -#include "icon-size.h" #include "preferences.h" #include "desktop.h" diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 5d911e9d2..d9b93f6db 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -107,8 +107,7 @@ static const GtkTargetEntry ui_drop_target_entries [] = { {"application/x-color", 0, APP_X_COLOR} }; -#define ENTRIES_SIZE(n) sizeof(n)/sizeof(n[0]) -static guint nui_drop_target_entries = ENTRIES_SIZE(ui_drop_target_entries); +static guint nui_drop_target_entries = G_N_ELEMENTS(ui_drop_target_entries); /* convenience function */ static Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop); diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 9680b6377..b8c61e2fe 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -10,8 +10,6 @@ set(util_SRC # ------- # Headers - accumulators.h - compose.hpp copy.h ege-appear-time-tracker.h ege-tags.h diff --git a/src/util/accumulators.h b/src/util/accumulators.h deleted file mode 100644 index 2cd51b101..000000000 --- a/src/util/accumulators.h +++ /dev/null @@ -1,113 +0,0 @@ -/** @file - * Frequently used accumulators for use with libsigc++ - */ -/* Authors: - * Krzysztof KosiÅ„ski <tweenk.pl@gmail.com> - * - * Copyright (C) 2009 Authors - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#ifndef SEEN_UTIL_ACCUMULATORS_H -#define SEEN_UTIL_ACCUMULATORS_H - -#include <iterator> - -namespace Inkscape { -namespace Util { - -/** - * Accumulator which evaluates slots in reverse connection order. - * The slot that was connected last is evaluated first. - */ -struct Reverse { - typedef void result_type; - template <typename T_iterator> - result_type operator()(T_iterator first, T_iterator last) const { - while (first != last) *(--last); - } -}; - -/** - * Accumulator type for interruptible signals. Slots return a boolean value; emission - * is stopped when true is returned from a slot. - */ -struct Interruptible { - typedef bool result_type; - template <typename T_iterator> - result_type operator()(T_iterator first, T_iterator last) const { - for (; first != last; ++first) - if (*first) return true; - return false; - } -}; - -/** - * Same as Interruptible, but the slots are called in reverse order of connection, - * e.g. the slot that was connected last is evaluated first. - */ -struct ReverseInterruptible { - typedef bool result_type; - template <typename T_iterator> - result_type operator()(T_iterator first, T_iterator last) const { - while (first != last) { - if (*(--last)) return true; - } - return false; - } -}; - -/** - * The template parameter specifies how many slots from the beginning of the list - * should be evaluated after other slots. Useful for signals which invoke other signals - * once complete. Undefined results if the signal does not have at least @c num_chained - * slots before first emission. - * - * For example, if template param = 3, the execution order is as follows: - * @verbatim - 8. 1. 2. 3. 4. 5. 6. 7. - S1 S2 S3 S4 S5 S6 S7 S8 @endverbatim - */ -template <unsigned num_chained = 1> -struct Chained { - typedef void result_type; - template <typename T_iterator> - result_type operator()(T_iterator first, T_iterator last) const { - T_iterator save_first = first; - // ARGH, iterator_traits is not defined for slot iterators! - //std::advance(first, num_chained); - for (unsigned i = 0; i < num_chained && first != last; ++i) ++first; - for (; first != last; ++first) *first; - for (unsigned i = 0; i < num_chained && save_first != last; ++i, ++save_first) - *save_first; - } -}; - -/** - * Executes a logical OR on the results from slots. - */ -struct LogicalOr { - typedef bool result_type; - template <typename T_iterator> - result_type operator()(T_iterator first, T_iterator last) const { - bool ret = false; - for (; first != last; ++first) ret |= *first; - return ret; - } -}; - -} // namespace Util -} // namespace Inkscape - -#endif - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/compose.hpp b/src/util/compose.hpp deleted file mode 100644 index b3f410c8e..000000000 --- a/src/util/compose.hpp +++ /dev/null @@ -1,393 +0,0 @@ -/* Defines String::compose(fmt, arg...) for easy, i18n-friendly - * composition of strings. - * - * Version 1.0. - * - * Copyright (c) 2002 Ole Laursen <olau@hardworking.dk>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -// -// Basic usage is like -// -// std::cout << String::compose("This is a %1x%2 matrix.", rows, cols); -// -// See http://www.cs.aau.dk/~olau/compose/ or the included README.compose for -// more details. -// - -#ifndef STRING_COMPOSE_H -#define STRING_COMPOSE_H - -#include <sstream> -#include <string> -#include <list> -#include <map> // for multimap - -namespace StringPrivate -{ - // the actual composition class - using string::compose is cleaner, so we - // hide it here - class Composition - { - public: - // initialize and prepare format string on the form "text %1 text %2 etc." - explicit Composition(std::string fmt); - - // supply an replacement argument starting from %1 - template <typename T> - Composition &arg(const T &obj); - - // compose and return string - std::string str() const; - - private: - std::ostringstream os; - int arg_no; - - // we store the output as a list - when the output string is requested, the - // list is concatenated to a string; this way we can keep iterators into - // the list instead of into a string where they're possibly invalidated on - // inserting a specification string - typedef std::list<std::string> output_list; - output_list output; - - // the initial parse of the format string fills in the specification map - // with positions for each of the various %?s - typedef std::multimap<int, output_list::iterator> specification_map; - specification_map specs; - }; - - // helper for converting spec string numbers - inline int char_to_int(char c) - { - switch (c) { - case '0': return 0; - case '1': return 1; - case '2': return 2; - case '3': return 3; - case '4': return 4; - case '5': return 5; - case '6': return 6; - case '7': return 7; - case '8': return 8; - case '9': return 9; - default: return -1000; - } - } - - inline bool is_number(int n) - { - switch (n) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - return true; - - default: - return false; - } - } - - - // implementation of class Composition - template <typename T> - inline Composition &Composition::arg(const T &obj) - { - os << obj; - - std::string rep = os.str(); - - if (!rep.empty()) { // manipulators don't produce output - for (specification_map::const_iterator i = specs.lower_bound(arg_no), - end = specs.upper_bound(arg_no); i != end; ++i) { - output_list::iterator pos = i->second; - ++pos; - - output.insert(pos, rep); - } - - os.str(std::string()); - //os.clear(); - ++arg_no; - } - - return *this; - } - - inline Composition::Composition(std::string fmt) - : arg_no(1) - { - std::string::size_type b = 0, i = 0; - - // fill in output with the strings between the %1 %2 %3 etc. and - // fill in specs with the positions - while (i < fmt.length()) { - if (fmt[i] == '%' && i + 1 < fmt.length()) { - if (fmt[i + 1] == '%') { // catch %% - fmt.replace(i, 2, "%"); - ++i; - } - else if (is_number(fmt[i + 1])) { // aha! a spec! - // save string - output.push_back(fmt.substr(b, i - b)); - - int n = 1; // number of digits - int spec_no = 0; - - do { - spec_no += char_to_int(fmt[i + n]); - spec_no *= 10; - ++n; - } while (i + n < fmt.length() && is_number(fmt[i + n])); - - spec_no /= 10; - output_list::iterator pos = output.end(); - --pos; // safe since we have just inserted a string> - - specs.insert(specification_map::value_type(spec_no, pos)); - - // jump over spec string - i += n; - b = i; - } - else - ++i; - } - else - ++i; - } - - if (i - b > 0) // add the rest of the string - output.push_back(fmt.substr(b, i - b)); - } - - inline std::string Composition::str() const - { - // assemble string - std::string str; - - for (output_list::const_iterator i = output.begin(), end = output.end(); - i != end; ++i) - str += *i; - - return str; - } -} - -// now for the real thing(s) -namespace String -{ - // a series of functions which accept a format string on the form "text %1 - // more %2 less %3" and a number of templated parameters and spits out the - // composited string - template <typename T1> - inline std::string compose(const std::string &fmt, const T1 &o1) - { - StringPrivate::Composition c(fmt); - c.arg(o1); - return c.str(); - } - - template <typename T1, typename T2> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2); - return c.str(); - } - - template <typename T1, typename T2, typename T3> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11, const T12 &o12) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11).arg(o12); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11, const T12 &o12, - const T13 &o13) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11).arg(o12).arg(o13); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11, const T12 &o12, - const T13 &o13, const T14 &o14) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11).arg(o12).arg(o13).arg(o14); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, - typename T15> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11, const T12 &o12, - const T13 &o13, const T14 &o14, const T15 &o15) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11).arg(o12).arg(o13).arg(o14).arg(o15); - return c.str(); - } -} - - -#endif // STRING_COMPOSE_H diff --git a/src/util/format.h b/src/util/format.h index 690121254..d2fe2d0ef 100644 --- a/src/util/format.h +++ b/src/util/format.h @@ -20,20 +20,20 @@ namespace Inkscape { namespace Util { -inline ptr_shared<char> vformat(char const *format, va_list args) { +inline ptr_shared vformat(char const *format, va_list args) { char *temp=g_strdup_vprintf(format, args); - ptr_shared<char> result=share_string(temp); + ptr_shared result=share_string(temp); g_free(temp); return result; } // needed since G_GNUC_PRINTF can only be used on a declaration - ptr_shared<char> format(char const *format, ...) G_GNUC_PRINTF(1,2); -inline ptr_shared<char> format(char const *format, ...) { + ptr_shared format(char const *format, ...) G_GNUC_PRINTF(1,2); +inline ptr_shared format(char const *format, ...) { va_list args; va_start(args, format); - ptr_shared<char> result=vformat(format, args); + ptr_shared result=vformat(format, args); va_end(args); return result; diff --git a/src/util/makefile.in b/src/util/makefile.in deleted file mode 100644 index fc4870075..000000000 --- a/src/util/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) util/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) util/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/util/share.cpp b/src/util/share.cpp index 3cb289b10..d5d93fc75 100644 --- a/src/util/share.cpp +++ b/src/util/share.cpp @@ -1,5 +1,6 @@ /* - * Inkscape::Util::ptr_shared<T> - like T const *, but stronger + * Inkscape::Util::ptr_shared<T> - like T const *, but stronger. + * Used to hold c-style strings for objects that are managed by the gc. * * Authors: * MenTaLguY <mental@rydia.net> @@ -15,13 +16,13 @@ namespace Inkscape { namespace Util { -ptr_shared<char> share_string(char const *string) { - g_return_val_if_fail(string != NULL, share_unsafe<char>(NULL)); +ptr_shared share_string(char const *string) { + g_return_val_if_fail(string != NULL, share_unsafe(NULL)); return share_string(string, std::strlen(string)); } -ptr_shared<char> share_string(char const *string, std::size_t length) { - g_return_val_if_fail(string != NULL, share_unsafe<char>(NULL)); +ptr_shared share_string(char const *string, std::size_t length) { + g_return_val_if_fail(string != NULL, share_unsafe(NULL)); char *new_string=new (GC::ATOMIC) char[length+1]; std::memcpy(new_string, string, length); new_string[length] = 0; diff --git a/src/util/share.h b/src/util/share.h index 8f1e7045a..6e5a24d71 100644 --- a/src/util/share.h +++ b/src/util/share.h @@ -1,5 +1,6 @@ /* - * Inkscape::Util::ptr_shared<T> - like T const *, but stronger + * Inkscape::Util::ptr_shared<T> - like T const *, but stronger. + * Used to hold c-style strings for objects that are managed by the gc. * * Authors: * MenTaLguY <mental@rydia.net> @@ -19,120 +20,84 @@ namespace Inkscape { namespace Util { -template <typename T> class ptr_shared { public: - ptr_shared() : _obj(NULL) {} - template <typename T1> - ptr_shared(ptr_shared<T1> const &other) : _obj(other._obj) {} + ptr_shared() : _string(NULL) {} + ptr_shared(ptr_shared const &other) : _string(other._string) {} - T const *pointer() const { return _obj; } + operator char const *() const { return _string; } + operator bool() const { return _string; } - template <typename T1> - operator T1 const *() const { return _obj; } + char const *pointer() const { return _string; } + char const &operator[](int i) const { return _string[i]; } - operator bool() const { return _obj; } - - T const &operator*() const { return *_obj; } - T const *operator->() const { return _obj; } - T const &operator[](int i) const { return _obj[i]; } - - ptr_shared<T> operator+(int i) const { - return share_unsafe(_obj+i); + ptr_shared operator+(int i) const { + return share_unsafe(_string+i); } - ptr_shared<T> operator-(int i) const { - return share_unsafe(_obj-i); + ptr_shared operator-(int i) const { + return share_unsafe(_string-i); } - - ptr_shared<T> &operator+=(int i) const { - _obj += i; + //WARNING: No bounds checking in += and -= functions. Moving the pointer + //past the end of the string and then back could probably cause the garbage + //collector to deallocate the string inbetween, as there's temporary no + //valid reference pointing into the allocated space. + ptr_shared &operator+=(int i) { + _string += i; return *this; } - ptr_shared<T> &operator-=(int i) const { - _obj -= i; + ptr_shared &operator-=(int i) { + _string -= i; return *this; } - - template <typename T1> - std::ptrdiff_t operator-(ptr_shared<T1> const &other) { - return _obj - other._obj; + std::ptrdiff_t operator-(ptr_shared const &other) { + return _string - other._string; } - template <typename T1> - ptr_shared<T> &operator=(ptr_shared<T1> const &other) { - _obj = other._obj; + ptr_shared &operator=(ptr_shared const &other) { + _string = other._string; return *this; } - template <typename T1> - bool operator==(ptr_shared<T1> const &other) const { - return _obj == other._obj; + bool operator==(ptr_shared const &other) const { + return _string == other._string; } - - template <typename T1> - bool operator!=(ptr_shared<T1> const &other) const { - return _obj != other._obj; + bool operator!=(ptr_shared const &other) const { + return _string != other._string; } - - template <typename T1> - bool operator>(ptr_shared<T1> const &other) const { - return _obj > other._obj; + bool operator>(ptr_shared const &other) const { + return _string > other._string; } - - template <typename T1> - bool operator<(ptr_shared<T1> const &other) const { - return _obj < other._obj; - } - - static ptr_shared<T> share_unsafe(T const *obj) { - return ptr_shared<T>(obj); + bool operator<(ptr_shared const &other) const { + return _string < other._string; } -protected: - explicit ptr_shared(T const *obj) : _obj(obj) {} + friend ptr_shared share_unsafe(char const *string); private: - T const *_obj; -}; - -template <typename T> -inline ptr_shared<T> share(T const *obj) { - return share_unsafe(obj ? new T(*obj) : NULL); -} + ptr_shared(char const *string) : _string(string) {} + static ptr_shared share_unsafe(char const *string) { + return ptr_shared(string); + } -ptr_shared<char> share_string(char const *string); -ptr_shared<char> share_string(char const *string, std::size_t length); + //This class (and code usign it) assumes that it never has to free this + //pointer, and that the memory it points to will not be freed as long as a + //ptr_shared pointing to it exists. + char const *_string; +}; -template <typename T> -inline ptr_shared<T> reshare(T const *obj) { - return ptr_shared<T>::share_unsafe(obj); -} +ptr_shared share_string(char const *string); +ptr_shared share_string(char const *string, std::size_t length); -template <typename T> -inline ptr_shared<T> share_unsafe(T const *obj) { - return ptr_shared<T>::share_unsafe(obj); +inline ptr_shared share_unsafe(char const *string) { + return ptr_shared::share_unsafe(string); } -inline ptr_shared<char> share_static_string(char const *string) { +//TODO: Do we need this function? +inline ptr_shared share_static_string(char const *string) { return share_unsafe(string); } -template <typename T1, typename T2> -inline ptr_shared<T1> static_cast_shared(ptr_shared<T2> const &ref) { - return reshare(static_cast<T1 const *>(ref.pointer())); -} - -template <typename T1, typename T2> -inline ptr_shared<T1> dynamic_cast_shared(ptr_shared<T2> const &ref) { - return reshare(dynamic_cast<T1 const *>(ref.pointer())); -} - -template <typename T1, typename T2> -inline ptr_shared<T1> reinterpret_cast_shared(ptr_shared<T2> const &ref) { - return reshare(reinterpret_cast<T1 const *>(ref.pointer())); -} - } } diff --git a/src/widgets/button.h b/src/widgets/button.h index 94a956de3..680ccb79d 100644 --- a/src/widgets/button.h +++ b/src/widgets/button.h @@ -18,7 +18,6 @@ #include <gtk/gtk.h> #include <sigc++/connection.h> -#include "icon-size.h" struct SPAction; diff --git a/src/widgets/ege-adjustment-action.cpp b/src/widgets/ege-adjustment-action.cpp index fc72f00c7..597c697cb 100644 --- a/src/widgets/ege-adjustment-action.cpp +++ b/src/widgets/ege-adjustment-action.cpp @@ -48,7 +48,6 @@ #include <gtkmm/radiomenuitem.h> #include <gdk/gdkkeysyms.h> -#include "icon-size.h" #include "widgets/ege-adjustment-action.h" #include "gimp/gimpspinscale.h" #include "ui/icon-names.h" diff --git a/src/widgets/ink-action.h b/src/widgets/ink-action.h index 99786c878..396e4838b 100644 --- a/src/widgets/ink-action.h +++ b/src/widgets/ink-action.h @@ -2,7 +2,6 @@ #define SEEN_INK_ACTION #include <gtk/gtk.h> -#include "icon-size.h" #include "attributes.h" /* Equivalent to GTK Actions of the same type, but can support Inkscape SVG icons */ diff --git a/src/widgets/ink-toggle-action.cpp b/src/widgets/ink-toggle-action.cpp index c091a2e0d..200d0d558 100644 --- a/src/widgets/ink-toggle-action.cpp +++ b/src/widgets/ink-toggle-action.cpp @@ -51,9 +51,9 @@ static void ink_toggle_action_class_init( InkToggleActionClass* klass ) g_param_spec_int( "iconSize", "Icon Size", "The size the icon", - (int)Inkscape::ICON_SIZE_MENU, + GTK_ICON_SIZE_MENU, (int)99, - (int)Inkscape::ICON_SIZE_SMALL_TOOLBAR, + GTK_ICON_SIZE_SMALL_TOOLBAR, (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) ); g_type_class_add_private( klass, sizeof(InkToggleActionClass) ); diff --git a/src/widgets/ink-toggle-action.h b/src/widgets/ink-toggle-action.h index 9130b9f9f..f329f57a6 100644 --- a/src/widgets/ink-toggle-action.h +++ b/src/widgets/ink-toggle-action.h @@ -4,7 +4,6 @@ #include <gtk/gtk.h> #include "attributes.h" -#include "icon-size.h" G_BEGIN_DECLS #define INK_TOGGLE_ACTION_TYPE ( ink_toggle_action_get_type() ) diff --git a/src/widgets/makefile.in b/src/widgets/makefile.in deleted file mode 100644 index 5b756ebf3..000000000 --- a/src/widgets/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) widgets/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) widgets/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/widgets/toolbox.h b/src/widgets/toolbox.h index 09178ec2f..afa382e5b 100644 --- a/src/widgets/toolbox.h +++ b/src/widgets/toolbox.h @@ -15,7 +15,6 @@ #include <glibmm/ustring.h> -#include "icon-size.h" #include "preferences.h" #define TOOLBAR_SLIDER_HINT "full" diff --git a/src/xml/attribute-record.h b/src/xml/attribute-record.h index 7caeab6b6..91118c8a0 100644 --- a/src/xml/attribute-record.h +++ b/src/xml/attribute-record.h @@ -22,13 +22,13 @@ namespace XML { * represented by this structure. */ struct AttributeRecord : public Inkscape::GC::Managed<> { - AttributeRecord(GQuark k, Inkscape::Util::ptr_shared<char> v) + AttributeRecord(GQuark k, Inkscape::Util::ptr_shared v) : key(k), value(v) {} /** @brief GQuark corresponding to the name of the attribute */ GQuark key; /** @brief Shared pointer to the value of the attribute */ - Inkscape::Util::ptr_shared<char> value; + Inkscape::Util::ptr_shared value; // accept default copy constructor and assignment operator }; diff --git a/src/xml/comment-node.h b/src/xml/comment-node.h index 56b8ad476..7c37a0d24 100644 --- a/src/xml/comment-node.h +++ b/src/xml/comment-node.h @@ -26,7 +26,7 @@ namespace XML { * @brief Comment node, e.g. <!-- Some comment --> */ struct CommentNode : public SimpleNode { - CommentNode(Util::ptr_shared<char> content, Document *doc) + CommentNode(Util::ptr_shared content, Document *doc) : SimpleNode(g_quark_from_static_string("comment"), doc) { setContent(content); diff --git a/src/xml/composite-node-observer.cpp b/src/xml/composite-node-observer.cpp index 7343ab1a8..581a4c226 100644 --- a/src/xml/composite-node-observer.cpp +++ b/src/xml/composite-node-observer.cpp @@ -69,7 +69,7 @@ void CompositeNodeObserver::notifyChildOrderChanged(Node &node, Node &child, void CompositeNodeObserver::notifyContentChanged( Node &node, - Util::ptr_shared<char> old_content, Util::ptr_shared<char> new_content + Util::ptr_shared old_content, Util::ptr_shared new_content ) { _startIteration(); for ( ObserverRecordList::iterator iter=_active.begin() ; @@ -84,7 +84,7 @@ void CompositeNodeObserver::notifyContentChanged( void CompositeNodeObserver::notifyAttributeChanged( Node &node, GQuark name, - Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value + Util::ptr_shared old_value, Util::ptr_shared new_value ) { _startIteration(); for ( ObserverRecordList::iterator iter=_active.begin() ; @@ -133,13 +133,13 @@ public: } } - void notifyContentChanged(Node &node, Util::ptr_shared<char> old_content, Util::ptr_shared<char> new_content) { + void notifyContentChanged(Node &node, Util::ptr_shared old_content, Util::ptr_shared new_content) { if (vector.content_changed) { vector.content_changed(&node, old_content, new_content, data); } } - void notifyAttributeChanged(Node &node, GQuark name, Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value) { + void notifyAttributeChanged(Node &node, GQuark name, Util::ptr_shared old_value, Util::ptr_shared new_value) { if (vector.attr_changed) { vector.attr_changed(&node, g_quark_to_string(name), old_value, new_value, false, data); } diff --git a/src/xml/composite-node-observer.h b/src/xml/composite-node-observer.h index 6e93a57da..1004617bf 100644 --- a/src/xml/composite-node-observer.h +++ b/src/xml/composite-node-observer.h @@ -75,12 +75,12 @@ public: Node *old_prev, Node *new_prev); void notifyContentChanged(Node &node, - Util::ptr_shared<char> old_content, - Util::ptr_shared<char> new_content); + Util::ptr_shared old_content, + Util::ptr_shared new_content); void notifyAttributeChanged(Node &node, GQuark name, - Util::ptr_shared<char> old_value, - Util::ptr_shared<char> new_value); + Util::ptr_shared old_value, + Util::ptr_shared new_value); private: unsigned _iterating; diff --git a/src/xml/event.cpp b/src/xml/event.cpp index 9a760ccc5..54f55d5c3 100644 --- a/src/xml/event.cpp +++ b/src/xml/event.cpp @@ -107,15 +107,15 @@ public: } void notifyAttributeChanged(Node &node, GQuark name, - Inkscape::Util::ptr_shared<char> /*old_value*/, - Inkscape::Util::ptr_shared<char> new_value) + Inkscape::Util::ptr_shared /*old_value*/, + Inkscape::Util::ptr_shared new_value) { node.setAttribute(g_quark_to_string(name), new_value); } void notifyContentChanged(Node &node, - Inkscape::Util::ptr_shared<char> /*old_value*/, - Inkscape::Util::ptr_shared<char> new_value) + Inkscape::Util::ptr_shared /*old_value*/, + Inkscape::Util::ptr_shared new_value) { node.setContent(new_value); } @@ -461,8 +461,8 @@ public: } void notifyAttributeChanged(Node &node, GQuark name, - Inkscape::Util::ptr_shared<char> /*old_value*/, - Inkscape::Util::ptr_shared<char> new_value) + Inkscape::Util::ptr_shared /*old_value*/, + Inkscape::Util::ptr_shared new_value) { if (new_value) { g_warning("Event: Set attribute %s to \"%s\" on %s", g_quark_to_string(name), new_value.pointer(), node_to_string(node).c_str()); @@ -472,8 +472,8 @@ public: } void notifyContentChanged(Node &node, - Inkscape::Util::ptr_shared<char> /*old_value*/, - Inkscape::Util::ptr_shared<char> new_value) + Inkscape::Util::ptr_shared /*old_value*/, + Inkscape::Util::ptr_shared new_value) { if (new_value) { g_warning("Event: Set content of %s to \"%s\"", node_to_string(node).c_str(), new_value.pointer()); diff --git a/src/xml/event.h b/src/xml/event.h index f6b734c29..ca79983ba 100644 --- a/src/xml/event.h +++ b/src/xml/event.h @@ -167,8 +167,8 @@ private: class EventChgAttr : public Event { public: EventChgAttr(Node *repr, GQuark k, - Inkscape::Util::ptr_shared<char> ov, - Inkscape::Util::ptr_shared<char> nv, + Inkscape::Util::ptr_shared ov, + Inkscape::Util::ptr_shared nv, Event *next) : Event(repr, next), key(k), oldval(ov), newval(nv) {} @@ -176,9 +176,9 @@ public: /// GQuark corresponding to the changed attribute's name GQuark key; /// Value of the attribute before the change - Inkscape::Util::ptr_shared<char> oldval; + Inkscape::Util::ptr_shared oldval; /// Value of the attribute after the change - Inkscape::Util::ptr_shared<char> newval; + Inkscape::Util::ptr_shared newval; private: Event *_optimizeOne(); @@ -192,15 +192,15 @@ private: class EventChgContent : public Event { public: EventChgContent(Node *repr, - Inkscape::Util::ptr_shared<char> ov, - Inkscape::Util::ptr_shared<char> nv, + Inkscape::Util::ptr_shared ov, + Inkscape::Util::ptr_shared nv, Event *next) : Event(repr, next), oldval(ov), newval(nv) {} /// Content of the node before the change - Inkscape::Util::ptr_shared<char> oldval; + Inkscape::Util::ptr_shared oldval; /// Content of the node after the change - Inkscape::Util::ptr_shared<char> newval; + Inkscape::Util::ptr_shared newval; private: Event *_optimizeOne(); diff --git a/src/xml/helper-observer.cpp b/src/xml/helper-observer.cpp index 957f3df0a..6f1094e53 100644 --- a/src/xml/helper-observer.cpp +++ b/src/xml/helper-observer.cpp @@ -44,10 +44,10 @@ void SignalObserver::notifyChildRemoved(XML::Node&, XML::Node&, XML::Node*) void SignalObserver::notifyChildOrderChanged(XML::Node&, XML::Node&, XML::Node*, XML::Node*) { signal_changed()(); } -void SignalObserver::notifyContentChanged(XML::Node&, Util::ptr_shared<char>, Util::ptr_shared<char>) +void SignalObserver::notifyContentChanged(XML::Node&, Util::ptr_shared, Util::ptr_shared) {} -void SignalObserver::notifyAttributeChanged(XML::Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>) +void SignalObserver::notifyAttributeChanged(XML::Node&, GQuark, Util::ptr_shared, Util::ptr_shared) { signal_changed()(); } sigc::signal<void>& SignalObserver::signal_changed() diff --git a/src/xml/helper-observer.h b/src/xml/helper-observer.h index b4c0aba41..b06b61e9c 100644 --- a/src/xml/helper-observer.h +++ b/src/xml/helper-observer.h @@ -24,8 +24,8 @@ public: void notifyChildAdded(Node&, Node&, Node*); void notifyChildRemoved(Node&, Node&, Node*); void notifyChildOrderChanged(Node&, Node&, Node*, Node*); - void notifyContentChanged(Node&, Util::ptr_shared<char>, Util::ptr_shared<char>); - void notifyAttributeChanged(Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>); + void notifyContentChanged(Node&, Util::ptr_shared, Util::ptr_shared); + void notifyAttributeChanged(Node&, GQuark, Util::ptr_shared, Util::ptr_shared); sigc::signal<void>& signal_changed(); private: sigc::signal<void> _signal_changed; diff --git a/src/xml/log-builder.cpp b/src/xml/log-builder.cpp index 2cbdcfacf..12577cf69 100644 --- a/src/xml/log-builder.cpp +++ b/src/xml/log-builder.cpp @@ -49,16 +49,16 @@ void LogBuilder::setChildOrder(Node &node, Node &child, } void LogBuilder::setContent(Node &node, - Util::ptr_shared<char> old_content, - Util::ptr_shared<char> new_content) + Util::ptr_shared old_content, + Util::ptr_shared new_content) { _log = new Inkscape::XML::EventChgContent(&node, old_content, new_content, _log); _log = _log->optimizeOne(); } void LogBuilder::setAttribute(Node &node, GQuark name, - Util::ptr_shared<char> old_value, - Util::ptr_shared<char> new_value) + Util::ptr_shared old_value, + Util::ptr_shared new_value) { _log = new Inkscape::XML::EventChgAttr(&node, name, old_value, new_value, _log); _log = _log->optimizeOne(); diff --git a/src/xml/log-builder.h b/src/xml/log-builder.h index e94dd1daa..8b0f6662d 100644 --- a/src/xml/log-builder.h +++ b/src/xml/log-builder.h @@ -58,12 +58,12 @@ public: Node *old_prev, Node *new_prev); void setContent(Node &node, - Util::ptr_shared<char> old_content, - Util::ptr_shared<char> new_content); + Util::ptr_shared old_content, + Util::ptr_shared new_content); void setAttribute(Node &node, GQuark name, - Util::ptr_shared<char> old_value, - Util::ptr_shared<char> new_value); + Util::ptr_shared old_value, + Util::ptr_shared new_value); /*@}*/ private: diff --git a/src/xml/makefile.in b/src/xml/makefile.in deleted file mode 100644 index 376b4c218..000000000 --- a/src/xml/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) xml/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) xml/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/xml/node-observer.h b/src/xml/node-observer.h index 9c7e096e5..28c492d66 100644 --- a/src/xml/node-observer.h +++ b/src/xml/node-observer.h @@ -123,8 +123,8 @@ public: * @param new_content New content of @c node */ virtual void notifyContentChanged(Node &node, - Util::ptr_shared<char> old_content, - Util::ptr_shared<char> new_content) { + Util::ptr_shared old_content, + Util::ptr_shared new_content) { INK_UNUSED(node); INK_UNUSED(old_content); INK_UNUSED(new_content); @@ -141,8 +141,8 @@ public: * @param new_value New value of the modified attribute */ virtual void notifyAttributeChanged(Node &node, GQuark name, - Util::ptr_shared<char> old_value, - Util::ptr_shared<char> new_value) { + Util::ptr_shared old_value, + Util::ptr_shared new_value) { INK_UNUSED(node); INK_UNUSED(name); INK_UNUSED(old_value); diff --git a/src/xml/pi-node.h b/src/xml/pi-node.h index 76a3dc741..eeed1632d 100644 --- a/src/xml/pi-node.h +++ b/src/xml/pi-node.h @@ -24,7 +24,7 @@ namespace XML { * @brief Processing instruction node, e.g. <?xml version="1.0" encoding="utf-8" standalone="no"?> */ struct PINode : public SimpleNode { - PINode(GQuark target, Util::ptr_shared<char> content, Document *doc) + PINode(GQuark target, Util::ptr_shared content, Document *doc) : SimpleNode(target, doc) { setContent(content); diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index a34df09a5..c023dc670 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -112,8 +112,8 @@ Inkscape::XML::rebase_href_attrs(gchar const *const old_abs_base, * * However, if we find that xlink:href doesn't need rebasing, then return immediately * with no change to attributes. */ - ptr_shared<char> old_href; - ptr_shared<char> sp_absref; + ptr_shared old_href; + ptr_shared sp_absref; List<AttributeRecord const> ret; { for (List<AttributeRecord const> ai(attributes); ai; ++ai) { diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index d8e0f5418..725b313b1 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -67,11 +67,6 @@ static void sp_repr_write_stream_element(Node *repr, Writer &out, gchar const *old_href_abs_base, gchar const *new_href_abs_base); -#ifdef HAVE_LIBWMF -static xmlDocPtr sp_wmf_convert (const char * file_name); -static char * sp_wmf_image_name (void * context); -#endif /* HAVE_LIBWMF */ - class XmlSource { @@ -323,19 +318,18 @@ int XmlSource::close() } /** - * Reads XML from a file, including WMF files, and returns the Document. + * Reads XML from a file, and returns the Document. * The default namespace can also be specified, if desired. */ Document *sp_repr_read_file (const gchar * filename, const gchar *default_ns) { - // g_warning( "Reading file: %s", filename ); xmlDocPtr doc = 0; Document * rdoc = 0; xmlSubstituteEntitiesDefault(1); - g_return_val_if_fail (filename != NULL, NULL); - if (!Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS )) { + g_return_val_if_fail(filename != NULL, NULL); + if (!Inkscape::IO::file_test(filename, G_FILE_TEST_EXISTS)) { g_warning("Can't open file: %s (doesn't exist)", filename); return NULL; } @@ -348,45 +342,32 @@ Document *sp_repr_read_file (const gchar * filename, const gchar *default_ns) gsize bytesWritten = 0; GError* error = NULL; // TODO: need to replace with our own fopen and reading - gchar* localFilename = g_filename_from_utf8 ( filename, - -1, &bytesRead, &bytesWritten, &error); - g_return_val_if_fail( localFilename != NULL, NULL ); - - Inkscape::IO::dump_fopen_call( filename, "N" ); + gchar* localFilename = g_filename_from_utf8(filename, -1, &bytesRead, &bytesWritten, &error); + g_return_val_if_fail(localFilename != NULL, NULL); -#ifdef HAVE_LIBWMF - if (strlen (localFilename) > 4) { - if ( (strcmp (localFilename + strlen (localFilename) - 4,".wmf") == 0) - || (strcmp (localFilename + strlen (localFilename) - 4,".WMF") == 0)) { - doc = sp_wmf_convert (localFilename); - } - } -#endif // !HAVE_LIBWMF + Inkscape::IO::dump_fopen_call(filename, "N"); - if ( !doc ) { - XmlSource src; + XmlSource src; - if ( (src.setFile(filename) == 0) ) { + if (src.setFile(filename) == 0) { + doc = src.readXml(); + rdoc = sp_repr_do_read(doc, default_ns); + // For some reason, failed ns loading results in this + // We try a system check version of load with NOENT for adobe + if (rdoc && strcmp(rdoc->root()->name(), "ns:svg") == 0) { + xmlFreeDoc(doc); + src.setFile(filename, true); doc = src.readXml(); - rdoc = sp_repr_do_read( doc, default_ns ); - // For some reason, failed ns loading results in this - // We try a system check version of load with NOENT for adobe - if(rdoc && strcmp(rdoc->root()->name(), "ns:svg") == 0) { - xmlFreeDoc( doc ); - src.setFile(filename, true); - doc = src.readXml(); - rdoc = sp_repr_do_read( doc, default_ns ); - } + rdoc = sp_repr_do_read(doc, default_ns); } } - - if ( doc ) { - xmlFreeDoc( doc ); + if (doc) { + xmlFreeDoc(doc); } - if ( localFilename ) { - g_free( localFilename ); + if (localFilename) { + g_free(localFilename); } return rdoc; @@ -812,7 +793,7 @@ static void repr_write_comment( Writer &out, const gchar * val, bool addWhitespa namespace { typedef std::map<Glib::QueryQuark, gchar const *, Inkscape::compare_quark_ids> LocalNameMap; -typedef std::map<Glib::QueryQuark, Inkscape::Util::ptr_shared<char>, Inkscape::compare_quark_ids> NSMap; +typedef std::map<Glib::QueryQuark, Inkscape::Util::ptr_shared, Inkscape::compare_quark_ids> NSMap; gchar const *qname_local_name(Glib::QueryQuark qname) { static LocalNameMap local_name_map; @@ -846,7 +827,7 @@ void add_ns_map_entry(NSMap &ns_map, Glib::QueryQuark prefix) { g_warning("No namespace known for normalized prefix %s", g_quark_to_string(prefix)); } } else { - ns_map.insert(NSMap::value_type(prefix, ptr_shared<char>())); + ns_map.insert(NSMap::value_type(prefix, ptr_shared())); } } } @@ -905,7 +886,7 @@ static void sp_repr_write_stream_root_element(Node *repr, Writer &out, for ( NSMap::iterator iter=ns_map.begin() ; iter != ns_map.end() ; ++iter ) { Glib::QueryQuark prefix=(*iter).first; - ptr_shared<char> ns_uri=(*iter).second; + ptr_shared ns_uri=(*iter).second; if (prefix.id()) { if ( prefix != xml_prefix ) { diff --git a/src/xml/simple-document.cpp b/src/xml/simple-document.cpp index bae28e4b4..cf7851897 100644 --- a/src/xml/simple-document.cpp +++ b/src/xml/simple-document.cpp @@ -100,8 +100,8 @@ void SimpleDocument::notifyChildOrderChanged(Node &parent, } void SimpleDocument::notifyContentChanged(Node &node, - Util::ptr_shared<char> old_content, - Util::ptr_shared<char> new_content) + Util::ptr_shared old_content, + Util::ptr_shared new_content) { if (_in_transaction) { _log_builder.setContent(node, old_content, new_content); @@ -110,8 +110,8 @@ void SimpleDocument::notifyContentChanged(Node &node, void SimpleDocument::notifyAttributeChanged(Node &node, GQuark name, - Util::ptr_shared<char> old_value, - Util::ptr_shared<char> new_value) + Util::ptr_shared old_value, + Util::ptr_shared new_value) { if (_in_transaction) { _log_builder.setAttribute(node, name, old_value, new_value); diff --git a/src/xml/simple-document.h b/src/xml/simple-document.h index 7cbe50dda..01933076f 100644 --- a/src/xml/simple-document.h +++ b/src/xml/simple-document.h @@ -56,12 +56,12 @@ public: Node *old_prev, Node *new_prev); void notifyContentChanged(Node &node, - Util::ptr_shared<char> old_content, - Util::ptr_shared<char> new_content); + Util::ptr_shared old_content, + Util::ptr_shared new_content); void notifyAttributeChanged(Node &node, GQuark name, - Util::ptr_shared<char> old_value, - Util::ptr_shared<char> new_value); + Util::ptr_shared old_value, + Util::ptr_shared new_value); protected: SimpleDocument(SimpleDocument const &doc) diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp index 6bd47fd22..78fc52a27 100644 --- a/src/xml/simple-node.cpp +++ b/src/xml/simple-node.cpp @@ -36,7 +36,7 @@ namespace XML { namespace { -Util::ptr_shared<char> stringify_node(Node const &node) { +Util::ptr_shared stringify_node(Node const &node) { gchar *string; switch (node.type()) { case ELEMENT_NODE: { @@ -59,7 +59,7 @@ Util::ptr_shared<char> stringify_node(Node const &node) { default: string = g_strdup_printf("unknown(%p)", &node); } - Util::ptr_shared<char> result=Util::share_string(string); + Util::ptr_shared result=Util::share_string(string); g_free(string); return result; } @@ -68,7 +68,7 @@ typedef Debug::SimpleEvent<Debug::Event::XML> DebugXML; class DebugXMLNode : public DebugXML { public: - DebugXMLNode(Node const &node, Util::ptr_shared<char> name) + DebugXMLNode(Node const &node, Util::ptr_shared name) : DebugXML(name) { _addProperty("node", stringify_node(node)); @@ -115,7 +115,7 @@ public: class DebugSetContent : public DebugXMLNode { public: DebugSetContent(Node const &node, - Util::ptr_shared<char> content) + Util::ptr_shared content) : DebugXMLNode(node, Util::share_static_string("set-content")) { _addProperty("content", content); @@ -133,7 +133,7 @@ class DebugSetAttribute : public DebugXMLNode { public: DebugSetAttribute(Node const &node, GQuark name, - Util::ptr_shared<char> value) + Util::ptr_shared value) : DebugXMLNode(node, Util::share_static_string("set-attribute")) { _addProperty("name", Util::share_static_string(g_quark_to_string(name))); @@ -290,8 +290,8 @@ void SimpleNode::_setParent(SimpleNode *parent) { } void SimpleNode::setContent(gchar const *content) { - ptr_shared<char> old_content=_content; - ptr_shared<char> new_content = ( content ? share_string(content) : ptr_shared<char>() ); + ptr_shared old_content=_content; + ptr_shared new_content = ( content ? share_string(content) : ptr_shared() ); Debug::EventTracker<> tracker; if (new_content) { @@ -365,9 +365,9 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_ } Debug::EventTracker<> tracker; - ptr_shared<char> old_value=( existing ? existing->value : ptr_shared<char>() ); + ptr_shared old_value=( existing ? existing->value : ptr_shared() ); - ptr_shared<char> new_value=ptr_shared<char>(); + ptr_shared new_value=ptr_shared(); if (cleaned_value) { new_value = share_string(cleaned_value); tracker.set<DebugSetAttribute>(*this, key, new_value); diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h index d09392249..f2cfa953c 100644 --- a/src/xml/simple-node.h +++ b/src/xml/simple-node.h @@ -144,7 +144,7 @@ private: Inkscape::Util::MutableList<AttributeRecord> _attributes; - Inkscape::Util::ptr_shared<char> _content; + Inkscape::Util::ptr_shared _content; unsigned _child_count; mutable bool _cached_positions_valid; diff --git a/src/xml/text-node.h b/src/xml/text-node.h index 53798b822..4d71203a5 100644 --- a/src/xml/text-node.h +++ b/src/xml/text-node.h @@ -26,13 +26,13 @@ namespace XML { * @brief Text node, e.g. "Some text" in <group>Some text</group> */ struct TextNode : public SimpleNode { - TextNode(Util::ptr_shared<char> content, Document *doc) + TextNode(Util::ptr_shared content, Document *doc) : SimpleNode(g_quark_from_static_string("string"), doc) { setContent(content); _is_CData = false; } - TextNode(Util::ptr_shared<char> content, Document *doc, bool is_CData) + TextNode(Util::ptr_shared content, Document *doc, bool is_CData) : SimpleNode(g_quark_from_static_string("string"), doc) { setContent(content); |
