summaryrefslogtreecommitdiffstats
path: root/src/helper
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2017-11-03 00:10:02 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2017-11-03 00:10:02 +0000
commitd2df0412f728dd5bb54537dfdfe7c35b34d40e0e (patch)
treee2703384779e83312c456399999997fcc289c5cf /src/helper
parentMerge branch 'master' into powerpencil (diff)
parentchange assignment to equality (diff)
downloadinkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.tar.gz
inkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.zip
Merge branch 'master' into powerpencil
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/CMakeLists.txt2
-rw-r--r--src/helper/gnome-utils.cpp116
-rw-r--r--src/helper/gnome-utils.h33
-rw-r--r--src/helper/makefile.in17
-rw-r--r--src/helper/pixbuf-ops.cpp24
-rw-r--r--src/helper/pixbuf-ops.h6
6 files changed, 15 insertions, 183 deletions
diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt
index 443648c5c..bcd9f7c58 100644
--- a/src/helper/CMakeLists.txt
+++ b/src/helper/CMakeLists.txt
@@ -17,7 +17,6 @@ set(helper_SRC
geom-pathvectorsatellites.cpp
geom-satellite.cpp
gettext.cpp
- gnome-utils.cpp
pixbuf-ops.cpp
png-write.cpp
stock-items.cpp
@@ -39,7 +38,6 @@ set(helper_SRC
geom-satellite.h
geom.h
gettext.h
- gnome-utils.h
mathfns.h
pixbuf-ops.h
png-write.h
diff --git a/src/helper/gnome-utils.cpp b/src/helper/gnome-utils.cpp
deleted file mode 100644
index 3d2b333a2..000000000
--- a/src/helper/gnome-utils.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * Helpers
- *
- * Authors:
- * Mitsuru Oka
- * Lauris Kaplinski <lauris@kaplinski.com>
- *
- * Copyright (C) 2002 authors
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include <string.h>
-#include <ctype.h>
-#include <glib.h>
-
-#include "gnome-utils.h"
-
-/**
- * gnome_uri_list_extract_uris:
- * @uri_list: an uri-list in the standard format.
- *
- * Returns a GList containing strings allocated with g_malloc
- * that have been splitted from @uri-list.
- */
-GList *gnome_uri_list_extract_uris(const gchar *uri_list)
-{
- const gchar *p, *q;
- gchar *retval;
- GList *result = NULL;
-
- g_return_val_if_fail(uri_list != NULL, NULL);
-
- p = uri_list;
-
- /* We don't actually try to validate the URI according to RFC
- * 2396, or even check for allowed characters - we just ignore
- * comments and trim whitespace off the ends. We also
- * allow LF delimination as well as the specified CRLF.
- */
- while (p) {
- if (*p != '#') {
- while (isspace(*p))
- p++;
-
- q = p;
- while (*q && (*q != '\n') && (*q != '\r'))
- q++;
-
- if (q > p) {
- q--;
- while (q > p && isspace(*q))
- q--;
-
- retval = (gchar *)g_malloc(q - p + 2);
- strncpy(retval, p, q - p + 1);
- retval[q - p + 1] = '\0';
-
- result = g_list_prepend(result, retval);
- }
- }
- p = strchr(p, '\n');
- if (p)
- p++;
- }
-
- return g_list_reverse(result);
-}
-
-/**
- * gnome_uri_list_extract_filenames:
- * @uri_list: an uri-list in the standard format
- *
- * Returns a GList containing strings allocated with g_malloc
- * that contain the filenames in the uri-list.
- *
- * Note that unlike gnome_uri_list_extract_uris() function, this
- * will discard any non-file uri from the result value.
- */
-GList *gnome_uri_list_extract_filenames(const gchar *uri_list)
-{
- g_return_val_if_fail(uri_list != NULL, NULL);
-
- GList *result = gnome_uri_list_extract_uris(uri_list);
-
- GList *tmp_list = result;
- while (tmp_list) {
- gchar *s = (gchar *)tmp_list->data;
-
- GList *node = tmp_list;
- tmp_list = tmp_list->next;
-
- if (!strncmp(s, "file:", 5)) {
- node->data = g_filename_from_uri(s, NULL, NULL);
- /* not sure if this fallback is useful at all */
- if (!node->data)
- node->data = g_strdup(s + 5);
- } else {
- result = g_list_remove_link(result, node);
- g_list_free_1(node);
- }
- g_free(s);
- }
- return result;
-}
-
-/*
- 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 :
diff --git a/src/helper/gnome-utils.h b/src/helper/gnome-utils.h
deleted file mode 100644
index 6f2f28223..000000000
--- a/src/helper/gnome-utils.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * GNOME Utils - Migration helper
- *
- * Authors:
- * GNOME Developer
- * Mitsuru Oka <oka326@parkcity.ne.jp>
- * Lauris Kaplinski <lauris@ximian.com>
- *
- * Copyright (C) 2001 Lauris Kaplinski and Ximian, Inc.
- *
- * Released under GNU GPL
- */
-
-#ifndef SEEN_GNOME_UTILS_H
-#define SEEN_GNOME_UTILS_H
-
-#include <glib.h>
-
-GList *gnome_uri_list_extract_uris(gchar const *uri_list);
-GList *gnome_uri_list_extract_filenames(gchar const *uri_list);
-
-#endif // !SEEN_GNOME_UTILS_H
-
-/*
- 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 :
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 bb33f7b15..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"
@@ -34,9 +33,9 @@
// TODO look for copy-n-paste duplication of this function:
/**
- * Hide all items that are not listed in list, recursively, skipping groups and defs.
+ * Hide all items except @item, recursively, skipping groups and defs.
*/
-static void hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey)
+static void hide_other_items_recursively(SPObject *o, SPItem *i, unsigned dkey)
{
SPItem *item = dynamic_cast<SPItem *>(o);
if ( item
@@ -44,15 +43,15 @@ static void hide_other_items_recursively(SPObject *o, GSList *list, unsigned dke
&& !dynamic_cast<SPRoot *>(item)
&& !dynamic_cast<SPGroup *>(item)
&& !dynamic_cast<SPUse *>(item)
- && !g_slist_find(list, o) )
+ && (i != o) )
{
item->invoke_hide(dkey);
}
// recurse
- if (!g_slist_find(list, o)) {
+ if (i != o) {
for (auto& child: o->children) {
- hide_other_items_recursively(&child, list, dkey);
+ hide_other_items_recursively(&child, i, dkey);
}
}
}
@@ -65,11 +64,11 @@ static void hide_other_items_recursively(SPObject *o, GSList *list, unsigned dke
bool sp_export_jpg_file(SPDocument *doc, gchar const *filename,
double x0, double y0, double x1, double y1,
unsigned width, unsigned height, double xdpi, double ydpi,
- unsigned long bgcolor, double quality,GSList *items)
+ 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, items));
+ width, height, xdpi, ydpi, bgcolor, item));
gchar c[32];
g_snprintf(c, 32, "%f", quality);
@@ -78,6 +77,7 @@ bool sp_export_jpg_file(SPDocument *doc, gchar const *filename,
return saved;
}
+
/**
generates a bitmap from given items
the bitmap is stored in RAM and not written to file
@@ -95,7 +95,7 @@ Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const */*fi
double x0, double y0, double x1, double y1,
unsigned width, unsigned height, double xdpi, double ydpi,
unsigned long /*bgcolor*/,
- GSList *items_only)
+ SPItem *item_only)
{
if (width == 0 || height == 0) return NULL;
@@ -128,8 +128,8 @@ Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const */*fi
// We show all and then hide all items we don't want, instead of showing only requested items,
// because that would not work if the shown item references something in defs
- if (items_only) {
- hide_other_items_recursively(doc->getRoot(), items_only, dkey);
+ if (item_only) {
+ hide_other_items_recursively(doc->getRoot(), item_only, dkey);
}
Geom::IntRect final_bbox = Geom::IntRect::from_xywh(0, 0, width, height);
diff --git a/src/helper/pixbuf-ops.h b/src/helper/pixbuf-ops.h
index 61a879f9b..067bc0be4 100644
--- a/src/helper/pixbuf-ops.h
+++ b/src/helper/pixbuf-ops.h
@@ -17,12 +17,12 @@
class SPDocument;
namespace Inkscape { class Pixbuf; }
-bool sp_export_jpg_file (SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1,
- unsigned int width, unsigned int height, double xdpi, double ydpi, unsigned long bgcolor, double quality, GSList *items_only = NULL);
+ bool sp_export_jpg_file (SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1,
+ unsigned int width, unsigned int height, double xdpi, double ydpi, unsigned long bgcolor, double quality, SPItem *item_only = NULL);
Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const *filename,
double x0, double y0, double x1, double y1,
unsigned width, unsigned height, double xdpi, double ydpi,
- unsigned long bgcolor, GSList *items_only = NULL);
+ unsigned long bgcolor, SPItem *item_only = NULL);
#endif