diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2014-09-06 15:25:51 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2014-09-06 15:25:51 +0000 |
| commit | 990c48b80c39b942dac8bb87f16189f52ffb0d8e (patch) | |
| tree | 8281fbe19ea8b1c6cf71c75dc08b338a230d29e3 /src | |
| parent | lpe interpolate points: small code style fix-up. should be done for all LPEs (diff) | |
| download | inkscape-990c48b80c39b942dac8bb87f16189f52ffb0d8e.tar.gz inkscape-990c48b80c39b942dac8bb87f16189f52ffb0d8e.zip | |
More header cleanup
(bzr r13341.1.198)
Diffstat (limited to 'src')
70 files changed, 368 insertions, 357 deletions
diff --git a/src/color.cpp b/src/color.cpp index da4406748..d7e8d25dd 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -12,13 +12,21 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <math.h> +#include <cmath> +#include <cstdio> + +#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) +#define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) + #include "color.h" #include "svg/svg-icc-color.h" #include "svg/svg-color.h" #include "svg/css-ostringstream.h" +#define return_if_fail(x) if (!(x)) { printf("assertion failed: " #x); return; } +#define return_val_if_fail(x, val) if (!(x)) { printf("assertion failed: " #x); return val; } + using Inkscape::CSSOStringStream; using std::vector; @@ -118,7 +126,7 @@ static bool profileMatches( SVGICCColor const* first, SVGICCColor const* second && (first->colorProfile == second->colorProfile) && (first->colors.size() == second->colors.size()); if ( match ) { - for ( guint i = 0; i < first->colors.size(); i++ ) { + for ( unsigned i = 0; i < first->colors.size(); i++ ) { match &= (fabs(first->colors[i] - second->colors[i]) < PROFILE_EPSILON); } } @@ -132,12 +140,12 @@ static bool profileMatches( SVGICCColor const* first, SVGICCColor const* second */ void SPColor::set( float r, float g, float b ) { - g_return_if_fail(r >= 0.0); - g_return_if_fail(r <= 1.0); - g_return_if_fail(g >= 0.0); - g_return_if_fail(g <= 1.0); - g_return_if_fail(b >= 0.0); - g_return_if_fail(b <= 1.0); + return_if_fail(r >= 0.0); + return_if_fail(r <= 1.0); + return_if_fail(g >= 0.0); + return_if_fail(g <= 1.0); + return_if_fail(b >= 0.0); + return_if_fail(b <= 1.0); // TODO clear icc if set? v.c[0] = r; @@ -162,7 +170,7 @@ void SPColor::set( guint32 value ) */ guint32 SPColor::toRGBA32( int alpha ) const { - g_return_val_if_fail (alpha <= 0xff, 0x0); + return_val_if_fail (alpha <= 0xff, 0x0); guint32 rgba = SP_RGBA32_U_COMPOSE( SP_COLOR_F_TO_U(v.c[0]), SP_COLOR_F_TO_U(v.c[1]), @@ -177,8 +185,8 @@ guint32 SPColor::toRGBA32( int alpha ) const */ guint32 SPColor::toRGBA32( double alpha ) const { - g_return_val_if_fail(alpha >= 0.0, 0x0); - g_return_val_if_fail(alpha <= 1.0, 0x0); + return_val_if_fail(alpha >= 0.0, 0x0); + return_val_if_fail(alpha <= 1.0, 0x0); return toRGBA32( static_cast<int>(SP_COLOR_F_TO_U(alpha)) ); } @@ -215,8 +223,8 @@ std::string SPColor::toString() const void sp_color_get_rgb_floatv(SPColor const *color, float *rgb) { - g_return_if_fail (color != NULL); - g_return_if_fail (rgb != NULL); + return_if_fail (color != NULL); + return_if_fail (rgb != NULL); rgb[0] = color->v.c[0]; rgb[1] = color->v.c[1]; @@ -230,8 +238,8 @@ sp_color_get_rgb_floatv(SPColor const *color, float *rgb) void sp_color_get_cmyk_floatv(SPColor const *color, float *cmyk) { - g_return_if_fail (color != NULL); - g_return_if_fail (cmyk != NULL); + return_if_fail (color != NULL); + return_if_fail (cmyk != NULL); sp_color_rgb_to_cmyk_floatv( cmyk, color->v.c[0], diff --git a/src/debug/gdk-event-latency-tracker.cpp b/src/debug/gdk-event-latency-tracker.cpp index b21675f53..4679f05f1 100644 --- a/src/debug/gdk-event-latency-tracker.cpp +++ b/src/debug/gdk-event-latency-tracker.cpp @@ -9,6 +9,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <gdk/gdk.h> + #include "debug/gdk-event-latency-tracker.h" #include "preferences.h" diff --git a/src/debug/gdk-event-latency-tracker.h b/src/debug/gdk-event-latency-tracker.h index c3624e74f..0fdb18790 100644 --- a/src/debug/gdk-event-latency-tracker.h +++ b/src/debug/gdk-event-latency-tracker.h @@ -12,7 +12,7 @@ #ifndef SEEN_INKSCAPE_DEBUG_GDK_EVENT_LATENCY_TRACKER_H #define SEEN_INKSCAPE_DEBUG_GDK_EVENT_LATENCY_TRACKER_H -#include <gdk/gdk.h> +typedef union _GdkEvent GdkEvent; #include <glibmm/timer.h> #include <boost/optional.hpp> diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp index d6ff7b2f0..b81162548 100644 --- a/src/display/cairo-utils.cpp +++ b/src/display/cairo-utils.cpp @@ -26,6 +26,8 @@ #include <2geom/path.h> #include <2geom/transforms.h> #include <2geom/sbasis-to-bezier.h> +#include <gdk-pixbuf/gdk-pixbuf.h> + #include "color.h" #include "style.h" #include "helper/geom-curves.h" diff --git a/src/display/canvas-arena.h b/src/display/canvas-arena.h index 26f19732d..15bbc2ee0 100644 --- a/src/display/canvas-arena.h +++ b/src/display/canvas-arena.h @@ -13,15 +13,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <cairo.h> #include <2geom/rect.h> + #include "display/drawing.h" #include "display/drawing-item.h" #include "display/sp-canvas.h" #include "display/sp-canvas-item.h" -G_BEGIN_DECLS - #define SP_TYPE_CANVAS_ARENA (sp_canvas_arena_get_type ()) #define SP_CANVAS_ARENA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CANVAS_ARENA, SPCanvasArena)) #define SP_CANVAS_ARENA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_CANVAS_ARENA, SPCanvasArenaClass)) @@ -30,6 +28,7 @@ G_BEGIN_DECLS typedef struct _SPCanvasArena SPCanvasArena; typedef struct _SPCanvasArenaClass SPCanvasArenaClass; +typedef struct _cairo_surface cairo_surface_t; struct CachePrefObserver; namespace Inkscape { @@ -39,7 +38,6 @@ class DrawingItem; } // namespace Inkscape - struct _SPCanvasArena { SPCanvasItem item; @@ -70,6 +68,4 @@ void sp_canvas_arena_set_sticky (SPCanvasArena *ca, gboolean sticky); void sp_canvas_arena_render_surface (SPCanvasArena *ca, cairo_surface_t *surface, Geom::IntRect const &area); -G_END_DECLS - #endif // SEEN_SP_CANVAS_ARENA_H diff --git a/src/display/canvas-axonomgrid.h b/src/display/canvas-axonomgrid.h index 3888a3dc4..92cdb4c50 100644 --- a/src/display/canvas-axonomgrid.h +++ b/src/display/canvas-axonomgrid.h @@ -26,11 +26,11 @@ public: CanvasAxonomGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc); virtual ~CanvasAxonomGrid(); - void Update (Geom::Affine const &affine, unsigned int flags); - void Render (SPCanvasBuf *buf); + virtual void Update (Geom::Affine const &affine, unsigned int flags); + virtual void Render (SPCanvasBuf *buf); - void readRepr(); - void onReprAttrChanged (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive); + virtual void readRepr(); + virtual void onReprAttrChanged (Inkscape::XML::Node * repr, char const *key, char const *oldval, char const *newval, bool is_interactive); double lengthy; /**< The lengths of the primary y-axis */ double angle_deg[3]; /**< Angle of each axis (note that angle[2] == 0) */ diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h index 5a23dee52..557bd6dab 100644 --- a/src/display/canvas-grid.h +++ b/src/display/canvas-grid.h @@ -82,7 +82,7 @@ public: virtual void Render (SPCanvasBuf *buf) = 0; virtual void readRepr() = 0; - virtual void onReprAttrChanged (Inkscape::XML::Node * /*repr*/, const gchar */*key*/, const gchar */*oldval*/, const gchar */*newval*/, bool /*is_interactive*/) = 0; + virtual void onReprAttrChanged (Inkscape::XML::Node * /*repr*/, char const */*key*/, char const */*oldval*/, char const */*newval*/, bool /*is_interactive*/) = 0; Gtk::Widget * newWidget(); @@ -129,11 +129,11 @@ public: CanvasXYGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc); virtual ~CanvasXYGrid(); - void Update (Geom::Affine const &affine, unsigned int flags); - void Render (SPCanvasBuf *buf); + virtual void Update (Geom::Affine const &affine, unsigned int flags); + virtual void Render (SPCanvasBuf *buf); - void readRepr(); - void onReprAttrChanged (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive); + virtual void readRepr(); + virtual void onReprAttrChanged (Inkscape::XML::Node * repr, char const *key, char const *oldval, char const *newval, bool is_interactive); Geom::Point spacing; /**< Spacing between elements of the grid */ bool scaled[2]; /**< Whether the grid is in scaled mode, which can diff --git a/src/display/canvas-temporary-item-list.cpp b/src/display/canvas-temporary-item-list.cpp index b0fec98b5..60ead11ce 100644 --- a/src/display/canvas-temporary-item-list.cpp +++ b/src/display/canvas-temporary-item-list.cpp @@ -10,9 +10,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "display/canvas-temporary-item-list.h" - #include "display/canvas-temporary-item.h" +#include "display/canvas-temporary-item-list.h" namespace Inkscape { namespace Display { @@ -35,7 +34,7 @@ TemporaryItemList::~TemporaryItemList() /* Note that TemporaryItem or TemporaryItemList is responsible for deletion and such, so this return pointer can safely be ignored. */ TemporaryItem * -TemporaryItemList::add_item(SPCanvasItem *item, guint lifetime) +TemporaryItemList::add_item(SPCanvasItem *item, unsigned int lifetime) { // beware of strange things happening due to very short timeouts TemporaryItem * tempitem = new TemporaryItem(item, lifetime); diff --git a/src/display/canvas-temporary-item-list.h b/src/display/canvas-temporary-item-list.h index d204c692f..471bb99b9 100644 --- a/src/display/canvas-temporary-item-list.h +++ b/src/display/canvas-temporary-item-list.h @@ -11,7 +11,6 @@ */ #include <list> -#include <glib.h> struct SPCanvasItem; class SPDesktop; @@ -22,14 +21,14 @@ namespace Display { class TemporaryItem; /** - * Provides a class that can contain active TemporaryItem's on a desktop. + * Provides a class that can contain active TemporaryItem[s] on a desktop. */ class TemporaryItemList { public: TemporaryItemList(SPDesktop *desktop); virtual ~TemporaryItemList(); - TemporaryItem* add_item (SPCanvasItem *item, guint lifetime); + TemporaryItem* add_item (SPCanvasItem *item, unsigned int lifetime); void delete_item (TemporaryItem * tempitem); protected: diff --git a/src/display/canvas-temporary-item.cpp b/src/display/canvas-temporary-item.cpp index 551ea1536..f55c8bf4e 100644 --- a/src/display/canvas-temporary-item.cpp +++ b/src/display/canvas-temporary-item.cpp @@ -16,7 +16,7 @@ #include "display/canvas-temporary-item.h" -#include <gtk/gtk.h> +#include <glib.h> #include "display/sp-canvas-item.h" namespace Inkscape { @@ -54,9 +54,9 @@ TemporaryItem::~TemporaryItem() } } -/* static method*/ -gboolean TemporaryItem::_timeout(gpointer data) { - TemporaryItem *tempitem = reinterpret_cast<TemporaryItem *>(data); +/* static method */ +int TemporaryItem::_timeout(void* data) { + TemporaryItem *tempitem = static_cast<TemporaryItem *>(data); tempitem->timeout_id = 0; tempitem->signal_timeout.emit(tempitem); delete tempitem; diff --git a/src/display/canvas-temporary-item.h b/src/display/canvas-temporary-item.h index 09d243fa1..39ca2fc65 100644 --- a/src/display/canvas-temporary-item.h +++ b/src/display/canvas-temporary-item.h @@ -11,9 +11,8 @@ */ -#include <stddef.h> -#include <sigc++/sigc++.h> -#include <glib.h> +#include <cstddef> +#include <sigc++/signal.h> struct SPCanvasItem; @@ -25,7 +24,7 @@ namespace Display { */ class TemporaryItem { public: - TemporaryItem(SPCanvasItem *item, guint lifetime, bool destroy_on_deselect = false); + TemporaryItem(SPCanvasItem *item, unsigned int lifetime, bool destroy_on_deselect = false); virtual ~TemporaryItem(); sigc::signal<void, TemporaryItem *> signal_timeout; @@ -34,10 +33,10 @@ protected: friend class TemporaryItemList; SPCanvasItem * canvasitem; /** The item we are holding on to */ - guint timeout_id; /** ID by which glib knows the timeout event */ + unsigned int timeout_id; /** ID by which glib knows the timeout event */ bool destroy_on_deselect; // only destroy when parent item is deselected, not when mouse leaves - static gboolean _timeout(gpointer data); ///< callback for when lifetime expired + static int _timeout(void* data); ///< callback for when lifetime expired private: TemporaryItem(const TemporaryItem&); diff --git a/src/display/curve.cpp b/src/display/curve.cpp index 0a39a8e7f..54a62939d 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -48,7 +48,7 @@ SPCurve::new_from_rect(Geom::Rect const &rect, bool all_four_sides) Geom::Point p = rect.corner(0); c->moveto(p); - for (int i=3; i>=1; i--) { + for (int i=3; i>=1; --i) { c->lineto(rect.corner(i)); } @@ -87,10 +87,10 @@ SPCurve::get_pathvector() const * Returns the number of segments of all paths summed * This count includes the closing line segment of a closed path. */ -guint +size_t SPCurve::get_segment_count() const { - guint nr = 0; + size_t nr = 0; for(Geom::PathVector::const_iterator it = _pathv.begin(); it != _pathv.end(); ++it) { nr += (*it).size(); @@ -200,7 +200,7 @@ SPCurve::reset() * Calls SPCurve::moveto() with point made of given coordinates. */ void -SPCurve::moveto(gdouble x, gdouble y) +SPCurve::moveto(double x, double y) { moveto(Geom::Point(x, y)); } @@ -229,7 +229,7 @@ SPCurve::lineto(Geom::Point const &p) * Calls SPCurve::lineto( Geom::Point(x,y) ) */ void -SPCurve::lineto(gdouble x, gdouble y) +SPCurve::lineto(double x, double y) { lineto(Geom::Point(x,y)); } @@ -249,7 +249,7 @@ SPCurve::quadto(Geom::Point const &p1, Geom::Point const &p2) * All coordinates must be finite. */ void -SPCurve::quadto(gdouble x1, gdouble y1, gdouble x2, gdouble y2) +SPCurve::quadto(double x1, double y1, double x2, double y2) { quadto( Geom::Point(x1,y1), Geom::Point(x2,y2) ); } @@ -269,7 +269,7 @@ SPCurve::curveto(Geom::Point const &p0, Geom::Point const &p1, Geom::Point const * All coordinates must be finite. */ void -SPCurve::curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2) +SPCurve::curveto(double x0, double y0, double x1, double y1, double x2, double y2) { curveto( Geom::Point(x0,y0), Geom::Point(x1,y1), Geom::Point(x2,y2) ); } @@ -520,7 +520,7 @@ SPCurve::append(SPCurve const *curve2, * When one of the curves is empty, this curves path becomes the non-empty path. */ SPCurve * -SPCurve::append_continuous(SPCurve const *c1, gdouble tolerance) +SPCurve::append_continuous(SPCurve const *c1, double tolerance) { using Geom::X; using Geom::Y; @@ -630,10 +630,10 @@ SPCurve::move_endpoints(Geom::Point const &new_p0, Geom::Point const &new_p1) * Sum of nodes in all the paths. When a path is closed, and its closing line segment is of zero-length, * this function will not count the closing knot double (so basically ignores the closing line segment when it has zero length) */ -guint +size_t SPCurve::nodes_in_path() const { - guint nr = 0; + size_t nr = 0; for(Geom::PathVector::const_iterator it = _pathv.begin(); it != _pathv.end(); ++it) { nr += (*it).size(); diff --git a/src/display/curve.h b/src/display/curve.h index b3f1e3702..5fad75b18 100644 --- a/src/display/curve.h +++ b/src/display/curve.h @@ -13,10 +13,12 @@ #ifndef SEEN_DISPLAY_CURVE_H #define SEEN_DISPLAY_CURVE_H -#include <glib.h> #include <2geom/forward.h> +#include <cstddef> #include <boost/optional.hpp> +extern "C" { typedef struct _GSList GSList; } + /** * Wrapper around a Geom::PathVector object. */ @@ -37,8 +39,8 @@ public: SPCurve * copy() const; - guint get_segment_count() const; - guint nodes_in_path() const; + size_t get_segment_count() const; + size_t nodes_in_path() const; bool is_empty() const; bool is_closed() const; @@ -54,13 +56,13 @@ public: void reset(); void moveto(Geom::Point const &p); - void moveto(gdouble x, gdouble y); + void moveto(double x, double y); void lineto(Geom::Point const &p); - void lineto(gdouble x, gdouble y); + void lineto(double x, double y); void quadto(Geom::Point const &p1, Geom::Point const &p2); - void quadto(gdouble x1, gdouble y1, gdouble x2, gdouble y2); + void quadto(double x1, double y1, double x2, double y2); void curveto(Geom::Point const &p0, Geom::Point const &p1, Geom::Point const &p2); - void curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2); + void curveto(double x0, double y0, double x1, double y1, double x2, double y2); void closepath(); void closepath_current(); void backspace(); @@ -71,14 +73,14 @@ public: void last_point_additive_move(Geom::Point const & p); void append(SPCurve const *curve2, bool use_lineto); - SPCurve * append_continuous(SPCurve const *c1, gdouble tolerance); + SPCurve * append_continuous(SPCurve const *c1, double tolerance); SPCurve * create_reverse() const; GSList * split() const; static SPCurve * concat(GSList const *list); protected: - gint _refcount; + size_t _refcount; Geom::PathVector _pathv; diff --git a/src/display/drawing-context.h b/src/display/drawing-context.h index 0d82087c3..a15e0d0e5 100644 --- a/src/display/drawing-context.h +++ b/src/display/drawing-context.h @@ -12,13 +12,13 @@ #ifndef SEEN_INKSCAPE_DISPLAY_DRAWING_CONTEXT_H #define SEEN_INKSCAPE_DISPLAY_DRAWING_CONTEXT_H -#include <boost/utility.hpp> -#include <glib.h> -#include <cairo.h> #include <2geom/affine.h> #include <2geom/angle.h> #include <2geom/rect.h> #include <2geom/transforms.h> +#include <boost/utility.hpp> +#include <cairo.h> +typedef unsigned int guint32; namespace Inkscape { diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h index 925bcbddb..dda5cd6ac 100644 --- a/src/display/drawing-item.h +++ b/src/display/drawing-item.h @@ -12,13 +12,13 @@ #ifndef SEEN_INKSCAPE_DISPLAY_DRAWING_ITEM_H #define SEEN_INKSCAPE_DISPLAY_DRAWING_ITEM_H -#include <list> -#include <exception> +#include <2geom/rect.h> +#include <2geom/affine.h> #include <boost/operators.hpp> #include <boost/utility.hpp> #include <boost/intrusive/list.hpp> -#include <2geom/rect.h> -#include <2geom/affine.h> +#include <exception> +#include <list> class SPStyle; diff --git a/src/display/drawing-surface.h b/src/display/drawing-surface.h index e937cca55..7bec1606a 100644 --- a/src/display/drawing-surface.h +++ b/src/display/drawing-surface.h @@ -14,11 +14,16 @@ #include <boost/shared_ptr.hpp> #include <cairo.h> -#include <gdk-pixbuf/gdk-pixbuf.h> #include <2geom/affine.h> #include <2geom/rect.h> #include <2geom/transforms.h> +extern "C" { +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; +typedef struct _cairo_region cairo_region_t; +} + namespace Inkscape { class DrawingContext; diff --git a/src/display/drawing.h b/src/display/drawing.h index 88e35b03b..0c12b1510 100644 --- a/src/display/drawing.h +++ b/src/display/drawing.h @@ -12,11 +12,12 @@ #ifndef SEEN_INKSCAPE_DISPLAY_DRAWING_H #define SEEN_INKSCAPE_DISPLAY_DRAWING_H -#include <set> +#include <2geom/rect.h> #include <boost/operators.hpp> #include <boost/utility.hpp> +#include <set> #include <sigc++/sigc++.h> -#include <2geom/rect.h> + #include "display/drawing-item.h" #include "display/rendermode.h" #include "nr-filter-colormatrix.h" diff --git a/src/display/gnome-canvas-acetate.h b/src/display/gnome-canvas-acetate.h index 447c3a9c4..3e1ba7661 100644 --- a/src/display/gnome-canvas-acetate.h +++ b/src/display/gnome-canvas-acetate.h @@ -15,10 +15,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> #include "display/sp-canvas-item.h" - #define GNOME_TYPE_CANVAS_ACETATE (sp_canvas_acetate_get_type ()) #define SP_CANVAS_ACETATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_ACETATE, SPCanvasAcetate)) #define SP_CANVAS_ACETATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_ACETATE, SPCanvasAcetateClass)) @@ -27,17 +25,15 @@ struct SPCanvasAcetate { - SPCanvasItem item; + SPCanvasItem item; }; struct SPCanvasAcetateClass { - SPCanvasItemClass parent_class; + SPCanvasItemClass parent_class; }; GType sp_canvas_acetate_get_type (void); - - #endif // SEEN_SP_CANVAS_ACETATE_H /* diff --git a/src/display/grayscale.cpp b/src/display/grayscale.cpp index f59cf6d23..3c0031e87 100644 --- a/src/display/grayscale.cpp +++ b/src/display/grayscale.cpp @@ -36,7 +36,7 @@ guint32 process(guint32 rgba) { return process(SP_RGBA32_R_U(rgba), SP_RGBA32_G_U(rgba), SP_RGBA32_B_U(rgba), SP_RGBA32_A_U(rgba)); } -guint32 process(guchar r, guchar g, guchar b, guchar a) { +guint32 process(unsigned char r, unsigned char g, unsigned char b, unsigned char a) { /** To reduce banding in gradients, this calculation is tweaked a bit * by outputing blue+1 or red+1 or both. The luminance is calculated @@ -62,7 +62,7 @@ guint32 process(guchar r, guchar g, guchar b, guchar a) { } } -guchar luminance(guchar r, guchar g, guchar b) { +unsigned char luminance(unsigned char r, unsigned char g, unsigned char b) { guint32 luminance = ( red_factor * r + green_factor * g + blue_factor * b ); diff --git a/src/display/grayscale.h b/src/display/grayscale.h index 18162e1f3..0ffe727da 100644 --- a/src/display/grayscale.h +++ b/src/display/grayscale.h @@ -10,15 +10,15 @@ * Released under GNU GPL */ -#include <gdk/gdk.h> +typedef unsigned int guint32; /** * Provide methods to calculate grayscale values (e.g. convert rgba value to grayscale rgba value). */ namespace Grayscale { guint32 process(guint32 rgba); - guint32 process(guchar r, guchar g, guchar b, guchar a); - guchar luminance(guchar r, guchar g, guchar b); + guint32 process(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + unsigned char luminance(unsigned char r, unsigned char g, unsigned char b); bool activeDesktopIsGrayscale(); }; diff --git a/src/display/nr-3dutils.h b/src/display/nr-3dutils.h index c278c81c6..eb773a9ad 100644 --- a/src/display/nr-3dutils.h +++ b/src/display/nr-3dutils.h @@ -1,5 +1,5 @@ -#ifndef __NR_3DUTILS_H__ -#define __NR_3DUTILS_H__ +#ifndef SEEN_NR_3DUTILS_H +#define SEEN_NR_3DUTILS_H /* * 3D utils. Definition of gdouble vectors of dimension 3 and of some basic @@ -14,7 +14,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gdk/gdk.h> #include <2geom/forward.h> namespace NR { @@ -51,7 +50,7 @@ const static Fvector EYE_VECTOR(0, 0, 1); * \param v a reference to a vector with double components * \return the euclidian norm of v */ -gdouble norm(const Fvector &v); +double norm(const Fvector &v); /** * Normalizes a vector @@ -67,7 +66,7 @@ void normalize_vector(Fvector &v); * \param b a Fvector reference * \return the scalar product of a and b */ -gdouble scalar_product(const Fvector &a, const Fvector &b); +double scalar_product(const Fvector &a, const Fvector &b); /** * Computes the normalized sum of two Fvectors @@ -88,7 +87,7 @@ void normalized_sum(Fvector &r, const Fvector &a, const Fvector &b); * \param z a reference to a z coordinate * \param z a reference to a transformation matrix */ -void convert_coord(gdouble &x, gdouble &y, gdouble &z, Geom::Affine const &trans); +void convert_coord(double &x, double &y, double &z, Geom::Affine const &trans); } /* namespace NR */ diff --git a/src/display/nr-filter-blend.h b/src/display/nr-filter-blend.h index c0504993b..30c9d6725 100644 --- a/src/display/nr-filter-blend.h +++ b/src/display/nr-filter-blend.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_BLEND_H__ -#define __NR_FILTER_BLEND_H__ +#ifndef SEEN_NR_FILTER_BLEND_H +#define SEEN_NR_FILTER_BLEND_H /* * SVG feBlend renderer diff --git a/src/display/nr-filter-colormatrix.h b/src/display/nr-filter-colormatrix.h index c7e5e91d9..cc43f4914 100644 --- a/src/display/nr-filter-colormatrix.h +++ b/src/display/nr-filter-colormatrix.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_COLOR_MATRIX_H__ -#define __NR_FILTER_COLOR_MATRIX_H__ +#ifndef SEEN_NR_FILTER_COLOR_MATRIX_H +#define SEEN_NR_FILTER_COLOR_MATRIX_H /* * feColorMatrix filter primitive renderer @@ -16,6 +16,9 @@ #include <2geom/forward.h> #include "display/nr-filter-primitive.h" +typedef unsigned int guint32; +typedef signed int gint32; + namespace Inkscape { namespace Filters { @@ -40,8 +43,8 @@ public: virtual double complexity(Geom::Affine const &ctm); virtual void set_type(FilterColorMatrixType type); - virtual void set_value(gdouble value); - virtual void set_values(std::vector<gdouble> const &values); + virtual void set_value(double value); + virtual void set_values(std::vector<double> const &values); public: struct ColorMatrixMatrix { @@ -52,8 +55,8 @@ public: }; private: - std::vector<gdouble> values; - gdouble value; + std::vector<double> values; + double value; FilterColorMatrixType type; }; diff --git a/src/display/nr-filter-component-transfer.h b/src/display/nr-filter-component-transfer.h index 558d097a8..7019dde37 100644 --- a/src/display/nr-filter-component-transfer.h +++ b/src/display/nr-filter-component-transfer.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_COMPONENT_TRANSFER_H__ -#define __NR_FILTER_COMPONENT_TRANSFER_H__ +#ifndef SEEN_NR_FILTER_COMPONENT_TRANSFER_H +#define SEEN_NR_FILTER_COMPONENT_TRANSFER_H /* * feComponentTransfer filter primitive renderer @@ -40,7 +40,7 @@ public: virtual double complexity(Geom::Affine const &ctm); FilterComponentTransferType type[4]; - std::vector<gdouble> tableValues[4]; + std::vector<double> tableValues[4]; double slope[4]; double intercept[4]; double amplitude[4]; diff --git a/src/display/nr-filter-composite.h b/src/display/nr-filter-composite.h index 95579cc0e..35756383b 100644 --- a/src/display/nr-filter-composite.h +++ b/src/display/nr-filter-composite.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_COMPOSITE_H__ -#define __NR_FILTER_COMPOSITE_H__ +#ifndef SEEN_NR_FILTER_COMPOSITE_H +#define SEEN_NR_FILTER_COMPOSITE_H /* * feComposite filter effect renderer diff --git a/src/display/nr-filter-convolve-matrix.h b/src/display/nr-filter-convolve-matrix.h index 4041ff96f..d2e38eb95 100644 --- a/src/display/nr-filter-convolve-matrix.h +++ b/src/display/nr-filter-convolve-matrix.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_CONVOLVE_MATRIX_H__ -#define __NR_FILTER_CONVOLVE_MATRIX_H__ +#ifndef SEEN_NR_FILTER_CONVOLVE_MATRIX_H +#define SEEN_NR_FILTER_CONVOLVE_MATRIX_H /* * feConvolveMatrix filter primitive renderer @@ -48,10 +48,10 @@ public: void set_preserveAlpha(bool pa); private: - std::vector<gdouble> kernelMatrix; + std::vector<double> kernelMatrix; int targetX, targetY; int orderX, orderY; - gdouble divisor, bias; + double divisor, bias; int dx, dy, kernelUnitLength; FilterConvolveMatrixEdgeMode edgeMode; bool preserveAlpha; diff --git a/src/display/nr-filter-diffuselighting.h b/src/display/nr-filter-diffuselighting.h index 043a5eb39..7739b3ea6 100644 --- a/src/display/nr-filter-diffuselighting.h +++ b/src/display/nr-filter-diffuselighting.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_DIFFUSELIGHTING_H__ -#define __NR_FILTER_DIFFUSELIGHTING_H__ +#ifndef SEEN_NR_FILTER_DIFFUSELIGHTING_H +#define SEEN_NR_FILTER_DIFFUSELIGHTING_H /* * feDiffuseLighting renderer @@ -13,7 +13,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gdk/gdk.h> #include "display/nr-light-types.h" #include "display/nr-filter-primitive.h" #include "display/nr-filter-slot.h" @@ -23,6 +22,7 @@ class SPFeDistantLight; class SPFePointLight; class SPFeSpotLight; struct SVGICCColor; +typedef unsigned int guint32; namespace Inkscape { namespace Filters { @@ -43,8 +43,8 @@ public: SPFeSpotLight *spot; } light; LightType light_type; - gdouble diffuseConstant; - gdouble surfaceScale; + double diffuseConstant; + double surfaceScale; guint32 lighting_color; private: diff --git a/src/display/nr-filter-displacement-map.h b/src/display/nr-filter-displacement-map.h index a01930045..c4e2400fe 100644 --- a/src/display/nr-filter-displacement-map.h +++ b/src/display/nr-filter-displacement-map.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_DISPLACEMENT_MAP_H__ -#define __NR_FILTER_DISPLACEMENT_MAP_H__ +#ifndef SEEN_NR_FILTER_DISPLACEMENT_MAP_H +#define SEEN_NR_FILTER_DISPLACEMENT_MAP_H /* * feDisplacementMap filter primitive renderer diff --git a/src/display/nr-filter-flood.h b/src/display/nr-filter-flood.h index 9a968047d..826aa981a 100644 --- a/src/display/nr-filter-flood.h +++ b/src/display/nr-filter-flood.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_FLOOD_H__ -#define __NR_FILTER_FLOOD_H__ +#ifndef SEEN_NR_FILTER_FLOOD_H +#define SEEN_NR_FILTER_FLOOD_H /* * feFlood filter primitive renderer @@ -15,6 +15,7 @@ #include "display/nr-filter-primitive.h" struct SVGICCColor; +typedef unsigned int guint32; namespace Inkscape { namespace Filters { diff --git a/src/display/nr-filter-gaussian.h b/src/display/nr-filter-gaussian.h index 1c35a0f1d..88c38247f 100644 --- a/src/display/nr-filter-gaussian.h +++ b/src/display/nr-filter-gaussian.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_GAUSSIAN_H__ -#define __NR_FILTER_GAUSSIAN_H__ +#ifndef SEEN_NR_FILTER_GAUSSIAN_H +#define SEEN_NR_FILTER_GAUSSIAN_H /* * Gaussian blur renderer diff --git a/src/display/nr-filter-image.h b/src/display/nr-filter-image.h index 69691ac99..147a8ba6c 100644 --- a/src/display/nr-filter-image.h +++ b/src/display/nr-filter-image.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_IMAGE_H__ -#define __NR_FILTER_IMAGE_H__ +#ifndef SEEN_NR_FILTER_IMAGE_H +#define SEEN_NR_FILTER_IMAGE_H /* * feImage filter primitive renderer @@ -34,7 +34,7 @@ public: virtual double complexity(Geom::Affine const &ctm); void set_document( SPDocument *document ); - void set_href(const gchar *href); + void set_href(char const *href); void set_align( unsigned int align ); void set_clip( unsigned int clip ); bool from_element; @@ -42,7 +42,7 @@ public: private: SPDocument *document; - gchar *feImageHref; + char *feImageHref; Inkscape::Pixbuf *image; float feImageX, feImageY, feImageWidth, feImageHeight; unsigned int aspect_align, aspect_clip; diff --git a/src/display/nr-filter-merge.h b/src/display/nr-filter-merge.h index 238f9a3e7..b20d663ab 100644 --- a/src/display/nr-filter-merge.h +++ b/src/display/nr-filter-merge.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_MERGE_H__ -#define __NR_FILTER_MERGE_H__ +#ifndef SEEN_NR_FILTER_MERGE_H +#define SEEN_NR_FILTER_MERGE_H /* * feMerge filter effect renderer diff --git a/src/display/nr-filter-morphology.h b/src/display/nr-filter-morphology.h index 0574ff4ad..cd7dfe775 100644 --- a/src/display/nr-filter-morphology.h +++ b/src/display/nr-filter-morphology.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_MORPHOLOGY_H__ -#define __NR_FILTER_MORPHOLOGY_H__ +#ifndef SEEN_NR_FILTER_MORPHOLOGY_H +#define SEEN_NR_FILTER_MORPHOLOGY_H /* * feMorphology filter primitive renderer diff --git a/src/display/nr-filter-offset.h b/src/display/nr-filter-offset.h index 1ecc1621e..c1ee1d82a 100644 --- a/src/display/nr-filter-offset.h +++ b/src/display/nr-filter-offset.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_OFFSET_H__ -#define __NR_FILTER_OFFSET_H__ +#ifndef SEEN_NR_FILTER_OFFSET_H +#define SEEN_NR_FILTER_OFFSET_H /* * feOffset filter primitive renderer diff --git a/src/display/nr-filter-primitive.h b/src/display/nr-filter-primitive.h index 62f350844..4b7577159 100644 --- a/src/display/nr-filter-primitive.h +++ b/src/display/nr-filter-primitive.h @@ -11,9 +11,9 @@ #ifndef SEEN_NR_FILTER_PRIMITIVE_H #define SEEN_NR_FILTER_PRIMITIVE_H -#include <glib.h> #include <2geom/forward.h> #include <2geom/rect.h> + #include "display/nr-filter-types.h" #include "svg/svg-length.h" @@ -31,7 +31,7 @@ public: virtual ~FilterPrimitive(); virtual void render_cairo(FilterSlot &slot); - virtual int render(FilterSlot & /*slot*/, FilterUnits const & /*units*/) { return 0; } + virtual int render(FilterSlot & /*slot*/, FilterUnits const & /*units*/) { return 0; } // pure virtual? virtual void area_enlarge(Geom::IntRect &area, Geom::Affine const &m); /** diff --git a/src/display/nr-filter-skeleton.h b/src/display/nr-filter-skeleton.h index 049c0df80..e17c244c1 100644 --- a/src/display/nr-filter-skeleton.h +++ b/src/display/nr-filter-skeleton.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_SKELETON_H__ -#define __NR_FILTER_SKELETON_H__ +#ifndef SEEN_NR_FILTER_SKELETON_H +#define SEEN_NR_FILTER_SKELETON_H /* * Filter primitive renderer skeleton class diff --git a/src/display/nr-filter-slot.h b/src/display/nr-filter-slot.h index f3c98b8d9..987dedfd1 100644 --- a/src/display/nr-filter-slot.h +++ b/src/display/nr-filter-slot.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_SLOT_H__ -#define __NR_FILTER_SLOT_H__ +#ifndef SEEN_NR_FILTER_SLOT_H +#define SEEN_NR_FILTER_SLOT_H /* * A container class for filter slots. Allows for simple getting and @@ -15,10 +15,14 @@ */ #include <map> -#include <cairo.h> #include "display/nr-filter-types.h" #include "display/nr-filter-units.h" +extern "C" { +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; +} + namespace Inkscape { class DrawingContext; class DrawingItem; diff --git a/src/display/nr-filter-specularlighting.h b/src/display/nr-filter-specularlighting.h index c57e3a9ff..ff9cda450 100644 --- a/src/display/nr-filter-specularlighting.h +++ b/src/display/nr-filter-specularlighting.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_SPECULARLIGHTING_H__ -#define __NR_FILTER_SPECULARLIGHTING_H__ +#ifndef SEEN_NR_FILTER_SPECULARLIGHTING_H +#define SEEN_NR_FILTER_SPECULARLIGHTING_H /* * feSpecularLighting renderer @@ -13,7 +13,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gdk/gdk.h> #include "display/nr-light-types.h" #include "display/nr-filter-primitive.h" @@ -21,6 +20,7 @@ class SPFeDistantLight; class SPFePointLight; class SPFeSpotLight; struct SVGICCColor; +typedef unsigned int guint32; namespace Inkscape { namespace Filters { @@ -44,9 +44,9 @@ public: SPFeSpotLight *spot; } light; LightType light_type; - gdouble surfaceScale; - gdouble specularConstant; - gdouble specularExponent; + double surfaceScale; + double specularConstant; + double specularExponent; guint32 lighting_color; private: diff --git a/src/display/nr-filter-tile.h b/src/display/nr-filter-tile.h index dc5b99a42..29087f2d6 100644 --- a/src/display/nr-filter-tile.h +++ b/src/display/nr-filter-tile.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_TILE_H__ -#define __NR_FILTER_TILE_H__ +#ifndef SEEN_NR_FILTER_TILE_H +#define SEEN_NR_FILTER_TILE_H /* * feTile filter primitive renderer diff --git a/src/display/nr-filter-turbulence.h b/src/display/nr-filter-turbulence.h index 360853364..ee8079133 100644 --- a/src/display/nr-filter-turbulence.h +++ b/src/display/nr-filter-turbulence.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_TURBULENCE_H__ -#define __NR_FILTER_TURBULENCE_H__ +#ifndef SEEN_NR_FILTER_TURBULENCE_H +#define SEEN_NR_FILTER_TURBULENCE_H /* * feTurbulence filter primitive renderer @@ -22,6 +22,7 @@ */ #include <2geom/point.h> + #include "display/nr-filter-primitive.h" #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" diff --git a/src/display/nr-filter-types.h b/src/display/nr-filter-types.h index 502bfe348..2e35d6da8 100644 --- a/src/display/nr-filter-types.h +++ b/src/display/nr-filter-types.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_TYPES_H__ -#define __NR_FILTER_TYPES_H__ +#ifndef SEEN_NR_FILTER_TYPES_H +#define SEEN_NR_FILTER_TYPES_H namespace Inkscape { namespace Filters { diff --git a/src/display/nr-filter-units.h b/src/display/nr-filter-units.h index f918cf12e..0ee6c3707 100644 --- a/src/display/nr-filter-units.h +++ b/src/display/nr-filter-units.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_UNITS_H__ -#define __NR_FILTER_UNITS_H__ +#ifndef SEEN_NR_FILTER_UNITS_H +#define SEEN_NR_FILTER_UNITS_H /* * Utilities for handling coordinate system transformations in filters diff --git a/src/display/nr-filter-utils.h b/src/display/nr-filter-utils.h index 7e073168f..35a74d7c1 100644 --- a/src/display/nr-filter-utils.h +++ b/src/display/nr-filter-utils.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_UTILS_H__ -#define __NR_FILTER_UTILS_H__ +#ifndef SEEN_NR_FILTER_UTILS_H +#define SEEN_NR_FILTER_UTILS_H /** * @file @@ -26,7 +26,6 @@ namespace Filters { * \return 0 if the value is smaller than 0, 255 if it is greater 255, else v * \param v the value to clamp */ -__attribute__ ((const)) inline int clamp(int const val) { if (val < 0) return 0; if (val > 255) return 255; @@ -39,7 +38,6 @@ inline int clamp(int const val) { * \return 0 if the value is smaller than 0, 255^3 (16581375) if it is greater than 255^3, else v * \param v the value to clamp */ -__attribute__ ((const)) inline int clamp3(int const val) { if (val < 0) return 0; if (val > 16581375) return 16581375; @@ -59,7 +57,6 @@ inline int clamp3(int const val) { * \param val the value to clamp * \param alpha the maximum value to clamp to */ -__attribute__ ((const)) inline int clamp_alpha(int const val, int const alpha) { if (val < 0) return 0; if (val > alpha) return alpha; diff --git a/src/display/nr-filter.h b/src/display/nr-filter.h index f9dcf1d84..9a30efabd 100644 --- a/src/display/nr-filter.h +++ b/src/display/nr-filter.h @@ -1,5 +1,5 @@ -#ifndef __NR_FILTER_H__ -#define __NR_FILTER_H__ +#ifndef SEEN_NR_FILTER_H +#define SEEN_NR_FILTER_H /* * SVG filters rendering diff --git a/src/display/nr-light-types.h b/src/display/nr-light-types.h index 5c9acb324..8cc92db77 100644 --- a/src/display/nr-light-types.h +++ b/src/display/nr-light-types.h @@ -1,5 +1,5 @@ -#ifndef __NR_LIGHT_TYPES_H__ -#define __NR_LIGHT_TYPES_H__ +#ifndef SEEN_NR_LIGHT_TYPES_H +#define SEEN_NR_LIGHT_TYPES_H namespace Inkscape { namespace Filters { diff --git a/src/display/nr-light.cpp b/src/display/nr-light.cpp index 6331d1546..0e9a55a9f 100644 --- a/src/display/nr-light.cpp +++ b/src/display/nr-light.cpp @@ -51,7 +51,7 @@ PointLight::PointLight(SPFePointLight *light, guint32 lighting_color, const Geom PointLight::~PointLight() {} -void PointLight::light_vector(NR::Fvector &v, gdouble x, gdouble y, gdouble z) { +void PointLight::light_vector(NR::Fvector &v, double x, double y, double z) { v[X_3D] = l_x - x; v[Y_3D] = l_y - y; v[Z_3D] = l_z - z; @@ -65,7 +65,7 @@ void PointLight::light_components(NR::Fvector &lc) { } SpotLight::SpotLight(SPFeSpotLight *light, guint32 lighting_color, const Geom::Affine &trans) { - gdouble p_x, p_y, p_z; + double p_x, p_y, p_z; color = lighting_color; l_x = light->x; l_y = light->y; @@ -86,7 +86,7 @@ SpotLight::SpotLight(SPFeSpotLight *light, guint32 lighting_color, const Geom::A SpotLight::~SpotLight() {} -void SpotLight::light_vector(NR::Fvector &v, gdouble x, gdouble y, gdouble z) { +void SpotLight::light_vector(NR::Fvector &v, double x, double y, double z) { v[X_3D] = l_x - x; v[Y_3D] = l_y - y; v[Z_3D] = l_z - z; @@ -94,7 +94,7 @@ void SpotLight::light_vector(NR::Fvector &v, gdouble x, gdouble y, gdouble z) { } void SpotLight::light_components(NR::Fvector &lc, const NR::Fvector &L) { - gdouble spmod = (-1) * NR::scalar_product(L, S); + double spmod = (-1) * NR::scalar_product(L, S); if (spmod <= cos_lca) spmod = 0; else diff --git a/src/display/nr-light.h b/src/display/nr-light.h index 0c1235483..94b573761 100644 --- a/src/display/nr-light.h +++ b/src/display/nr-light.h @@ -1,5 +1,6 @@ -#ifndef __NR_LIGHT_H__ -#define __NR_LIGHT_H__ +#ifndef SEEN_NR_LIGHT_H +#define SEEN_NR_LIGHT_H + /** \file * These classes provide tools to compute interesting objects relative to light * sources. Each class provides a constructor converting information contained @@ -8,14 +9,15 @@ * light color components (at a given point). */ -#include <gdk/gdk.h> +#include <2geom/forward.h> + #include "display/nr-3dutils.h" #include "display/nr-light-types.h" -#include <2geom/forward.h> class SPFeDistantLight; class SPFePointLight; class SPFeSpotLight; +typedef unsigned int guint32; namespace Inkscape { namespace Filters { @@ -53,8 +55,8 @@ class DistantLight { private: guint32 color; - gdouble azimuth; //azimuth in rad - gdouble elevation; //elevation in rad + double azimuth; //azimuth in rad + double elevation; //elevation in rad }; class PointLight { @@ -80,7 +82,7 @@ class PointLight { * \param y y coordinate of the current point * \param z z coordinate of the current point */ - void light_vector(NR::Fvector &v, gdouble x, gdouble y, gdouble z); + void light_vector(NR::Fvector &v, double x, double y, double z); /** * Computes the light components of the distant light @@ -92,9 +94,9 @@ class PointLight { private: guint32 color; //light position coordinates in render setting - gdouble l_x; - gdouble l_y; - gdouble l_z; + double l_x; + double l_y; + double l_z; }; class SpotLight { @@ -121,7 +123,7 @@ class SpotLight { * \param y y coordinate of the current point * \param z z coordinate of the current point */ - void light_vector(NR::Fvector &v, gdouble x, gdouble y, gdouble z); + void light_vector(NR::Fvector &v, double x, double y, double z); /** * Computes the light components of the distant light at the current @@ -135,11 +137,11 @@ class SpotLight { private: guint32 color; //light position coordinates in render setting - gdouble l_x; - gdouble l_y; - gdouble l_z; - gdouble cos_lca; //cos of the limiting cone angle - gdouble speExp; //specular exponent; + double l_x; + double l_y; + double l_z; + double cos_lca; //cos of the limiting cone angle + double speExp; //specular exponent; NR::Fvector S; //unit vector from light position in the direction //the spot point at }; diff --git a/src/display/nr-svgfonts.h b/src/display/nr-svgfonts.h index e1bb047bb..bdd966144 100644 --- a/src/display/nr-svgfonts.h +++ b/src/display/nr-svgfonts.h @@ -1,4 +1,3 @@ -#include "config.h" #ifndef NR_SVGFONTS_H_SEEN #define NR_SVGFONTS_H_SEEN /* @@ -21,8 +20,7 @@ class SPFont; class SPGlyph; class SPMissingGlyph; -struct _GdkEventExpose; -typedef _GdkEventExpose GdkEventExpose; +extern "C" { typedef struct _GdkEventExpose GdkEventExpose; } namespace Gtk { class Widget; diff --git a/src/display/sp-canvas-item.h b/src/display/sp-canvas-item.h index a388ffa91..3b7b7bd4f 100644 --- a/src/display/sp-canvas-item.h +++ b/src/display/sp-canvas-item.h @@ -23,8 +23,9 @@ # include "config.h" #endif -#include <glib-object.h> #include <2geom/rect.h> +#include <glib-object.h> + #include "ui/control-types.h" G_BEGIN_DECLS diff --git a/src/display/sp-canvas-util.h b/src/display/sp-canvas-util.h index 07323f31a..73135ed79 100644 --- a/src/display/sp-canvas-util.h +++ b/src/display/sp-canvas-util.h @@ -1,5 +1,5 @@ -#ifndef __SP_CANVAS_UTILS_H__ -#define __SP_CANVAS_UTILS_H__ +#ifndef SEEN_SP_CANVAS_UTILS_H +#define SEEN_SP_CANVAS_UTILS_H /* * Helper stuff for SPCanvas @@ -19,7 +19,7 @@ struct SPCanvasItem; struct SPCanvasBuf; namespace Geom { - class Affine; + class Affine; } /* Miscellaneous utility & convenience functions for general canvas objects */ diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index adae30f35..48c3de2fc 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -22,15 +22,6 @@ # include "config.h" #endif -#ifdef HAVE_INTTYPES_H -# include <inttypes.h> -#else -# ifdef HAVE_STDINT_H -# include <stdint.h> -# endif -#endif - -#include <gdk/gdk.h> #include <gtk/gtk.h> #include <glibmm/ustring.h> #include <2geom/affine.h> diff --git a/src/filters/distantlight.h b/src/filters/distantlight.h index 0eebf768f..6490d987c 100644 --- a/src/filters/distantlight.h +++ b/src/filters/distantlight.h @@ -27,21 +27,21 @@ public: virtual ~SPFeDistantLight(); /** azimuth attribute */ - gfloat azimuth; - guint azimuth_set : 1; + float azimuth; + unsigned int azimuth_set : 1; /** elevation attribute */ - gfloat elevation; - guint elevation_set : 1; + float elevation; + unsigned int elevation_set : 1; protected: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); virtual void release(); - virtual void set(unsigned int key, const gchar* value); + virtual void set(unsigned int key, char const* value); virtual void update(SPCtx* ctx, unsigned int flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); }; #endif /* !SP_FEDISTANTLIGHT_H_SEEN */ diff --git a/src/filters/pointlight.h b/src/filters/pointlight.h index 3819d8ff5..1e26d45e7 100644 --- a/src/filters/pointlight.h +++ b/src/filters/pointlight.h @@ -26,24 +26,24 @@ public: virtual ~SPFePointLight(); /** x coordinate of the light source */ - gfloat x; - guint x_set : 1; + float x; + unsigned int x_set : 1; /** y coordinate of the light source */ - gfloat y; - guint y_set : 1; + float y; + unsigned int y_set : 1; /** z coordinate of the light source */ - gfloat z; - guint z_set : 1; + float z; + unsigned int z_set : 1; protected: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); virtual void release(); - virtual void set(unsigned int key, const gchar* value); + virtual void set(unsigned int key, char const* value); virtual void update(SPCtx* ctx, unsigned int flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); }; #endif /* !SP_FEPOINTLIGHT_H_SEEN */ diff --git a/src/filters/spotlight.h b/src/filters/spotlight.h index 8caf12858..7d5f6dd30 100644 --- a/src/filters/spotlight.h +++ b/src/filters/spotlight.h @@ -26,40 +26,40 @@ public: virtual ~SPFeSpotLight(); /** x coordinate of the light source */ - gfloat x; - guint x_set : 1; + float x; + unsigned int x_set : 1; /** y coordinate of the light source */ - gfloat y; - guint y_set : 1; + float y; + unsigned int y_set : 1; /** z coordinate of the light source */ - gfloat z; - guint z_set : 1; + float z; + unsigned int z_set : 1; /** x coordinate of the point the source is pointing at */ - gfloat pointsAtX; - guint pointsAtX_set : 1; + float pointsAtX; + unsigned int pointsAtX_set : 1; /** y coordinate of the point the source is pointing at */ - gfloat pointsAtY; - guint pointsAtY_set : 1; + float pointsAtY; + unsigned int pointsAtY_set : 1; /** z coordinate of the point the source is pointing at */ - gfloat pointsAtZ; - guint pointsAtZ_set : 1; + float pointsAtZ; + unsigned int pointsAtZ_set : 1; /** specular exponent (focus of the light) */ - gfloat specularExponent; - guint specularExponent_set : 1; + float specularExponent; + unsigned int specularExponent_set : 1; /** limiting cone angle */ - gfloat limitingConeAngle; - guint limitingConeAngle_set : 1; + float limitingConeAngle; + unsigned int limitingConeAngle_set : 1; //other fields protected: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); virtual void release(); - virtual void set(unsigned int key, const gchar* value); + virtual void set(unsigned int key, char const* value); virtual void update(SPCtx* ctx, unsigned int flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); }; #endif /* !SP_FESPOTLIGHT_H_SEEN */ diff --git a/src/proj_pt.cpp b/src/proj_pt.cpp index f5cca8fca..311b9a034 100644 --- a/src/proj_pt.cpp +++ b/src/proj_pt.cpp @@ -9,12 +9,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <glib.h> + #include "proj_pt.h" #include "svg/stringstream.h" namespace Proj { -Pt2::Pt2(const gchar *coord_str) { +Pt2::Pt2(const char *coord_str) { if (!coord_str) { pt[0] = 0.0; pt[1] = 0.0; @@ -22,7 +24,7 @@ Pt2::Pt2(const gchar *coord_str) { g_warning ("Coordinate string is empty. Creating default Pt2\n"); return; } - gchar **coords = g_strsplit(coord_str, ":", 0); + char **coords = g_strsplit(coord_str, ":", 0); if (coords[0] == NULL || coords[1] == NULL || coords[2] == NULL) { g_strfreev (coords); g_warning ("Malformed coordinate string.\n"); @@ -52,7 +54,7 @@ Pt2::affine() { return Geom::Point (pt[0]/pt[2], pt[1]/pt[2]); } -gchar * +char * Pt2::coord_string() { Inkscape::SVGOStringStream os; os << pt[0] << " : " @@ -61,7 +63,7 @@ Pt2::coord_string() { return g_strdup(os.str().c_str()); } -Pt3::Pt3(const gchar *coord_str) { +Pt3::Pt3(const char *coord_str) { if (!coord_str) { pt[0] = 0.0; pt[1] = 0.0; @@ -70,7 +72,7 @@ Pt3::Pt3(const gchar *coord_str) { g_warning ("Coordinate string is empty. Creating default Pt2\n"); return; } - gchar **coords = g_strsplit(coord_str, ":", 0); + char **coords = g_strsplit(coord_str, ":", 0); if (coords[0] == NULL || coords[1] == NULL || coords[2] == NULL || coords[3] == NULL) { g_strfreev (coords); @@ -94,7 +96,7 @@ Pt3::normalize() { pt[3] = 1.0; } -gchar * +char * Pt3::coord_string() { Inkscape::SVGOStringStream os; os << pt[0] << " : " diff --git a/src/svg/css-ostringstream.h b/src/svg/css-ostringstream.h index 8cedb0979..2c66dff16 100644 --- a/src/svg/css-ostringstream.h +++ b/src/svg/css-ostringstream.h @@ -1,7 +1,6 @@ #ifndef SVG_CSS_OSTRINGSTREAM_H_INKSCAPE #define SVG_CSS_OSTRINGSTREAM_H_INKSCAPE -#include <glib.h> #include <sstream> namespace Inkscape { @@ -42,8 +41,8 @@ public: #undef INK_CSS_STR_OP - gchar const *gcharp() const { - return reinterpret_cast<gchar const *>(ostr.str().c_str()); + char const *gcharp() const { + return ostr.str().c_str(); } std::string str() const { diff --git a/src/svg/path-string.h b/src/svg/path-string.h index 3a891873d..6c7e23017 100644 --- a/src/svg/path-string.h +++ b/src/svg/path-string.h @@ -15,10 +15,10 @@ #ifndef SEEN_INKSCAPE_SVG_PATH_STRING_H #define SEEN_INKSCAPE_SVG_PATH_STRING_H +#include <2geom/point.h> +#include <cstdio> #include <glibmm/ustring.h> #include <string> -#include <stdio.h> -#include <2geom/point.h> namespace Inkscape { diff --git a/src/svg/stringstream.h b/src/svg/stringstream.h index d143abee8..c9cfdd601 100644 --- a/src/svg/stringstream.h +++ b/src/svg/stringstream.h @@ -1,7 +1,6 @@ #ifndef INKSCAPE_STRINGSTREAM_H #define INKSCAPE_STRINGSTREAM_H -#include <glib.h> #include <sstream> #include <string> @@ -41,8 +40,8 @@ public: #undef INK_SVG_STR_OP - gchar const *gcharp() const { - return reinterpret_cast<gchar const *>(ostr.str().c_str()); + char const *gcharp() const { + return ostr.str().c_str(); } std::string str() const { diff --git a/src/svg/svg-color.h b/src/svg/svg-color.h index b8e317e3b..ea0896872 100644 --- a/src/svg/svg-color.h +++ b/src/svg/svg-color.h @@ -1,16 +1,15 @@ #ifndef SVG_SVG_COLOR_H_SEEN #define SVG_SVG_COLOR_H_SEEN -#include <glib.h> - +typedef unsigned int guint32; struct SVGICCColor; -guint32 sp_svg_read_color(gchar const *str, unsigned int dfl); -guint32 sp_svg_read_color(gchar const *str, gchar const **end_ptr, guint32 def); +guint32 sp_svg_read_color(char const *str, unsigned int dfl); +guint32 sp_svg_read_color(char const *str, char const **end_ptr, guint32 def); void sp_svg_write_color(char *buf, unsigned int buflen, unsigned int rgba32); -bool sp_svg_read_icc_color( gchar const *str, gchar const **end_ptr, SVGICCColor* dest ); -bool sp_svg_read_icc_color( gchar const *str, SVGICCColor* dest ); -void icc_color_to_sRGB(SVGICCColor* dest, guchar* r, guchar* g, guchar* b); +bool sp_svg_read_icc_color( char const *str, char const **end_ptr, SVGICCColor* dest ); +bool sp_svg_read_icc_color( char const *str, SVGICCColor* dest ); +void icc_color_to_sRGB(SVGICCColor* dest, unsigned char* r, unsigned char* g, unsigned char* b); #endif /* !SVG_SVG_COLOR_H_SEEN */ diff --git a/src/svg/svg.h b/src/svg/svg.h index a7795b82e..6ce9db937 100644 --- a/src/svg/svg.h +++ b/src/svg/svg.h @@ -11,7 +11,7 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> + #include <vector> #include <cstring> #include <string> @@ -28,13 +28,13 @@ * Return FALSE and let val untouched on error */ -unsigned int sp_svg_number_read_f( const gchar *str, float *val ); -unsigned int sp_svg_number_read_d( const gchar *str, double *val ); +unsigned int sp_svg_number_read_f( const char *str, float *val ); +unsigned int sp_svg_number_read_d( const char *str, double *val ); /* * No buffer overflow checking is done, so better wrap them if needed */ -unsigned int sp_svg_number_write_de( gchar *buf, int bufLen, double val, unsigned int tprec, int min_exp ); +unsigned int sp_svg_number_write_de( char *buf, int bufLen, double val, unsigned int tprec, int min_exp ); /* Length */ @@ -47,24 +47,24 @@ unsigned int sp_svg_number_write_de( gchar *buf, int bufLen, double val, unsigne * Any return value pointer can be NULL */ -unsigned int sp_svg_length_read_computed_absolute( const gchar *str, float *length ); -std::vector<SVGLength> sp_svg_length_list_read( const gchar *str ); -unsigned int sp_svg_length_read_ldd( const gchar *str, SVGLength::Unit *unit, double *value, double *computed ); +unsigned int sp_svg_length_read_computed_absolute( const char *str, float *length ); +std::vector<SVGLength> sp_svg_length_list_read( const char *str ); +unsigned int sp_svg_length_read_ldd( const char *str, SVGLength::Unit *unit, double *value, double *computed ); std::string sp_svg_length_write_with_units(SVGLength const &length); -bool sp_svg_transform_read(gchar const *str, Geom::Affine *transform); +bool sp_svg_transform_read(char const *str, Geom::Affine *transform); -gchar *sp_svg_transform_write(Geom::Affine const &transform); -gchar *sp_svg_transform_write(Geom::Affine const *transform); +char *sp_svg_transform_write(Geom::Affine const &transform); +char *sp_svg_transform_write(Geom::Affine const *transform); double sp_svg_read_percentage( const char * str, double def ); /* NB! As paths can be long, we use here dynamic string */ Geom::PathVector sp_svg_read_pathv( char const * str ); -gchar * sp_svg_write_path( Geom::PathVector const &p ); -gchar * sp_svg_write_path( Geom::Path const &p ); +char * sp_svg_write_path( Geom::PathVector const &p ); +char * sp_svg_write_path( Geom::Path const &p ); #endif // SEEN_SP_SVG_H diff --git a/src/xml/event.h b/src/xml/event.h index 55e2add88..d25ea0e07 100644 --- a/src/xml/event.h +++ b/src/xml/event.h @@ -18,7 +18,7 @@ #ifndef SEEN_INKSCAPE_XML_SP_REPR_ACTION_H #define SEEN_INKSCAPE_XML_SP_REPR_ACTION_H -#include <glib.h> +typedef unsigned int GQuark; #include <glibmm/ustring.h> #include <iterator> diff --git a/src/xml/helper-observer.h b/src/xml/helper-observer.h index 2f70ba792..c076b3e2c 100644 --- a/src/xml/helper-observer.h +++ b/src/xml/helper-observer.h @@ -1,12 +1,12 @@ -#ifndef __XML_HELPER_OBSERVER__ -#define __XML_HELPER_OBSERVER__ +#ifndef SEEN_XML_HELPER_OBSERVER +#define SEEN_XML_HELPER_OBSERVER + +#include <cstddef> +#include <sigc++/sigc++.h> #include "node-observer.h" #include "node.h" -#include "../sp-object.h" -//#include "../sp-object-repr.h" -#include <stddef.h> -#include <sigc++/sigc++.h> +#include "sp-object.h" namespace Inkscape { namespace XML { diff --git a/src/xml/node-event-vector.h b/src/xml/node-event-vector.h index e6396877d..416640b86 100644 --- a/src/xml/node-event-vector.h +++ b/src/xml/node-event-vector.h @@ -14,26 +14,11 @@ #ifndef SEEN_INKSCAPE_XML_SP_REPR_EVENT_VECTOR #define SEEN_INKSCAPE_XML_SP_REPR_EVENT_VECTOR -#include <glib.h> - #include "xml/node.h" namespace Inkscape { namespace XML { - -/** - * @brief Structure holding callbacks for node state changes - * @deprecated Derive an observer object from the NodeObserver class instead - */ -struct NodeEventVector { - /* Immediate signals */ - void (* child_added) (Node *repr, Node *child, Node *ref, void * data); - void (* child_removed) (Node *repr, Node *child, Node *ref, void * data); - void (* attr_changed) (Node *repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data); - void (* content_changed) (Node *repr, const gchar *oldcontent, const gchar *newcontent, void * data); - void (* order_changed) (Node *repr, Node *child, Node *oldref, Node *newref, void * data); -}; - +struct NodeEventVector; } } @@ -41,22 +26,45 @@ struct NodeEventVector { * @brief Generate events corresponding to the node's state * @deprecated Use Node::synthesizeEvents(NodeObserver &) instead */ -inline void sp_repr_synthesize_events (Inkscape::XML::Node *repr, const Inkscape::XML::NodeEventVector *vector, void * data) { +inline void sp_repr_synthesize_events (Inkscape::XML::Node *repr, const Inkscape::XML::NodeEventVector *vector, void* data) { repr->synthesizeEvents(vector, data); } /** * @brief Add a set of callbacks for node state changes and its associated data * @deprecated Use Node::addObserver() instead */ -inline void sp_repr_add_listener (Inkscape::XML::Node *repr, const Inkscape::XML::NodeEventVector *vector, void * data) { +inline void sp_repr_add_listener (Inkscape::XML::Node *repr, const Inkscape::XML::NodeEventVector *vector, void* data) { repr->addListener(vector, data); } /** * @brief Remove a set of callbacks based on associated data * @deprecated Use Node::removeObserver() instead */ -inline void sp_repr_remove_listener_by_data (Inkscape::XML::Node *repr, void * data) { +inline void sp_repr_remove_listener_by_data (Inkscape::XML::Node *repr, void* data) { repr->removeListenerByData(data); } +namespace Inkscape { +namespace XML { + +/** + * @brief Structure holding callbacks for node state changes + * @deprecated Derive an observer object from the NodeObserver class instead + */ +struct NodeEventVector { + /* Immediate signals */ + void (* child_added) (Node *repr, Node *child, Node *ref, void* data); + void (* child_removed) (Node *repr, Node *child, Node *ref, void* data); + void (* attr_changed) (Node *repr, char const *key, char const *oldval, char const *newval, bool is_interactive, void* data); + void (* content_changed) (Node *repr, char const *oldcontent, char const *newcontent, void * data); + void (* order_changed) (Node *repr, Node *child, Node *oldref, Node *newref, void* data); +} +#ifdef __GNUC__ +__attribute__((deprecated)) +#endif +; + +} +} + #endif diff --git a/src/xml/node-observer.h b/src/xml/node-observer.h index d0c85d1dd..9c7e096e5 100644 --- a/src/xml/node-observer.h +++ b/src/xml/node-observer.h @@ -18,8 +18,8 @@ #ifndef SEEN_INKSCAPE_XML_NODE_OBSERVER_H #define SEEN_INKSCAPE_XML_NODE_OBSERVER_H -#include <glib.h> #include "util/share.h" +typedef unsigned int GQuark; #ifndef INK_UNUSED #define INK_UNUSED(x) ((void)(x)) @@ -56,7 +56,9 @@ protected: NodeObserver() {} public: virtual ~NodeObserver() {} - + + // FIXME: somebody needs to learn what "pure virtual" means + /** * @brief Child addition callback * diff --git a/src/xml/node.h b/src/xml/node.h index c1977b0a8..8bb70acc0 100644 --- a/src/xml/node.h +++ b/src/xml/node.h @@ -18,7 +18,6 @@ #ifndef SEEN_INKSCAPE_XML_NODE_H #define SEEN_INKSCAPE_XML_NODE_H -#include <glibmm/value.h> #include <glibmm/ustring.h> #include "gc-anchored.h" #include "util/list.h" @@ -100,7 +99,7 @@ public: * * @return Name for element nodes, NULL for others */ - virtual gchar const *name() const=0; + virtual char const *name() const=0; /** * @brief Get the integer code corresponding to the node's name * @return GQuark code corresponding to the name @@ -131,7 +130,7 @@ public: * * @return The node's content */ - virtual gchar const *content() const=0; + virtual char const *content() const=0; /** * @brief Get the string representation of a node's attribute @@ -144,7 +143,7 @@ public: * * @param key The name of the node's attribute */ - virtual gchar const *attribute(gchar const *key) const=0; + virtual char const *attribute(char const *key) const=0; /** * @brief Get a list of the node's attributes @@ -168,7 +167,7 @@ public: * @param partial_name The string to match against all attributes * @return true if there is such an attribute, false otherwise */ - virtual bool matchAttributeName(gchar const *partial_name) const=0; + virtual bool matchAttributeName(char const *partial_name) const=0; /*@}*/ @@ -193,7 +192,7 @@ public: * * @param value The node's new content */ - virtual void setContent(gchar const *value)=0; + virtual void setContent(char const *value)=0; //@{ /** @@ -205,7 +204,7 @@ public: * @param value The new value of the attribute * @param is_interactive Ignored */ - virtual void setAttribute(gchar const *key, gchar const *value, bool is_interactive=false)=0; + virtual void setAttribute(char const *key, char const *value, bool is_interactive=false)=0; void setAttribute(char const *key, Glib::ustring const &value, bool is_interactive=false) { @@ -399,7 +398,7 @@ public: * @param src The node to merge into this node * @param key The attribute to use as the identity attribute */ - virtual void mergeFrom(Node const *src, gchar const *key)=0; + virtual void mergeFrom(Node const *src, char const *key)=0; /*@}*/ diff --git a/src/xml/pi-node.h b/src/xml/pi-node.h index 1f892f97a..76a3dc741 100644 --- a/src/xml/pi-node.h +++ b/src/xml/pi-node.h @@ -14,7 +14,6 @@ #ifndef SEEN_INKSCAPE_XML_PI_NODE_H #define SEEN_INKSCAPE_XML_PI_NODE_H -#include <glib.h> #include "xml/simple-node.h" namespace Inkscape { diff --git a/src/xml/quote.h b/src/xml/quote.h index 8e3bca0eb..393bdf46e 100644 --- a/src/xml/quote.h +++ b/src/xml/quote.h @@ -1,7 +1,7 @@ #ifndef SEEN_XML_QUOTE_H #define SEEN_XML_QUOTE_H -#include <stddef.h> +#include <cstddef> size_t xml_quoted_strlen(char const *val); char *xml_quote_strdup(char const *src); diff --git a/src/xml/rebase-hrefs.h b/src/xml/rebase-hrefs.h index 5baf96516..34afe6076 100644 --- a/src/xml/rebase-hrefs.h +++ b/src/xml/rebase-hrefs.h @@ -1,7 +1,6 @@ #ifndef REBASE_HREFS_H_SEEN #define REBASE_HREFS_H_SEEN -#include <glib.h> #include "util/list.h" #include "xml/attribute-record.h" class SPDocument; @@ -9,7 +8,7 @@ class SPDocument; namespace Inkscape { namespace XML { -std::string calc_abs_doc_base(gchar const *doc_base); +std::string calc_abs_doc_base(char const *doc_base); /** * Change relative hrefs in doc to be relative to \a new_base instead of doc.base. @@ -18,7 +17,7 @@ std::string calc_abs_doc_base(gchar const *doc_base); * * @param spns True if doc should contain sodipodi:absref attributes. */ -void rebase_hrefs(SPDocument *doc, gchar const *new_base, bool spns); +void rebase_hrefs(SPDocument *doc, char const *new_base, bool spns); /** * Change relative xlink:href attributes to be relative to \a new_abs_base instead of old_abs_base. @@ -26,8 +25,8 @@ void rebase_hrefs(SPDocument *doc, gchar const *new_base, bool spns); * Note that old_abs_base and new_abs_base must each be non-NULL, absolute directory paths. */ Inkscape::Util::List<AttributeRecord const> rebase_href_attrs( - gchar const *old_abs_base, - gchar const *new_abs_base, + char const *old_abs_base, + char const *new_abs_base, Inkscape::Util::List<AttributeRecord const> attributes); diff --git a/src/xml/repr.h b/src/xml/repr.h index e691eaa7f..e1d7fdfd6 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -14,7 +14,6 @@ #ifndef SEEN_SP_REPR_H #define SEEN_SP_REPR_H -#include <glib.h> #include <glibmm/quark.h> #include "xml/node.h" @@ -43,55 +42,55 @@ class Point; } /* SPXMLNs */ -char const *sp_xml_ns_uri_prefix(gchar const *uri, gchar const *suggested); -char const *sp_xml_ns_prefix_uri(gchar const *prefix); +char const *sp_xml_ns_uri_prefix(char const *uri, char const *suggested); +char const *sp_xml_ns_prefix_uri(char const *prefix); -Inkscape::XML::Document *sp_repr_document_new(gchar const *rootname); +Inkscape::XML::Document *sp_repr_document_new(char const *rootname); /* IO */ -Inkscape::XML::Document *sp_repr_read_file(gchar const *filename, gchar const *default_ns); -Inkscape::XML::Document *sp_repr_read_mem(gchar const *buffer, int length, gchar const *default_ns); +Inkscape::XML::Document *sp_repr_read_file(char const *filename, char const *default_ns); +Inkscape::XML::Document *sp_repr_read_mem(char const *buffer, int length, char const *default_ns); void sp_repr_write_stream(Inkscape::XML::Node *repr, Inkscape::IO::Writer &out, - gint indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix, + int indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix, int inlineattrs, int indent, - gchar const *old_href_base = NULL, - gchar const *new_href_base = NULL); -Inkscape::XML::Document *sp_repr_read_buf (const Glib::ustring &buf, const gchar *default_ns); + char const *old_href_base = NULL, + char const *new_href_base = NULL); +Inkscape::XML::Document *sp_repr_read_buf (const Glib::ustring &buf, const char *default_ns); Glib::ustring sp_repr_save_buf(Inkscape::XML::Document *doc); // TODO convert to std::string void sp_repr_save_stream(Inkscape::XML::Document *doc, FILE *to_file, - gchar const *default_ns = NULL, bool compress = false, - gchar const *old_href_base = NULL, - gchar const *new_href_base = NULL); + char const *default_ns = NULL, bool compress = false, + char const *old_href_base = NULL, + char const *new_href_base = NULL); -bool sp_repr_save_file(Inkscape::XML::Document *doc, gchar const *filename, gchar const *default_ns=NULL); -bool sp_repr_save_rebased_file(Inkscape::XML::Document *doc, gchar const *filename_utf8, - gchar const *default_ns, - gchar const *old_base, gchar const *new_base_filename); +bool sp_repr_save_file(Inkscape::XML::Document *doc, char const *filename, char const *default_ns=NULL); +bool sp_repr_save_rebased_file(Inkscape::XML::Document *doc, char const *filename_utf8, + char const *default_ns, + char const *old_base, char const *new_base_filename); /* CSS stuff */ SPCSSAttr *sp_repr_css_attr_new(void); void sp_repr_css_attr_unref(SPCSSAttr *css); -SPCSSAttr *sp_repr_css_attr(Inkscape::XML::Node *repr, gchar const *attr); +SPCSSAttr *sp_repr_css_attr(Inkscape::XML::Node *repr, char const *attr); SPCSSAttr *sp_repr_css_attr_parse_color_to_fill(const Glib::ustring &text); -SPCSSAttr *sp_repr_css_attr_inherited(Inkscape::XML::Node *repr, gchar const *attr); +SPCSSAttr *sp_repr_css_attr_inherited(Inkscape::XML::Node *repr, char const *attr); -gchar const *sp_repr_css_property(SPCSSAttr *css, gchar const *name, gchar const *defval); -void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value); -void sp_repr_css_unset_property(SPCSSAttr *css, gchar const *name); -bool sp_repr_css_property_is_unset(SPCSSAttr *css, gchar const *name); -double sp_repr_css_double_property(SPCSSAttr *css, gchar const *name, double defval); +char const *sp_repr_css_property(SPCSSAttr *css, char const *name, char const *defval); +void sp_repr_css_set_property(SPCSSAttr *css, char const *name, char const *value); +void sp_repr_css_unset_property(SPCSSAttr *css, char const *name); +bool sp_repr_css_property_is_unset(SPCSSAttr *css, char const *name); +double sp_repr_css_double_property(SPCSSAttr *css, char const *name, double defval); void sp_repr_css_write_string(SPCSSAttr *css, Glib::ustring &str); -void sp_repr_css_set(Inkscape::XML::Node *repr, SPCSSAttr *css, gchar const *key); +void sp_repr_css_set(Inkscape::XML::Node *repr, SPCSSAttr *css, char const *key); void sp_repr_css_merge(SPCSSAttr *dst, SPCSSAttr *src); -void sp_repr_css_attr_add_from_string(SPCSSAttr *css, const gchar *data); -void sp_repr_css_change(Inkscape::XML::Node *repr, SPCSSAttr *css, gchar const *key); -void sp_repr_css_change_recursive(Inkscape::XML::Node *repr, SPCSSAttr *css, gchar const *key); +void sp_repr_css_attr_add_from_string(SPCSSAttr *css, const char *data); +void sp_repr_css_change(Inkscape::XML::Node *repr, SPCSSAttr *css, char const *key); +void sp_repr_css_change_recursive(Inkscape::XML::Node *repr, SPCSSAttr *css, char const *key); void sp_repr_css_print(SPCSSAttr *css); @@ -109,15 +108,15 @@ inline void sp_repr_unparent(Inkscape::XML::Node *repr) { bool sp_repr_is_meta_element(const Inkscape::XML::Node *node); /* Convenience */ -unsigned sp_repr_get_boolean(Inkscape::XML::Node *repr, gchar const *key, unsigned *val); -unsigned sp_repr_get_int(Inkscape::XML::Node *repr, gchar const *key, int *val); -unsigned sp_repr_get_double(Inkscape::XML::Node *repr, gchar const *key, double *val); -unsigned sp_repr_set_boolean(Inkscape::XML::Node *repr, gchar const *key, unsigned val); -unsigned sp_repr_set_int(Inkscape::XML::Node *repr, gchar const *key, int val); -unsigned sp_repr_set_css_double(Inkscape::XML::Node *repr, gchar const *key, double val); -unsigned sp_repr_set_svg_double(Inkscape::XML::Node *repr, gchar const *key, double val); -unsigned sp_repr_set_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point const & val); -unsigned sp_repr_get_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point *val); +unsigned sp_repr_get_boolean(Inkscape::XML::Node *repr, char const *key, unsigned *val); +unsigned sp_repr_get_int(Inkscape::XML::Node *repr, char const *key, int *val); +unsigned sp_repr_get_double(Inkscape::XML::Node *repr, char const *key, double *val); +unsigned sp_repr_set_boolean(Inkscape::XML::Node *repr, char const *key, unsigned val); +unsigned sp_repr_set_int(Inkscape::XML::Node *repr, char const *key, int val); +unsigned sp_repr_set_css_double(Inkscape::XML::Node *repr, char const *key, double val); +unsigned sp_repr_set_svg_double(Inkscape::XML::Node *repr, char const *key, double val); +unsigned sp_repr_set_point(Inkscape::XML::Node *repr, char const *key, Geom::Point const & val); +unsigned sp_repr_get_point(Inkscape::XML::Node *repr, char const *key, Geom::Point *val); int sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second); @@ -135,16 +134,16 @@ int sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::No * @relatesalso Inkscape::XML::Node */ Inkscape::XML::Node *sp_repr_lookup_name(Inkscape::XML::Node *repr, - gchar const *name, - gint maxdepth = -1); + char const *name, + int maxdepth = -1); Inkscape::XML::Node const *sp_repr_lookup_name(Inkscape::XML::Node const *repr, - gchar const *name, - gint maxdepth = -1); + char const *name, + int maxdepth = -1); Inkscape::XML::Node *sp_repr_lookup_child(Inkscape::XML::Node *repr, - gchar const *key, - gchar const *value); + char const *key, + char const *value); inline Inkscape::XML::Node *sp_repr_document_first_child(Inkscape::XML::Document const *doc) { diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h index 7c5eb8fbd..1fcb9193b 100644 --- a/src/xml/simple-node.h +++ b/src/xml/simple-node.h @@ -18,7 +18,7 @@ #ifndef SEEN_INKSCAPE_XML_SIMPLE_NODE_H #define SEEN_INKSCAPE_XML_SIMPLE_NODE_H -#include <glib.h> // g_assert() +#include <cassert> #include "xml/node.h" #include "xml/attribute-record.h" @@ -38,7 +38,7 @@ class SimpleNode : virtual public Node, public Inkscape::GC::Managed<> { public: - gchar const *name() const; + char const *name() const; int code() const { return _name; } void setCodeUnsafe(int code) { _name = code; @@ -83,14 +83,14 @@ public: unsigned position() const; void setPosition(int pos); - gchar const *attribute(gchar const *key) const; - void setAttribute(gchar const *key, gchar const *value, bool is_interactive=false); - bool matchAttributeName(gchar const *partial_name) const; + char const *attribute(char const *key) const; + void setAttribute(char const *key, char const *value, bool is_interactive=false); + bool matchAttributeName(char const *partial_name) const; - gchar const *content() const; - void setContent(gchar const *value); + char const *content() const; + void setContent(char const *value); - void mergeFrom(Node const *src, gchar const *key); + void mergeFrom(Node const *src, char const *key); Inkscape::Util::List<AttributeRecord const> attributeList() const { return _attributes; @@ -100,7 +100,7 @@ public: void synthesizeEvents(NodeObserver &observer); void addListener(NodeEventVector const *vector, void *data) { - g_assert(vector != NULL); + assert(vector != NULL); _observers.addListener(*vector, data); } void addObserver(NodeObserver &observer) { |
