diff options
Diffstat (limited to 'src')
410 files changed, 3381 insertions, 3844 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ab697d126..34f06ed99 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -351,7 +351,6 @@ set(inkscape_SRC inkscape.h interface.h isinf.h - isnormal.h knot-enums.h knot-holder-entity.h knot.h diff --git a/src/Makefile_insert b/src/Makefile_insert index 5d234ea6b..86ae970d1 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -74,7 +74,6 @@ ink_common_sources += \ inkscape.cpp inkscape.h inkscape-private.h \ interface.cpp interface.h \ isinf.h \ - isnormal.h \ knot.cpp knot.h \ knot-enums.h \ knotholder.cpp knotholder.h \ diff --git a/src/attribute-rel-util.h b/src/attribute-rel-util.h index 3a6661965..604987779 100644 --- a/src/attribute-rel-util.h +++ b/src/attribute-rel-util.h @@ -8,7 +8,7 @@ * Author: tavmjong */ -#include "glibmm/ustring.h" +#include <glibmm/ustring.h> #include "xml/sp-css-attr.h" using Inkscape::XML::Node; diff --git a/src/attributes.cpp b/src/attributes.cpp index 3e446628d..87bfdbe88 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -1,9 +1,4 @@ -#define __SP_ATTRIBUTES_C__ - -/** \file - * Lookup dictionary for attributes/properties. - */ -/* +/** * Author: * Lauris Kaplinski <lauris@kaplinski.com> * @@ -25,6 +20,10 @@ typedef struct { gchar const *name; } SPStyleProp; +/** + * Lookup dictionary for attributes/properties. + */ + static SPStyleProp const props[] = { {SP_ATTR_INVALID, NULL}, /* SPObject */ @@ -541,4 +540,4 @@ sp_attribute_name(unsigned int id) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/axis-manip.cpp b/src/axis-manip.cpp index 1dfa0e6bf..8955202c8 100644 --- a/src/axis-manip.cpp +++ b/src/axis-manip.cpp @@ -1,6 +1,4 @@ -#define __AXIS_MANIP_C__ - -/* +/** * Generic auxiliary routines for 3D axes * * Authors: @@ -11,6 +9,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <glib.h> #include "axis-manip.h" namespace Proj { @@ -33,6 +32,14 @@ get_remaining_axes (Axis axis) { return std::make_pair (extract_first_axis_direction (plane), extract_second_axis_direction (plane)); } +char * string_from_axes (Box3D::Axis axis) { + GString *pstring = g_string_new(""); + if (axis & Box3D::X) g_string_append_printf (pstring, "X"); + if (axis & Box3D::Y) g_string_append_printf (pstring, "Y"); + if (axis & Box3D::Z) g_string_append_printf (pstring, "Z"); + return pstring->str; +} + } // namespace Box3D /* @@ -44,4 +51,4 @@ get_remaining_axes (Axis axis) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/axis-manip.h b/src/axis-manip.h index 9392e2ddd..619b9089c 100644 --- a/src/axis-manip.h +++ b/src/axis-manip.h @@ -12,8 +12,9 @@ #ifndef SEEN_AXIS_MANIP_H #define SEEN_AXIS_MANIP_H +#include <cassert> +#include <string> #include <utility> -#include <gtk/gtk.h> namespace Proj { @@ -34,7 +35,7 @@ enum Axis { extern Axis axes[4]; -inline gchar const * +inline char const* string_from_axis(Proj::Axis axis) { switch (axis) { case X: return "X"; break; @@ -88,7 +89,7 @@ inline int axis_to_int(Box3D::Axis axis) { return -1; break; default: - g_assert_not_reached(); + assert(false); } } @@ -103,7 +104,7 @@ inline Proj::Axis toProj(Box3D::Axis axis) { case Box3D::NONE: return Proj::NONE; default: - g_assert_not_reached(); + assert(false); } } @@ -126,7 +127,7 @@ inline Box3D::Axis toAffine(Proj::Axis axis) { case Proj::NONE: return Box3D::NONE; default: - g_assert_not_reached(); + assert(false); } } @@ -144,7 +145,7 @@ namespace Box3D { // (which is normally used to index an array). Return -1 if the bit sequence // does not specify a face. A face can either be given by its plane (e.g, XY) // or by the axis that is orthogonal to it (e.g., Z). -inline gint face_to_int (guint face_id) { +inline int face_to_int (unsigned int face_id) { switch (face_id) { case 1: return 0; case 2: return 1; @@ -164,7 +165,7 @@ inline gint face_to_int (guint face_id) { } } -inline gint int_to_face (guint id) { +inline int int_to_face (unsigned id) { switch (id) { case 0: return Box3D::YZ ^ Box3D::FRONT; case 1: return Box3D::XZ ^ Box3D::FRONT; @@ -176,7 +177,7 @@ inline gint int_to_face (guint id) { return Box3D::NONE; // should not be reached } -inline bool is_face_id (guint face_id) { +inline bool is_face_id (unsigned int face_id) { return !((face_id & 0x7) == 0x7); } @@ -186,8 +187,8 @@ inline gint opposite_face (guint face_id) { } **/ -inline guint number_of_axis_directions (Box3D::Axis axis) { - guint num = 0; +inline unsigned int number_of_axis_directions (Box3D::Axis axis) { + unsigned int num = 0; if (axis & Box3D::X) num++; if (axis & Box3D::Y) num++; if (axis & Box3D::Z) num++; @@ -238,14 +239,7 @@ inline Box3D::Axis get_perpendicular_axis_direction (Box3D::Axis dirs) { return Box3D::NONE; } -inline gchar * string_from_axes (Box3D::Axis axis) { - GString *pstring = g_string_new(""); - if (axis & Box3D::X) g_string_append_printf (pstring, "X"); - if (axis & Box3D::Y) g_string_append_printf (pstring, "Y"); - if (axis & Box3D::Z) g_string_append_printf (pstring, "Z"); - return pstring->str; -} - +char * string_from_axes (Box3D::Axis axis); std::pair <Axis, Axis> get_remaining_axes (Axis axis); } // namespace Box3D diff --git a/src/box3d-side.h b/src/box3d-side.h index 04bd196c2..89b3b0399 100644 --- a/src/box3d-side.h +++ b/src/box3d-side.h @@ -36,16 +36,16 @@ public: static Box3DSide * createBox3DSide(SPBox3D *box); virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void set(unsigned int key, gchar const* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); - virtual void update(SPCtx *ctx, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); + virtual void update(SPCtx *ctx, unsigned int flags); virtual void set_shape(); }; void box3d_side_position_set (Box3DSide *side); // FIXME: Replace this by box3d_side_set_shape?? -gchar *box3d_side_axes_string(Box3DSide *side); +char *box3d_side_axes_string(Box3DSide *side); Persp3D *box3d_side_perspective(Box3DSide *side); diff --git a/src/box3d.h b/src/box3d.h index 4107d2452..60b966187 100644 --- a/src/box3d.h +++ b/src/box3d.h @@ -32,9 +32,9 @@ public: SPBox3D(); virtual ~SPBox3D(); - gint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom) + int z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom) - gchar *persp_href; + char *persp_href; Persp3DReference *persp_ref; Proj::Pt3 orig_corner0; @@ -45,7 +45,7 @@ public: Box3D::Axis swapped; // to indicate which coordinates are swapped during dragging - gint my_counter; // for debugging only + int my_counter; // for debugging only /** * Create a SPBox3D and append it to the parent. @@ -54,24 +54,24 @@ public: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void set(unsigned int key, gchar const* value); - virtual void update(SPCtx *ctx, guint flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + 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 *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual const char* display_name(); virtual Geom::Affine set_transform(Geom::Affine const &transform); virtual void convert_to_guides() const; virtual const char* displayName() const; - virtual gchar *description() const; + virtual char *description() const; }; void box3d_position_set (SPBox3D *box); -Proj::Pt3 box3d_get_proj_corner (SPBox3D const *box, guint id); -Geom::Point box3d_get_corner_screen (SPBox3D const *box, guint id, bool item_coords = true); +Proj::Pt3 box3d_get_proj_corner (SPBox3D const *box, unsigned int id); +Geom::Point box3d_get_corner_screen (SPBox3D const *box, unsigned int id, bool item_coords = true); Proj::Pt3 box3d_get_proj_center (SPBox3D *box); Geom::Point box3d_get_center_screen (SPBox3D *box); -void box3d_set_corner (SPBox3D *box, guint id, Geom::Point const &new_pos, Box3D::Axis movement, bool constrained); +void box3d_set_corner (SPBox3D *box, unsigned int id, Geom::Point const &new_pos, Box3D::Axis movement, bool constrained); void box3d_set_center (SPBox3D *box, Geom::Point const &new_pos, Geom::Point const &old_pos, Box3D::Axis movement, bool constrained); void box3d_corners_for_PLs (const SPBox3D * box, Proj::Axis axis, Geom::Point &corner1, Geom::Point &corner2, Geom::Point &corner3, Geom::Point &corner4); bool box3d_recompute_z_orders (SPBox3D *box); diff --git a/src/cms-color-types.h b/src/cms-color-types.h index 47157c243..b94c96029 100644 --- a/src/cms-color-types.h +++ b/src/cms-color-types.h @@ -10,15 +10,14 @@ # include "config.h" #endif // HAVE_CONFIG_H -#include <glib.h> - #if HAVE_LIBLCMS1 # include <icc34.h> #endif #if HAVE_STDINT_H -# include <stdint.h> +# include <stdint.h> // uint8_t, etc #endif +typedef unsigned int guint32; typedef void * cmsHPROFILE; typedef void * cmsHTRANSFORM; diff --git a/src/cms-system.h b/src/cms-system.h index c528deb94..73d1a89c4 100644 --- a/src/cms-system.h +++ b/src/cms-system.h @@ -5,8 +5,6 @@ * Macros and fn declarations related to linear gradients. */ -#include <glib-object.h> -#include <glib.h> #include <vector> #include <glibmm/ustring.h> #include "cms-color-types.h" @@ -19,13 +17,13 @@ class ColorProfile; class CMSSystem { public: - static cmsHPROFILE getHandle( SPDocument* document, guint* intent, gchar const* name ); + static cmsHPROFILE getHandle( SPDocument* document, unsigned int* intent, char const* name ); static cmsHTRANSFORM getDisplayTransform(); static Glib::ustring getDisplayId( int screen, int monitor ); - static Glib::ustring setDisplayPer( gpointer buf, guint bufLen, int screen, int monitor ); + static Glib::ustring setDisplayPer( void* buf, unsigned int bufLen, int screen, int monitor ); static cmsHTRANSFORM getDisplayPer( Glib::ustring const& id ); @@ -39,7 +37,7 @@ public: static bool isPrintColorSpace(ColorProfile const *profile); - static gint getChannelCount(ColorProfile const *profile); + static int getChannelCount(ColorProfile const *profile); }; diff --git a/src/color-profile.h b/src/color-profile.h index 2da757b91..cb6b25945 100644 --- a/src/color-profile.h +++ b/src/color-profile.h @@ -2,7 +2,6 @@ #define SEEN_COLOR_PROFILE_H #include <vector> -#include <glib.h> #include <sp-object.h> #include <glibmm/ustring.h> #include "cms-color-types.h" @@ -31,7 +30,7 @@ public: ColorProfile(); virtual ~ColorProfile(); - friend cmsHPROFILE colorprofile_get_handle( SPDocument*, guint*, gchar const* ); + friend cmsHPROFILE colorprofile_get_handle( SPDocument*, unsigned int*, char const* ); friend class CMSSystem; static std::vector<Glib::ustring> getBaseProfileDirs(); @@ -49,21 +48,21 @@ public: #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gchar* href; - gchar* local; - gchar* name; - gchar* intentStr; - guint rendering_intent; + char* href; + char* local; + char* name; + char* intentStr; + unsigned int rendering_intent; // FIXME: type the enum and hold that instead protected: ColorProfileImpl *impl; - virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void release(); + 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 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); }; } // namespace Inkscape diff --git a/src/color-rgba.h b/src/color-rgba.h index ef7d9aee1..55cf68877 100644 --- a/src/color-rgba.h +++ b/src/color-rgba.h @@ -9,8 +9,9 @@ #ifndef SEEN_COLOR_RGBA_H #define SEEN_COLOR_RGBA_H -#include <glib.h> // g_assert() +#include <cassert> #include "decimal-round.h" +typedef unsigned int guint32; /** * A class to contain a floating point RGBA color as one unit. @@ -96,7 +97,7 @@ public: * @return The requested value. */ float operator[](unsigned int const i) const { - g_assert( unsigned(i) < 4 ); + assert( unsigned(i) < 4 ); return _c[i]; } diff --git a/src/color.cpp b/src/color.cpp index dccd603b0..da4406748 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -160,7 +160,7 @@ void SPColor::set( guint32 value ) * Convert SPColor with integer alpha value to 32bit RGBA value. * \pre alpha < 256 */ -guint32 SPColor::toRGBA32( gint alpha ) const +guint32 SPColor::toRGBA32( int alpha ) const { g_return_val_if_fail (alpha <= 0xff, 0x0); @@ -175,12 +175,12 @@ guint32 SPColor::toRGBA32( gint alpha ) const * Convert SPColor with float alpha value to 32bit RGBA value. * \pre color != NULL && 0 <= alpha <= 1 */ -guint32 SPColor::toRGBA32( gdouble 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 toRGBA32( static_cast<gint>(SP_COLOR_F_TO_U(alpha)) ); + return toRGBA32( static_cast<int>(SP_COLOR_F_TO_U(alpha)) ); } std::string SPColor::toString() const @@ -284,7 +284,7 @@ sp_color_rgb_to_hsv_floatv (float *hsv, float r, float g, float b) void sp_color_hsv_to_rgb_floatv (float *rgb, float h, float s, float v) { - gdouble f, w, q, t, d; + double f, w, q, t, d; d = h * 5.99999999; f = d - floor (d); diff --git a/src/color.h b/src/color.h index 604dff0e3..887daf66b 100644 --- a/src/color.h +++ b/src/color.h @@ -13,8 +13,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gdk/gdk.h> #include <string> +typedef unsigned int guint32; // uint is guaranteed to hold up to 2^32 − 1 /* Useful composition macros */ @@ -52,8 +52,8 @@ struct SPColor { void set( float r, float g, float b ); void set( guint32 value ); - guint32 toRGBA32( gint alpha ) const; - guint32 toRGBA32( gdouble alpha ) const; + guint32 toRGBA32( int alpha ) const; + guint32 toRGBA32( double alpha ) const; std::string toString() const; diff --git a/src/conn-avoid-ref.h b/src/conn-avoid-ref.h index ce364abf1..e9e12118f 100644 --- a/src/conn-avoid-ref.h +++ b/src/conn-avoid-ref.h @@ -14,13 +14,13 @@ */ #include <2geom/point.h> -#include <glib.h> #include <stddef.h> #include <sigc++/connection.h> class SPDesktop; class SPObject; class SPItem; +typedef struct _GSList GSList; namespace Avoid { class ShapeRef; } class SPAvoidRef { diff --git a/src/context-fns.cpp b/src/context-fns.cpp index 1e30e51de..e1df53d98 100644 --- a/src/context-fns.cpp +++ b/src/context-fns.cpp @@ -1,17 +1,14 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <glibmm/i18n.h> -#include "sp-item.h" + +#include "context-fns.h" #include "desktop.h" +#include "display/snap-indicator.h" #include "message-context.h" #include "message-stack.h" -#include "context-fns.h" #include "snap.h" -#include "ui/tools/tool-base.h" +#include "sp-item.h" #include "sp-namedview.h" -#include "display/snap-indicator.h" +#include "ui/tools/tool-base.h" static const double midpt_1_goldenratio = (1 + goldenratio) / 2; static const double midpt_goldenratio_2 = (goldenratio + 2) / 2; diff --git a/src/context-fns.h b/src/context-fns.h index bd48e5fb8..82554a6c9 100644 --- a/src/context-fns.h +++ b/src/context-fns.h @@ -2,7 +2,6 @@ #define SEEN_CONTEXT_FNS_H /* - * <description> * * Authors: * @@ -11,11 +10,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gdk/gdk.h> #include <2geom/forward.h> -class SPDesktop; -class SPItem; +class SPDesktop; +class SPItem; +typedef union _GdkEvent GdkEvent; + +const double goldenratio = 1.61803398874989484820; // golden ratio namespace Inkscape { namespace UI { @@ -25,12 +26,6 @@ class ToolBase; } } -} - -const double goldenratio = 1.61803398874989484820; // golden ratio - -namespace Inkscape -{ class MessageContext; class MessageStack; diff --git a/src/debug/log-display-config.cpp b/src/debug/log-display-config.cpp index 07380b3ad..ecc05b7b7 100644 --- a/src/debug/log-display-config.cpp +++ b/src/debug/log-display-config.cpp @@ -10,6 +10,7 @@ */ #include <iostream> +#include <gtk/gtk.h> #include <gdk/gdk.h> #include "debug/event-tracker.h" #include "debug/logger.h" @@ -58,11 +59,16 @@ public: Display() : ConfigurationEvent("display") {} void generateChildEvents() const { GdkDisplay *display=gdk_display_get_default(); +#if GTK_CHECK_VERSION(3,10,0) + GdkScreen *screen = gdk_display_get_screen(display, 0); + Logger::write<Screen>(screen); +#else gint n_screens = gdk_display_get_n_screens(display); for ( gint i = 0 ; i < n_screens ; i++ ) { GdkScreen *screen = gdk_display_get_screen(display, i); Logger::write<Screen>(screen); } +#endif } }; diff --git a/src/desktop-events.h b/src/desktop-events.h index 7123ce91b..dc85e563b 100644 --- a/src/desktop-events.h +++ b/src/desktop-events.h @@ -13,13 +13,15 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gdk/gdk.h> -#include <gtk/gtk.h> - class SPDesktop; struct SPDesktopWidget; struct SPCanvasItem; +typedef union _GdkEvent GdkEvent; +typedef struct _GdkEventCrossing GdkEventCrossing; +typedef struct _GdkEventMotion GdkEventMotion; +typedef struct _GtkWidget GtkWidget; + /* Item handlers */ int sp_desktop_root_handler (SPCanvasItem *item, GdkEvent *event, SPDesktop *desktop); diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index f6347e5c0..91359983b 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -14,6 +14,7 @@ #include <string> #include <cstring> +#include <glibmm.h> #include "desktop.h" #include "color-rgba.h" diff --git a/src/desktop-style.h b/src/desktop-style.h index fc20e97b9..40ca27e9e 100644 --- a/src/desktop-style.h +++ b/src/desktop-style.h @@ -13,13 +13,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> - class ColorRGBA; class SPCSSAttr; class SPDesktop; class SPObject; class SPStyle; +typedef struct _GSList GSList; namespace Inkscape { namespace XML { class Node; diff --git a/src/desktop.h b/src/desktop.h index ec240dd40..509f8a396 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -72,8 +72,9 @@ typedef struct _GdkEventAny GdkEventAny; struct _GdkEventWindowState; typedef struct _GdkEventWindowState GdkEventWindowState; +struct InkscapeApplication; + namespace Inkscape { - struct Application; class LayerModel; class MessageContext; class Selection; @@ -423,7 +424,7 @@ public: private: Inkscape::UI::View::EditWidgetInterface *_widget; - Inkscape::Application *_inkscape; + InkscapeApplication *_inkscape; Inkscape::MessageContext *_guides_message_context; bool _active; Geom::Affine _w2d; diff --git a/src/dialogs/dialog-events.cpp b/src/dialogs/dialog-events.cpp index a12e3eafc..cf3497c9b 100644 --- a/src/dialogs/dialog-events.cpp +++ b/src/dialogs/dialog-events.cpp @@ -187,7 +187,7 @@ void on_transientize (SPDesktop *desktop, win_data *wd ) } void -sp_transientize_callback ( Inkscape::Application * /*inkscape*/, +sp_transientize_callback ( InkscapeApplication * /*inkscape*/, SPDesktop *desktop, win_data *wd ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/dialogs/dialog-events.h b/src/dialogs/dialog-events.h index 623058282..b33eb3f38 100644 --- a/src/dialogs/dialog-events.h +++ b/src/dialogs/dialog-events.h @@ -29,9 +29,7 @@ class Entry; class SPDesktop; -namespace Inkscape { -struct Application; -} // namespace Inkscape +struct InkscapeApplication; typedef struct { GtkWidget *win; @@ -55,7 +53,7 @@ void sp_transientize ( GtkWidget *win ); void on_transientize ( SPDesktop *desktop, win_data *wd ); -void sp_transientize_callback ( Inkscape::Application *inkscape, +void sp_transientize_callback ( InkscapeApplication *inkscape, SPDesktop *desktop, win_data *wd ); diff --git a/src/dir-util.h b/src/dir-util.h index 17261af41..4865158bd 100644 --- a/src/dir-util.h +++ b/src/dir-util.h @@ -9,8 +9,7 @@ * */ -#include <stdlib.h> -#include <glib.h> +#include <cstdlib> /** * Returns a form of \a path relative to \a base if that is easy to construct (eg if \a path @@ -49,7 +48,7 @@ char *inkscape_rel2abs(char const *path, char const *base, char *result, size_t char *inkscape_abs2rel(char const *path, char const *base, char *result, size_t const size); -gchar *prepend_current_dir_if_relative(gchar const *filename); +gchar *prepend_current_dir_if_relative(char const *filename); #endif // !SEEN_DIR_UTIL_H diff --git a/src/display/cairo-templates.h b/src/display/cairo-templates.h index 57ec98f81..a49f925c3 100644 --- a/src/display/cairo-templates.h +++ b/src/display/cairo-templates.h @@ -16,6 +16,8 @@ #include "config.h" #endif +#include <glib.h> + #ifdef HAVE_OPENMP #include <omp.h> #include "preferences.h" @@ -25,7 +27,6 @@ static const int OPENMP_THRESHOLD = 2048; #include <algorithm> #include <cairo.h> -#include <glib.h> #include <math.h> #include "display/nr-3dutils.h" #include "display/cairo-utils.h" diff --git a/src/display/cairo-utils.h b/src/display/cairo-utils.h index fa0ee8853..2a7e460e8 100644 --- a/src/display/cairo-utils.h +++ b/src/display/cairo-utils.h @@ -12,16 +12,15 @@ #ifndef SEEN_INKSCAPE_DISPLAY_CAIRO_UTILS_H #define SEEN_INKSCAPE_DISPLAY_CAIRO_UTILS_H +#include <2geom/forward.h> #include <boost/noncopyable.hpp> -//#include <glibmm/threads.h> // workaround -#include <glib.h> #include <cairomm/cairomm.h> -//#include <gdkmm/pixbuf.h> -#include <2geom/forward.h> #include "style.h" struct SPColor; -void ink_cairo_pixbuf_cleanup(guchar *, void *); +typedef struct _GdkPixbuf GdkPixbuf; + +void ink_cairo_pixbuf_cleanup(unsigned char *, void *); void convert_pixbuf_argb32_to_normal(GdkPixbuf *pb); namespace Inkscape { diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp index 25d35fc6b..8738b93e4 100644 --- a/src/display/canvas-arena.cpp +++ b/src/display/canvas-arena.cpp @@ -11,7 +11,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gtk/gtk.h> +#include <gtkmm.h> #include "display/sp-canvas-util.h" #include "helper/sp-marshal.h" @@ -30,8 +30,6 @@ enum { LAST_SIGNAL }; -static void sp_canvas_arena_class_init(SPCanvasArenaClass *klass); -static void sp_canvas_arena_init(SPCanvasArena *group); static void sp_canvas_arena_destroy(SPCanvasItem *object); static void sp_canvas_arena_item_deleted(SPCanvasArena *arena, Inkscape::DrawingItem *item); @@ -46,7 +44,6 @@ static gint sp_canvas_arena_send_event (SPCanvasArena *arena, GdkEvent *event); static void sp_canvas_arena_request_update (SPCanvasArena *ca, DrawingItem *item); static void sp_canvas_arena_request_render (SPCanvasArena *ca, Geom::IntRect const &area); -static SPCanvasItemClass *parent_class; static guint signals[LAST_SIGNAL] = {0}; struct CachePrefObserver : public Inkscape::Preferences::Observer { @@ -70,33 +67,13 @@ struct CachePrefObserver : public Inkscape::Preferences::Observer { SPCanvasArena *_arena; }; -GType -sp_canvas_arena_get_type (void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof (SPCanvasArenaClass), - NULL, NULL, - (GClassInitFunc) sp_canvas_arena_class_init, - NULL, NULL, - sizeof (SPCanvasArena), - 0, - (GInstanceInitFunc) sp_canvas_arena_init, - NULL - }; - type = g_type_register_static (SP_TYPE_CANVAS_ITEM, "SPCanvasArena", &info, (GTypeFlags)0); - } - return type; -} +G_DEFINE_TYPE(SPCanvasArena, sp_canvas_arena, SP_TYPE_CANVAS_ITEM); static void sp_canvas_arena_class_init (SPCanvasArenaClass *klass) { SPCanvasItemClass *item_class = (SPCanvasItemClass *) klass; - parent_class = (SPCanvasItemClass*)g_type_class_peek_parent (klass); - signals[ARENA_EVENT] = g_signal_new ("arena_event", G_TYPE_FROM_CLASS(item_class), G_SIGNAL_RUN_LAST, @@ -149,8 +126,8 @@ static void sp_canvas_arena_destroy(SPCanvasItem *object) delete arena->observer; arena->drawing.~Drawing(); - if (SP_CANVAS_ITEM_CLASS(parent_class)->destroy) - (* SP_CANVAS_ITEM_CLASS(parent_class)->destroy) (object); + if (SP_CANVAS_ITEM_CLASS(sp_canvas_arena_parent_class)->destroy) + SP_CANVAS_ITEM_CLASS(sp_canvas_arena_parent_class)->destroy(object); } static void @@ -158,8 +135,8 @@ sp_canvas_arena_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned { SPCanvasArena *arena = SP_CANVAS_ARENA (item); - if (((SPCanvasItemClass *) parent_class)->update) - (* ((SPCanvasItemClass *) parent_class)->update) (item, affine, flags); + if (SP_CANVAS_ITEM_CLASS(sp_canvas_arena_parent_class)->update) + SP_CANVAS_ITEM_CLASS(sp_canvas_arena_parent_class)->update(item, affine, flags); arena->ctx.ctm = affine; diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp index ee9e14f10..46b59d25a 100644 --- a/src/display/canvas-bpath.cpp +++ b/src/display/canvas-bpath.cpp @@ -11,9 +11,6 @@ * */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif #include <sstream> #include <string.h> #include "desktop.h" @@ -27,42 +24,18 @@ #include "helper/geom.h" #include "display/sp-canvas.h" -static void sp_canvas_bpath_class_init (SPCanvasBPathClass *klass); -static void sp_canvas_bpath_init (SPCanvasBPath *path); static void sp_canvas_bpath_destroy(SPCanvasItem *object); static void sp_canvas_bpath_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); static void sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf); static double sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); -static SPCanvasItemClass *parent_class; - -GType -sp_canvas_bpath_get_type (void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof (SPCanvasBPathClass), - NULL, NULL, - (GClassInitFunc) sp_canvas_bpath_class_init, - NULL, NULL, - sizeof (SPCanvasBPath), - 0, - (GInstanceInitFunc) sp_canvas_bpath_init, - NULL - }; - type = g_type_register_static (SP_TYPE_CANVAS_ITEM, "SPCanvasBPath", &info, (GTypeFlags)0); - } - return type; -} +G_DEFINE_TYPE(SPCanvasBPath, sp_canvas_bpath, SP_TYPE_CANVAS_ITEM); static void sp_canvas_bpath_class_init(SPCanvasBPathClass *klass) { SPCanvasItemClass *item_class = (SPCanvasItemClass *) klass; - parent_class = (SPCanvasItemClass*)g_type_class_peek_parent (klass); - item_class->destroy = sp_canvas_bpath_destroy; item_class->update = sp_canvas_bpath_update; item_class->render = sp_canvas_bpath_render; @@ -90,8 +63,8 @@ static void sp_canvas_bpath_destroy(SPCanvasItem *object) cbp->curve = cbp->curve->unref(); } - if (SP_CANVAS_ITEM_CLASS(parent_class)->destroy) - (* SP_CANVAS_ITEM_CLASS(parent_class)->destroy) (object); + if (SP_CANVAS_ITEM_CLASS(sp_canvas_bpath_parent_class)->destroy) + (* SP_CANVAS_ITEM_CLASS(sp_canvas_bpath_parent_class)->destroy) (object); } static void sp_canvas_bpath_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags) @@ -100,8 +73,8 @@ static void sp_canvas_bpath_update(SPCanvasItem *item, Geom::Affine const &affin item->canvas->requestRedraw((int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2); - if (reinterpret_cast<SPCanvasItemClass *>(parent_class)->update) { - reinterpret_cast<SPCanvasItemClass *>(parent_class)->update(item, affine, flags); + if (reinterpret_cast<SPCanvasItemClass *>(sp_canvas_bpath_parent_class)->update) { + reinterpret_cast<SPCanvasItemClass *>(sp_canvas_bpath_parent_class)->update(item, affine, flags); } sp_canvas_item_reset_bounds (item); diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 4b1dbd1ed..2eeaa7006 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -71,42 +71,16 @@ static gchar const *const grid_svgname[] = { // ########################################################## // Grid CanvasItem -static void grid_canvasitem_class_init (GridCanvasItemClass *klass); -static void grid_canvasitem_init (GridCanvasItem *grid); static void grid_canvasitem_destroy(SPCanvasItem *object); static void grid_canvasitem_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); static void grid_canvasitem_render (SPCanvasItem *item, SPCanvasBuf *buf); -static SPCanvasItemClass * parent_class; - -GType -grid_canvasitem_get_type (void) -{ - static GType grid_canvasitem_type = 0; - - if (!grid_canvasitem_type) { - GTypeInfo grid_canvasitem_info = { - sizeof (GridCanvasItemClass), - NULL, NULL, - (GClassInitFunc) grid_canvasitem_class_init, - NULL, NULL, - sizeof (GridCanvasItem), - 0, - (GInstanceInitFunc) grid_canvasitem_init, - NULL - }; - - grid_canvasitem_type = g_type_register_static(SPCanvasItem::getType(), "GridCanvasItem", &grid_canvasitem_info, GTypeFlags(0)); - } - return grid_canvasitem_type; -} +G_DEFINE_TYPE(GridCanvasItem, grid_canvasitem, SP_TYPE_CANVAS_ITEM); static void grid_canvasitem_class_init(GridCanvasItemClass *klass) { SPCanvasItemClass *item_class = (SPCanvasItemClass *) klass; - parent_class = (SPCanvasItemClass*)g_type_class_peek_parent (klass); - item_class->destroy = grid_canvasitem_destroy; item_class->update = grid_canvasitem_update; item_class->render = grid_canvasitem_render; @@ -123,8 +97,8 @@ static void grid_canvasitem_destroy(SPCanvasItem *object) g_return_if_fail (object != NULL); g_return_if_fail (INKSCAPE_IS_GRID_CANVASITEM (object)); - if (SP_CANVAS_ITEM_CLASS(parent_class)->destroy) - (* SP_CANVAS_ITEM_CLASS(parent_class)->destroy) (object); + if (SP_CANVAS_ITEM_CLASS(grid_canvasitem_parent_class)->destroy) + (* SP_CANVAS_ITEM_CLASS(grid_canvasitem_parent_class)->destroy) (object); } /** @@ -145,8 +119,8 @@ grid_canvasitem_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned { GridCanvasItem *gridcanvasitem = INKSCAPE_GRID_CANVASITEM (item); - if (parent_class->update) - (* parent_class->update) (item, affine, flags); + if (SP_CANVAS_ITEM_CLASS(grid_canvasitem_parent_class)->update) + SP_CANVAS_ITEM_CLASS(grid_canvasitem_parent_class)->update(item, affine, flags); if (gridcanvasitem->grid) { gridcanvasitem->grid->Update(affine, flags); diff --git a/src/display/canvas-text.cpp b/src/display/canvas-text.cpp index fe60d9c65..5ad87b4ef 100644 --- a/src/display/canvas-text.cpp +++ b/src/display/canvas-text.cpp @@ -12,10 +12,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #include <sstream> #include <string.h> @@ -26,42 +22,17 @@ #include "color.h" #include "display/sp-canvas.h" -static void sp_canvastext_class_init (SPCanvasTextClass *klass); -static void sp_canvastext_init (SPCanvasText *canvastext); static void sp_canvastext_destroy(SPCanvasItem *object); static void sp_canvastext_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); static void sp_canvastext_render (SPCanvasItem *item, SPCanvasBuf *buf); -static SPCanvasItemClass *parent_class_ct; - -GType -sp_canvastext_get_type (void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof (SPCanvasTextClass), - NULL, NULL, - (GClassInitFunc) sp_canvastext_class_init, - NULL, NULL, - sizeof (SPCanvasText), - 0, - (GInstanceInitFunc) sp_canvastext_init, - NULL - }; - type = g_type_register_static (SP_TYPE_CANVAS_ITEM, "SPCanvasText", &info, (GTypeFlags)0); - } - return type; -} +G_DEFINE_TYPE(SPCanvasText, sp_canvastext, SP_TYPE_CANVAS_ITEM); static void sp_canvastext_class_init(SPCanvasTextClass *klass) { SPCanvasItemClass *item_class = SP_CANVAS_ITEM_CLASS(klass); - parent_class_ct = SP_CANVAS_ITEM_CLASS(g_type_class_peek_parent(klass)); - item_class->destroy = sp_canvastext_destroy; item_class->update = sp_canvastext_update; item_class->render = sp_canvastext_render; @@ -101,8 +72,8 @@ static void sp_canvastext_destroy(SPCanvasItem *object) canvastext->text = NULL; canvastext->item = NULL; - if (SP_CANVAS_ITEM_CLASS(parent_class_ct)->destroy) - (* SP_CANVAS_ITEM_CLASS(parent_class_ct)->destroy) (object); + if (SP_CANVAS_ITEM_CLASS(sp_canvastext_parent_class)->destroy) + SP_CANVAS_ITEM_CLASS(sp_canvastext_parent_class)->destroy(object); } static void @@ -151,8 +122,8 @@ sp_canvastext_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned i item->canvas->requestRedraw((int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2); - if (parent_class_ct->update) - (* parent_class_ct->update) (item, affine, flags); + if (SP_CANVAS_ITEM_CLASS(sp_canvastext_parent_class)->update) + SP_CANVAS_ITEM_CLASS(sp_canvastext_parent_class)->update(item, affine, flags); sp_canvas_item_reset_bounds (item); diff --git a/src/display/curve.cpp b/src/display/curve.cpp index 50f4c8954..0a39a8e7f 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -1,10 +1,4 @@ -#define __CURVE_C__ - -/** \file - * Routines for SPCurve and for its Geom::PathVector - */ - -/* +/** * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * Johan Engelen @@ -14,7 +8,7 @@ * Copyright (C) 2002 Lauris Kaplinski * Copyright (C) 2008 Johan Engelen * - * Released under GNU GPL + * Released under GNU GPL, see file 'COPYING' for more information */ #include "display/curve.h" @@ -25,6 +19,10 @@ #include <2geom/sbasis-to-bezier.h> #include <2geom/point.h> +/** + * Routines for SPCurve and for its Geom::PathVector + */ + /* Constructors */ /** @@ -686,4 +684,4 @@ SPCurve::last_point_additive_move(Geom::Point const & p) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8: diff --git a/src/display/curve.h b/src/display/curve.h index 4866655c4..b3f1e3702 100644 --- a/src/display/curve.h +++ b/src/display/curve.h @@ -1,8 +1,5 @@ -#ifndef SEEN_DISPLAY_CURVE_H -#define SEEN_DISPLAY_CURVE_H - -/* - * Author: +/** + * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * * Copyright (C) 2000 Lauris Kaplinski @@ -10,17 +7,18 @@ * Copyright (C) 2002 Lauris Kaplinski * Copyright (C) 2008 Johan Engelen * - * Released under GNU GPL + * Released under GNU GPL, see file 'COPYING' for more information */ -#include <glib.h> +#ifndef SEEN_DISPLAY_CURVE_H +#define SEEN_DISPLAY_CURVE_H +#include <glib.h> #include <2geom/forward.h> - #include <boost/optional.hpp> /** - * Wrapper around a Geom::PathVector objects. + * Wrapper around a Geom::PathVector object. */ class SPCurve { public: @@ -90,7 +88,7 @@ private: SPCurve& operator=(const SPCurve&); }; -#endif /* !SEEN_DISPLAY_CURVE_H */ +#endif // !SEEN_DISPLAY_CURVE_H /* Local Variables: @@ -101,4 +99,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp index 38ace001f..bce89d70e 100644 --- a/src/display/drawing-group.cpp +++ b/src/display/drawing-group.cpp @@ -9,13 +9,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "display/cairo-utils.h" #include "display/drawing.h" #include "display/drawing-context.h" #include "display/drawing-item.h" #include "display/drawing-group.h" #include "style.h" +#include "display/cairo-utils.h" + namespace Inkscape { DrawingGroup::DrawingGroup(Drawing &drawing) diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp index 00caef525..e56f3e58b 100644 --- a/src/display/drawing-image.cpp +++ b/src/display/drawing-image.cpp @@ -10,13 +10,15 @@ */ #include <2geom/bezier-curve.h> -#include "display/cairo-utils.h" + #include "display/drawing.h" #include "display/drawing-context.h" #include "display/drawing-image.h" #include "preferences.h" #include "style.h" +#include "display/cairo-utils.h" + namespace Inkscape { DrawingImage::DrawingImage(Drawing &drawing) diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 94b8a871f..56507bacb 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -10,8 +10,7 @@ */ #include <climits> -#include "display/cairo-utils.h" -#include "display/cairo-templates.h" + #include "display/drawing.h" #include "display/drawing-context.h" #include "display/drawing-item.h" @@ -21,6 +20,9 @@ #include "preferences.h" #include "style.h" +#include "display/cairo-utils.h" +#include "display/cairo-templates.h" + namespace Inkscape { void set_cairo_blend_operator( DrawingContext &dc, unsigned blend_mode ) { diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp index 1a41bdb3a..88506f2b9 100644 --- a/src/display/drawing-shape.cpp +++ b/src/display/drawing-shape.cpp @@ -9,7 +9,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> +#include <glibmm.h> #include <2geom/curves.h> #include <2geom/pathvector.h> #include <2geom/path-sink.h> diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index 9f3b447df..97a8c23d3 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -9,8 +9,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "display/cairo-utils.h" -#include "display/canvas-bpath.h" // for SPWindRule (WTF!) +//#include "display/cairo-utils.h" +//#include "display/canvas-bpath.h" // for SPWindRule (WTF!) #include "display/drawing.h" #include "display/drawing-context.h" #include "display/drawing-surface.h" @@ -20,6 +20,9 @@ #include "style.h" #include "2geom/pathvector.h" +#include "display/cairo-utils.h" +#include "display/canvas-bpath.h" + namespace Inkscape { diff --git a/src/display/drawing.h b/src/display/drawing.h index cc74833ba..88e35b03b 100644 --- a/src/display/drawing.h +++ b/src/display/drawing.h @@ -13,7 +13,6 @@ #define SEEN_INKSCAPE_DISPLAY_DRAWING_H #include <set> -#include <glib.h> #include <boost/operators.hpp> #include <boost/utility.hpp> #include <sigc++/sigc++.h> @@ -23,7 +22,7 @@ #include "nr-filter-colormatrix.h" typedef struct _SPCanvasArena SPCanvasArena; - +typedef unsigned int guint32; namespace Inkscape { @@ -65,7 +64,7 @@ public: OutlineColors const &colors() const { return _colors; } - void setGrayscaleMatrix(gdouble value_matrix[20]); + void setGrayscaleMatrix(double value_matrix[20]); void update(Geom::IntRect const &area = Geom::IntRect::infinite(), UpdateContext const &ctx = UpdateContext(), unsigned flags = DrawingItem::STATE_ALL, unsigned reset = 0); void render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0); @@ -100,7 +99,7 @@ private: OutlineColors _colors; Filters::FilterColorMatrix::ColorMatrixMatrix _grayscale_colormatrix; - SPCanvasArena *_canvasarena; // may be NULL is this arena is not the screen + SPCanvasArena *_canvasarena; // may be NULL if this arena is not the screen // but used for export etc. friend class DrawingItem; diff --git a/src/display/gnome-canvas-acetate.cpp b/src/display/gnome-canvas-acetate.cpp index 2cd0f296d..9147a1bbf 100644 --- a/src/display/gnome-canvas-acetate.cpp +++ b/src/display/gnome-canvas-acetate.cpp @@ -15,40 +15,17 @@ #include "gnome-canvas-acetate.h" -static void sp_canvas_acetate_class_init (SPCanvasAcetateClass *klass); -static void sp_canvas_acetate_init (SPCanvasAcetate *acetate); static void sp_canvas_acetate_destroy(SPCanvasItem *object); static void sp_canvas_acetate_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); static double sp_canvas_acetate_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); -static SPCanvasItemClass *parent_class; - -GType sp_canvas_acetate_get_type (void) -{ - static GType acetate_type = 0; - if (!acetate_type) { - GTypeInfo acetate_info = { - sizeof (SPCanvasAcetateClass), - NULL, NULL, - (GClassInitFunc) sp_canvas_acetate_class_init, - NULL, NULL, - sizeof (SPCanvasAcetate), - 0, - (GInstanceInitFunc) sp_canvas_acetate_init, - NULL - }; - acetate_type = g_type_register_static(SPCanvasItem::getType(), "SPCanvasAcetate", &acetate_info, GTypeFlags(0)); - } - return acetate_type; -} +G_DEFINE_TYPE(SPCanvasAcetate, sp_canvas_acetate, SP_TYPE_CANVAS_ITEM); static void sp_canvas_acetate_class_init (SPCanvasAcetateClass *klass) { SPCanvasItemClass *item_class = (SPCanvasItemClass *) klass; - parent_class = (SPCanvasItemClass*)g_type_class_peek_parent (klass); - item_class->destroy = sp_canvas_acetate_destroy; item_class->update = sp_canvas_acetate_update; item_class->point = sp_canvas_acetate_point; @@ -64,8 +41,8 @@ static void sp_canvas_acetate_destroy(SPCanvasItem *object) g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_ACETATE (object)); - if (SP_CANVAS_ITEM_CLASS(parent_class)->destroy) - (* SP_CANVAS_ITEM_CLASS(parent_class)->destroy) (object); + if (SP_CANVAS_ITEM_CLASS(sp_canvas_acetate_parent_class)->destroy) + SP_CANVAS_ITEM_CLASS(sp_canvas_acetate_parent_class)->destroy(object); } static void sp_canvas_acetate_update( SPCanvasItem *item, Geom::Affine const &/*affine*/, unsigned int /*flags*/ ) diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index 55c1ee495..44bbd14bd 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -29,8 +29,6 @@ using Inkscape::ControlManager; -static void sp_guideline_class_init(SPGuideLineClass *c); -static void sp_guideline_init(SPGuideLine *guideline); static void sp_guideline_destroy(SPCanvasItem *object); static void sp_guideline_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); @@ -40,34 +38,10 @@ static double sp_guideline_point(SPCanvasItem *item, Geom::Point p, SPCanvasItem static void sp_guideline_drawline (SPCanvasBuf *buf, gint x0, gint y0, gint x1, gint y1, guint32 rgba); -static SPCanvasItemClass *parent_class; - -GType sp_guideline_get_type() -{ - static GType guideline_type = 0; - - if (!guideline_type) { - static GTypeInfo const guideline_info = { - sizeof (SPGuideLineClass), - NULL, NULL, - (GClassInitFunc) sp_guideline_class_init, - NULL, NULL, - sizeof (SPGuideLine), - 16, - (GInstanceInitFunc) sp_guideline_init, - NULL, - }; - - guideline_type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPGuideLine", &guideline_info, (GTypeFlags) 0); - } - - return guideline_type; -} +G_DEFINE_TYPE(SPGuideLine, sp_guideline, SP_TYPE_CANVAS_ITEM); static void sp_guideline_class_init(SPGuideLineClass *c) { - parent_class = SP_CANVAS_ITEM_CLASS(g_type_class_peek_parent(c)); - SPCanvasItemClass *item_class = SP_CANVAS_ITEM_CLASS(c); item_class->destroy = sp_guideline_destroy; item_class->update = sp_guideline_update; @@ -108,7 +82,7 @@ static void sp_guideline_destroy(SPCanvasItem *object) g_free(gl->label); } - SP_CANVAS_ITEM_CLASS(parent_class)->destroy(object); + SP_CANVAS_ITEM_CLASS(sp_guideline_parent_class)->destroy(object); } static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) @@ -197,8 +171,8 @@ static void sp_guideline_update(SPCanvasItem *item, Geom::Affine const &affine, { SPGuideLine *gl = SP_GUIDELINE(item); - if ((SP_CANVAS_ITEM_CLASS(parent_class))->update) { - (SP_CANVAS_ITEM_CLASS(parent_class))->update(item, affine, flags); + if ((SP_CANVAS_ITEM_CLASS(sp_guideline_parent_class))->update) { + (SP_CANVAS_ITEM_CLASS(sp_guideline_parent_class))->update(item, affine, flags); } gl->affine = affine; diff --git a/src/display/nr-filter-blend.cpp b/src/display/nr-filter-blend.cpp index 25aea6f13..d0db6b42e 100644 --- a/src/display/nr-filter-blend.cpp +++ b/src/display/nr-filter-blend.cpp @@ -20,6 +20,7 @@ #include "config.h" #endif +#include <glibmm.h> #include "display/cairo-templates.h" #include "display/cairo-utils.h" #include "display/nr-filter-blend.h" diff --git a/src/display/nr-filter-primitive.h b/src/display/nr-filter-primitive.h index 214b2cfc5..62f350844 100644 --- a/src/display/nr-filter-primitive.h +++ b/src/display/nr-filter-primitive.h @@ -11,6 +11,7 @@ #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" diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index 90b233fbc..dec5b1f57 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -9,7 +9,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "display/nr-filter-image.h" #include <glib.h> #include <cmath> #include <cstring> @@ -29,6 +28,7 @@ #include "display/nr-filter-component-transfer.h" #include "display/nr-filter-diffuselighting.h" #include "display/nr-filter-displacement-map.h" +#include "display/nr-filter-image.h" #include "display/nr-filter-flood.h" #include "display/nr-filter-gaussian.h" #include "display/nr-filter-merge.h" diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp index 3636319df..327fbce1f 100644 --- a/src/display/sodipodi-ctrl.cpp +++ b/src/display/sodipodi-ctrl.cpp @@ -25,9 +25,6 @@ enum { ARG_PIXBUF }; - -static void sp_ctrl_class_init (SPCtrlClass *klass); -static void sp_ctrl_init (SPCtrl *ctrl); static void sp_ctrl_destroy(SPCanvasItem *object); static void sp_ctrl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void sp_ctrl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); @@ -36,29 +33,7 @@ static void sp_ctrl_render (SPCanvasItem *item, SPCanvasBuf *buf); static double sp_ctrl_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); -static SPCanvasItemClass *parent_class; - -GType -sp_ctrl_get_type (void) -{ - static GType ctrl_type = 0; - if (!ctrl_type) { - static GTypeInfo const ctrl_info = { - sizeof (SPCtrlClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_ctrl_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (SPCtrl), - 0, /* n_preallocs */ - (GInstanceInitFunc) sp_ctrl_init, - NULL - }; - ctrl_type = g_type_register_static (SP_TYPE_CANVAS_ITEM, "SPCtrl", &ctrl_info, (GTypeFlags)0); - } - return ctrl_type; -} +G_DEFINE_TYPE(SPCtrl, sp_ctrl, SP_TYPE_CANVAS_ITEM); static void sp_ctrl_class_init (SPCtrlClass *klass) @@ -66,8 +41,6 @@ sp_ctrl_class_init (SPCtrlClass *klass) SPCanvasItemClass *item_class = SP_CANVAS_ITEM_CLASS(klass); GObjectClass *g_object_class = (GObjectClass *) klass; - parent_class = SP_CANVAS_ITEM_CLASS(g_type_class_peek_parent (klass)); - g_object_class->set_property = sp_ctrl_set_property; g_object_class->get_property = sp_ctrl_get_property; @@ -239,8 +212,8 @@ static void sp_ctrl_destroy(SPCanvasItem *object) ctrl->cache = NULL; } - if (SP_CANVAS_ITEM_CLASS(parent_class)->destroy) - (* SP_CANVAS_ITEM_CLASS(parent_class)->destroy) (object); + if (SP_CANVAS_ITEM_CLASS(sp_ctrl_parent_class)->destroy) + SP_CANVAS_ITEM_CLASS(sp_ctrl_parent_class)->destroy(object); } static void @@ -251,8 +224,8 @@ sp_ctrl_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int fla ctrl = SP_CTRL (item); - if ((SP_CANVAS_ITEM_CLASS(parent_class))->update) - (* (SP_CANVAS_ITEM_CLASS(parent_class))->update) (item, affine, flags); + if (SP_CANVAS_ITEM_CLASS(sp_ctrl_parent_class)->update) + SP_CANVAS_ITEM_CLASS(sp_ctrl_parent_class)->update(item, affine, flags); sp_canvas_item_reset_bounds (item); diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp index e6e427047..75789ff50 100644 --- a/src/display/sodipodi-ctrlrect.cpp +++ b/src/display/sodipodi-ctrlrect.cpp @@ -26,45 +26,19 @@ * Corner coords can be in any order - i.e. x1 < x0 is allowed */ -static void sp_ctrlrect_class_init(SPCtrlRectClass *c); -static void sp_ctrlrect_init(CtrlRect *ctrlrect); static void sp_ctrlrect_destroy(SPCanvasItem *object); static void sp_ctrlrect_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); static void sp_ctrlrect_render(SPCanvasItem *item, SPCanvasBuf *buf); -static SPCanvasItemClass *parent_class; - static const guint DASH_LENGTH = 4; -GType sp_ctrlrect_get_type() -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof(SPCtrlRectClass), - 0, // base_init - 0, // base_finalize - (GClassInitFunc)sp_ctrlrect_class_init, - 0, // class_finalize - 0, // class_data - sizeof(CtrlRect), - 0, // n_preallocs - (GInstanceInitFunc)sp_ctrlrect_init, - 0 // value_table - }; - type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPCtrlRect", &info, static_cast<GTypeFlags>(0)); - } - return type; -} +G_DEFINE_TYPE(CtrlRect, sp_ctrlrect, SP_TYPE_CANVAS_ITEM); -static void sp_ctrlrect_class_init(SPCtrlRectClass *c) +static void sp_ctrlrect_class_init(CtrlRectClass *c) { SPCanvasItemClass *item_class = SP_CANVAS_ITEM_CLASS(c); - parent_class = SP_CANVAS_ITEM_CLASS(g_type_class_peek_parent(c)); - item_class->destroy = sp_ctrlrect_destroy; item_class->update = sp_ctrlrect_update; item_class->render = sp_ctrlrect_render; @@ -77,8 +51,8 @@ static void sp_ctrlrect_init(CtrlRect *cr) static void sp_ctrlrect_destroy(SPCanvasItem *object) { - if (SP_CANVAS_ITEM_CLASS(parent_class)->destroy) { - (* SP_CANVAS_ITEM_CLASS(parent_class)->destroy)(object); + if (SP_CANVAS_ITEM_CLASS(sp_ctrlrect_parent_class)->destroy) { + (* SP_CANVAS_ITEM_CLASS(sp_ctrlrect_parent_class)->destroy)(object); } } @@ -171,8 +145,8 @@ void CtrlRect::update(Geom::Affine const &affine, unsigned int flags) using Geom::X; using Geom::Y; - if ((SP_CANVAS_ITEM_CLASS(parent_class))->update) { - (SP_CANVAS_ITEM_CLASS(parent_class))->update(this, affine, flags); + if ((SP_CANVAS_ITEM_CLASS(sp_ctrlrect_parent_class))->update) { + (SP_CANVAS_ITEM_CLASS(sp_ctrlrect_parent_class))->update(this, affine, flags); } sp_canvas_item_reset_bounds(this); diff --git a/src/display/sodipodi-ctrlrect.h b/src/display/sodipodi-ctrlrect.h index 65a40a850..ff6c55b06 100644 --- a/src/display/sodipodi-ctrlrect.h +++ b/src/display/sodipodi-ctrlrect.h @@ -26,7 +26,7 @@ struct SPCanvasBuf; #define SP_TYPE_CTRLRECT (sp_ctrlrect_get_type ()) #define SP_CTRLRECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CTRLRECT, CtrlRect)) -#define SP_CTRLRECT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST((c), SP_TYPE_CTRLRECT, SPCtrlRectClass)) +#define SP_CTRLRECT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST((c), SP_TYPE_CTRLRECT, CtrlRectClass)) #define SP_IS_CTRLRECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRLRECT)) #define SP_IS_CTRLRECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_CTRLRECT)) @@ -57,7 +57,7 @@ private: int _shadow; }; -struct SPCtrlRectClass : public SPCanvasItemClass {}; +struct CtrlRectClass : public SPCanvasItemClass {}; GType sp_ctrlrect_get_type(); diff --git a/src/display/sp-canvas-item.h b/src/display/sp-canvas-item.h index f34ec453c..a388ffa91 100644 --- a/src/display/sp-canvas-item.h +++ b/src/display/sp-canvas-item.h @@ -24,8 +24,6 @@ #endif #include <glib-object.h> -#include <gtk/gtk.h> -#include <gdk/gdk.h> #include <2geom/rect.h> #include "ui/control-types.h" @@ -36,8 +34,10 @@ struct SPCanvasBuf; struct SPCanvasGroup; typedef struct _SPCanvasItemClass SPCanvasItemClass; +typedef union _GdkEvent GdkEvent; +typedef struct _GdkCursor GdkCursor; -#define SP_TYPE_CANVAS_ITEM (SPCanvasItem::getType()) +#define SP_TYPE_CANVAS_ITEM (sp_canvas_item_get_type()) #define SP_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CANVAS_ITEM, SPCanvasItem)) #define SP_CANVAS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_CANVAS_ITEM, SPCanvasItemClass)) #define SP_IS_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_CANVAS_ITEM)) @@ -50,7 +50,6 @@ typedef struct _SPCanvasItemClass SPCanvasItemClass; */ struct SPCanvasItem { GInitiallyUnowned parent_instance; - static GType getType(); SPCanvas *canvas; SPCanvasItem *parent; @@ -73,6 +72,8 @@ struct SPCanvasItem { bool in_destruction; }; +GType sp_canvas_item_get_type(); + /** * The vtable of an SPCanvasItem. */ diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 3dc4a7504..305b0950a 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -61,8 +61,6 @@ struct SPCanvasGroupClass { * A group of Items. */ struct SPCanvasGroup { - static GType getType(); - /** * Adds an item to a canvas group. */ @@ -113,17 +111,8 @@ struct SPCanvasGroup { GList *items; GList *last; - - static SPCanvasItemClass *parentClass; }; -SPCanvasItemClass *SPCanvasGroup::parentClass; - -GType sp_canvas_group_get_type() -{ - return SPCanvasGroup::getType(); -} - /** * The SPCanvas vtable. */ @@ -161,19 +150,6 @@ enum { LAST_SIGNAL }; -void sp_canvas_item_base_class_init(SPCanvasItemClass *klass); -void sp_canvas_item_base_class_finalize(SPCanvasItemClass *klass); - -/** - * Initializes the SPCanvasItem vtable and the "event" signal. - */ -void sp_canvas_item_class_init(SPCanvasItemClass *klass); - -/** - * Callback for initialization of SPCanvasItem. - */ -void sp_canvas_item_init(SPCanvasItem *item, SPCanvasItemClass *klass); - /** * Callback that removes item from all referers and destroys it. */ @@ -181,7 +157,6 @@ void sp_canvas_item_dispose(GObject *object); void sp_canvas_item_finalize(GObject *object); void sp_canvas_item_real_destroy(SPCanvasItem *object); -static gpointer parent_class = NULL; static guint object_signals[LAST_SIGNAL] = { 0 }; /** @@ -358,45 +333,12 @@ public: static void requestCanvasUpdate(SPCanvas *canvas); }; -GType SPCanvasItem::getType() -{ - static GType object_type = 0; - - if (!object_type) { - static GTypeInfo const object_info = { - sizeof(SPCanvasItemClass), - reinterpret_cast<GBaseInitFunc>(sp_canvas_item_base_class_init), - reinterpret_cast<GBaseFinalizeFunc>(sp_canvas_item_base_class_finalize), - reinterpret_cast<GClassInitFunc>(sp_canvas_item_class_init), - NULL, // class_finalize - NULL, // class_data - sizeof(SPCanvasItem), - 16, // n_preallocs - reinterpret_cast<GInstanceInitFunc>(sp_canvas_item_init), - NULL // value_table - }; - - object_type = g_type_register_static(G_TYPE_INITIALLY_UNOWNED, - "SPCanvasItem", &object_info, GTypeFlags(0)); - } - - return object_type; -} - -namespace { - -void sp_canvas_item_base_class_init(SPCanvasItemClass * /*klass*/) -{ -} - -void sp_canvas_item_base_class_finalize(SPCanvasItemClass * /*klass*/) -{ -} +G_DEFINE_TYPE(SPCanvasItem, sp_canvas_item, G_TYPE_INITIALLY_UNOWNED); -void sp_canvas_item_class_init(SPCanvasItemClass *klass) +static void +sp_canvas_item_class_init(SPCanvasItemClass *klass) { GObjectClass *gobject_class = (GObjectClass *) klass; - parent_class = g_type_class_ref (G_TYPE_OBJECT); item_signals[ITEM_EVENT] = g_signal_new ("event", G_TYPE_FROM_CLASS (klass), @@ -421,7 +363,8 @@ void sp_canvas_item_class_init(SPCanvasItemClass *klass) G_TYPE_NONE, 0); } -void sp_canvas_item_init(SPCanvasItem *item, SPCanvasItemClass * /*klass*/) +static void +sp_canvas_item_init(SPCanvasItem *item) { item->xform = Geom::Affine(Geom::identity()); item->ctrlType = Inkscape::CTRL_TYPE_UNKNOWN; @@ -434,15 +377,13 @@ void sp_canvas_item_init(SPCanvasItem *item, SPCanvasItemClass * /*klass*/) item->in_destruction = false; } -} // namespace - SPCanvasItem *sp_canvas_item_new(SPCanvasGroup *parent, GType type, gchar const *first_arg_name, ...) { va_list args; g_return_val_if_fail(parent != NULL, NULL); g_return_val_if_fail(SP_IS_CANVAS_GROUP(parent), NULL); - g_return_val_if_fail(g_type_is_a(type, SPCanvasItem::getType()), NULL); + g_return_val_if_fail(g_type_is_a(type, SP_TYPE_CANVAS_ITEM), NULL); SPCanvasItem *item = SP_CANVAS_ITEM(g_object_new(type, NULL)); @@ -554,7 +495,7 @@ void sp_canvas_item_dispose(GObject *object) item->in_destruction = false; } - G_OBJECT_CLASS(parent_class)->dispose(object); + G_OBJECT_CLASS(sp_canvas_item_parent_class)->dispose(object); } void sp_canvas_item_real_destroy(SPCanvasItem *object) @@ -574,7 +515,7 @@ void sp_canvas_item_finalize(GObject *gobject) "and must be removed with g_object_ref_sink()."); } - G_OBJECT_CLASS (parent_class)->finalize (gobject); + G_OBJECT_CLASS (sp_canvas_item_parent_class)->finalize (gobject); } } // namespace @@ -982,37 +923,12 @@ gint sp_canvas_item_order (SPCanvasItem * item) } // SPCanvasGroup +G_DEFINE_TYPE(SPCanvasGroup, sp_canvas_group, SP_TYPE_CANVAS_ITEM); -/** - * Registers SPCanvasGroup class with Gtk and returns its type number. - */ -GType SPCanvasGroup::getType(void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPCanvasGroupClass), - 0, // base_init - 0, // base_finalize - reinterpret_cast<GClassInitFunc>(SPCanvasGroup::classInit), - 0, // class_finalize - 0, // class_data - sizeof(SPCanvasGroup), - 0, // n_preallocs - reinterpret_cast<GInstanceInitFunc>(SPCanvasGroup::init), - 0 // value_table - }; - type = g_type_register_static(SPCanvasItem::getType(), "SPCanvasGroup", &info, static_cast<GTypeFlags>(0)); - } - return type; -} - -void SPCanvasGroup::classInit(SPCanvasGroupClass *klass) +static void sp_canvas_group_class_init(SPCanvasGroupClass *klass) { SPCanvasItemClass *item_class = reinterpret_cast<SPCanvasItemClass *>(klass); - parentClass = reinterpret_cast<SPCanvasItemClass*>(g_type_class_peek_parent(klass)); - item_class->destroy = SPCanvasGroup::destroy; item_class->update = SPCanvasGroup::update; item_class->render = SPCanvasGroup::render; @@ -1020,7 +936,7 @@ void SPCanvasGroup::classInit(SPCanvasGroupClass *klass) item_class->viewbox_changed = SPCanvasGroup::viewboxChanged; } -void SPCanvasGroup::init(SPCanvasGroup * /*group*/) +static void sp_canvas_group_init(SPCanvasGroup * /*group*/) { // Nothing here } @@ -1040,8 +956,8 @@ void SPCanvasGroup::destroy(SPCanvasItem *object) sp_canvas_item_destroy(child); } - if (SP_CANVAS_ITEM_CLASS(parentClass)->destroy) { - (* SP_CANVAS_ITEM_CLASS(parentClass)->destroy)(object); + if (SP_CANVAS_ITEM_CLASS(sp_canvas_group_parent_class)->destroy) { + (* SP_CANVAS_ITEM_CLASS(sp_canvas_group_parent_class)->destroy)(object); } } @@ -1238,7 +1154,7 @@ sp_canvas_init(SPCanvas *canvas) canvas->pick_event.crossing.y = 0; // Create the root item as a special case - canvas->root = SP_CANVAS_ITEM(g_object_new(SPCanvasGroup::getType(), NULL)); + canvas->root = SP_CANVAS_ITEM(g_object_new(SP_TYPE_CANVAS_GROUP, NULL)); canvas->root->canvas = canvas; g_object_ref (canvas->root); diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index 72ae4b6bc..adae30f35 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -30,7 +30,6 @@ # endif #endif -#include <glib.h> #include <gdk/gdk.h> #include <gtk/gtk.h> #include <glibmm/ustring.h> diff --git a/src/display/sp-ctrlcurve.cpp b/src/display/sp-ctrlcurve.cpp index d9b687f2e..2e0e8105b 100644 --- a/src/display/sp-ctrlcurve.cpp +++ b/src/display/sp-ctrlcurve.cpp @@ -23,42 +23,18 @@ namespace { -static void sp_ctrlcurve_class_init(SPCtrlCurveClass *klass, gpointer data); -static void sp_ctrlcurve_init(SPCtrlCurve *ctrlcurve, gpointer g_class); static void sp_ctrlcurve_destroy(SPCanvasItem *object); static void sp_ctrlcurve_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); static void sp_ctrlcurve_render(SPCanvasItem *item, SPCanvasBuf *buf); -static SPCanvasItemClass *parent_class; - } // namespace -GType SPCtrlCurve::getType() -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPCtrlCurveClass), - NULL, NULL, - reinterpret_cast<GClassInitFunc>(sp_ctrlcurve_class_init), - NULL, NULL, - sizeof(SPCtrlCurve), - 0, - reinterpret_cast<GInstanceInitFunc>(sp_ctrlcurve_init), - NULL - }; - type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPCtrlCurve", &info, static_cast<GTypeFlags>(0)); - } - return type; -} +G_DEFINE_TYPE(SPCtrlCurve, sp_ctrlcurve, SP_TYPE_CANVAS_ITEM); -namespace { - -void sp_ctrlcurve_class_init(SPCtrlCurveClass *klass, gpointer /*g_class*/) +static void +sp_ctrlcurve_class_init(SPCtrlCurveClass *klass) { - parent_class = reinterpret_cast<SPCanvasItemClass*>(g_type_class_peek_parent(klass)); - klass->destroy = sp_ctrlcurve_destroy; klass->update = sp_ctrlcurve_update; @@ -66,13 +42,14 @@ void sp_ctrlcurve_class_init(SPCtrlCurveClass *klass, gpointer /*g_class*/) } static void -sp_ctrlcurve_init(SPCtrlCurve *ctrlcurve, gpointer /*g_class*/) +sp_ctrlcurve_init(SPCtrlCurve *ctrlcurve) { // Points are initialized to 0,0 ctrlcurve->rgba = 0x0000ff7f; ctrlcurve->item=NULL; } +namespace { static void sp_ctrlcurve_destroy(SPCanvasItem *object) { @@ -83,8 +60,8 @@ sp_ctrlcurve_destroy(SPCanvasItem *object) ctrlcurve->item=NULL; - if (SP_CANVAS_ITEM_CLASS (parent_class)->destroy) - (* SP_CANVAS_ITEM_CLASS (parent_class)->destroy) (object); + if (SP_CANVAS_ITEM_CLASS(sp_ctrlcurve_parent_class)->destroy) + SP_CANVAS_ITEM_CLASS(sp_ctrlcurve_parent_class)->destroy(object); } static void @@ -125,8 +102,8 @@ sp_ctrlcurve_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned int item->canvas->requestRedraw(item->x1, item->y1, item->x2, item->y2); - if (parent_class->update) - (* parent_class->update) (item, affine, flags); + if (SP_CANVAS_ITEM_CLASS(sp_ctrlcurve_parent_class)->update) + SP_CANVAS_ITEM_CLASS(sp_ctrlcurve_parent_class)->update(item, affine, flags); sp_canvas_item_reset_bounds (item); diff --git a/src/display/sp-ctrlcurve.h b/src/display/sp-ctrlcurve.h index 90936185c..847944f38 100644 --- a/src/display/sp-ctrlcurve.h +++ b/src/display/sp-ctrlcurve.h @@ -19,14 +19,11 @@ class SPItem; -#define SP_TYPE_CTRLCURVE (SPCtrlCurve::getType()) +#define SP_TYPE_CTRLCURVE (sp_ctrlcurve_get_type()) #define SP_CTRLCURVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CTRLCURVE, SPCtrlCurve)) #define SP_IS_CTRLCURVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRLCURVE)) struct SPCtrlCurve : public SPCtrlLine { - - static GType getType(); - void setCoords( gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble x3, gdouble y3 ); @@ -36,9 +33,9 @@ struct SPCtrlCurve : public SPCtrlLine { Geom::Point p0, p1, p2, p3; }; -struct SPCtrlCurveClass : public SPCtrlLineClass{}; - +GType sp_ctrlcurve_get_type(); +struct SPCtrlCurveClass : public SPCtrlLineClass{}; #endif // SEEN_INKSCAPE_CTRLCURVE_H diff --git a/src/display/sp-ctrlline.cpp b/src/display/sp-ctrlline.cpp index aef284c1a..1bde540c0 100644 --- a/src/display/sp-ctrlline.cpp +++ b/src/display/sp-ctrlline.cpp @@ -30,55 +30,31 @@ namespace { -void sp_ctrlline_class_init(SPCtrlLineClass *klass, gpointer data); -void sp_ctrlline_init(SPCtrlLine *ctrlline, gpointer g_class); void sp_ctrlline_destroy(SPCanvasItem *object); void sp_ctrlline_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); void sp_ctrlline_render(SPCanvasItem *item, SPCanvasBuf *buf); -SPCanvasItemClass *parent_class = 0; - } // namespace -GType SPCtrlLine::getType() -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPCtrlLineClass), - NULL, NULL, - reinterpret_cast<GClassInitFunc>(sp_ctrlline_class_init), - NULL, NULL, - sizeof(SPCtrlLine), - 0, - reinterpret_cast<GInstanceInitFunc>(sp_ctrlline_init), - NULL - }; - type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPCtrlLine", &info, static_cast<GTypeFlags>(0)); - } - return type; -} - -namespace { +G_DEFINE_TYPE(SPCtrlLine, sp_ctrlline, SP_TYPE_CANVAS_ITEM); -void sp_ctrlline_class_init(SPCtrlLineClass *klass, gpointer /*data*/) +static void sp_ctrlline_class_init(SPCtrlLineClass *klass) { - parent_class = reinterpret_cast<SPCanvasItemClass*>(g_type_class_peek_parent(klass)); - klass->destroy = sp_ctrlline_destroy; klass->update = sp_ctrlline_update; klass->render = sp_ctrlline_render; } -void sp_ctrlline_init(SPCtrlLine *ctrlline, gpointer /*g_class*/) +static void sp_ctrlline_init(SPCtrlLine *ctrlline) { ctrlline->rgba = 0x0000ff7f; ctrlline->s[Geom::X] = ctrlline->s[Geom::Y] = ctrlline->e[Geom::X] = ctrlline->e[Geom::Y] = 0.0; ctrlline->item=NULL; } +namespace { void sp_ctrlline_destroy(SPCanvasItem *object) { g_return_if_fail(object != NULL); @@ -88,8 +64,8 @@ void sp_ctrlline_destroy(SPCanvasItem *object) ctrlline->item = NULL; - if(SP_CANVAS_ITEM_CLASS (parent_class)->destroy) { - (* SP_CANVAS_ITEM_CLASS (parent_class)->destroy)(object); + if(SP_CANVAS_ITEM_CLASS (sp_ctrlline_parent_class)->destroy) { + SP_CANVAS_ITEM_CLASS (sp_ctrlline_parent_class)->destroy(object); } } @@ -134,8 +110,8 @@ void sp_ctrlline_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned item->canvas->requestRedraw(item->x1, item->y1, item->x2, item->y2); - if (parent_class->update) { - (* parent_class->update)(item, affine, flags); + if (SP_CANVAS_ITEM_CLASS(sp_ctrlline_parent_class)->update) { + SP_CANVAS_ITEM_CLASS(sp_ctrlline_parent_class)->update(item, affine, flags); } sp_canvas_item_reset_bounds(item); diff --git a/src/display/sp-ctrlline.h b/src/display/sp-ctrlline.h index 12be03ca5..b2e222437 100644 --- a/src/display/sp-ctrlline.h +++ b/src/display/sp-ctrlline.h @@ -20,13 +20,11 @@ class SPItem; -#define SP_TYPE_CTRLLINE (SPCtrlLine::getType()) +#define SP_TYPE_CTRLLINE (sp_ctrlline_get_type()) #define SP_CTRLLINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CTRLLINE, SPCtrlLine)) #define SP_IS_CTRLLINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRLLINE)) struct SPCtrlLine : public SPCanvasItem { - static GType getType(); - void setRgba32(guint32 rgba); void setCoords(gdouble x0, gdouble y0, gdouble x1, gdouble y1); @@ -41,6 +39,8 @@ struct SPCtrlLine : public SPCanvasItem { Geom::Affine affine; }; +GType sp_ctrlline_get_type(); + struct SPCtrlLineClass : public SPCanvasItemClass{}; diff --git a/src/display/sp-ctrlpoint.cpp b/src/display/sp-ctrlpoint.cpp index 026cc7589..1082cb1b3 100644 --- a/src/display/sp-ctrlpoint.cpp +++ b/src/display/sp-ctrlpoint.cpp @@ -20,42 +20,17 @@ #include "display/cairo-utils.h" #include "display/sp-canvas.h" - -static void sp_ctrlpoint_class_init (SPCtrlPointClass *klass); -static void sp_ctrlpoint_init (SPCtrlPoint *ctrlpoint); static void sp_ctrlpoint_destroy(SPCanvasItem *object); static void sp_ctrlpoint_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); static void sp_ctrlpoint_render (SPCanvasItem *item, SPCanvasBuf *buf); -static SPCanvasItemClass *parent_class; - -GType -sp_ctrlpoint_get_type (void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPCtrlPointClass), - NULL, NULL, - (GClassInitFunc) sp_ctrlpoint_class_init, - NULL, NULL, - sizeof(SPCtrlPoint), - 0, - (GInstanceInitFunc) sp_ctrlpoint_init, - NULL - }; - type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPCtrlPoint", &info, (GTypeFlags)0); - } - return type; -} +G_DEFINE_TYPE(SPCtrlPoint, sp_ctrlpoint, SP_TYPE_CANVAS_ITEM); static void sp_ctrlpoint_class_init(SPCtrlPointClass *klass) { SPCanvasItemClass *item_class = SP_CANVAS_ITEM_CLASS(klass); - parent_class = SP_CANVAS_ITEM_CLASS(g_type_class_peek_parent(klass)); - item_class->destroy = sp_ctrlpoint_destroy; item_class->update = sp_ctrlpoint_update; item_class->render = sp_ctrlpoint_render; @@ -79,8 +54,8 @@ static void sp_ctrlpoint_destroy(SPCanvasItem *object) ctrlpoint->item=NULL; - if (SP_CANVAS_ITEM_CLASS(parent_class)->destroy) - (* SP_CANVAS_ITEM_CLASS(parent_class)->destroy) (object); + if (SP_CANVAS_ITEM_CLASS(sp_ctrlpoint_parent_class)->destroy) + SP_CANVAS_ITEM_CLASS(sp_ctrlpoint_parent_class)->destroy(object); } static void @@ -111,8 +86,8 @@ static void sp_ctrlpoint_update(SPCanvasItem *item, Geom::Affine const &affine, item->canvas->requestRedraw((int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2); - if (parent_class->update) { - (* parent_class->update) (item, affine, flags); + if (SP_CANVAS_ITEM_CLASS(sp_ctrlpoint_parent_class)->update) { + SP_CANVAS_ITEM_CLASS(sp_ctrlpoint_parent_class)->update(item, affine, flags); } sp_canvas_item_reset_bounds (item); diff --git a/src/display/sp-ctrlquadr.cpp b/src/display/sp-ctrlquadr.cpp index b6a0da109..760e93a6d 100644 --- a/src/display/sp-ctrlquadr.cpp +++ b/src/display/sp-ctrlquadr.cpp @@ -29,42 +29,18 @@ struct SPCtrlQuadr : public SPCanvasItem{ struct SPCtrlQuadrClass : public SPCanvasItemClass{}; -static void sp_ctrlquadr_class_init (SPCtrlQuadrClass *klass); -static void sp_ctrlquadr_init (SPCtrlQuadr *ctrlquadr); static void sp_ctrlquadr_destroy(SPCanvasItem *object); static void sp_ctrlquadr_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); static void sp_ctrlquadr_render (SPCanvasItem *item, SPCanvasBuf *buf); -static SPCanvasItemClass *parent_class; - -GType -sp_ctrlquadr_get_type (void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPCtrlQuadrClass), - NULL, NULL, - (GClassInitFunc) sp_ctrlquadr_class_init, - NULL, NULL, - sizeof(SPCtrlQuadr), - 0, - (GInstanceInitFunc) sp_ctrlquadr_init, - NULL - }; - type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPCtrlQuadr", &info, (GTypeFlags)0); - } - return type; -} +G_DEFINE_TYPE(SPCtrlQuadr, sp_ctrlquadr, SP_TYPE_CANVAS_ITEM); static void sp_ctrlquadr_class_init (SPCtrlQuadrClass *klass) { SPCanvasItemClass *item_class = SP_CANVAS_ITEM_CLASS(klass); - parent_class = SP_CANVAS_ITEM_CLASS(g_type_class_peek_parent(klass)); - item_class->destroy = sp_ctrlquadr_destroy; item_class->update = sp_ctrlquadr_update; item_class->render = sp_ctrlquadr_render; @@ -85,8 +61,8 @@ static void sp_ctrlquadr_destroy(SPCanvasItem *object) g_return_if_fail (object != NULL); g_return_if_fail (SP_IS_CTRLQUADR (object)); - if (SP_CANVAS_ITEM_CLASS(parent_class)->destroy) - (* SP_CANVAS_ITEM_CLASS(parent_class)->destroy) (object); + if (SP_CANVAS_ITEM_CLASS(sp_ctrlquadr_parent_class)->destroy) + (* SP_CANVAS_ITEM_CLASS(sp_ctrlquadr_parent_class)->destroy) (object); } static void @@ -139,8 +115,8 @@ static void sp_ctrlquadr_update(SPCanvasItem *item, Geom::Affine const &affine, item->canvas->requestRedraw((int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2); - if (parent_class->update) { - (* parent_class->update)(item, affine, flags); + if (SP_CANVAS_ITEM_CLASS(sp_ctrlquadr_parent_class)->update) { + SP_CANVAS_ITEM_CLASS(sp_ctrlquadr_parent_class)->update(item, affine, flags); } sp_canvas_item_reset_bounds (item); diff --git a/src/document-private.h b/src/document-private.h index 4560aa28f..8e28b288b 100644 --- a/src/document-private.h +++ b/src/document-private.h @@ -34,6 +34,7 @@ class Event; } } +typedef struct _GHashTable GHashTable; struct SPDocumentPrivate { typedef std::map<GQuark, SPDocument::IDChangedSignal> IDChangedSignalMap; diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 53e701648..0519b6874 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -44,19 +44,6 @@ * (Lauris Kaplinski) */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - - - -#if HAVE_STRING_H -#endif - - -#if HAVE_STDLIB_H -#endif - #include <string> #include <cstring> #include "xml/repr.h" @@ -112,7 +99,7 @@ void Inkscape::DocumentUndo::done(SPDocument *doc, const unsigned int event_type maybeDone(doc, NULL, event_type, event_description); } -void Inkscape::DocumentUndo::resetKey( Inkscape::Application * /*inkscape*/, SPDesktop * /*desktop*/, GObject *base ) +void Inkscape::DocumentUndo::resetKey( InkscapeApplication * /*inkscape*/, SPDesktop * /*desktop*/, GObject *base ) { SPDocument *doc = reinterpret_cast<SPDocument *>(base); doc->actionkey.clear(); diff --git a/src/document-undo.h b/src/document-undo.h index 38e575a34..17b3de252 100644 --- a/src/document-undo.h +++ b/src/document-undo.h @@ -9,11 +9,10 @@ typedef struct _GObject GObject; class SPDesktop; class SPDocument; +struct InkscapeApplication; namespace Inkscape { -struct Application; - class DocumentUndo { public: @@ -42,7 +41,7 @@ public: static void maybeDone(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring const &event_description); - static void resetKey(Inkscape::Application *inkscape, SPDesktop *desktop, GObject *base); + static void resetKey(InkscapeApplication *inkscape, SPDesktop *desktop, GObject *base); static void cancel(SPDocument *document); diff --git a/src/document.cpp b/src/document.cpp index f79a00178..bb1954916 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1370,7 +1370,7 @@ GSList *SPDocument::getItemsAtPoints(unsigned const key, std::vector<Geom::Point } SPItem *SPDocument::getItemAtPoint( unsigned const key, Geom::Point const &p, - gboolean const into_groups, SPItem *upto) const + bool const into_groups, SPItem *upto) const { g_return_val_if_fail(this->priv != NULL, NULL); diff --git a/src/document.h b/src/document.h index ee903449d..4ace249ae 100644 --- a/src/document.h +++ b/src/document.h @@ -75,8 +75,8 @@ class SPDocument : public Inkscape::GC::Managed<>, public: typedef sigc::signal<void, SPObject *> IDChangedSignal; typedef sigc::signal<void> ResourcesChangedSignal; - typedef sigc::signal<void, guint> ModifiedSignal; - typedef sigc::signal<void, gchar const *> URISetSignal; + typedef sigc::signal<void, unsigned> ModifiedSignal; + typedef sigc::signal<void, char const *> URISetSignal; typedef sigc::signal<void, double, double> ResizedSignal; typedef sigc::signal<void> ReconstructionStart; typedef sigc::signal<void> ReconstructionFinish; @@ -100,9 +100,9 @@ public: CRCascade *style_cascade; protected: - gchar *uri; ///< A filename (not a URI yet), or NULL - gchar *base; ///< To be used for resolving relative hrefs. - gchar *name; ///< basename(uri) or other human-readable label for the document. + char *uri; ///< A filename (not a URI yet), or NULL + char *base; ///< To be used for resolving relative hrefs. + char *name; ///< basename(uri) or other human-readable label for the document. public: @@ -112,10 +112,10 @@ public: Glib::ustring actionkey; /// Handler ID - guint modified_id; + unsigned modified_id; /// Connector rerouting handler ID - guint rerouting_handler_id; + unsigned rerouting_handler_id; Inkscape::ProfileManager* profileManager; @@ -137,15 +137,15 @@ public: Inkscape::XML::Document const *getReprDoc() const { return rdoc; } /** A filename (not a URI yet), or NULL */ - gchar const *getURI() const { return uri; } - void setUri(gchar const *uri); + char const *getURI() const { return uri; } + void setUri(char const *uri); /** To be used for resolving relative hrefs. */ - gchar const *getBase() const { return base; }; - void setBase( gchar const* base ); + char const *getBase() const { return base; }; + void setBase( char const* base ); /** basename(uri) or other human-readable label for the document. */ - gchar const* getName() const { return name; } + char const* getName() const { return name; } /** Return the main defs object for the document. */ SPDefs *getDefs(); @@ -173,10 +173,10 @@ public: sigc::connection connectResized(ResizedSignal::slot_type slot); sigc::connection connectCommit(CommitSignal::slot_type slot); - void bindObjectToId(gchar const *id, SPObject *object); + void bindObjectToId(char const *id, SPObject *object); SPObject *getObjectById(Glib::ustring const &id) const; - SPObject *getObjectById(gchar const *id) const; - sigc::connection connectIdChanged(const gchar *id, IDChangedSignal::slot_type slot); + SPObject *getObjectById(char const *id) const; + sigc::connection connectIdChanged(const char *id, IDChangedSignal::slot_type slot); void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object); SPObject *getObjectByRepr(Inkscape::XML::Node *repr) const; @@ -222,12 +222,12 @@ public: sigc::connection _selection_changed_connection; sigc::connection _desktop_activated_connection; - sigc::connection connectResourcesChanged(const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot); + sigc::connection connectResourcesChanged(char const *key, SPDocument::ResourcesChangedSignal::slot_type slot); void fitToRect(Geom::Rect const &rect, bool with_margins = false); - static SPDocument *createNewDoc(const gchar *uri, unsigned int keepalive, + static SPDocument *createNewDoc(char const*uri, unsigned int keepalive, bool make_new = false, SPDocument *parent=NULL ); - static SPDocument *createNewDocFromMem(const gchar *buffer, gint length, unsigned int keepalive); + static SPDocument *createNewDocFromMem(char const*buffer, int length, unsigned int keepalive); SPDocument *createChildDoc(std::string const &uri); /** @@ -235,8 +235,8 @@ public: */ static SPItem *getItemFromListAtPointBottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const &p, bool take_insensitive = false); - static SPDocument *createDoc(Inkscape::XML::Document *rdoc, gchar const *uri, - gchar const *base, gchar const *name, unsigned int keepalive, + static SPDocument *createDoc(Inkscape::XML::Document *rdoc, char const *uri, + char const *base, char const *name, unsigned int keepalive, SPDocument *parent); SPDocument *doRef(); @@ -250,25 +250,25 @@ public: void setHeight(const Inkscape::Util::Quantity &height); void setViewBox(const Geom::Rect &viewBox); void requestModified(); - gint ensureUpToDate(); - bool addResource(const gchar *key, SPObject *object); - bool removeResource(const gchar *key, SPObject *object); - const GSList *getResourceList(const gchar *key) const; + int ensureUpToDate(); + bool addResource(char const *key, SPObject *object); + bool removeResource(char const *key, SPObject *object); + const GSList *getResourceList(char const *key) const; GSList *getItemsInBox(unsigned int dkey, Geom::Rect const &box) const; GSList *getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box) const; - SPItem *getItemAtPoint(unsigned int key, Geom::Point const &p, gboolean into_groups, SPItem *upto = NULL) const; + SPItem *getItemAtPoint(unsigned int key, Geom::Point const &p, bool into_groups, SPItem *upto = NULL) const; GSList *getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points) const; SPItem *getGroupAtPoint(unsigned int key, Geom::Point const &p) const; - void changeUriAndHrefs(gchar const *uri); - void emitResizedSignal(gdouble width, gdouble height); + void changeUriAndHrefs(char const *uri); + void emitResizedSignal(double width, double height); unsigned int vacuumDocument(); void importDefs(SPDocument *source); private: - void do_change_uri(gchar const *const filename, bool const rebase); + void do_change_uri(char const *const filename, bool const rebase); void setupViewport(SPItemCtx *ctx); }; diff --git a/src/draw-anchor.cpp b/src/draw-anchor.cpp index 00db936e1..6b02bb607 100644 --- a/src/draw-anchor.cpp +++ b/src/draw-anchor.cpp @@ -30,7 +30,7 @@ using Inkscape::ControlManager; /** * Creates an anchor object and initializes it. */ -SPDrawAnchor *sp_draw_anchor_new(Inkscape::UI::Tools::FreehandBase *dc, SPCurve *curve, gboolean start, Geom::Point delta) +SPDrawAnchor *sp_draw_anchor_new(Inkscape::UI::Tools::FreehandBase *dc, SPCurve *curve, bool start, Geom::Point delta) { if (SP_IS_LPETOOL_CONTEXT(dc)) { // suppress all kinds of anchors in LPEToolContext @@ -73,7 +73,7 @@ SPDrawAnchor *sp_draw_anchor_destroy(SPDrawAnchor *anchor) * Test if point is near anchor, if so fill anchor on canvas and return * pointer to it or NULL. */ -SPDrawAnchor *sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, gboolean activate) +SPDrawAnchor *sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, bool activate) { SPCtrl *ctrl = SP_CTRL(anchor->ctrl); diff --git a/src/draw-anchor.h b/src/draw-anchor.h index e7b252186..1f7b55920 100644 --- a/src/draw-anchor.h +++ b/src/draw-anchor.h @@ -5,7 +5,6 @@ * Drawing anchors. */ -#include <glib.h> #include <2geom/point.h> namespace Inkscape { @@ -26,17 +25,17 @@ struct SPCanvasItem; struct SPDrawAnchor { Inkscape::UI::Tools::FreehandBase *dc; SPCurve *curve; - guint start : 1; - guint active : 1; + unsigned int start : 1; + unsigned int active : 1; Geom::Point dp; SPCanvasItem *ctrl; }; -SPDrawAnchor *sp_draw_anchor_new(Inkscape::UI::Tools::FreehandBase *dc, SPCurve *curve, gboolean start, +SPDrawAnchor *sp_draw_anchor_new(Inkscape::UI::Tools::FreehandBase *dc, SPCurve *curve, bool start, Geom::Point delta); SPDrawAnchor *sp_draw_anchor_destroy(SPDrawAnchor *anchor); -SPDrawAnchor *sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, gboolean activate); +SPDrawAnchor *sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, bool activate); #endif /* !SEEN_DRAW_ANCHOR_H */ diff --git a/src/ege-adjustment-action.h b/src/ege-adjustment-action.h index 590035eb3..8cfaa3e52 100644 --- a/src/ege-adjustment-action.h +++ b/src/ege-adjustment-action.h @@ -45,9 +45,7 @@ /* Note: this file should be kept compilable as both .cpp and .c */ -#include <glib.h> #include <gtk/gtk.h> -#include <glib-object.h> G_BEGIN_DECLS diff --git a/src/ege-color-prof-tracker.cpp b/src/ege-color-prof-tracker.cpp index eca90ecb7..78ee6b8b5 100644 --- a/src/ege-color-prof-tracker.cpp +++ b/src/ege-color-prof-tracker.cpp @@ -273,8 +273,13 @@ void ege_color_prof_tracker_get_profile_for( guint screenNum, guint monitor, gpo gpointer dataPos = 0; guint dataLen = 0; GdkDisplay* display = gdk_display_get_default(); + +#if GTK_CHECK_VERSION(3,10,0) + GdkScreen* screen = (screenNum < 1) ? gdk_display_get_screen(display, screenNum) : 0; +#else gint numScreens = gdk_display_get_n_screens(display); GdkScreen* screen = (screenNum < (guint)numScreens) ? gdk_display_get_screen(display, screenNum) : 0; +#endif if ( screen ) { GSList* curr = tracked_screens; @@ -494,7 +499,11 @@ GdkFilterReturn x11_win_filter(GdkXEvent *xevent, if ( stat ) { GdkDisplay* display = gdk_x11_lookup_xdisplay(native->xproperty.display); if ( display ) { +#if GTK_CHECK_VERSION(3,10,0) + gint screenCount = 1; +#else gint screenCount = gdk_display_get_n_screens(display); +#endif GdkScreen* targetScreen = 0; gint i = 0; for ( i = 0; i < screenCount; i++ ) { diff --git a/src/ege-output-action.h b/src/ege-output-action.h index fc21c2f27..0f4e21805 100644 --- a/src/ege-output-action.h +++ b/src/ege-output-action.h @@ -45,9 +45,7 @@ /* Note: this file should be kept compilable as both .cpp and .c */ -#include <glib.h> #include <gtk/gtk.h> -#include <glib-object.h> G_BEGIN_DECLS diff --git a/src/ege-select-one-action.h b/src/ege-select-one-action.h index d605f4a67..0c5cecaa3 100644 --- a/src/ege-select-one-action.h +++ b/src/ege-select-one-action.h @@ -48,9 +48,7 @@ /* Note: this file should be kept compilable as both .cpp and .c */ -#include <glib.h> #include <gtk/gtk.h> -#include <glib-object.h> G_BEGIN_DECLS diff --git a/src/event-log.h b/src/event-log.h index 7e3ba6817..6d4112a5a 100644 --- a/src/event-log.h +++ b/src/event-log.h @@ -11,14 +11,6 @@ #ifndef INKSCAPE_EVENT_LOG_H #define INKSCAPE_EVENT_LOG_H -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/treestore.h> #include <glibmm/refptr.h> #include <gtkmm/treeselection.h> diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index f0fd3711b..70a2ca672 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -1,28 +1,18 @@ -/** \file - * Code for handling extensions (i.e.\ scripts). - */ -/* +/** + * Code for handling extensions (i.e. scripts). + * * Authors: * Bryce Harrington <bryce@osdl.org> * Ted Gould <ted@gould.cx> * Jon A. Cruz <jon@joncruz.org> * Abhishek Sharma * - * Copyright (C) 2002-2005,2007 Authors + * Copyright (C) 2002-2007 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ -#define __INKSCAPE_EXTENSION_IMPLEMENTATION_SCRIPT_C__ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - +#include <glibmm.h> #include <gtkmm/messagedialog.h> #include <gtkmm/main.h> #include <gtkmm/scrolledwindow.h> @@ -32,44 +22,38 @@ #include <unistd.h> #include <errno.h> -#include <glib.h> #include <glib/gstdio.h> -#include "ui/view/view.h" #include "desktop-handles.h" #include "desktop.h" -#include "selection.h" -#include "sp-namedview.h" -#include "io/sys.h" -#include "preferences.h" -#include "../system.h" +#include "dialogs/dialog-events.h" #include "extension/effect.h" #include "extension/output.h" #include "extension/input.h" #include "extension/db.h" -#include "script.h" -#include "dialogs/dialog-events.h" #include "inkscape.h" +#include "io/sys.h" +#include "preferences.h" +#include "script.h" +#include "selection.h" +#include "sp-namedview.h" +#include "extension/system.h" +#include "ui/view/view.h" #include "xml/node.h" #include "xml/attribute-record.h" #include "util/glib-list-iterators.h" #include "path-prefix.h" - #ifdef WIN32 #include <windows.h> #include <sys/stat.h> #include "registrytool.h" #endif - - /** This is the command buffer that gets allocated from the stack */ #define BUFSIZE (255) - - /* Namespaces */ namespace Inkscape { namespace Extension { @@ -1063,4 +1047,4 @@ int Script::execute (const std::list<std::string> &in_command, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/extension/implementation/script.h b/src/extension/implementation/script.h index 270c361af..6a7d0c3b8 100644 --- a/src/extension/implementation/script.h +++ b/src/extension/implementation/script.h @@ -22,81 +22,30 @@ namespace Inkscape { namespace XML { class Node; -} -} +} // namespace XML - -namespace Inkscape { namespace Extension { namespace Implementation { - /** * Utility class used for loading and launching script extensions */ class Script : public Implementation { - public: - /** - * - */ Script(void); - - /** - * - */ virtual ~Script(); - - - /** - * - */ virtual bool load(Inkscape::Extension::Extension *module); - - /** - * - */ virtual void unload(Inkscape::Extension::Extension *module); - - /** - * - */ virtual bool check(Inkscape::Extension::Extension *module); ImplementationDocumentCache * newDocCache(Inkscape::Extension::Extension * ext, Inkscape::UI::View::View * view); - /** - * - */ - virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module, - gchar const *filename); - - /** - * - */ - virtual SPDocument *open(Inkscape::Extension::Input *module, - gchar const *filename); - - /** - * - */ + virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module, gchar const *filename); + virtual SPDocument *open(Inkscape::Extension::Input *module, gchar const *filename); virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module); - - /** - * - */ - virtual void save(Inkscape::Extension::Output *module, - SPDocument *doc, - gchar const *filename); - - /** - * - */ - virtual void effect(Inkscape::Extension::Effect *module, - Inkscape::UI::View::View *doc, - ImplementationDocumentCache * docCache); - + virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename); + virtual void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc, ImplementationDocumentCache * docCache); virtual bool cancelProcessing (void); private: @@ -105,7 +54,7 @@ private: Glib::RefPtr<Glib::MainLoop> _main_loop; /** - * The command that has been dirived from + * The command that has been derived from * the configuration file with appropriate directories */ std::list<std::string> command; @@ -117,13 +66,10 @@ private: */ Glib::ustring helper_extension; - std::string solve_reldir (Inkscape::XML::Node *reprin); - bool check_existence (const std::string &command); - void copy_doc (Inkscape::XML::Node * olddoc, - Inkscape::XML::Node * newdoc); - void checkStderr (const Glib::ustring &filename, - Gtk::MessageType type, - const Glib::ustring &message); + std::string solve_reldir(Inkscape::XML::Node *repr_in); + bool check_existence (std::string const& command); + void copy_doc(Inkscape::XML::Node * olddoc, Inkscape::XML::Node * newdoc); + void checkStderr (Glib::ustring const& filename, Gtk::MessageType type, Glib::ustring const& message); class file_listener { Glib::ustring _string; @@ -140,6 +86,7 @@ private: bool isDead () { return _dead; } + // TODO move these definitions into script.cpp void init (int fd, Glib::RefPtr<Glib::MainLoop> main) { _channel = Glib::IOChannel::create_from_fd(fd); _channel->set_encoding(); @@ -202,11 +149,6 @@ private: std::string resolveInterpreterExecutable(const Glib::ustring &interpNameArg); }; // class Script - - - - - } // namespace Implementation } // namespace Extension } // namespace Inkscape diff --git a/src/extension/input.h b/src/extension/input.h index b01ffeb86..2a0a177a0 100644 --- a/src/extension/input.h +++ b/src/extension/input.h @@ -14,9 +14,8 @@ #include <exception> #include <glib.h> #include "extension.h" -#include "xml/repr.h" -#include "document.h" -#include <gtk/gtk.h> + +class SPDocument; namespace Inkscape { namespace Extension { diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index 8d3e63775..8071cae36 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -31,6 +31,9 @@ class SPClipPath; class SPMask; +typedef struct _PangoFont PangoFont; +typedef struct _PangoLayout PangoLayout; + namespace Inkscape { class Pixbuf; diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 6fbc85c05..0fec68c06 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -202,8 +202,10 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) if ( shape->_marker[i] ) { SPMarker* marker = SP_MARKER (shape->_marker[i]); Geom::Affine tr; - if (marker->orient_auto) { + if (marker->orient_mode == MARKER_ORIENT_AUTO) { tr = sp_shape_marker_get_transform_at_start(pathv.begin()->front()); + } else if (marker->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) { + tr = Geom::Rotate::from_degrees( 180.0 ) * sp_shape_marker_get_transform_at_start(pathv.begin()->front()); } else { tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(pathv.begin()->front().pointAt(0)); } @@ -220,7 +222,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there { Geom::Affine tr; - if (marker->orient_auto) { + if (marker->orient_mode != MARKER_ORIENT_ANGLE) { tr = sp_shape_marker_get_transform_at_start(path_it->front()); } else { tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(path_it->front().pointAt(0)); @@ -237,7 +239,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) * Loop to end_default (so including closing segment), because when a path is closed, * there should be a midpoint marker between last segment and closing straight line segment */ Geom::Affine tr; - if (marker->orient_auto) { + if (marker->orient_mode != MARKER_ORIENT_ANGLE) { tr = sp_shape_marker_get_transform(*curve_it1, *curve_it2); } else { tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(curve_it1->pointAt(1)); @@ -253,7 +255,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) if ( path_it != (pathv.end()-1) && !path_it->empty()) { Geom::Curve const &lastcurve = path_it->back_default(); Geom::Affine tr; - if (marker->orient_auto) { + if (marker->orient_mode != MARKER_ORIENT_ANGLE) { tr = sp_shape_marker_get_transform_at_end(lastcurve); } else { tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(lastcurve.pointAt(1)); @@ -277,7 +279,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) Geom::Curve const &lastcurve = path_last[index]; Geom::Affine tr; - if (marker->orient_auto) { + if (marker->orient_mode != MARKER_ORIENT_ANGLE) { tr = sp_shape_marker_get_transform_at_end(lastcurve); } else { tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(lastcurve.pointAt(1)); diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index 0111ed626..b8f429a87 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -139,9 +139,15 @@ CdrImportDialog::CdrImportDialog(const std::vector<WPXString> &vec) _labelTotalPages->set_use_markup(false); _labelTotalPages->set_selectable(false); vbox2->pack_start(*_previewArea, Gtk::PACK_SHRINK, 0); +#if WITH_GTKMM_3_0 + this->get_content_area()->set_homogeneous(false); + this->get_content_area()->set_spacing(0); + this->get_content_area()->pack_start(*vbox2); +#else this->get_vbox()->set_homogeneous(false); this->get_vbox()->set_spacing(0); this->get_vbox()->pack_start(*vbox2); +#endif this->set_title(_("Page Selector")); this->set_modal(true); sp_transientize(GTK_WIDGET(this->gobj())); //Make transient diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 084fbcd58..9a5a78a34 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -27,12 +27,12 @@ # include "config.h" #endif -//#include <png.h> //This must precede text_reassemble.h or it blows up in pngconf.h when compiling #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <libuemf/symbol_convert.h> +#include "document.h" #include "sp-root.h" // even though it is included indirectly by wmf-inout.h #include "sp-path.h" #include "print.h" diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index da179bee0..28e44c461 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -1,21 +1,20 @@ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include <gdk-pixbuf/gdk-pixbuf.h> + #include <boost/scoped_ptr.hpp> #include <glib/gprintf.h> #include <glibmm/i18n.h> +#include "dir-util.h" +#include "display/cairo-utils.h" #include "document-private.h" -#include <dir-util.h> +#include "document-undo.h" #include "extension/input.h" #include "extension/system.h" +#include "image-resolution.h" #include "gdkpixbuf-input.h" #include "preferences.h" #include "selection-chemistry.h" #include "sp-image.h" -#include "document-undo.h" #include "util/units.h" -#include "image-resolution.h" -#include "display/cairo-utils.h" #include <set> namespace Inkscape { diff --git a/src/extension/internal/gdkpixbuf-input.h b/src/extension/internal/gdkpixbuf-input.h index 597e7246b..2e03a96db 100644 --- a/src/extension/internal/gdkpixbuf-input.h +++ b/src/extension/internal/gdkpixbuf-input.h @@ -10,7 +10,7 @@ namespace Internal { class GdkpixbufInput : Inkscape::Extension::Implementation::Implementation { public: SPDocument *open(Inkscape::Extension::Input *mod, - gchar const *uri); + char const *uri); static void init(); }; diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index 6fc79237b..83bfb5a92 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -138,9 +138,15 @@ VsdImportDialog::VsdImportDialog(const std::vector<WPXString> &vec) _labelTotalPages->set_use_markup(false); _labelTotalPages->set_selectable(false); vbox2->pack_start(*_previewArea, Gtk::PACK_SHRINK, 0); +#if WITH_GTKMM_3_0 + this->get_content_area()->set_homogeneous(false); + this->get_content_area()->set_spacing(0); + this->get_content_area()->pack_start(*vbox2); +#else this->get_vbox()->set_homogeneous(false); this->get_vbox()->set_spacing(0); this->get_vbox()->pack_start(*vbox2); +#endif this->set_title(_("Page Selector")); this->set_modal(true); sp_transientize(GTK_WIDGET(this->gobj())); //Make transient diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 5ccad678a..c03e7efe0 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -33,6 +33,7 @@ #include <stdint.h> #include <libuemf/symbol_convert.h> +#include "document.h" #include "sp-root.h" // even though it is included indirectly by wmf-inout.h #include "sp-path.h" #include "print.h" diff --git a/src/extension/output.h b/src/extension/output.h index c5b1beb45..44a731ca0 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -13,7 +13,6 @@ #ifndef INKSCAPE_EXTENSION_OUTPUT_H__ #define INKSCAPE_EXTENSION_OUTPUT_H__ -#include <gtk/gtk.h> #include "extension.h" class SPDocument; diff --git a/src/extract-uri.h b/src/extract-uri.h index a6707f1a1..e9ee0b1d8 100644 --- a/src/extract-uri.h +++ b/src/extract-uri.h @@ -1,9 +1,7 @@ #ifndef SEEN_EXTRACT_URI_H #define SEEN_EXTRACT_URI_H -#include <glib.h> - -gchar *extract_uri(gchar const *s, gchar const** endptr = 0); +char *extract_uri(char const *s, char const** endptr = 0); #endif /* !SEEN_EXTRACT_URI_H */ diff --git a/src/factory.h b/src/factory.h index c76501cfd..c1288b460 100644 --- a/src/factory.h +++ b/src/factory.h @@ -91,7 +91,7 @@ struct NodeTraits { break; case Inkscape::XML::ELEMENT_NODE: { - gchar const *const sptype = node.attribute("sodipodi:type"); + char const *const sptype = node.attribute("sodipodi:type"); if (sptype) { name = sptype; diff --git a/src/file.cpp b/src/file.cpp index 2f13ae3b0..7181f4f98 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -148,14 +148,14 @@ SPDesktop *sp_file_new(const std::string &templ) DocumentUndo::setUndoSensitive(doc, true); } - SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop) - desktop->setWaitingCursor(); + SPDesktop *olddesktop = SP_ACTIVE_DESKTOP; + if (olddesktop) + olddesktop->setWaitingCursor(); SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. g_return_val_if_fail(dtw != NULL, NULL); sp_create_window(dtw, TRUE); - desktop = static_cast<SPDesktop *>(dtw->view); + SPDesktop* desktop = static_cast<SPDesktop *>(dtw->view); doc->doUnref(); @@ -166,6 +166,8 @@ SPDesktop *sp_file_new(const std::string &templ) Inkscape::Extension::Dbus::dbus_init_desktop_interface(desktop); #endif + if (olddesktop) + olddesktop->clearWaitingCursor(); if (desktop) desktop->clearWaitingCursor(); diff --git a/src/file.h b/src/file.h index 7f80f3645..4ffbc8ec0 100644 --- a/src/file.h +++ b/src/file.h @@ -75,7 +75,7 @@ bool sp_file_open( * Displays a file open dialog. Calls sp_file_open on * an OK. */ -void sp_file_open_dialog (Gtk::Window &parentWindow, gpointer object, gpointer data); +void sp_file_open_dialog (Gtk::Window &parentWindow, void* object, void* data); /** * Reverts file to disk-copy on "YES" @@ -96,19 +96,19 @@ bool file_save_remote(SPDocument *doc, const Glib::ustring &uri, /** * */ -bool sp_file_save (Gtk::Window &parentWindow, gpointer object, gpointer data); +bool sp_file_save (Gtk::Window &parentWindow, void* object, void* data); /** * Saves the given document. Displays a file select dialog * to choose the new name. */ -bool sp_file_save_as (Gtk::Window &parentWindow, gpointer object, gpointer data); +bool sp_file_save_as (Gtk::Window &parentWindow, void* object, void* data); /** * Saves a copy of the given document. Displays a file select dialog * to choose a name for the copy. */ -bool sp_file_save_a_copy (Gtk::Window &parentWindow, gpointer object, gpointer data); +bool sp_file_save_a_copy (Gtk::Window &parentWindow, void* object, void* data); /** diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index 151480177..9298a1ffc 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -15,6 +15,8 @@ #include <cstring> +#include <glibmm.h> + #include "style.h" #include "document-private.h" #include "desktop-style.h" diff --git a/src/filter-chemistry.h b/src/filter-chemistry.h index 2ac3ebe8f..104016845 100644 --- a/src/filter-chemistry.h +++ b/src/filter-chemistry.h @@ -14,8 +14,6 @@ #ifndef SEEN_SP_FILTER_CHEMISTRY_H #define SEEN_SP_FILTER_CHEMISTRY_H -#include <glib.h> - #include "display/nr-filter-types.h" class SPDocument; @@ -24,12 +22,11 @@ class SPFilterPrimitive; class SPItem; class SPObject; - SPFilterPrimitive *filter_add_primitive(SPFilter *filter, Inkscape::Filters::FilterPrimitiveType); SPFilter *new_filter (SPDocument *document); -SPFilter *new_filter_gaussian_blur (SPDocument *document, gdouble stdDeviation, double expansion, double expansionX, double expansionY, double width, double height); -SPFilter *new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, gdouble stdDeviation); -SPFilter *modify_filter_gaussian_blur_from_item (SPDocument *document, SPItem *item, gdouble stdDeviation); +SPFilter *new_filter_gaussian_blur (SPDocument *document, double stdDeviation, double expansion, double expansionX, double expansionY, double width, double height); +SPFilter *new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, double stdDeviation); +SPFilter *modify_filter_gaussian_blur_from_item (SPDocument *document, SPItem *item, double stdDeviation); void remove_filter (SPObject *item, bool recursive); void remove_filter_gaussian_blur (SPObject *item); bool filter_is_single_gaussian_blur(SPFilter *filter); diff --git a/src/filter-enums.cpp b/src/filter-enums.cpp index 09a1a7614..037c66922 100644 --- a/src/filter-enums.cpp +++ b/src/filter-enums.cpp @@ -9,6 +9,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <glibmm.h> #include <glibmm/i18n.h> #include "filter-enums.h" diff --git a/src/gc-anchored.h b/src/gc-anchored.h index a20904dce..99b78c784 100644 --- a/src/gc-anchored.h +++ b/src/gc-anchored.h @@ -9,7 +9,6 @@ #ifndef SEEN_INKSCAPE_GC_ANCHORED_H #define SEEN_INKSCAPE_GC_ANCHORED_H -#include <glib.h> #include "gc-managed.h" namespace Inkscape { diff --git a/src/gc-core.h b/src/gc-core.h index 3957bda1a..d9d0bf4ff 100644 --- a/src/gc-core.h +++ b/src/gc-core.h @@ -24,7 +24,6 @@ #else # include <gc.h> #endif -#include <glib.h> namespace Inkscape { namespace GC { diff --git a/src/gradient-chemistry.h b/src/gradient-chemistry.h index 728874f88..792ccc72e 100644 --- a/src/gradient-chemistry.h +++ b/src/gradient-chemistry.h @@ -22,6 +22,7 @@ class SPCSSAttr; class SPItem; +typedef unsigned int guint32; /** * Either normalizes given gradient to vector, or returns fresh normalized @@ -53,7 +54,7 @@ SPGradient *sp_gradient_vector_for_object( SPDocument *doc, SPDesktop *desktop, void sp_object_ensure_fill_gradient_normalized (SPObject *object); void sp_object_ensure_stroke_gradient_normalized (SPObject *object); -SPGradient *sp_gradient_convert_to_userspace (SPGradient *gr, SPItem *item, const gchar *property); +SPGradient *sp_gradient_convert_to_userspace (SPGradient *gr, SPItem *item, const char *property); SPGradient *sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item); SPGradient *sp_gradient_fork_vector_if_necessary (SPGradient *gr); @@ -61,11 +62,11 @@ SPGradient *sp_gradient_get_forked_vector_if_necessary(SPGradient *gradient, boo SPStop* sp_last_stop(SPGradient *gradient); -SPStop* sp_get_stop_i(SPGradient *gradient, guint i); -guint sp_number_of_stops(SPGradient const *gradient); -guint sp_number_of_stops_before_stop(SPGradient const *gradient, SPStop *target); +SPStop* sp_get_stop_i(SPGradient *gradient, unsigned int i); +unsigned int sp_number_of_stops(SPGradient const *gradient); +unsigned int sp_number_of_stops_before_stop(SPGradient const *gradient, SPStop *target); -guint32 average_color(guint32 c1, guint32 c2, gdouble p = 0.5); +guint32 average_color(guint32 c1, guint32 c2, double p = 0.5); SPStop *sp_vector_add_stop(SPGradient *vector, SPStop* prev_stop, SPStop* next_stop, gfloat offset); @@ -86,20 +87,20 @@ void sp_gradient_unset_swatch(SPDesktop *desktop, std::string id); SPGradient *getGradient(SPItem *item, Inkscape::PaintTarget fill_or_stroke); -void sp_item_gradient_set_coords(SPItem *item, GrPointType point_type, guint point_i, Geom::Point p_desk, Inkscape::PaintTarget fill_or_stroke, bool write_repr, bool scale); +void sp_item_gradient_set_coords(SPItem *item, GrPointType point_type, unsigned int point_i, Geom::Point p_desk, Inkscape::PaintTarget fill_or_stroke, bool write_repr, bool scale); /** * Returns the position of point point_type of the gradient applied to item (either fill_or_stroke), * in desktop coordinates. */ -Geom::Point getGradientCoords(SPItem *item, GrPointType point_type, guint point_i, Inkscape::PaintTarget fill_or_stroke); +Geom::Point getGradientCoords(SPItem *item, GrPointType point_type, unsigned int point_i, Inkscape::PaintTarget fill_or_stroke); SPGradient *sp_item_gradient_get_vector(SPItem *item, Inkscape::PaintTarget fill_or_stroke); SPGradientSpread sp_item_gradient_get_spread(SPItem *item, Inkscape::PaintTarget fill_or_stroke); -void sp_item_gradient_stop_set_style(SPItem *item, GrPointType point_type, guint point_i, Inkscape::PaintTarget fill_or_stroke, SPCSSAttr *stop); -guint32 sp_item_gradient_stop_query_style(SPItem *item, GrPointType point_type, guint point_i, Inkscape::PaintTarget fill_or_stroke); -void sp_item_gradient_edit_stop(SPItem *item, GrPointType point_type, guint point_i, Inkscape::PaintTarget fill_or_stroke); +void sp_item_gradient_stop_set_style(SPItem *item, GrPointType point_type, unsigned int point_i, Inkscape::PaintTarget fill_or_stroke, SPCSSAttr *stop); +guint32 sp_item_gradient_stop_query_style(SPItem *item, GrPointType point_type, unsigned int point_i, Inkscape::PaintTarget fill_or_stroke); +void sp_item_gradient_edit_stop(SPItem *item, GrPointType point_type, unsigned int point_i, Inkscape::PaintTarget fill_or_stroke); void sp_item_gradient_reverse_vector(SPItem *item, Inkscape::PaintTarget fill_or_stroke); void sp_item_gradient_invert_vector_color(SPItem *item, Inkscape::PaintTarget fill_or_stroke); diff --git a/src/graphlayout.h b/src/graphlayout.h index 6083ad77f..0ffb645b6 100644 --- a/src/graphlayout.h +++ b/src/graphlayout.h @@ -14,10 +14,15 @@ #ifndef SEEN_GRAPHLAYOUT_H #define SEEN_GRAPHLAYOUT_H -struct _GSList; -void graphlayout(_GSList const *const items); +#include <list> + +typedef struct _GSList GSList; class SPItem; + +void graphlayout(GSList const *const items); + bool isConnector(SPItem const *const item); -#include <list> -void filterConnectors(_GSList const *const items, std::list<SPItem *> &filtered); + +void filterConnectors(GSList const *const items, std::list<SPItem *> &filtered); + #endif // SEEN_GRAPHLAYOUT_H diff --git a/src/help.cpp b/src/help.cpp index 02a1930f4..643945a69 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -1,6 +1,4 @@ -#define __SP_HELP_C__ - -/* +/** * Help/About window * * Authors: @@ -17,20 +15,19 @@ # include "config.h" #endif -#include "ui/dialog/aboutbox.h" -#include "path-prefix.h" -#include "help.h" -#include "file.h" +#include <glibmm.h> +#include "file.h" +#include "help.h" +#include "path-prefix.h" +#include "ui/dialog/aboutbox.h" -void -sp_help_about (void) +void sp_help_about() { Inkscape::UI::Dialog::AboutBox::show_about(); } -void -sp_help_open_tutorial(GtkMenuItem *, gpointer data) +void sp_help_open_tutorial(GtkMenuItem *, void* data) { gchar const *name = static_cast<gchar const *>(data); gchar *c = g_build_filename(INKSCAPE_TUTORIALSDIR, name, NULL); diff --git a/src/help.h b/src/help.h index 3fce65fef..3f83e3367 100644 --- a/src/help.h +++ b/src/help.h @@ -1,6 +1,4 @@ -#ifndef SEEN_HELP_H -#define SEEN_HELP_H -/* +/** * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * @@ -10,18 +8,18 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> -#include <gtk/gtk.h> +#ifndef SEEN_HELP_H +#define SEEN_HELP_H + +typedef struct _GtkMenuItem GtkMenuItem; /** * Help/About window. */ -void sp_help_about(void); - -void sp_help_open_tutorial(GtkMenuItem *menuitem, gpointer data); - +void sp_help_about(); +void sp_help_open_tutorial(GtkMenuItem * /*unused*/, void* data); -#endif /* !SEEN_HELP_H */ +#endif // !SEEN_HELP_H /* Local Variables: @@ -32,4 +30,4 @@ void sp_help_open_tutorial(GtkMenuItem *menuitem, gpointer data); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/helper-fns.h b/src/helper-fns.h index 699fbbe11..2f1829c37 100644 --- a/src/helper-fns.h +++ b/src/helper-fns.h @@ -10,7 +10,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <string.h> +#include <cstring> #include <vector> #include <sstream> @@ -63,34 +63,6 @@ inline bool helperfns_read_bool(gchar const *value, bool default_value){ * the function can only be used to convert numbers as given by gui elements that use localized representation * numbers are delimeted by space * @param value ascii representation of the number - * @param size number of elements in string - * @return the vector of the converted numbers - */ -/* -inline std::vector<gdouble> helperfns_read_vector(const gchar* value, int size){ - std::vector<gdouble> v(size, (gdouble) 0); - std::istringstream is(value); - for(int i = 0; i < size; i++){ - std::string str; - is >> str; - char *end; - - double ret = g_ascii_strtod(str.c_str(), &end); - if (*end) { - g_warning("helper-fns::helperfns_read_vector() Unable to convert \"%s\" to number", str.c_str()); - // We could leave this out, too. If strtod can't convert - // anything, it will return zero. - ret = 0; - } - v[i] = ret; - }; - return v; -} -*/ -/* convert ascii representation to double - * the function can only be used to convert numbers as given by gui elements that use localized representation - * numbers are delimeted by space - * @param value ascii representation of the number * @return the vector of the converted numbers */ inline std::vector<gdouble> helperfns_read_vector(const gchar* value){ diff --git a/src/helper/action.h b/src/helper/action.h index 1f2de87b4..4b81ee7f9 100644 --- a/src/helper/action.h +++ b/src/helper/action.h @@ -13,12 +13,8 @@ #define SEEN_INKSCAPE_SP_ACTION_H #include "helper/action-context.h" -#include <sigc++/sigc++.h> +#include <sigc++/signal.h> #include <glibmm/ustring.h> -#include <glib-object.h> - -struct SPAction; -struct SPActionClass; #define SP_TYPE_ACTION (sp_action_get_type()) #define SP_ACTION(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_ACTION, SPAction)) diff --git a/src/helper/gnome-utils.cpp b/src/helper/gnome-utils.cpp index 957b7ea5e..3d2b333a2 100644 --- a/src/helper/gnome-utils.cpp +++ b/src/helper/gnome-utils.cpp @@ -1,9 +1,7 @@ -#define __GNOME_UTILS_C__ - -/* +/** * Helpers * - * Author: + * Authors: * Mitsuru Oka * Lauris Kaplinski <lauris@kaplinski.com> * @@ -25,49 +23,48 @@ * 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) +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); + 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); } /** @@ -80,29 +77,40 @@ gnome_uri_list_extract_uris (const gchar* 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) +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; + 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 index 3502b28df..6f2f28223 100644 --- a/src/helper/gnome-utils.h +++ b/src/helper/gnome-utils.h @@ -1,7 +1,7 @@ -/* +/** * GNOME Utils - Migration helper * - * Author: + * Authors: * GNOME Developer * Mitsuru Oka <oka326@parkcity.ne.jp> * Lauris Kaplinski <lauris@ximian.com> @@ -11,17 +11,15 @@ * Released under GNU GPL */ - -#ifndef __GNOME_UTILS_H__ -#define __GNOME_UTILS_H__ +#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 /* __GNOME_UTILS_H__ */ +#endif // !SEEN_GNOME_UTILS_H /* Local Variables: @@ -32,4 +30,4 @@ GList *gnome_uri_list_extract_filenames(gchar const *uri_list); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/helper/window.cpp b/src/helper/window.cpp index 98fbef170..98e886a38 100644 --- a/src/helper/window.cpp +++ b/src/helper/window.cpp @@ -1,6 +1,4 @@ -#define __SP_WINDOW_C__ - -/* +/** * Generic window implementation * * Author: @@ -9,61 +7,61 @@ * This code is in public domain */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - +#include <glibmm.h> #include <gtkmm/window.h> +#include "desktop.h" #include "inkscape.h" #include "shortcuts.h" -#include "desktop.h" #include "ui/tools/tool-base.h" #include "window.h" -#include <gtk/gtk.h> static bool on_window_key_press(GdkEventKey* event) { - unsigned int shortcut; - shortcut = Inkscape::UI::Tools::get_group0_keyval (event) | + unsigned shortcut = 0; + // FIXME why? + shortcut = Inkscape::UI::Tools::get_group0_keyval (event) | ( event->state & GDK_SHIFT_MASK ? SP_SHORTCUT_SHIFT_MASK : 0 ) | ( event->state & GDK_CONTROL_MASK ? SP_SHORTCUT_CONTROL_MASK : 0 ) | ( event->state & GDK_MOD1_MASK ? SP_SHORTCUT_ALT_MASK : 0 ); - return sp_shortcut_invoke (shortcut, SP_ACTIVE_DESKTOP); + return sp_shortcut_invoke (shortcut, SP_ACTIVE_DESKTOP); } -Gtk::Window * -Inkscape::UI::window_new (const gchar *title, unsigned int resizeable) +Gtk::Window * Inkscape::UI::window_new (const gchar *title, unsigned int resizeable) { - Gtk::Window *window = new Gtk::Window(Gtk::WINDOW_TOPLEVEL); - window->set_title (title); - window->set_resizable (resizeable); - window->signal_key_press_event().connect(sigc::ptr_fun(&on_window_key_press)); + Gtk::Window *window = new Gtk::Window(Gtk::WINDOW_TOPLEVEL); + window->set_title (title); + window->set_resizable (resizeable); + window->signal_key_press_event().connect(sigc::ptr_fun(&on_window_key_press)); - return window; + return window; } -static gboolean -sp_window_key_press(GtkWidget */*widget*/, GdkEventKey *event) +static gboolean sp_window_key_press(GtkWidget *, GdkEventKey *event) { return on_window_key_press(event); } -GtkWidget * -sp_window_new (const gchar *title, unsigned int resizeable) +GtkWidget * sp_window_new (const gchar *title, unsigned int resizeable) { - GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title ((GtkWindow *) window, title); - gtk_window_set_resizable ((GtkWindow *) window, resizeable); - g_signal_connect_after ((GObject *) window, "key_press_event", (GCallback) sp_window_key_press, NULL); + GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title ((GtkWindow *) window, title); + gtk_window_set_resizable ((GtkWindow *) window, resizeable); + g_signal_connect_after ((GObject *) window, "key_press_event", (GCallback) sp_window_key_press, NULL); - return window; + return window; } +/* + 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/window.h b/src/helper/window.h index c6807f9e5..a0efcd292 100644 --- a/src/helper/window.h +++ b/src/helper/window.h @@ -1,7 +1,7 @@ -#ifndef __SP_WINDOW_H__ -#define __SP_WINDOW_H__ +#ifndef SEEN_SP_WINDOW_H +#define SEEN_SP_WINDOW_H -/* +/** * Generic window implementation * * Author: @@ -17,10 +17,11 @@ namespace Gtk { class Window; } -/* - * This function is deprecated. Use Inkscape::UI::window_new instead. - */ -GtkWidget *sp_window_new (const gchar *title, unsigned int resizeable); +// Can we just get rid of this altogether? +#if defined(GCC_VERSION) || defined(__clang__) +__attribute__((deprecated)) +#endif +GtkWidget * sp_window_new (const gchar *title, unsigned int resizeable); namespace Inkscape { namespace UI { @@ -30,7 +31,7 @@ Gtk::Window *window_new (const gchar *title, unsigned int resizeable); } } -#endif +#endif // !SEEN_SP_WINDOW_H /* Local Variables: @@ -41,4 +42,4 @@ Gtk::Window *window_new (const gchar *title, unsigned int resizeable); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/icon-size.h b/src/icon-size.h index 4bb4f1df6..d7a9c9b0b 100644 --- a/src/icon-size.h +++ b/src/icon-size.h @@ -12,8 +12,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> - #include <gtk/gtk.h> namespace Inkscape { diff --git a/src/ink-action.h b/src/ink-action.h index 1d4106681..ac5cb9873 100644 --- a/src/ink-action.h +++ b/src/ink-action.h @@ -2,9 +2,7 @@ #define SEEN_INK_ACTION -#include <glib.h> #include <gtk/gtk.h> -#include <glib-object.h> #include "icon-size.h" #include "attributes.h" diff --git a/src/ink-comboboxentry-action.h b/src/ink-comboboxentry-action.h index a66f0790e..04b66e8fe 100644 --- a/src/ink-comboboxentry-action.h +++ b/src/ink-comboboxentry-action.h @@ -19,12 +19,8 @@ #ifndef SEEN_INK_COMBOBOXENTRY_ACTION #define SEEN_INK_COMBOBOXENTRY_ACTION -#include <glib.h> -#include <glib-object.h> - #include <gtk/gtk.h> - #define INK_COMBOBOXENTRY_TYPE_ACTION (ink_comboboxentry_action_get_type()) #define INK_COMBOBOXENTRY_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INK_COMBOBOXENTRY_TYPE_ACTION, Ink_ComboBoxEntry_Action)) #define INK_COMBOBOXENTRY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INK_COMBOBOXENTRY_TYPE_ACTION, Ink_ComboBoxEntry_ActionClass)) diff --git a/src/inkscape-version.h b/src/inkscape-version.h index 791351184..ff219047e 100644 --- a/src/inkscape-version.h +++ b/src/inkscape-version.h @@ -16,7 +16,7 @@ namespace Inkscape { -extern gchar const *version_string; ///< Full version string +extern char const *version_string; ///< Full version string } // namespace Inkscape diff --git a/src/inkscape-x64.rc b/src/inkscape-x64.rc index 47dbcb2bc..65a2b08b9 100644 --- a/src/inkscape-x64.rc +++ b/src/inkscape-x64.rc @@ -3,8 +3,8 @@ APPLICATION_ICON ICON DISCARDABLE "../inkscape.ico" 1 24 DISCARDABLE "./inkscape-manifest-x64.xml" 1 VERSIONINFO - FILEVERSION 0,91pre2,0,0 - PRODUCTVERSION 0,91pre2,0,0 + FILEVERSION 0,91,0,0 + PRODUCTVERSION 0,91,0,0 BEGIN BLOCK "StringFileInfo" BEGIN diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 4b4c8c678..8ac87dadd 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -71,7 +71,7 @@ #include "helper/action-context.h" #include "helper/sp-marshal.h" -static Inkscape::Application *inkscape = NULL; +static InkscapeApplication *inkscape = NULL; /* Backbones of configuration xml data */ #include "menus-skeleton.h" @@ -99,16 +99,10 @@ enum { # FORWARD DECLARATIONS ################################*/ -namespace Inkscape { -struct ApplicationClass; -} - -static void inkscape_class_init (Inkscape::ApplicationClass *klass); -static void inkscape_init (SPObject *object); static void inkscape_dispose (GObject *object); -static void inkscape_activate_desktop_private (Inkscape::Application *inkscape, SPDesktop *desktop); -static void inkscape_deactivate_desktop_private (Inkscape::Application *inkscape, SPDesktop *desktop); +static void inkscape_activate_desktop_private (InkscapeApplication *inkscape, SPDesktop *desktop); +static void inkscape_deactivate_desktop_private (InkscapeApplication *inkscape, SPDesktop *desktop); class AppSelectionModel { Inkscape::LayerModel _layer_model; @@ -126,7 +120,7 @@ public: Inkscape::Selection *getSelection() const { return _selection; } }; -struct Inkscape::Application { +struct InkscapeApplication { GObject object; Inkscape::XML::Document *menus; std::map<SPDocument *, int> document_set; @@ -140,26 +134,25 @@ struct Inkscape::Application { guint trackalt; }; -struct Inkscape::ApplicationClass { +struct InkscapeApplicationClass { GObjectClass object_class; /* Signals */ - void (* change_selection) (Inkscape::Application * inkscape, Inkscape::Selection * selection); - void (* change_subselection) (Inkscape::Application * inkscape, SPDesktop *desktop); - void (* modify_selection) (Inkscape::Application * inkscape, Inkscape::Selection * selection, guint flags); - void (* set_selection) (Inkscape::Application * inkscape, Inkscape::Selection * selection); - void (* set_eventcontext) (Inkscape::Application * inkscape, Inkscape::UI::Tools::ToolBase * eventcontext); - void (* activate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); - void (* deactivate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); - void (* destroy_document) (Inkscape::Application *inkscape, SPDocument *doc); - void (* color_set) (Inkscape::Application *inkscape, SPColor *color, double opacity); - void (* shut_down) (Inkscape::Application *inkscape); - void (* dialogs_hide) (Inkscape::Application *inkscape); - void (* dialogs_unhide) (Inkscape::Application *inkscape); - void (* external_change) (Inkscape::Application *inkscape); + void (* change_selection) (InkscapeApplication * inkscape, Inkscape::Selection * selection); + void (* change_subselection) (InkscapeApplication * inkscape, SPDesktop *desktop); + void (* modify_selection) (InkscapeApplication * inkscape, Inkscape::Selection * selection, guint flags); + void (* set_selection) (InkscapeApplication * inkscape, Inkscape::Selection * selection); + void (* set_eventcontext) (InkscapeApplication * inkscape, Inkscape::UI::Tools::ToolBase * eventcontext); + void (* activate_desktop) (InkscapeApplication * inkscape, SPDesktop * desktop); + void (* deactivate_desktop) (InkscapeApplication * inkscape, SPDesktop * desktop); + void (* destroy_document) (InkscapeApplication *inkscape, SPDocument *doc); + void (* color_set) (InkscapeApplication *inkscape, SPColor *color, double opacity); + void (* shut_down) (InkscapeApplication *inkscape); + void (* dialogs_hide) (InkscapeApplication *inkscape); + void (* dialogs_unhide) (InkscapeApplication *inkscape); + void (* external_change) (InkscapeApplication *inkscape); }; -static GObjectClass * parent_class; static guint inkscape_signals[LAST_SIGNAL] = {0}; static void (* segv_handler) (int) = SIG_DFL; @@ -175,48 +168,21 @@ static void (* bus_handler) (int) = SIG_DFL; #define INKSCAPE_LEGACY_PROFILE_DIR ".inkscape" #define MENUS_FILE "menus.xml" - -/** - * Retrieves the GType for the Inkscape Application object. - */ -GType -inkscape_get_type (void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof (Inkscape::ApplicationClass), - NULL, NULL, - (GClassInitFunc) inkscape_class_init, - NULL, NULL, - sizeof (Inkscape::Application), - 4, - (GInstanceInitFunc) inkscape_init, - NULL - }; - type = g_type_register_static (G_TYPE_OBJECT, "Inkscape_Application", &info, (GTypeFlags)0); - } - return type; -} - +G_DEFINE_TYPE(InkscapeApplication, inkscape, G_TYPE_OBJECT); /** * Initializes the inkscape class, registering all of its signal handlers * and virtual functions */ static void -inkscape_class_init (Inkscape::ApplicationClass * klass) +inkscape_class_init (InkscapeApplicationClass * klass) { - GObjectClass * object_class; - - object_class = (GObjectClass *) klass; - - parent_class = (GObjectClass *)g_type_class_peek_parent (klass); + GObjectClass * object_class = G_OBJECT_CLASS(klass); inkscape_signals[MODIFY_SELECTION] = g_signal_new ("modify_selection", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, modify_selection), + G_STRUCT_OFFSET (InkscapeApplicationClass, modify_selection), NULL, NULL, sp_marshal_VOID__POINTER_UINT, G_TYPE_NONE, 2, @@ -224,7 +190,7 @@ inkscape_class_init (Inkscape::ApplicationClass * klass) inkscape_signals[CHANGE_SELECTION] = g_signal_new ("change_selection", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, change_selection), + G_STRUCT_OFFSET (InkscapeApplicationClass, change_selection), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, @@ -232,7 +198,7 @@ inkscape_class_init (Inkscape::ApplicationClass * klass) inkscape_signals[CHANGE_SUBSELECTION] = g_signal_new ("change_subselection", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, change_subselection), + G_STRUCT_OFFSET (InkscapeApplicationClass, change_subselection), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, @@ -240,7 +206,7 @@ inkscape_class_init (Inkscape::ApplicationClass * klass) inkscape_signals[SET_SELECTION] = g_signal_new ("set_selection", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, set_selection), + G_STRUCT_OFFSET (InkscapeApplicationClass, set_selection), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, @@ -248,7 +214,7 @@ inkscape_class_init (Inkscape::ApplicationClass * klass) inkscape_signals[SET_EVENTCONTEXT] = g_signal_new ("set_eventcontext", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, set_eventcontext), + G_STRUCT_OFFSET (InkscapeApplicationClass, set_eventcontext), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, @@ -256,7 +222,7 @@ inkscape_class_init (Inkscape::ApplicationClass * klass) inkscape_signals[ACTIVATE_DESKTOP] = g_signal_new ("activate_desktop", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, activate_desktop), + G_STRUCT_OFFSET (InkscapeApplicationClass, activate_desktop), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, @@ -264,7 +230,7 @@ inkscape_class_init (Inkscape::ApplicationClass * klass) inkscape_signals[DEACTIVATE_DESKTOP] = g_signal_new ("deactivate_desktop", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, deactivate_desktop), + G_STRUCT_OFFSET (InkscapeApplicationClass, deactivate_desktop), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, @@ -272,28 +238,28 @@ inkscape_class_init (Inkscape::ApplicationClass * klass) inkscape_signals[SHUTDOWN_SIGNAL] = g_signal_new ("shut_down", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, shut_down), + G_STRUCT_OFFSET (InkscapeApplicationClass, shut_down), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); inkscape_signals[DIALOGS_HIDE] = g_signal_new ("dialogs_hide", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, dialogs_hide), + G_STRUCT_OFFSET (InkscapeApplicationClass, dialogs_hide), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); inkscape_signals[DIALOGS_UNHIDE] = g_signal_new ("dialogs_unhide", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, dialogs_unhide), + G_STRUCT_OFFSET (InkscapeApplicationClass, dialogs_unhide), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); inkscape_signals[EXTERNAL_CHANGE] = g_signal_new ("external_change", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (Inkscape::ApplicationClass, external_change), + G_STRUCT_OFFSET (InkscapeApplicationClass, external_change), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -494,10 +460,10 @@ void inkscape_autosave_init() static void -inkscape_init (SPObject * object) +inkscape_init (InkscapeApplication * object) { if (!inkscape) { - inkscape = (Inkscape::Application *) object; + inkscape = (InkscapeApplication *) object; } else { g_assert_not_reached (); } @@ -515,7 +481,7 @@ inkscape_init (SPObject * object) static void inkscape_dispose (GObject *object) { - Inkscape::Application *inkscape = (Inkscape::Application *) object; + InkscapeApplication *inkscape = (InkscapeApplication *) object; g_assert (!inkscape->desktops); @@ -530,7 +496,7 @@ inkscape_dispose (GObject *object) inkscape->selection_models.~map(); inkscape->document_set.~map(); - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (inkscape_parent_class)->dispose (object); gtk_main_quit (); } @@ -580,14 +546,14 @@ void inkscape_trackalt(guint trackvalue) static void -inkscape_activate_desktop_private (Inkscape::Application */*inkscape*/, SPDesktop *desktop) +inkscape_activate_desktop_private (InkscapeApplication */*inkscape*/, SPDesktop *desktop) { desktop->set_active (true); } static void -inkscape_deactivate_desktop_private (Inkscape::Application */*inkscape*/, SPDesktop *desktop) +inkscape_deactivate_desktop_private (InkscapeApplication */*inkscape*/, SPDesktop *desktop) { desktop->set_active (false); } @@ -835,7 +801,7 @@ private: void inkscape_application_init (const gchar *argv0, gboolean use_gui) { - inkscape = (Inkscape::Application *)g_object_new (SP_TYPE_INKSCAPE, NULL); + inkscape = (InkscapeApplication *)g_object_new (SP_TYPE_INKSCAPE, NULL); /* fixme: load application defaults */ segv_handler = signal (SIGSEGV, inkscape_crash_handler); @@ -904,9 +870,9 @@ inkscape_application_init (const gchar *argv0, gboolean use_gui) } /** - * Returns the current Inkscape::Application global object + * Returns the current InkscapeApplication global object */ -Inkscape::Application * +InkscapeApplication * inkscape_get_instance() { return inkscape; @@ -921,7 +887,7 @@ gboolean inkscape_use_gui() * Menus management * */ -bool inkscape_load_menus( Inkscape::Application * inkscape ) +bool inkscape_load_menus( InkscapeApplication * inkscape ) { gchar *fn = profile_path(MENUS_FILE); gchar *menus_xml = 0; @@ -1391,7 +1357,7 @@ inkscape_action_context_for_document(SPDocument *doc) #####################*/ void -inkscape_refresh_display (Inkscape::Application *inkscape) +inkscape_refresh_display (InkscapeApplication *inkscape) { for (GSList *l = inkscape->desktops; l != NULL; l = l->next) { (static_cast<Inkscape::UI::View::View*>(l->data))->requestRedraw(); @@ -1404,7 +1370,7 @@ inkscape_refresh_display (Inkscape::Application *inkscape) * saves the preferences if appropriate, and quits. */ void -inkscape_exit (Inkscape::Application */*inkscape*/) +inkscape_exit (InkscapeApplication */*inkscape*/) { g_assert (INKSCAPE); @@ -1546,7 +1512,7 @@ profile_path(const char *filename) } Inkscape::XML::Node * -inkscape_get_menus (Inkscape::Application * inkscape) +inkscape_get_menus (InkscapeApplication * inkscape) { Inkscape::XML::Node *repr = inkscape->menus->root(); g_assert (!(strcmp (repr->name(), "inkscape"))); diff --git a/src/inkscape.h b/src/inkscape.h index 823e7524f..3a9b85fc9 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -28,9 +28,10 @@ class ToolBase; } } +struct InkscapeApplication; + namespace Inkscape { class ActionContext; - struct Application; namespace XML { class Node; struct Document; @@ -46,11 +47,11 @@ void inkscape_application_init (const gchar *argv0, gboolean use_gui); bool inkscape_load_config (const gchar *filename, Inkscape::XML::Document *config, const gchar *skeleton, unsigned int skel_size, const gchar *e_notreg, const gchar *e_notxml, const gchar *e_notsp, const gchar *warn); /* Menus */ -bool inkscape_load_menus (Inkscape::Application * inkscape); -bool inkscape_save_menus (Inkscape::Application * inkscape); -Inkscape::XML::Node *inkscape_get_menus (Inkscape::Application * inkscape); +bool inkscape_load_menus (InkscapeApplication * inkscape); +bool inkscape_save_menus (InkscapeApplication * inkscape); +Inkscape::XML::Node *inkscape_get_menus (InkscapeApplication * inkscape); -Inkscape::Application *inkscape_get_instance(); +InkscapeApplication *inkscape_get_instance(); gboolean inkscape_use_gui(); bool inkscapeIsCrashing(); @@ -108,13 +109,13 @@ bool inkscape_remove_document (SPDocument *document); * fixme: This has to be rethought */ -void inkscape_refresh_display (Inkscape::Application *inkscape); +void inkscape_refresh_display (InkscapeApplication *inkscape); /* * fixme: This also */ -void inkscape_exit (Inkscape::Application *inkscape); +void inkscape_exit (InkscapeApplication *inkscape); #endif diff --git a/src/inkscape.rc b/src/inkscape.rc index 2c2c0112b..689653f74 100644 --- a/src/inkscape.rc +++ b/src/inkscape.rc @@ -3,8 +3,8 @@ APPLICATION_ICON ICON DISCARDABLE "../inkscape.ico" 1 24 DISCARDABLE "./inkscape-manifest.xml" 1 VERSIONINFO - FILEVERSION 0,91pre2,0,0 - PRODUCTVERSION 0,91pre2,0,0 + FILEVERSION 0,91,0,0 + PRODUCTVERSION 0,91,0,0 BEGIN BLOCK "StringFileInfo" BEGIN diff --git a/src/inkview.cpp b/src/inkview.cpp index 82bd08e34..2969bb140 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -62,7 +62,7 @@ #include "inkscape-private.h" -Inkscape::Application *inkscape; +InkscapeApplication *inkscape; #include <iostream> @@ -232,7 +232,7 @@ main (int argc, const char **argv) ss.view = NULL; ss.fullscreen = false; - inkscape = (Inkscape::Application *)g_object_new (SP_TYPE_INKSCAPE, NULL); + inkscape = (InkscapeApplication *)g_object_new (SP_TYPE_INKSCAPE, NULL); // starting at where the commandline options stopped parsing because // we want all the files to be in the list @@ -570,16 +570,6 @@ static void usage() exit(1); } -#ifdef XXX -/* TODO !!! make this temporary stub unnecessary */ -Inkscape::Application *inkscape_get_instance() { return NULL; } -void inkscape_ref (void) {} -void inkscape_unref (void) {} -void inkscape_add_document (SPDocument *document) {} -void inkscape_remove_document (SPDocument *document) {} -#endif - - /* Local Variables: mode:c++ diff --git a/src/inkview.rc b/src/inkview.rc index efbe2568b..43a63c725 100644 --- a/src/inkview.rc +++ b/src/inkview.rc @@ -3,8 +3,8 @@ APPLICATION_ICON ICON DISCARDABLE "../inkscape.ico" 1 24 DISCARDABLE "./inkview-manifest.xml" 1 VERSIONINFO - FILEVERSION 0,91pre2,0,0 - PRODUCTVERSION 0,91pre2,0,0 + FILEVERSION 0,91,0,0 + PRODUCTVERSION 0,91,0,0 BEGIN BLOCK "StringFileInfo" BEGIN diff --git a/src/interface.cpp b/src/interface.cpp index e47cff598..9f7ee52cd 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -149,7 +149,7 @@ static void injectRenamedIcons(); static const int MIN_ONSCREEN_DISTANCE = 50; void -sp_create_window(SPViewWidget *vw, gboolean editable) +sp_create_window(SPViewWidget *vw, bool editable) { g_return_if_fail(vw != NULL); g_return_if_fail(SP_IS_VIEW_WIDGET(vw)); diff --git a/src/interface.h b/src/interface.h index a4eedf9db..6fb74046f 100644 --- a/src/interface.h +++ b/src/interface.h @@ -17,13 +17,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif +//#ifdef HAVE_CONFIG_H +//# include <config.h> +//#endif #include <gtkmm/menu.h> @@ -50,7 +46,7 @@ class View; /** * Create a new document window. */ -void sp_create_window (SPViewWidget *vw, gboolean editable); +void sp_create_window (SPViewWidget *vw, bool editable); /** * \param widget unused @@ -87,15 +83,15 @@ unsigned int sp_ui_close_all (void); GtkWidget *sp_ui_main_menubar (Inkscape::UI::View::View *view); void sp_menu_append_recent_documents (GtkWidget *menu); -void sp_ui_dialog_title_string (Inkscape::Verb * verb, gchar* c); +void sp_ui_dialog_title_string (Inkscape::Verb * verb, char* c); Glib::ustring getLayoutPrefPath( Inkscape::UI::View::View *view ); /** * */ -void sp_ui_error_dialog (const gchar * message); -bool sp_ui_overwrite_file (const gchar * filename); +void sp_ui_error_dialog (char const* message); +bool sp_ui_overwrite_file (char const* filename); /** diff --git a/src/isinf.h b/src/isinf.h index b4c56f79d..8d590b972 100644 --- a/src/isinf.h +++ b/src/isinf.h @@ -2,7 +2,7 @@ #define __ISINF_H__ /* - * Fix for missing std::isnormal with SOLARIS8/GCC3.2 + * Fix for missing std::isinf with SOLARIS8/GCC3.2 */ #if defined (SOLARIS) diff --git a/src/isnormal.h b/src/isnormal.h deleted file mode 100644 index d53105926..000000000 --- a/src/isnormal.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __ISNORMAL_H__ -#define __ISNORMAL_H__ - -/* - * Fix for missing std::isnormal with SOLARIS8/GCC3.2 - */ - -#if defined (SOLARIS) - - #include <ieeefp.h> - #define isnormal(x) (fpclass(x) >= FP_NZERO) - -#else - - using std::isnormal; - -#endif - -#endif /* __ISNORMAL_H__ */ diff --git a/src/knot-holder-entity.h b/src/knot-holder-entity.h index dde60f515..43ab25e5c 100644 --- a/src/knot-holder-entity.h +++ b/src/knot-holder-entity.h @@ -14,11 +14,11 @@ * Released under GNU GPL */ -#include <glib.h> -#include "knot.h" #include <2geom/forward.h> -#include "snapper.h" + #include "display/sp-canvas-item.h" +#include "knot.h" +#include "snapper.h" class SPItem; class SPKnot; @@ -31,7 +31,7 @@ namespace LivePathEffect { } // namespace LivePathEffect } // namespace Inkscape -typedef void (* SPKnotHolderSetFunc) (SPItem *item, Geom::Point const &p, Geom::Point const &origin, guint state); +typedef void (* SPKnotHolderSetFunc) (SPItem *item, Geom::Point const &p, Geom::Point const &origin, unsigned int state); typedef Geom::Point (* SPKnotHolderGetFunc) (SPItem *item); /** @@ -50,22 +50,22 @@ public: virtual void create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, Inkscape::ControlType type = Inkscape::CTRL_TYPE_UNKNOWN, - const gchar *tip = "", + char const*tip = "", SPKnotShapeType shape = SP_KNOT_SHAPE_DIAMOND, SPKnotModeType mode = SP_KNOT_MODE_XOR, guint32 color = 0xffffff00); /* the get/set/click handlers are virtual functions; each handler class for a knot should be derived from KnotHolderEntity and override these functions */ - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) = 0; + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state) = 0; virtual Geom::Point knot_get() const = 0; - virtual void knot_click(guint /*state*/) {} + virtual void knot_click(unsigned int /*state*/) {} void update_knot(); //private: - Geom::Point snap_knot_position(Geom::Point const &p, guint state); - Geom::Point snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint, guint state); + Geom::Point snap_knot_position(Geom::Point const &p, unsigned int state); + Geom::Point snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint, unsigned int state); SPKnot *knot; SPItem *item; @@ -77,11 +77,11 @@ public: static int counter; /** Connection to \a knot's "moved" signal. */ - guint handler_id; + unsigned int handler_id; /** Connection to \a knot's "clicked" signal. */ - guint _click_handler_id; + unsigned int _click_handler_id; /** Connection to \a knot's "ungrabbed" signal. */ - guint _ungrab_handler_id; + unsigned int _ungrab_handler_id; private: sigc::connection _moved_connection; @@ -103,7 +103,7 @@ class PatternKnotHolderEntityXY : public KnotHolderEntity { public: PatternKnotHolderEntityXY(bool fill) : KnotHolderEntity(), _fill(fill) {} virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); private: // true if the entity tracks fill, false for stroke bool _fill; @@ -113,7 +113,7 @@ class PatternKnotHolderEntityAngle : public KnotHolderEntity { public: PatternKnotHolderEntityAngle(bool fill) : KnotHolderEntity(), _fill(fill) {} virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); private: bool _fill; }; @@ -122,7 +122,7 @@ class PatternKnotHolderEntityScale : public KnotHolderEntity { public: PatternKnotHolderEntityScale(bool fill) : KnotHolderEntity(), _fill(fill) {} virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); private: bool _fill; }; diff --git a/src/knot.cpp b/src/knot.cpp index 6205af26a..49b4dbb54 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -28,6 +28,7 @@ #include "message-stack.h" #include "message-context.h" #include "ui/tools/tool-base.h" +#include <gtk/gtk.h> using Inkscape::DocumentUndo; diff --git a/src/knot.h b/src/knot.h index b18f89566..e3ad98e66 100644 --- a/src/knot.h +++ b/src/knot.h @@ -14,18 +14,20 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gdk/gdk.h> #include <2geom/point.h> -#include "knot-enums.h" -#include <stddef.h> #include <sigc++/sigc++.h> + +#include "knot-enums.h" #include "enums.h" -#include <gtk/gtk.h> -#include "sp-item.h" class SPDesktop; +class SPItem; struct SPCanvasItem; +typedef struct _GdkCursor GdkCursor; +typedef union _GdkEvent GdkEvent; +typedef unsigned int guint32; + #define SP_KNOT(obj) (dynamic_cast<SPKnot*>(static_cast<SPKnot*>(obj))) #define SP_IS_KNOT(obj) (dynamic_cast<const SPKnot*>(static_cast<const SPKnot*>(obj)) != NULL) @@ -38,19 +40,17 @@ struct SPCanvasItem; */ class SPKnot { public: - SPKnot(SPDesktop *desktop, gchar const *tip); + SPKnot(SPDesktop *desktop, char const *tip); virtual ~SPKnot(); - - int ref_count; - + int ref_count; // FIXME encapsulation SPDesktop *desktop; /**< Desktop we are on. */ SPCanvasItem *item; /**< Our CanvasItem. */ SPItem *owner; /**< Optional Owner Item */ - guint flags; + unsigned int flags; - guint size; /**< Always square. */ + unsigned int size; /**< Always square. */ Geom::Point pos; /**< Our desktop coordinates. */ Geom::Point grabbed_rel_pos; /**< Grabbed relative position. */ Geom::Point drag_origin; /**< Origin of drag. */ @@ -61,39 +61,41 @@ public: guint32 fill[SP_KNOT_VISIBLE_STATES]; guint32 stroke[SP_KNOT_VISIBLE_STATES]; - guchar *image[SP_KNOT_VISIBLE_STATES]; + unsigned char *image[SP_KNOT_VISIBLE_STATES]; GdkCursor *cursor[SP_KNOT_VISIBLE_STATES]; GdkCursor *saved_cursor; - gpointer pixbuf; + void* pixbuf; - gchar *tip; + char *tip; - gulong _event_handler_id; + unsigned long _event_handler_id; double pressure; /**< The tablet pen pressure when the knot is being dragged. */ - sigc::signal<void, SPKnot *, guint> click_signal; - sigc::signal<void, SPKnot*, guint> doubleclicked_signal; - sigc::signal<void, SPKnot*, guint> grabbed_signal; - sigc::signal<void, SPKnot *, guint> ungrabbed_signal; - sigc::signal<void, SPKnot *, Geom::Point const &, guint> moved_signal; + // FIXME: signals should NOT need to emit the object they came from, the callee should + // be able to figure that out + sigc::signal<void, SPKnot *, unsigned int> click_signal; + sigc::signal<void, SPKnot*, unsigned int> doubleclicked_signal; + sigc::signal<void, SPKnot*, unsigned int> grabbed_signal; + sigc::signal<void, SPKnot *, unsigned int> ungrabbed_signal; + sigc::signal<void, SPKnot *, Geom::Point const &, unsigned int> moved_signal; sigc::signal<bool, SPKnot*, GdkEvent*> event_signal; - sigc::signal<bool, SPKnot*, Geom::Point*, guint> request_signal; + sigc::signal<bool, SPKnot*, Geom::Point*, unsigned int> request_signal; //TODO: all the members above should eventualle become private, accessible via setters/getters - void setSize(guint i); - void setShape(guint i); - void setAnchor(guint i); - void setMode(guint i); - void setPixbuf(gpointer p); + void setSize(unsigned int i); + void setShape(unsigned int i); + void setAnchor(unsigned int i); + void setMode(unsigned int i); + void setPixbuf(void* p); void setFill(guint32 normal, guint32 mouseover, guint32 dragging); void setStroke(guint32 normal, guint32 mouseover, guint32 dragging); - void setImage(guchar* normal, guchar* mouseover, guchar* dragging); + void setImage(unsigned char* normal, unsigned char* mouseover, unsigned char* dragging); void setCursor(GdkCursor* normal, GdkCursor* mouseover, GdkCursor* dragging); @@ -110,7 +112,7 @@ public: /** * Set flag in knot, with side effects. */ - void setFlag(guint flag, bool set); + void setFlag(unsigned int flag, bool set); /** * Update knot's pixbuf and set its control state. @@ -120,17 +122,17 @@ public: /** * Request or set new position for knot. */ - void requestPosition(Geom::Point const &pos, guint state); + void requestPosition(Geom::Point const &pos, unsigned int state); /** * Update knot for dragging and tell canvas an item was grabbed. */ - void startDragging(Geom::Point const &p, gint x, gint y, guint32 etime); + void startDragging(Geom::Point const &p, int x, int y, guint32 etime); /** * Move knot to new position and emits "moved" signal. */ - void setPosition(Geom::Point const &p, guint state); + void setPosition(Geom::Point const &p, unsigned int state); /** * Move knot to new position, without emitting a MOVED signal. diff --git a/src/knotholder.h b/src/knotholder.h index dc2300105..d33adb610 100644 --- a/src/knotholder.h +++ b/src/knotholder.h @@ -17,7 +17,6 @@ * */ -#include <glib.h> #include <2geom/forward.h> #include <list> #include <sigc++/connection.h> @@ -47,9 +46,9 @@ public: void update_knots(); - void knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state); - void knot_clicked_handler(SPKnot *knot, guint state); - void knot_ungrabbed_handler(SPKnot *knot, guint); + void knot_moved_handler(SPKnot *knot, Geom::Point const &p, unsigned int state); + void knot_clicked_handler(SPKnot *knot, unsigned int state); + void knot_ungrabbed_handler(SPKnot *knot, unsigned int); void add(KnotHolderEntity *e); @@ -76,7 +75,7 @@ protected: SPKnotHolderReleasedFunc released; - gboolean local_change; ///< if true, no need to recreate knotholder if repr was changed. + bool local_change; ///< if true, no need to recreate knotholder if repr was changed. bool dragging; diff --git a/src/layer-manager.h b/src/layer-manager.h index 1b69324d5..9eea68004 100644 --- a/src/layer-manager.h +++ b/src/layer-manager.h @@ -10,11 +10,12 @@ #ifndef SEEN_INKSCAPE_LAYER_MANAGER_H #define SEEN_INKSCAPE_LAYER_MANAGER_H +#include <vector> +#include <map> + #include "document-subset.h" #include "gc-finalized.h" #include "gc-soft-ptr.h" -#include <vector> -#include <map> class SPDesktop; class SPDocument; @@ -29,8 +30,8 @@ public: virtual ~LayerManager(); void setCurrentLayer( SPObject* obj ); - void renameLayer( SPObject* obj, gchar const *label, bool uniquify ); - Glib::ustring getNextLayerName( SPObject* obj, gchar const *label); + void renameLayer( SPObject* obj, char const *label, bool uniquify ); + Glib::ustring getNextLayerName( SPObject* obj, char const *label); sigc::connection connectCurrentLayerChanged(const sigc::slot<void, SPObject *> & slot) { return _layer_changed_signal.connect(slot); @@ -44,7 +45,7 @@ private: friend class LayerWatcher; class LayerWatcher; - void _objectModified( SPObject* obj, guint flags ); + void _objectModified( SPObject* obj, unsigned int flags ); void _setDocument(SPDocument *document); void _rebuild(); void _selectedLayerChanged(SPObject *layer); diff --git a/src/layer-model.h b/src/layer-model.h index 79b7fbe44..86aba63ef 100644 --- a/src/layer-model.h +++ b/src/layer-model.h @@ -22,12 +22,8 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stddef.h> #include <sigc++/sigc++.h> +#include <cstddef> class SPDocument; class SPObject; diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index 1b4d9d256..6f25ab5f9 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -2,8 +2,8 @@ #include <config.h> #endif -#include <gtkmm/treemodel.h> #include <gtkmm/liststore.h> +#include <gtkmm/treemodel.h> #include <libnrtype/font-instance.h> #include <libnrtype/TextWrapper.h> diff --git a/src/libnrtype/nr-type-primitives.cpp b/src/libnrtype/nr-type-primitives.cpp index 63a3abcc5..3ad4a3771 100644 --- a/src/libnrtype/nr-type-primitives.cpp +++ b/src/libnrtype/nr-type-primitives.cpp @@ -1,6 +1,4 @@ -#define __NR_TYPE_PRIMITIVES_C__ - -/* +/** * Typeface and script library * * Authors: @@ -12,26 +10,27 @@ /* This should be enough for approximately 10000 fonts */ #define NR_DICTSIZE 2777 -#include <stdlib.h> +#include <cstdlib> #include <string.h> #include <glib.h> + #include "nr-type-primitives.h" /** * An entry in a list of key->value pairs */ struct NRTDEntry { - NRTDEntry *next; - const gchar *key; - void *val; + NRTDEntry *next; + const gchar *key; + void *val; }; /** * Type Dictionary, consisting of size number of key-value entries */ struct NRTypeDict { - unsigned int size; - NRTDEntry **entries; + unsigned int size; + NRTDEntry **entries; }; static NRTDEntry *nr_td_entry_new (void); @@ -42,17 +41,17 @@ static NRTDEntry *nr_td_entry_new (void); void nr_name_list_release (NRNameList *list) { - if (list->destructor) { - list->destructor (list); - } + if (list->destructor) { + list->destructor (list); + } } void nr_style_list_release (NRStyleList *list) { - if (list->destructor) { - list->destructor (list); - } + if (list->destructor) { + list->destructor (list); + } } /** @@ -62,18 +61,18 @@ nr_style_list_release (NRStyleList *list) NRTypeDict * nr_type_dict_new (void) { - NRTypeDict *td; - int i; + NRTypeDict *td; + int i; - td = g_new (NRTypeDict, 1); + td = g_new (NRTypeDict, 1); - td->size = NR_DICTSIZE; - td->entries = g_new (NRTDEntry *, td->size); - for (i = 0; i < NR_DICTSIZE; i++) { - td->entries[i] = NULL; - } + td->size = NR_DICTSIZE; + td->entries = g_new (NRTDEntry *, td->size); + for (i = 0; i < NR_DICTSIZE; i++) { + td->entries[i] = NULL; + } - return td; + return td; } /** @@ -82,15 +81,15 @@ nr_type_dict_new (void) static unsigned int nr_str_hash (const gchar *p) { - unsigned int h; + unsigned int h; - h = *p; + h = *p; - if (h != 0) { - for (p += 1; *p; p++) h = (h << 5) - h + *p; - } + if (h != 0) { + for (p += 1; *p; p++) h = (h << 5) - h + *p; + } - return h; + return h; } /** @@ -99,25 +98,25 @@ nr_str_hash (const gchar *p) void nr_type_dict_insert (NRTypeDict *td, const gchar *key, void *val) { - if (key) { - NRTDEntry *tde; - unsigned int hval; - - hval = nr_str_hash (key) % td->size; - - for (tde = td->entries[hval]; tde; tde = tde->next) { - if (!strcmp (key, tde->key)) { - tde->val = val; - return; - } - } - - tde = nr_td_entry_new (); - tde->next = td->entries[hval]; - tde->key = key; - tde->val = val; - td->entries[hval] = tde; - } + if (key) { + NRTDEntry *tde; + unsigned int hval; + + hval = nr_str_hash (key) % td->size; + + for (tde = td->entries[hval]; tde; tde = tde->next) { + if (!strcmp (key, tde->key)) { + tde->val = val; + return; + } + } + + tde = nr_td_entry_new (); + tde->next = td->entries[hval]; + tde->key = key; + tde->val = val; + td->entries[hval] = tde; + } } /** @@ -126,16 +125,16 @@ nr_type_dict_insert (NRTypeDict *td, const gchar *key, void *val) void * nr_type_dict_lookup (NRTypeDict *td, const gchar *key) { - if (key) { - NRTDEntry *tde; - unsigned int hval; - hval = nr_str_hash (key) % td->size; - for (tde = td->entries[hval]; tde; tde = tde->next) { - if (!strcmp (key, tde->key)) return tde->val; - } - } - - return NULL; + if (key) { + NRTDEntry *tde; + unsigned int hval; + hval = nr_str_hash (key) % td->size; + for (tde = td->entries[hval]; tde; tde = tde->next) { + if (!strcmp (key, tde->key)) return tde->val; + } + } + + return NULL; } #define NR_TDE_BLOCK_SIZE 32 @@ -148,20 +147,30 @@ static NRTDEntry *nr_tde_free_list; static NRTDEntry * nr_td_entry_new (void) { - NRTDEntry *tde; + NRTDEntry *tde; - if (!nr_tde_free_list) { - int i; - nr_tde_free_list = g_new (NRTDEntry, NR_TDE_BLOCK_SIZE); - for (i = 0; i < (NR_TDE_BLOCK_SIZE - 1); i++) { - nr_tde_free_list[i].next = nr_tde_free_list + i + 1; - } - nr_tde_free_list[i].next = NULL; - } + if (!nr_tde_free_list) { + int i; + nr_tde_free_list = g_new (NRTDEntry, NR_TDE_BLOCK_SIZE); + for (i = 0; i < (NR_TDE_BLOCK_SIZE - 1); i++) { + nr_tde_free_list[i].next = nr_tde_free_list + i + 1; + } + nr_tde_free_list[i].next = NULL; + } - tde = nr_tde_free_list; - nr_tde_free_list = tde->next; + tde = nr_tde_free_list; + nr_tde_free_list = tde->next; - return tde; + return tde; } +/* + 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/libnrtype/nr-type-primitives.h b/src/libnrtype/nr-type-primitives.h index 9bb181c4b..863803433 100644 --- a/src/libnrtype/nr-type-primitives.h +++ b/src/libnrtype/nr-type-primitives.h @@ -1,12 +1,12 @@ -#ifndef __NR_TYPE_PRIMITIVES_H__ -#define __NR_TYPE_PRIMITIVES_H__ +#ifndef SEEN_NR_TYPE_PRIMITIVES_H +#define SEEN_NR_TYPE_PRIMITIVES_H -/* +/** * Typeface and script library * * Authors: * Lauris Kaplinski <lauris@kaplinski.com> - * g++ port: Nathan Hurst <njh@mail.csse.monash.edu.au> + * c++ port: Nathan Hurst <njh@mail.csse.monash.edu.au> * * This code is in public domain */ @@ -47,4 +47,15 @@ void nr_type_dict_insert (NRTypeDict *td, const gchar *key, void *val); void *nr_type_dict_lookup (NRTypeDict *td, const gchar *key); -#endif +#endif // !SEEN_NR_TYPE_PRIMITIVES_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/line-geometry.h b/src/line-geometry.h index d7be9570c..a77d6e1f3 100644 --- a/src/line-geometry.h +++ b/src/line-geometry.h @@ -12,13 +12,14 @@ #ifndef SEEN_LINE_GEOMETRY_H #define SEEN_LINE_GEOMETRY_H +#include <2geom/point.h> #include <boost/optional.hpp> -#include "glib.h" + #include "axis-manip.h" // FIXME: This is only for Box3D::epsilon; move that to a better location -#include "2geom/point.h" #include "persp3d.h" class SPDesktop; +typedef unsigned int guint32; namespace Box3D { diff --git a/src/line-snapper.cpp b/src/line-snapper.cpp index 930b7fca9..6122b133a 100644 --- a/src/line-snapper.cpp +++ b/src/line-snapper.cpp @@ -11,9 +11,10 @@ */ #include <2geom/line.h> +#include <cassert> + #include "line-snapper.h" #include "snapped-line.h" -//#include <gtk/gtk.h> #include "snap.h" Inkscape::LineSnapper::LineSnapper(SnapManager *sm, Geom::Coord const d) : Snapper(sm, d) @@ -37,7 +38,7 @@ void Inkscape::LineSnapper::freeSnap(IntermSnapResults &isr, Geom::Point const p1 = i->second; // point at guide/grid line Geom::Point const p2 = p1 + Geom::rot90(i->first); // 2nd point at guide/grid line // std::cout << " line through " << i->second << " with normal " << i->first; - g_assert(i->first != Geom::Point(0,0)); // we cannot project on an linesegment of zero length + assert(i->first != Geom::Point(0,0)); // we cannot project on an linesegment of zero length Geom::Point const p_proj = Geom::projection(p.getPoint(), Geom::Line(p1, p2)); Geom::Coord const dist = Geom::L2(p_proj - p.getPoint()); diff --git a/src/line-snapper.h b/src/line-snapper.h index 4b165e0a5..b2fc3d389 100644 --- a/src/line-snapper.h +++ b/src/line-snapper.h @@ -12,10 +12,9 @@ #include "snapper.h" -namespace Inkscape -{ -class SnapCandidatePoint; +namespace Inkscape { +class SnapCandidatePoint; /** * Superclass for snappers to horizontal and vertical lines. diff --git a/src/livarot/PathStroke.cpp b/src/livarot/PathStroke.cpp index 50c335176..6ec7fa209 100644 --- a/src/livarot/PathStroke.cpp +++ b/src/livarot/PathStroke.cpp @@ -748,12 +748,12 @@ void Path::RecRound(Shape *dest, int sNo, int eNo, // start and end index } /* - Local Variables: -mode:c++ -c-file-style:"stroustrup" -c-file-offsets:((innamespace . 0)(inline-open . 0)) -indent-tabs-mode:nil -fill-column:99 -End: - */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : + 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/live_effects/Makefile_insert b/src/live_effects/Makefile_insert index f6e5125e3..f18dcdef0 100644 --- a/src/live_effects/Makefile_insert +++ b/src/live_effects/Makefile_insert @@ -38,6 +38,8 @@ ink_common_sources += \ live_effects/lpe-gears.h \ live_effects/lpe-interpolate.cpp \ live_effects/lpe-interpolate.h \ + live_effects/lpe-interpolate_points.cpp \ + live_effects/lpe-interpolate_points.h \ live_effects/lpe-test-doEffect-stack.cpp \ live_effects/lpe-test-doEffect-stack.h \ live_effects/lpe-bspline.cpp \ diff --git a/src/live_effects/effect-enum.h b/src/live_effects/effect-enum.h index 422b95910..c53f1a5b9 100644 --- a/src/live_effects/effect-enum.h +++ b/src/live_effects/effect-enum.h @@ -45,6 +45,7 @@ enum EffectType { RULER, BOOLOPS, INTERPOLATE, + INTERPOLATE_POINTS, TEXT_LABEL, PATH_LENGTH, LINE_SEGMENT, diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 4e1b4bffa..895408707 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -44,6 +44,7 @@ #include "live_effects/lpe-ruler.h" #include "live_effects/lpe-boolops.h" #include "live_effects/lpe-interpolate.h" +#include "live_effects/lpe-interpolate_points.h" #include "live_effects/lpe-text_label.h" #include "live_effects/lpe-path_length.h" #include "live_effects/lpe-line_segment.h" @@ -136,6 +137,7 @@ const Util::EnumData<EffectType> LPETypeData[] = { /* 0.91 */ {POWERSTROKE, N_("Power stroke"), "powerstroke"}, {CLONE_ORIGINAL, N_("Clone original path"), "clone_original"}, +/* EXPERIMENTAL */ {SHOW_HANDLES, N_("Show handles"), "show_handles"}, {ROUGHEN, N_("Roughen"), "roughen"}, {BSPLINE, N_("BSpline"), "bspline"}, @@ -151,6 +153,8 @@ const Util::EnumData<EffectType> LPETypeData[] = { {SIMPLIFY, N_("Simplify"), "simplify"}, {LATTICE2, N_("Lattice Deformation 2"), "lattice2"}, {ENVELOPE_PERSPECTIVE, N_("Envelope-Perspective"), "envelope-perspective"}, + {FILLET_CHAMFER, N_("Fillet/Chamfer"), "fillet-chamfer"}, + {INTERPOLATE_POINTS, N_("Interpolate points"), "interpolate_points"}, }; const Util::EnumDataConverter<EffectType> LPETypeConverter(LPETypeData, sizeof(LPETypeData)/sizeof(*LPETypeData)); @@ -247,6 +251,9 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) case INTERPOLATE: neweffect = static_cast<Effect*> ( new LPEInterpolate(lpeobj) ); break; + case INTERPOLATE_POINTS: + neweffect = static_cast<Effect*> ( new LPEInterpolatePoints(lpeobj) ); + break; case TEXT_LABEL: neweffect = static_cast<Effect*> ( new LPETextLabel(lpeobj) ); break; diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index a004b8490..433696aab 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -1,5 +1,3 @@ -#define INKSCAPE_LPE_BSPLINE_C - /* * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -8,23 +6,19 @@ # include <config.h> #endif -#if WITH_GLIBMM_2_32 && HAVE_GLIBMM_THREADS_H +#include <gtkmm.h> + +#if WITH_GLIBMM_2_32 # include <glibmm/threads.h> #endif -#include <2geom/bezier-curve.h> -#include <2geom/point.h> - -#include <gtkmm/box.h> -#include <gtkmm/entry.h> -#include <gtkmm/box.h> -#include <gtkmm/button.h> -#include <gtkmm/checkbutton.h> - #include <glib.h> #include <glibmm/i18n.h> + #include "display/curve.h" +#include <2geom/bezier-curve.h> +#include <2geom/point.h> #include "helper/geom-curves.h" #include "live_effects/lpe-bspline.h" #include "live_effects/lpeobject.h" @@ -48,8 +42,7 @@ #include "display/sp-canvas.h" #include <typeinfo> #include <vector> - -// For handling non-contiguous paths: +// For handling un-continuous paths: #include "message-stack.h" #include "inkscape.h" #include "desktop.h" diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 65bbcdad1..e466093d3 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -12,6 +12,7 @@ */ #include <glibmm/i18n.h> +#include <gdk/gdk.h> #include "live_effects/lpe-copy_rotate.h" #include "sp-shape.h" diff --git a/src/live_effects/lpe-envelope-perspective.cpp b/src/live_effects/lpe-envelope-perspective.cpp index 02cb67db3..3b91eb183 100644 --- a/src/live_effects/lpe-envelope-perspective.cpp +++ b/src/live_effects/lpe-envelope-perspective.cpp @@ -14,12 +14,11 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <gtkmm.h> #include "live_effects/lpe-envelope-perspective.h" #include "helper/geom.h" #include "display/curve.h" #include "svg/svg.h" -#include <gtkmm/separator.h> -#include <gtkmm/stock.h> #include <tools-switch.h> #include <gsl/gsl_linalg.h> #include "desktop.h" @@ -286,12 +285,20 @@ LPEEnvelopePerspective::newWidget() Gtk::Label* handles = Gtk::manage(new Gtk::Label(Glib::ustring(_("Handles:")),Gtk::ALIGN_START)); vbox->pack_start(*handles, false, false, 2); hboxUpHandles->pack_start(*widg, true, true, 2); +#if WITH_GTKMM_3_0 + hboxUpHandles->pack_start(*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_VERTICAL)), Gtk::PACK_EXPAND_WIDGET); +#else hboxUpHandles->pack_start(*Gtk::manage(new Gtk::VSeparator()), Gtk::PACK_EXPAND_WIDGET); +#endif }else if(param->param_key == "Up_Right_Point"){ hboxUpHandles->pack_start(*widg, true, true, 2); }else if(param->param_key == "Down_Left_Point"){ hboxDownHandles->pack_start(*widg, true, true, 2); +#if WITH_GTKMM_3_0 + hboxDownHandles->pack_start(*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_VERTICAL)), Gtk::PACK_EXPAND_WIDGET); +#else hboxDownHandles->pack_start(*Gtk::manage(new Gtk::VSeparator()), Gtk::PACK_EXPAND_WIDGET); +#endif }else{ hboxDownHandles->pack_start(*widg, true, true, 2); } @@ -320,8 +327,13 @@ LPEEnvelopePerspective::newWidget() } vbox->pack_start(*hboxUpHandles,true, true, 2); Gtk::HBox * hboxMiddle = Gtk::manage(new Gtk::HBox(true,2)); +#if WITH_GTKMM_3_0 + hboxMiddle->pack_start(*Gtk::manage(new Gtk::Separator()), Gtk::PACK_EXPAND_WIDGET); + hboxMiddle->pack_start(*Gtk::manage(new Gtk::Separator()), Gtk::PACK_EXPAND_WIDGET); +#else hboxMiddle->pack_start(*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_EXPAND_WIDGET); hboxMiddle->pack_start(*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_EXPAND_WIDGET); +#endif vbox->pack_start(*hboxMiddle, false, true, 2); vbox->pack_start(*hboxDownHandles, true, true, 2); Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false,0)); @@ -422,4 +434,4 @@ LPEEnvelopePerspective::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::v fill-column:99 End: */ -// vim: file_type=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/live_effects/lpe-interpolate_points.cpp b/src/live_effects/lpe-interpolate_points.cpp new file mode 100644 index 000000000..865b46ca7 --- /dev/null +++ b/src/live_effects/lpe-interpolate_points.cpp @@ -0,0 +1,94 @@ +/** \file + * LPE interpolate_points implementation + * Interpolates between knots of the input path. + */ +/* + * Authors: + * Johan Engelen + * + * Copyright (C) Johan Engelen 2014 <j.b.c.engelen@alumnus.utwente.nl> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "live_effects/lpe-interpolate_points.h" + +#include <2geom/path.h> + +#include "live_effects/lpe-powerstroke-interpolators.h" + +namespace Inkscape { +namespace LivePathEffect { + + +static const Util::EnumData<unsigned> InterpolatorTypeData[] = { + {Geom::Interpolate::INTERP_LINEAR , N_("Linear"), "Linear"}, + {Geom::Interpolate::INTERP_CUBICBEZIER , N_("CubicBezierFit"), "CubicBezierFit"}, + {Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN , N_("CubicBezierJohan"), "CubicBezierJohan"}, + {Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"}, + {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"} +}; +static const Util::EnumDataConverter<unsigned> InterpolatorTypeConverter(InterpolatorTypeData, sizeof(InterpolatorTypeData)/sizeof(*InterpolatorTypeData)); + + +LPEInterpolatePoints::LPEInterpolatePoints(LivePathEffectObject *lpeobject) + : Effect(lpeobject) + , interpolator_type( + _("Interpolator type:"), + _("Determines which kind of interpolator will be used to interpolate between stroke width along the path"), + "interpolator_type", InterpolatorTypeConverter, &wr, this, Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM) +{ + show_orig_path = false; + + registerParameter( dynamic_cast<Parameter *>(&interpolator_type) ); +} + +LPEInterpolatePoints::~LPEInterpolatePoints() +{ +} + + +Geom::PathVector +LPEInterpolatePoints::doEffect_path (Geom::PathVector const & path_in) +{ + Geom::PathVector path_out; + + std::auto_ptr<Geom::Interpolate::Interpolator> interpolator( Geom::Interpolate::Interpolator::create(static_cast<Geom::Interpolate::InterpolatorType>(interpolator_type.get_value())) ); + + for(Geom::PathVector::const_iterator path_it = path_in.begin(); path_it != path_in.end(); ++path_it) { + if (path_it->empty()) + continue; + + if (path_it->closed()) { + g_warning("Interpolate points LPE currently ignores whether path is closed or not."); + } + + std::vector<Geom::Point> pts; + pts.push_back(path_it->initialPoint()); + + for (Geom::Path::const_iterator it = path_it->begin(), e = path_it->end_default(); it != e; ++it) { + pts.push_back((*it).finalPoint()); + } + + Geom::Path path = interpolator->interpolateToPath(pts); + + path_out.push_back(path); + } + + return path_out; +} + + +} //namespace LivePathEffect +} /* namespace Inkscape */ + +/* + 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 : diff --git a/src/live_effects/lpe-interpolate_points.h b/src/live_effects/lpe-interpolate_points.h new file mode 100644 index 000000000..7a3364747 --- /dev/null +++ b/src/live_effects/lpe-interpolate_points.h @@ -0,0 +1,51 @@ +#ifndef INKSCAPE_LPE_INTERPOLATEPOINTS_H +#define INKSCAPE_LPE_INTERPOLATEPOINTS_H + +/** \file + * LPE interpolate_points implementation, see lpe-interpolate_points.cpp. + */ + +/* + * Authors: + * Johan Engelen + * + * Copyright (C) Johan Engelen 2014 <j.b.c.engelen@alumnus.utwente.nl> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "live_effects/parameter/enum.h" +#include "live_effects/effect.h" + +namespace Inkscape { +namespace LivePathEffect { + +class LPEInterpolatePoints : public Effect { +public: + LPEInterpolatePoints(LivePathEffectObject *lpeobject); + virtual ~LPEInterpolatePoints(); + + virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in); + +private: + EnumParam<unsigned> interpolator_type; + + LPEInterpolatePoints(const LPEInterpolatePoints&); + LPEInterpolatePoints& operator=(const LPEInterpolatePoints&); +}; + +} //namespace LivePathEffect +} //namespace Inkscape + +#endif // INKSCAPE_LPE_INTERPOLATEPOINTS_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 : diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 7e5006b3b..3876aa24b 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -22,6 +22,7 @@ #include "knotholder.h" #include <glibmm/i18n.h> +#include <gdk/gdk.h> #include <2geom/sbasis-to-bezier.h> #include <2geom/sbasis.h> diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp index c255f8665..9e21f5d25 100644 --- a/src/live_effects/lpe-perspective_path.cpp +++ b/src/live_effects/lpe-perspective_path.cpp @@ -10,17 +10,19 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ - +#include <gtkmm.h> #include <glibmm/i18n.h> #include "persp3d.h" //#include "transf_mat_3x4.h" #include "document.h" - +#include "document-private.h" #include "live_effects/lpe-perspective_path.h" +#include "live_effects/lpeobject.h" #include "sp-item-group.h" #include "knot-holder-entity.h" #include "knotholder.h" +#include "desktop.h" #include "inkscape.h" @@ -41,6 +43,7 @@ public: } // namespace PP +static Glib::ustring perspectiveID = _("First perspective"); LPEPerspectivePath::LPEPerspectivePath(LivePathEffectObject *lpeobject) : Effect(lpeobject), // initialise your parameters here: @@ -59,9 +62,18 @@ LPEPerspectivePath::LPEPerspectivePath(LivePathEffectObject *lpeobject) : concatenate_before_pwd2 = true; // don't split the path into its subpaths _provides_knotholder_entities = true; - - Persp3D *persp = persp3d_document_first_persp(inkscape_active_document()); + unapply = false; + Persp3D *persp = persp3d_document_first_persp(lpeobject->document); + if(persp == 0 ){ + char *msg = _("You need a BOX 3D object"); + Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, + Gtk::BUTTONS_OK, true); + dialog.run(); + unapply = true; + return; + } Proj::TransfMat3x4 pmat = persp->perspective_impl->tmat; + pmat = pmat * SP_ACTIVE_DESKTOP->doc2dt(); pmat.copy_tmat(tmat); } @@ -74,8 +86,50 @@ void LPEPerspectivePath::doBeforeEffect (SPLPEItem const* lpeitem) { original_bbox(lpeitem, true); + if(unapply){ + SP_LPE_ITEM(lpeitem)->removeCurrentPathEffect(false); + return; + } } +void LPEPerspectivePath::refresh(Gtk::Entry* perspective) { + perspectiveID = perspective->get_text(); + Persp3D *first = 0; + Persp3D *persp = 0; + for ( SPObject *child = this->lpeobj->document->getDefs()->firstChild(); child && !persp; child = child->getNext() ) { + if (SP_IS_PERSP3D(child) && first == 0) { + first = SP_PERSP3D(child); + } + if (SP_IS_PERSP3D(child) && strcmp(child->getId(), const_cast<const gchar *>(perspectiveID.c_str())) == 0) { + persp = SP_PERSP3D(child); + break; + } + } + if(first == 0 ){ + char *msg = _("You need a BOX 3D object"); + Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, + Gtk::BUTTONS_OK, true); + dialog.run(); + return; + } + if(persp == 0){ + persp = first; + char *msg = _("First perspective selected"); + Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, + Gtk::BUTTONS_OK, true); + dialog.run(); + perspectiveID = _("First perspective"); + }else{ + char *msg = _("Perspective changed"); + Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, + Gtk::BUTTONS_OK, true); + dialog.run(); + } + Proj::TransfMat3x4 pmat = persp->perspective_impl->tmat; + pmat = pmat * SP_ACTIVE_DESKTOP->doc2dt(); + pmat.copy_tmat(tmat); +}; + Geom::Piecewise<Geom::D2<Geom::SBasis> > LPEPerspectivePath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in) { @@ -91,7 +145,7 @@ LPEPerspectivePath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > cons Piecewise<SBasis> preimage[4]; //Geom::Point orig = Geom::Point(bounds_X.min(), bounds_Y.middle()); - //orig = Geom::Point(orig[X], sp_document_height(inkscape_active_document()) - orig[Y]); + //orig = Geom::Point(orig[X], sp_document_height(this->lpeobj->document) - orig[Y]); //double offset = uses_plane_xy ? boundingbox_X.extent() : 0.0; @@ -139,6 +193,49 @@ LPEPerspectivePath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > cons return output; } +Gtk::Widget * +LPEPerspectivePath::newWidget() +{ + // use manage here, because after deletion of Effect object, others might still be pointing to this widget. + Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox(Effect::newWidget()) ); + + vbox->set_border_width(5); + std::vector<Parameter *>::iterator it = param_vector.begin(); + while (it != param_vector.end()) { + if ((*it)->widget_is_visible) { + Parameter * param = *it; + Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget()); + Glib::ustring * tip = param->param_getTooltip(); + if (widg) { + vbox->pack_start(*widg, true, true, 2); + if (tip) { + widg->set_tooltip_text(*tip); + } else { + widg->set_tooltip_text(""); + widg->set_has_tooltip(false); + } + } + } + + ++it; + } + Gtk::HBox * perspectiveId = Gtk::manage(new Gtk::HBox(true,0)); + Gtk::Label* labelPerspective = Gtk::manage(new Gtk::Label("Perspective ID:", 0., 0.)); + Gtk::Entry* perspective = Gtk::manage(new Gtk::Entry()); + perspective->set_text(perspectiveID); + perspective->set_tooltip_text("Set the perspective ID to apply"); + perspectiveId->pack_start(*labelPerspective, true, true, 2); + perspectiveId->pack_start(*perspective, true, true, 2); + vbox->pack_start(*perspectiveId, true, true, 2); + Gtk::Button* apply3D = Gtk::manage(new Gtk::Button(Glib::ustring(_("Refresh perspective")))); + apply3D->set_alignment(0.0, 0.5); + apply3D->signal_clicked().connect(sigc::bind<Gtk::Entry*>(sigc::mem_fun(*this,&LPEPerspectivePath::refresh),perspective)); + Gtk::Widget* apply3DWidget = dynamic_cast<Gtk::Widget *>(apply3D); + apply3DWidget->set_tooltip_text("Refresh perspective"); + vbox->pack_start(*apply3DWidget, true, true,2); + return dynamic_cast<Gtk::Widget *>(vbox); +} + void LPEPerspectivePath::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { KnotHolderEntity *e = new PP::KnotHolderEntityOffset(this); e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, diff --git a/src/live_effects/lpe-perspective_path.h b/src/live_effects/lpe-perspective_path.h index a9ee004f9..6ccac4a51 100644 --- a/src/live_effects/lpe-perspective_path.h +++ b/src/live_effects/lpe-perspective_path.h @@ -38,6 +38,8 @@ public: virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in); + virtual void refresh(Gtk::Entry* perspective); + virtual Gtk::Widget * newWidget(); /* the knotholder entity classes must be declared friends */ friend class PP::KnotHolderEntityOffset; void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item); @@ -52,6 +54,7 @@ private: BoolParam uses_plane_xy; // there are all kinds of parameters. Check the /live_effects/parameter directory which types exist! + bool unapply; Geom::Point orig; LPEPerspectivePath(const LPEPerspectivePath&); diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h index f080b06e6..3cde0b4b3 100644 --- a/src/live_effects/lpe-powerstroke-interpolators.h +++ b/src/live_effects/lpe-powerstroke-interpolators.h @@ -28,7 +28,8 @@ enum InterpolatorType { INTERP_CUBICBEZIER, INTERP_CUBICBEZIER_JOHAN, INTERP_SPIRO, - INTERP_CUBICBEZIER_SMOOTH + INTERP_CUBICBEZIER_SMOOTH, + INTERP_CENTRIPETAL_CATMULLROM }; class Interpolator { @@ -206,7 +207,88 @@ private: }; -Interpolator* +// Quick mockup for testing the behavior for powerstroke controlpoint interpolation +class CentripetalCatmullRomInterpolator : public Interpolator { +public: + CentripetalCatmullRomInterpolator() {}; + virtual ~CentripetalCatmullRomInterpolator() {}; + + virtual Path interpolateToPath(std::vector<Point> const &points) const { + unsigned int n_points = points.size(); + + Geom::Path fit(points.front()); + + if (n_points < 3) return fit; // TODO special cases for 0,1 and 2 input points + + // return n_points-1 cubic segments + + // duplicate first point + fit.append(calc_bezier(points[0],points[0],points[1],points[2])); + + for (std::size_t i = 0; i < n_points-2; ++i) { + Point p0 = points[i]; + Point p1 = points[i+1]; + Point p2 = points[i+2]; + Point p3 = (i < n_points-3) ? points[i+3] : points[i+2]; + + fit.append(calc_bezier(p0, p1, p2, p3)); + } + + return fit; + }; + +private: + CubicBezier calc_bezier(Point p0, Point p1, Point p2, Point p3) const { + // create interpolating bezier between p1 and p2 + + // Part of the code comes from StackOverflow user eriatarka84 + // http://stackoverflow.com/a/23980479/2929337 + + // calculate time coords (deltas) of points + // the factor 0.25 can be generalized for other Catmull-Rom interpolation types + // see alpha in Yuksel et al. "On the Parameterization of Catmull-Rom Curves", + // --> http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf + double dt0 = powf(distanceSq(p0, p1), 0.25); + double dt1 = powf(distanceSq(p1, p2), 0.25); + double dt2 = powf(distanceSq(p2, p3), 0.25); + + + // safety check for repeated points + double eps = Geom::EPSILON; + if (dt1 < eps) + dt1 = 1.0; + if (dt0 < eps) + dt0 = dt1; + if (dt2 < eps) + dt2 = dt1; + + // compute tangents when parameterized in [t1,t2] + Point tan1 = (p1 - p0) / dt0 - (p2 - p0) / (dt0 + dt1) + (p2 - p1) / dt1; + Point tan2 = (p2 - p1) / dt1 - (p3 - p1) / (dt1 + dt2) + (p3 - p2) / dt2; + // rescale tangents for parametrization in [0,1] + tan1 *= dt1; + tan2 *= dt1; + + // create bezier from tangents (this is already in 2geom somewhere, or should be moved to it) + // the tangent of a bezier curve is: B'(t) = 3(1-t)^2 (b1 - b0) + 6(1-t)t(b2-b1) + 3t^2(b3-b2) + // So we have to make sure that B'(0) = tan1 and B'(1) = tan2, and we already know that b0=p1 and b3=p2 + // tan1 = B'(0) = 3 (b1 - p1) --> p1 + (tan1)/3 = b1 + // tan2 = B'(1) = 3 (p2 - b2) --> p2 - (tan2)/3 = b2 + + Point b0 = p1; + Point b1 = p1 + tan1 / 3; + Point b2 = p2 - tan2 / 3; + Point b3 = p2; + + return CubicBezier(b0, b1, b2, b3); + } + + CentripetalCatmullRomInterpolator(const CentripetalCatmullRomInterpolator&); + CentripetalCatmullRomInterpolator& operator=(const CentripetalCatmullRomInterpolator&); +}; + + +inline Interpolator* Interpolator::create(InterpolatorType type) { switch (type) { case INTERP_LINEAR: @@ -219,6 +301,8 @@ Interpolator::create(InterpolatorType type) { return new Geom::Interpolate::SpiroInterpolator(); case INTERP_CUBICBEZIER_SMOOTH: return new Geom::Interpolate::CubicBezierSmooth(); + case INTERP_CENTRIPETAL_CATMULLROM: + return new Geom::Interpolate::CentripetalCatmullRomInterpolator(); default: return new Geom::Interpolate::Linear(); } diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index f7516677d..b1951d978 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -194,7 +194,8 @@ static const Util::EnumData<unsigned> InterpolatorTypeData[] = { {Geom::Interpolate::INTERP_LINEAR , N_("Linear"), "Linear"}, {Geom::Interpolate::INTERP_CUBICBEZIER , N_("CubicBezierFit"), "CubicBezierFit"}, {Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN , N_("CubicBezierJohan"), "CubicBezierJohan"}, - {Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"} + {Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"}, + {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"} }; static const Util::EnumDataConverter<unsigned> InterpolatorTypeConverter(InterpolatorTypeData, sizeof(InterpolatorTypeData)/sizeof(*InterpolatorTypeData)); diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp index 9af849530..5f6acd6f4 100644 --- a/src/live_effects/lpe-roughen.cpp +++ b/src/live_effects/lpe-roughen.cpp @@ -2,9 +2,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gtkmm.h> - #include "live_effects/lpe-roughen.h" +#include <gtkmm/separator.h> + #include "display/curve.h" #include "live_effects/parameter/parameter.h" #include "helper/geom.h" @@ -82,7 +82,11 @@ Gtk::Widget *LPERoughen::newWidget() { Glib::ustring(_("<b>Roughen unit</b>")), Gtk::ALIGN_START)); unitLabel->set_use_markup(true); vbox->pack_start(*unitLabel, false, false, 2); +#if WITH_GTKMM_3_0 + vbox->pack_start(*Gtk::manage(new Gtk::Separator()), +#else vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()), +#endif Gtk::PACK_EXPAND_WIDGET); } if (param->param_key == "method") { @@ -91,7 +95,11 @@ Gtk::Widget *LPERoughen::newWidget() { Gtk::ALIGN_START)); methodLabel->set_use_markup(true); vbox->pack_start(*methodLabel, false, false, 2); +#if WITH_GTKMM_3_0 + vbox->pack_start(*Gtk::manage(new Gtk::Separator()), +#else vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()), +#endif Gtk::PACK_EXPAND_WIDGET); } if (param->param_key == "displaceX") { @@ -100,7 +108,11 @@ Gtk::Widget *LPERoughen::newWidget() { Gtk::ALIGN_START)); displaceXLabel->set_use_markup(true); vbox->pack_start(*displaceXLabel, false, false, 2); +#if WITH_GTKMM_3_0 + vbox->pack_start(*Gtk::manage(new Gtk::Separator()), +#else vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()), +#endif Gtk::PACK_EXPAND_WIDGET); } Glib::ustring *tip = param->param_getTooltip(); diff --git a/src/live_effects/lpeobject-reference.h b/src/live_effects/lpeobject-reference.h index b1ba1ee4e..374e715ec 100644 --- a/src/live_effects/lpeobject-reference.h +++ b/src/live_effects/lpeobject-reference.h @@ -9,10 +9,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information. */ -#include <uri-references.h> -#include <stddef.h> #include <sigc++/sigc++.h> +#include "uri-references.h" + namespace Inkscape { namespace XML { class Node; @@ -33,7 +33,7 @@ public: SPObject *owner; // concerning the LPEObject that is refered to: - gchar *lpeobject_href; + char *lpeobject_href; Inkscape::XML::Node *lpeobject_repr; LivePathEffectObject *lpeobject; diff --git a/src/live_effects/lpeobject.h b/src/live_effects/lpeobject.h index 9700024fe..2e62707e3 100644 --- a/src/live_effects/lpeobject.h +++ b/src/live_effects/lpeobject.h @@ -47,9 +47,9 @@ 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 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 diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index 47cdd27cc..1a32e04e7 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -8,13 +8,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "ui/dialog/lpe-fillet-chamfer-properties.h" +#include "live_effects/parameter/filletchamferpointarray.h" #include <2geom/piecewise.h> #include <2geom/sbasis-to-bezier.h> #include <2geom/sbasis-geometric.h> #include <gtkmm.h> -#include "ui/dialog/lpe-fillet-chamfer-properties.h" -#include "live_effects/parameter/filletchamferpointarray.h" #include "live_effects/effect.h" #include "svg/svg.h" #include "svg/stringstream.h" diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index 5658d238f..c5da8b858 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -5,10 +5,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gtkmm.h> +#include "ui/widget/registered-widget.h" #include <glibmm/i18n.h> -#include "ui/widget/registered-widget.h" #include "live_effects/parameter/togglebutton.h" #include "live_effects/effect.h" #include "svg/svg.h" @@ -75,7 +74,12 @@ ToggleButtonParam::param_newWidget() false, param_effect->getRepr(), param_effect->getSPDoc()) ); +#if GTK_CHECK_VERSION(3,0,0) + GtkWidget * boxButton = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_set_homogeneous(GTK_BOX(boxButton), false); +#else GtkWidget * boxButton = gtk_hbox_new (false, 0); +#endif GtkWidget * labelButton = gtk_label_new (""); if (!param_label.empty()) { if(value || inactiveLabel.empty()){ diff --git a/src/macros.h b/src/macros.h index b221ebdc2..cbb9bca78 100644 --- a/src/macros.h +++ b/src/macros.h @@ -1,7 +1,7 @@ -#ifndef __MACROS_H__ -#define __MACROS_H__ +#ifndef SEEN_MACROS_H +#define SEEN_MACROS_H -/* +/** * Useful macros for inkscape * * Author: @@ -12,6 +12,9 @@ * Released under GNU GPL */ +// I'm of the opinion that this file should be removed, so I will in the future take the necessary steps to wipe it out. +// Macros are not in general bad, but these particular ones are rather ugly. Especially that sp_round one. --Liam + #ifdef SP_MACROS_SILENT #define SP_PRINT_MATRIX(s,m) #define SP_PRINT_TRANSFORM(s,t) @@ -51,4 +54,4 @@ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/main-cmdlineact.h b/src/main-cmdlineact.h index fe11357fa..c8ef64f10 100644 --- a/src/main-cmdlineact.h +++ b/src/main-cmdlineact.h @@ -15,20 +15,18 @@ * Released under GNU GPL v2.x, read the file 'COPYING' for more information */ -#include <glib.h> - namespace Inkscape { class ActionContext; class CmdLineAction { bool _isVerb; - gchar * _arg; + char * _arg; static std::list <CmdLineAction *> _list; public: - CmdLineAction (bool isVerb, gchar const * arg); + CmdLineAction (bool isVerb, char const * arg); virtual ~CmdLineAction (); void doIt (ActionContext const & context); diff --git a/src/marker.cpp b/src/marker.cpp index 7fee16ead..a4cbc30ca 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -52,7 +52,7 @@ SPMarker::SPMarker() : SPGroup(), SPViewBox() { this->markerUnits = 0; this->markerUnits_set = 0; - this->orient_auto = 0; + this->orient_mode = MARKER_ORIENT_ANGLE; this->orient_set = 0; this->orient = 0; @@ -158,16 +158,20 @@ void SPMarker::set(unsigned int key, const gchar* value) { case SP_ATTR_ORIENT: this->orient_set = FALSE; - this->orient_auto = FALSE; + this->orient_mode = MARKER_ORIENT_ANGLE; this->orient = 0.0; if (value) { - if (!strcmp (value, "auto")) { - this->orient_auto = TRUE; - this->orient_set = TRUE; - } else if (sp_svg_number_read_f (value, &this->orient)) { - this->orient_set = TRUE; - } + if (!strcmp (value, "auto")) { + this->orient_mode = MARKER_ORIENT_AUTO; + this->orient_set = TRUE; + } else if (!strcmp (value, "auto-start-reverse")) { + this->orient_mode = MARKER_ORIENT_AUTO_START_REVERSE; + this->orient_set = TRUE; + } else if (sp_svg_number_read_f (value, &this->orient)) { + this->orient_mode = MARKER_ORIENT_ANGLE; + this->orient_set = TRUE; + } } this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -264,15 +268,17 @@ Inkscape::XML::Node* SPMarker::write(Inkscape::XML::Document *xml_doc, Inkscape: } if (this->orient_set) { - if (this->orient_auto) { - repr->setAttribute("orient", "auto"); - } else { - sp_repr_set_css_double(repr, "orient", this->orient); - } + if (this->orient_mode == MARKER_ORIENT_AUTO) { + repr->setAttribute("orient", "auto"); + } else if (this->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) { + repr->setAttribute("orient", "auto-start-reverse"); + } else { + sp_repr_set_css_double(repr, "orient", this->orient); + } } else { - repr->setAttribute("orient", NULL); + repr->setAttribute("orient", NULL); } - + /* fixme: */ //XML Tree being used directly here while it shouldn't be.... repr->setAttribute("viewBox", this->getRepr()->attribute("viewBox")); @@ -381,7 +387,10 @@ sp_marker_show_instance ( SPMarker *marker, Inkscape::DrawingItem *parent, } if (v->items[pos]) { Geom::Affine m; - if (marker->orient_auto) { + if (marker->orient_mode == MARKER_ORIENT_AUTO) { + m = base; + } else if (marker->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) { + m = Geom::Rotate::from_degrees( 180.0 ) * base; m = base; } else { /* fixme: Orient units (Lauris) */ diff --git a/src/marker.h b/src/marker.h index 585615476..b58523251 100644 --- a/src/marker.h +++ b/src/marker.h @@ -1,5 +1,5 @@ -#ifndef __SP_MARKER_H__ -#define __SP_MARKER_H__ +#ifndef SEEN_SP_MARKER_H +#define SEEN_SP_MARKER_H /* * SVG <marker> implementation @@ -12,7 +12,6 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ - /* * This is quite similar in logic to <svg> * Maybe we should merge them somehow (Lauris) @@ -26,12 +25,19 @@ struct SPMarkerView; #include <2geom/rect.h> #include <2geom/affine.h> -#include "svg/svg-length.h" + #include "enums.h" +#include "svg/svg-length.h" #include "sp-item-group.h" #include "uri-references.h" #include "viewbox.h" +enum markerOrient { + MARKER_ORIENT_ANGLE, + MARKER_ORIENT_AUTO, + MARKER_ORIENT_AUTO_START_REVERSE +}; + class SPMarker : public SPGroup, public SPViewBox { public: SPMarker(); @@ -51,7 +57,7 @@ public: /* orient */ unsigned int orient_set : 1; - unsigned int orient_auto : 1; + markerOrient orient_mode : 2; float orient; /* Private views */ @@ -87,7 +93,7 @@ Inkscape::DrawingItem *sp_marker_show_instance (SPMarker *marker, Inkscape::Draw unsigned int key, unsigned int pos, Geom::Affine const &base, float linewidth); void sp_marker_hide (SPMarker *marker, unsigned int key); -const gchar *generate_marker (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Point center, Geom::Affine move); +const char *generate_marker (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Point center, Geom::Affine move); SPObject *sp_marker_fork_if_necessary(SPObject *marker); #endif diff --git a/src/message-context.h b/src/message-context.h index a92874d68..ea86c4ec0 100644 --- a/src/message-context.h +++ b/src/message-context.h @@ -14,8 +14,9 @@ #ifndef SEEN_INKSCAPE_MESSAGE_CONTEXT_H #define SEEN_INKSCAPE_MESSAGE_CONTEXT_H -#include <stdarg.h> +#include <cstdarg> #include <glib.h> + #include "message.h" namespace Inkscape { @@ -48,7 +49,7 @@ public: * @param type the message type * @param message the message text */ - void set(MessageType type, gchar const *message); + void set(MessageType type, char const *message); /** @brief pushes a message on the stack using prinf-style formatting, * and replacing our old message @@ -56,7 +57,7 @@ public: * @param type the message type * @param format a printf-style formatting string */ - void setF(MessageType type, gchar const *format, ...) G_GNUC_PRINTF(3,4); + void setF(MessageType type, char const *format, ...) G_GNUC_PRINTF(3,4); /** @brief pushes a message on the stack using printf-style formatting, * and a stdarg argument list @@ -65,7 +66,7 @@ public: * @param format a printf-style formatting string * @param args printf-style arguments */ - void setVF(MessageType type, gchar const *format, va_list args); + void setVF(MessageType type, char const *format, va_list args); /** @brief pushes a message onto the stack for a brief period of time * without disturbing our "current" message @@ -73,7 +74,7 @@ public: * @param type the message type * @param message the message text */ - void flash(MessageType type, gchar const *message); + void flash(MessageType type, char const *message); /** @brief pushes a message onto the stack for a brief period of time * using printf-style formatting, without disturbing our current @@ -82,7 +83,7 @@ public: * @param type the message type * @param format a printf-style formatting string */ - void flashF(MessageType type, gchar const *format, ...) G_GNUC_PRINTF(3,4); + void flashF(MessageType type, char const *format, ...) G_GNUC_PRINTF(3,4); /** @brief pushes a message onto the stack for a brief period of time * using printf-style formatting and a stdarg argument list; @@ -92,7 +93,7 @@ public: * @param format a printf-style formatting string * @param args printf-style arguments */ - void flashVF(MessageType type, gchar const *format, va_list args); + void flashVF(MessageType type, char const *format, va_list args); /** @brief removes our current message from the stack */ void clear(); diff --git a/src/message-stack.h b/src/message-stack.h index 3b8307761..42bf4e8a7 100644 --- a/src/message-stack.h +++ b/src/message-stack.h @@ -16,11 +16,12 @@ #ifndef SEEN_INKSCAPE_MESSAGE_STACK_H #define SEEN_INKSCAPE_MESSAGE_STACK_H -#include <stddef.h> -#include <sigc++/sigc++.h> -#include <glib.h> -#include <stdarg.h> +#include <cstdarg> +#include <cstddef> +#include <glib.h> // G_GNUC_PRINTF is the only thing worth having from here #include <glibmm/ustring.h> +#include <sigc++/sigc++.h> + #include "gc-managed.h" #include "gc-finalized.h" #include "gc-anchored.h" @@ -61,14 +62,14 @@ public: /** @brief returns the text of the message currently at the top of * the stack */ - gchar const *currentMessage() { + char const *currentMessage() { return _messages ? _messages->message : NULL; } /** @brief connects to the "changed" signal which is emitted whenever * the topmost message on the stack changes. */ - sigc::connection connectChanged(sigc::slot<void, MessageType, gchar const *> slot) + sigc::connection connectChanged(sigc::slot<void, MessageType, char const *> slot) { return _changed_signal.connect(slot); } @@ -80,7 +81,7 @@ public: * * @return the id of the pushed message */ - MessageId push(MessageType type, gchar const *message); + MessageId push(MessageType type, char const *message); /** @brief pushes a message onto the stack using printf-like formatting * @@ -89,7 +90,7 @@ public: * * @return the id of the pushed message */ - MessageId pushF(MessageType type, gchar const *format, ...) G_GNUC_PRINTF(3,4); + MessageId pushF(MessageType type, char const *format, ...) G_GNUC_PRINTF(3,4); /** @brief pushes a message onto the stack using printf-like formatting, * using a stdarg argument list @@ -100,7 +101,7 @@ public: * * @return the id of the pushed message */ - MessageId pushVF(MessageType type, gchar const *format, va_list args); + MessageId pushVF(MessageType type, char const *format, va_list args); /** @brief removes a message from the stack, given its id * @@ -119,7 +120,7 @@ public: * * @return the id of the pushed message */ - MessageId flash(MessageType type, gchar const *message); + MessageId flash(MessageType type, char const *message); /** * Temporarily pushes a message onto the stack. @@ -140,7 +141,7 @@ public: * * @return the id of the pushed message */ - MessageId flashF(MessageType type, gchar const *format, ...) G_GNUC_PRINTF(3,4); + MessageId flashF(MessageType type, char const *format, ...) G_GNUC_PRINTF(3,4); /** @brief temporarily pushes a message onto the stack using * printf-like formatting, using a stdarg argument list @@ -151,7 +152,7 @@ public: * * @return the id of the pushed message */ - MessageId flashVF(MessageType type, gchar const *format, va_list args); + MessageId flashVF(MessageType type, char const *format, va_list args); private: struct Message { @@ -167,13 +168,13 @@ private: void operator=(MessageStack const &); // no assign /// pushes a message onto the stack with an optional timeout - MessageId _push(MessageType type, guint lifetime, gchar const *message); + MessageId _push(MessageType type, unsigned int lifetime, char const *message); Message *_discard(Message *m); ///< frees a message struct and returns the next such struct in the list void _emitChanged(); ///< emits the "changed" signal - static gboolean _timeout(gpointer data); ///< callback to expire flashed messages + static int _timeout(void* data); ///< callback to expire flashed messages - sigc::signal<void, MessageType, gchar const *> _changed_signal; + sigc::signal<void, MessageType, char const *> _changed_signal; Message *_messages; ///< the stack of messages as a linked list MessageId _next_id; ///< the next message id to assign }; diff --git a/src/number-opt-number.h b/src/number-opt-number.h index d9ab56102..f6fe584f9 100644 --- a/src/number-opt-number.h +++ b/src/number-opt-number.h @@ -13,27 +13,23 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <glib.h> #include <glib/gprintf.h> -//todo: use glib instead of stdlib -#include <stdlib.h> +#include <cstdlib> + #include "svg/stringstream.h" class NumberOptNumber { public: - gfloat number; + float number; - gfloat optNumber; + float optNumber; - guint _set : 1; + unsigned int _set : 1; - guint optNumber_set : 1; + unsigned int optNumber_set : 1; NumberOptNumber() { @@ -44,27 +40,27 @@ public: optNumber_set = FALSE; } - gfloat getNumber() + float getNumber() { if(_set) return number; return -1; } - gfloat getOptNumber() + float getOptNumber() { if(optNumber_set) return optNumber; return -1; } - void setOptNumber(gfloat num) + void setOptNumber(float num) { optNumber_set = true; optNumber = num; } - void setNumber(gfloat num) + void setNumber(float num) { _set = true; number = num; @@ -78,7 +74,7 @@ public: return _set; } - gchar *getValueString() + char *getValueString() { Inkscape::SVGOStringStream os; @@ -96,12 +92,12 @@ public: return g_strdup(os.str().c_str()); } - void set(gchar const *str) + void set(char const *str) { if(!str) return; - gchar **values = g_strsplit(str, " ", 2); + char **values = g_strsplit(str, " ", 2); if( values[0] != NULL ) { diff --git a/src/object-edit.cpp b/src/object-edit.cpp index fe22f6c1c..14a5bd3d5 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -96,33 +96,33 @@ KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop) class RectKnotHolderEntityRX : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual void knot_click(guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); + virtual void knot_click(unsigned int state); }; /* handle for vertical rounding radius */ class RectKnotHolderEntityRY : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual void knot_click(guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); + virtual void knot_click(unsigned int state); }; /* handle for width/height adjustment */ class RectKnotHolderEntityWH : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); protected: - void set_internal(Geom::Point const &p, Geom::Point const &origin, guint state); + void set_internal(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; /* handle for x/y adjustment */ class RectKnotHolderEntityXY : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; Geom::Point @@ -134,7 +134,7 @@ RectKnotHolderEntityRX::knot_get() const } void -RectKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +RectKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPRect *rect = SP_RECT(item); @@ -159,7 +159,7 @@ RectKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*orig } void -RectKnotHolderEntityRX::knot_click(guint state) +RectKnotHolderEntityRX::knot_click(unsigned int state) { SPRect *rect = SP_RECT(item); @@ -183,7 +183,7 @@ RectKnotHolderEntityRY::knot_get() const } void -RectKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +RectKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPRect *rect = SP_RECT(item); @@ -217,7 +217,7 @@ RectKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*orig } void -RectKnotHolderEntityRY::knot_click(guint state) +RectKnotHolderEntityRY::knot_click(unsigned int state) { SPRect *rect = SP_RECT(item); @@ -255,7 +255,7 @@ RectKnotHolderEntityWH::knot_get() const } void -RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &origin, guint state) +RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &origin, unsigned int state) { SPRect *rect = SP_RECT(item); @@ -327,7 +327,7 @@ RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &or } void -RectKnotHolderEntityWH::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) +RectKnotHolderEntityWH::knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state) { set_internal(p, origin, state); update_knot(); @@ -342,7 +342,7 @@ RectKnotHolderEntityXY::knot_get() const } void -RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) +RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state) { SPRect *rect = SP_RECT(item); @@ -468,10 +468,10 @@ RectKnotHolder::RectKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel class Box3DKnotHolderEntity : public KnotHolderEntity { public: virtual Geom::Point knot_get() const = 0; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) = 0; + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state) = 0; Geom::Point knot_get_generic(SPItem *item, unsigned int knot_id) const; - void knot_set_generic(SPItem *item, unsigned int knot_id, Geom::Point const &p, guint state); + void knot_set_generic(SPItem *item, unsigned int knot_id, Geom::Point const &p, unsigned int state); }; Geom::Point @@ -481,7 +481,7 @@ Box3DKnotHolderEntity::knot_get_generic(SPItem *item, unsigned int knot_id) cons } void -Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom::Point const &new_pos, guint state) +Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom::Point const &new_pos, unsigned int state) { Geom::Point const s = snap_knot_position(new_pos, state); @@ -504,55 +504,55 @@ Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom class Box3DKnotHolderEntity0 : public Box3DKnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; class Box3DKnotHolderEntity1 : public Box3DKnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; class Box3DKnotHolderEntity2 : public Box3DKnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; class Box3DKnotHolderEntity3 : public Box3DKnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; class Box3DKnotHolderEntity4 : public Box3DKnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; class Box3DKnotHolderEntity5 : public Box3DKnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; class Box3DKnotHolderEntity6 : public Box3DKnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; class Box3DKnotHolderEntity7 : public Box3DKnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; class Box3DKnotHolderEntityCenter : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; Geom::Point @@ -610,55 +610,55 @@ Box3DKnotHolderEntityCenter::knot_get() const } void -Box3DKnotHolderEntity0::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity0::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, unsigned int state) { knot_set_generic(item, 0, new_pos, state); } void -Box3DKnotHolderEntity1::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity1::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, unsigned int state) { knot_set_generic(item, 1, new_pos, state); } void -Box3DKnotHolderEntity2::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity2::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, unsigned int state) { knot_set_generic(item, 2, new_pos, state); } void -Box3DKnotHolderEntity3::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity3::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, unsigned int state) { knot_set_generic(item, 3, new_pos, state); } void -Box3DKnotHolderEntity4::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity4::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, unsigned int state) { knot_set_generic(item, 4, new_pos, state); } void -Box3DKnotHolderEntity5::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity5::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, unsigned int state) { knot_set_generic(item, 5, new_pos, state); } void -Box3DKnotHolderEntity6::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity6::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, unsigned int state) { knot_set_generic(item, 6, new_pos, state); } void -Box3DKnotHolderEntity7::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity7::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, unsigned int state) { knot_set_generic(item, 7, new_pos, state); } void -Box3DKnotHolderEntityCenter::knot_set(Geom::Point const &new_pos, Geom::Point const &origin, guint state) +Box3DKnotHolderEntityCenter::knot_set(Geom::Point const &new_pos, Geom::Point const &origin, unsigned int state) { Geom::Point const s = snap_knot_position(new_pos, state); @@ -739,29 +739,29 @@ Box3DKnotHolder::Box3DKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderR class ArcKnotHolderEntityStart : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual void knot_click(guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); + virtual void knot_click(unsigned int state); }; class ArcKnotHolderEntityEnd : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual void knot_click(guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); + virtual void knot_click(unsigned int state); }; class ArcKnotHolderEntityRX : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual void knot_click(guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); + virtual void knot_click(unsigned int state); }; class ArcKnotHolderEntityRY : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual void knot_click(guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); + virtual void knot_click(unsigned int state); }; /* @@ -783,7 +783,7 @@ sp_genericellipse_side(SPGenericEllipse *ellipse, Geom::Point const &p) } void -ArcKnotHolderEntityStart::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +ArcKnotHolderEntityStart::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { int snaps = Inkscape::Preferences::get()->getInt("/options/rotationsnapsperpi/value", 12); @@ -813,7 +813,7 @@ ArcKnotHolderEntityStart::knot_get() const } void -ArcKnotHolderEntityStart::knot_click(guint state) +ArcKnotHolderEntityStart::knot_click(unsigned int state) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); @@ -824,7 +824,7 @@ ArcKnotHolderEntityStart::knot_click(guint state) } void -ArcKnotHolderEntityEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +ArcKnotHolderEntityEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { int snaps = Inkscape::Preferences::get()->getInt("/options/rotationsnapsperpi/value", 12); @@ -855,7 +855,7 @@ ArcKnotHolderEntityEnd::knot_get() const void -ArcKnotHolderEntityEnd::knot_click(guint state) +ArcKnotHolderEntityEnd::knot_click(unsigned int state) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); @@ -867,7 +867,7 @@ ArcKnotHolderEntityEnd::knot_click(guint state) void -ArcKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +ArcKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); @@ -891,7 +891,7 @@ ArcKnotHolderEntityRX::knot_get() const } void -ArcKnotHolderEntityRX::knot_click(guint state) +ArcKnotHolderEntityRX::knot_click(unsigned int state) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); @@ -902,7 +902,7 @@ ArcKnotHolderEntityRX::knot_click(guint state) } void -ArcKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +ArcKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); @@ -926,7 +926,7 @@ ArcKnotHolderEntityRY::knot_get() const } void -ArcKnotHolderEntityRY::knot_click(guint state) +ArcKnotHolderEntityRY::knot_click(unsigned int state) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); @@ -975,19 +975,19 @@ ArcKnotHolder::ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRelea class StarKnotHolderEntity1 : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual void knot_click(guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); + virtual void knot_click(unsigned int state); }; class StarKnotHolderEntity2 : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual void knot_click(guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); + virtual void knot_click(unsigned int state); }; void -StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPStar *star = SP_STAR(item); @@ -1013,7 +1013,7 @@ StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origi } void -StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPStar *star = SP_STAR(item); @@ -1063,7 +1063,7 @@ StarKnotHolderEntity2::knot_get() const } static void -sp_star_knot_click(SPItem *item, guint state) +sp_star_knot_click(SPItem *item, unsigned int state) { SPStar *star = SP_STAR(item); @@ -1080,13 +1080,13 @@ sp_star_knot_click(SPItem *item, guint state) } void -StarKnotHolderEntity1::knot_click(guint state) +StarKnotHolderEntity1::knot_click(unsigned int state) { sp_star_knot_click(item, state); } void -StarKnotHolderEntity2::knot_click(guint state) +StarKnotHolderEntity2::knot_click(unsigned int state) { sp_star_knot_click(item, state); } @@ -1119,14 +1119,14 @@ StarKnotHolder::StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel class SpiralKnotHolderEntityInner : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); - virtual void knot_click(guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); + virtual void knot_click(unsigned int state); }; class SpiralKnotHolderEntityOuter : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; @@ -1137,7 +1137,7 @@ public: * [control] constrain inner arg to round per PI/4 */ void -SpiralKnotHolderEntityInner::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) +SpiralKnotHolderEntityInner::knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12); @@ -1186,7 +1186,7 @@ SpiralKnotHolderEntityInner::knot_set(Geom::Point const &p, Geom::Point const &o * [control] constrain inner arg to round per PI/4 */ void -SpiralKnotHolderEntityOuter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +SpiralKnotHolderEntityOuter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12); @@ -1276,7 +1276,7 @@ SpiralKnotHolderEntityOuter::knot_get() const } void -SpiralKnotHolderEntityInner::knot_click(guint state) +SpiralKnotHolderEntityInner::knot_click(unsigned int state) { SPSpiral *spiral = SP_SPIRAL(item); @@ -1314,11 +1314,11 @@ SpiralKnotHolder::SpiralKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolde class OffsetKnotHolderEntity : public KnotHolderEntity { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; void -OffsetKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) +OffsetKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int /*state*/) { SPOffset *offset = SP_OFFSET(item); @@ -1357,7 +1357,7 @@ OffsetKnotHolder::OffsetKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolde class FlowtextKnotHolderEntity : public RectKnotHolderEntityWH { public: virtual Geom::Point knot_get() const; - virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state); }; Geom::Point @@ -1369,7 +1369,7 @@ FlowtextKnotHolderEntity::knot_get() const } void -FlowtextKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) +FlowtextKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state) { set_internal(p, origin, state); } diff --git a/src/object-hierarchy.cpp b/src/object-hierarchy.cpp index f2bf177dc..f241da83d 100644 --- a/src/object-hierarchy.cpp +++ b/src/object-hierarchy.cpp @@ -9,6 +9,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <cstdio> +#include <cassert> + #include "sp-object.h" #include "object-hierarchy.h" @@ -32,7 +35,7 @@ void ObjectHierarchy::clear() { } void ObjectHierarchy::setTop(SPObject *object) { - g_return_if_fail(object != NULL); + if (object == NULL) { printf("Assertion object != NULL failed\n"); return; } if ( top() == object ) { return; @@ -53,8 +56,8 @@ void ObjectHierarchy::setTop(SPObject *object) { } void ObjectHierarchy::_addTop(SPObject *senior, SPObject *junior) { - g_assert(junior != NULL); - g_assert(senior != NULL); + assert(junior != NULL); + assert(senior != NULL); SPObject *object = junior->parent; do { @@ -64,7 +67,7 @@ void ObjectHierarchy::_addTop(SPObject *senior, SPObject *junior) { } void ObjectHierarchy::_addTop(SPObject *object) { - g_assert(object != NULL); + assert(object != NULL); _hierarchy.push_back(_attach(object)); _added_signal.emit(object); } @@ -82,7 +85,7 @@ void ObjectHierarchy::_trimAbove(SPObject *limit) { } void ObjectHierarchy::setBottom(SPObject *object) { - g_return_if_fail(object != NULL); + if (object == NULL) { printf("assertion object != NULL failed\n"); return; } if ( bottom() == object ) { return; @@ -125,8 +128,8 @@ void ObjectHierarchy::_trimBelow(SPObject *limit) { } void ObjectHierarchy::_addBottom(SPObject *senior, SPObject *junior) { - g_assert(junior != NULL); - g_assert(senior != NULL); + assert(junior != NULL); + assert(senior != NULL); if ( junior != senior ) { _addBottom(senior, junior->parent); @@ -135,15 +138,15 @@ void ObjectHierarchy::_addBottom(SPObject *senior, SPObject *junior) { } void ObjectHierarchy::_addBottom(SPObject *object) { - g_assert(object != NULL); + assert(object != NULL); _hierarchy.push_front(_attach(object)); _added_signal.emit(object); } void ObjectHierarchy::_trim_for_release(SPObject *object) { this->_trimBelow(object); - g_assert(!this->_hierarchy.empty()); - g_assert(this->_hierarchy.front().object == object); + assert(!this->_hierarchy.empty()); + assert(this->_hierarchy.front().object == object); sp_object_ref(object, NULL); this->_detach(this->_hierarchy.front()); diff --git a/src/object-hierarchy.h b/src/object-hierarchy.h index 0343d850e..16004c81a 100644 --- a/src/object-hierarchy.h +++ b/src/object-hierarchy.h @@ -10,12 +10,11 @@ #ifndef SEEN_INKSCAPE_OBJECT_HIERARCHY_H #define SEEN_INKSCAPE_OBJECT_HIERARCHY_H +#include <cstddef> #include <exception> #include <list> -#include <stddef.h> #include <sigc++/connection.h> #include <sigc++/signal.h> -#include <glib.h> class SPObject; diff --git a/src/path-chemistry.h b/src/path-chemistry.h index efc687b44..a2150440c 100644 --- a/src/path-chemistry.h +++ b/src/path-chemistry.h @@ -13,8 +13,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> - class SPDesktop; class SPItem; @@ -25,6 +23,9 @@ class Node; } // namespace XML } // namespace Inkscape +typedef unsigned int guint32; +typedef struct _GSList GSList; + void sp_selected_path_combine (SPDesktop *desktop); void sp_selected_path_break_apart (SPDesktop *desktop); // interactive=true only has an effect if desktop != NULL, i.e. if a GUI is available diff --git a/src/path-prefix.h b/src/path-prefix.h index be57ae354..6ef0ccbe9 100644 --- a/src/path-prefix.h +++ b/src/path-prefix.h @@ -10,15 +10,15 @@ * define'd directories, and instead should use only the paths defined here. * */ -#ifndef _PATH_PREFIX_H_ -#define _PATH_PREFIX_H_ +#ifndef SEEN_PATH_PREFIX_H +#define SEEN_PATH_PREFIX_H #include "require-config.h" // INKSCAPE_DATADIR #include "prefix.h" -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +//#ifdef __cplusplus +//extern "C" { +//#endif /* __cplusplus */ #ifdef ENABLE_BINRELOC # define INKSCAPE_APPICONDIR BR_DATADIR( "/pixmaps" ) @@ -112,8 +112,8 @@ extern "C" { # endif #endif -#ifdef __cplusplus -} -#endif /* __cplusplus */ +//#ifdef __cplusplus +//} +//#endif /* __cplusplus */ #endif /* _PATH_PREFIX_H_ */ diff --git a/src/persp3d-reference.h b/src/persp3d-reference.h index fa9eca5c9..cce497d94 100644 --- a/src/persp3d-reference.h +++ b/src/persp3d-reference.h @@ -10,9 +10,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information. */ -#include "uri-references.h" -#include <stddef.h> +#include <cstddef> #include <sigc++/sigc++.h> + +#include "uri-references.h" #include "persp3d.h" class SPObject; @@ -35,7 +36,7 @@ public: SPObject *owner; // concerning the Persp3D (we only use SPBox3D) that is refered to: - gchar *persp_href; + char *persp_href; Inkscape::XML::Node *persp_repr; Persp3D *persp; diff --git a/src/persp3d.h b/src/persp3d.h index bd3777a19..be5680bcb 100644 --- a/src/persp3d.h +++ b/src/persp3d.h @@ -1,5 +1,5 @@ -#ifndef __PERSP3D_H__ -#define __PERSP3D_H__ +#ifndef SEEN_PERSP3D_H +#define SEEN_PERSP3D_H /* * Implementation of 3D perspectives as SPObjects @@ -16,8 +16,9 @@ #define SP_IS_PERSP3D(obj) (dynamic_cast<const Persp3D*>((SPObject*)obj) != NULL) #include <list> -#include <vector> #include <map> +#include <vector> + #include "transf_mat_3x4.h" #include "document.h" #include "inkscape.h" // for SP_ACTIVE_DOCUMENT @@ -64,11 +65,11 @@ 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); }; @@ -100,7 +101,7 @@ void persp3d_update_z_orders (Persp3D *persp); inline unsigned int persp3d_num_boxes (Persp3D *persp) { return persp->perspective_impl->boxes.size(); } std::list<SPBox3D *> persp3d_list_of_boxes(Persp3D *persp); -bool persp3d_perspectives_coincide(const Persp3D *lhs, const Persp3D *rhs); +bool persp3d_perspectives_coincide(Persp3D const *lhs, Persp3D const *rhs); void persp3d_absorb(Persp3D *persp1, Persp3D *persp2); Persp3D * persp3d_create_xml_element (SPDocument *document, Persp3DImpl *dup = NULL); @@ -112,7 +113,7 @@ void persp3d_print_debugging_info (Persp3D *persp); void persp3d_print_debugging_info_all(SPDocument *doc); void persp3d_print_all_selected(); -void print_current_persp3d(gchar *func_name, Persp3D *persp); +void print_current_persp3d(char *func_name, Persp3D *persp); #endif /* __PERSP3D_H__ */ diff --git a/src/perspective-line.cpp b/src/perspective-line.cpp index 4fd68f8ed..e6c78403b 100644 --- a/src/perspective-line.cpp +++ b/src/perspective-line.cpp @@ -1,6 +1,4 @@ -#define __PERSPECTIVE_LINE_C__ - -/* +/** * Perspective line for 3D perspectives * * Authors: @@ -40,4 +38,4 @@ PerspectiveLine::PerspectiveLine (Geom::Point const &pt, Proj::Axis const axis, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/perspective-line.h b/src/perspective-line.h index 57abaae9c..64f7d03bd 100644 --- a/src/perspective-line.h +++ b/src/perspective-line.h @@ -13,7 +13,6 @@ #define SEEN_PERSPECTIVE_LINE_H #include "line-geometry.h" -#include <glib.h> class SPDesktop; diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 734e8a582..66a3e47d4 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -1,8 +1,9 @@ #ifndef SEEN_PREFERENCES_SKELETON_H #define SEEN_PREFERENCES_SKELETON_H -#include <inkscape-version.h> +#include "inkscape-version.h" +// FIXME why is this here? #ifdef N_ #undef N_ #endif diff --git a/src/preferences.h b/src/preferences.h index d5429815e..d5ae40e56 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -13,14 +13,16 @@ #ifndef INKSCAPE_PREFSTORE_H #define INKSCAPE_PREFSTORE_H -#include <map> -#include <vector> #include <climits> #include <cfloat> #include <glibmm/ustring.h> +#include <map> +#include <vector> + #include "xml/repr.h" class SPCSSAttr; +typedef unsigned int guint32; namespace Inkscape { diff --git a/src/print.h b/src/print.h index bbf95b833..ab2bcc0a7 100644 --- a/src/print.h +++ b/src/print.h @@ -41,18 +41,18 @@ unsigned int sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox); unsigned int sp_print_image_R8G8B8A8_N(SPPrintContext *ctx, - guchar *px, unsigned int w, unsigned int h, unsigned int rs, + unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, Geom::Affine const &transform, SPStyle const *style); unsigned int sp_print_text(SPPrintContext *ctx, char const *text, Geom::Point p, SPStyle const *style); -void sp_print_get_param(SPPrintContext *ctx, gchar *name, bool *value); +void sp_print_get_param(SPPrintContext *ctx, char *name, bool *value); /* UI */ void sp_print_document(Gtk::Window& parentWindow, SPDocument *doc); -void sp_print_document_to_file(SPDocument *doc, gchar const *filename); +void sp_print_document_to_file(SPDocument *doc, char const *filename); #endif /* !PRINT_H_INKSCAPE */ diff --git a/src/profile-manager.h b/src/profile-manager.h index be9446c17..54cd4a1da 100644 --- a/src/profile-manager.h +++ b/src/profile-manager.h @@ -9,9 +9,10 @@ #ifndef SEEN_INKSCAPE_PROFILE_MANAGER_H #define SEEN_INKSCAPE_PROFILE_MANAGER_H +#include <vector> + #include "document-subset.h" #include "gc-finalized.h" -#include <vector> class SPDocument; @@ -26,7 +27,7 @@ public: ProfileManager(SPDocument *document); ~ProfileManager(); - ColorProfile* find(gchar const* name); + ColorProfile* find(char const* name); private: ProfileManager(ProfileManager const &); // no copy diff --git a/src/proj_pt.cpp b/src/proj_pt.cpp index 28286948d..f5cca8fca 100644 --- a/src/proj_pt.cpp +++ b/src/proj_pt.cpp @@ -1,6 +1,4 @@ -#define __PROJ_PT_C__ - -/* +/** * 3x4 transformation matrix to map points from projective 3-space into the projective plane * * Authors: @@ -117,4 +115,4 @@ Pt3::coord_string() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/proj_pt.h b/src/proj_pt.h index 90b9df201..1ee4b7f14 100644 --- a/src/proj_pt.h +++ b/src/proj_pt.h @@ -1,7 +1,4 @@ -#ifndef __PROJ_PT_H__ -#define __PROJ_PT_H__ - -/* +/** * 3x4 transformation matrix to map points from projective 3-space into the projective plane * * Authors: @@ -12,8 +9,11 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifndef SEEN_PROJ_PT_H +#define SEEN_PROJ_PT_H + #include <2geom/point.h> -#include <gtk/gtk.h> +#include <cstdio> namespace Proj { @@ -25,7 +25,7 @@ public: Pt2 () { pt[0] = 0; pt[1] = 0; pt[2] = 1.0; } // we default to (0 : 0 : 1) Pt2 (double x, double y, double w) { pt[0] = x; pt[1] = y; pt[2] = w; } Pt2 (Geom::Point const &point) { pt[0] = point[Geom::X]; pt[1] = point[Geom::Y]; pt[2] = 1; } - Pt2 (const gchar *coord_str); + Pt2 (const char *coord_str); inline double operator[] (unsigned int index) const { if (index > 2) { return Geom::infinity(); } @@ -81,8 +81,8 @@ public: void normalize(); Geom::Point affine(); inline bool is_finite() { return pt[2] != 0; } // FIXME: Should we allow for some tolerance? - gchar *coord_string(); - inline void print(gchar const *s) const { g_print ("%s(%8.2f : %8.2f : %8.2f)\n", s, pt[0], pt[1], pt[2]); } + char *coord_string(); + inline void print(char const *s) const { printf ("%s(%8.2f : %8.2f : %8.2f)\n", s, pt[0], pt[1], pt[2]); } private: double pt[3]; @@ -93,7 +93,7 @@ class Pt3 { public: Pt3 () { pt[0] = 0; pt[1] = 0; pt[2] = 0; pt[3] = 1.0; } // we default to (0 : 0 : 0 : 1) Pt3 (double x, double y, double z, double w) { pt[0] = x; pt[1] = y; pt[2] = z; pt[3] = w; } - Pt3 (const gchar *coord_str); + Pt3 (const char *coord_str); inline bool operator== (Pt3 &rhs) { normalize(); @@ -146,9 +146,9 @@ public: } void normalize(); inline bool is_finite() { return pt[3] != 0; } // FIXME: Should we allow for some tolerance? - gchar *coord_string(); - inline void print(gchar const *s) const { - g_print ("%s(%8.2f : %8.2f : %8.2f : %8.2f)\n", s, pt[0], pt[1], pt[2], pt[3]); + char *coord_string(); + inline void print(char const *s) const { + printf ("%s(%8.2f : %8.2f : %8.2f : %8.2f)\n", s, pt[0], pt[1], pt[2], pt[3]); } private: @@ -157,7 +157,7 @@ private: } // namespace Proj -#endif /* __PROJ_PT_H__ */ +#endif // !SEEN_PROJ_PT_H /* Local Variables: @@ -168,4 +168,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : @@ -11,7 +11,6 @@ #ifndef SEEN_RDF_H #define SEEN_RDF_H -#include <glib.h> #include <glibmm/i18n.h> #include "document.h" @@ -22,18 +21,18 @@ * \brief Holds license name/resource doubles for rdf_license_t entries */ struct rdf_double_t { - gchar const *name; - gchar const *resource; + char const *name; + char const *resource; }; /** * \brief Holds license name and RDF information */ struct rdf_license_t { - gchar const *name; /* localized name of this license */ - gchar const *uri; /* URL for the RDF/Work/license element */ + char const *name; /* localized name of this license */ + char const *uri; /* URL for the RDF/Work/license element */ struct rdf_double_t *details; /* the license details */ -// gchar const *fragment; /* XML contents for the RDF/License tag */ +// char const *fragment; /* XML contents for the RDF/License tag */ }; extern rdf_license_t rdf_licenses []; @@ -69,10 +68,10 @@ enum RDF_Editable { */ struct rdf_work_entity_t { char const *name; /* unique name of this entity for internal reference */ - gchar const *title; /* localized title of this entity for data entry */ - gchar const *tag; /* namespace tag for the RDF/Work element */ + char const *title; /* localized title of this entity for data entry */ + char const *tag; /* namespace tag for the RDF/Work element */ RDFType datatype; /* how to extract/inject the RDF information */ - gchar const *tip; /* tool tip to explain the meaning of the entity */ + char const *tip; /* tool tip to explain the meaning of the entity */ RDF_Format format; /* in what format is this data edited? */ RDF_Editable editable;/* in what way is the data editable? */ }; @@ -83,19 +82,19 @@ extern rdf_work_entity_t rdf_work_entities []; * \brief Generic collection of RDF information for the RDF debug function */ struct rdf_t { - gchar* work_title; - gchar* work_date; - gchar* work_creator; - gchar* work_owner; - gchar* work_publisher; - gchar* work_type; - gchar* work_source; - gchar* work_subject; - gchar* work_description; + char* work_title; + char* work_date; + char* work_creator; + char* work_owner; + char* work_publisher; + char* work_type; + char* work_source; + char* work_subject; + char* work_description; struct rdf_license_t* license; }; -struct rdf_work_entity_t * rdf_find_entity(gchar const * name); +struct rdf_work_entity_t * rdf_find_entity(char const * name); /** * \brief Retrieves a known RDF/Work entity's contents from the document XML by name @@ -114,7 +113,7 @@ const gchar * rdf_get_work_entity(SPDocument const * doc, */ unsigned int rdf_set_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity, - const gchar * text); + const char * text); /** * \brief Attempts to match and retrieve a known RDF/License from the document XML diff --git a/src/removeoverlap.h b/src/removeoverlap.h index 1ba41572a..7109c9513 100644 --- a/src/removeoverlap.h +++ b/src/removeoverlap.h @@ -13,7 +13,7 @@ #ifndef SEEN_REMOVEOVERLAP_H #define SEEN_REMOVEOVERLAP_H -#include <glib.h> +typedef struct _GSList GSList; void removeoverlap(GSList const *items, double xGap, double yGap); diff --git a/src/rubberband.h b/src/rubberband.h index fbebe2b08..a7bc57145 100644 --- a/src/rubberband.h +++ b/src/rubberband.h @@ -10,17 +10,17 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <boost/optional.hpp> -#include <vector> #include <2geom/point.h> #include <2geom/rect.h> +#include <boost/optional.hpp> +#include <vector> /* fixme: do multidocument safe */ -class CtrlRect; +class CtrlRect; +class SPCurve; +class SPDesktop; struct SPCanvasItem; -class SPCurve; -class SPDesktop; enum { RUBBERBAND_MODE_RECT, diff --git a/src/satisfied-guide-cns.h b/src/satisfied-guide-cns.h index 73e1e7e7f..25e5919d0 100644 --- a/src/satisfied-guide-cns.h +++ b/src/satisfied-guide-cns.h @@ -3,7 +3,7 @@ #include <2geom/forward.h> #include <vector> -#include <sp-item.h> +#include "sp-item.h" class SPDesktop; class SPGuideConstraint; diff --git a/src/selcue.h b/src/selcue.h index bcac7315f..d9b16b0f5 100644 --- a/src/selcue.h +++ b/src/selcue.h @@ -1,5 +1,5 @@ -#ifndef __SP_SELCUE_H__ -#define __SP_SELCUE_H__ +#ifndef SEEN_SP_SELCUE_H +#define SEEN_SP_SELCUE_H /* * Helper object for showing selected items @@ -13,8 +13,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <cstddef> #include <list> -#include <stddef.h> #include <sigc++/sigc++.h> class SPDesktop; @@ -52,7 +52,7 @@ private: void _updateItemBboxes(); void _updateItemBboxes(Inkscape::Preferences *prefs); - void _updateItemBboxes(gint mode, int prefs_bbox); + void _updateItemBboxes(int mode, int prefs_bbox); void _newItemBboxes(); void _newTextBaselines(); void _boundingBoxPrefsChanged(int prefs_bbox); diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 7bac363c2..d86906548 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -17,21 +17,21 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <2geom/forward.h> #include "sp-item.h" -#include "2geom/forward.h" -namespace Inkscape { class Selection; } +class SPCSSAttr; +class SPDesktop; +typedef struct _GSList GSList; namespace Inkscape { + +class Selection; + namespace LivePathEffect { class PathParam; } -} -class SPCSSAttr; -class SPDesktop; - -namespace Inkscape { class SelectionHelper { public: static void selectAll(SPDesktop *desktop); @@ -108,21 +108,21 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons void sp_selection_remove_transform (SPDesktop *desktop); void sp_selection_scale_absolute (Inkscape::Selection *selection, double x0, double x1, double y0, double y1); void sp_selection_scale_relative(Inkscape::Selection *selection, Geom::Point const &align, Geom::Scale const &scale); -void sp_selection_rotate_relative (Inkscape::Selection *selection, Geom::Point const ¢er, gdouble angle); +void sp_selection_rotate_relative (Inkscape::Selection *selection, Geom::Point const ¢er, double angle); void sp_selection_skew_relative (Inkscape::Selection *selection, Geom::Point const &align, double dx, double dy); void sp_selection_move_relative (Inkscape::Selection *selection, Geom::Point const &move, bool compensate = true); void sp_selection_move_relative (Inkscape::Selection *selection, double dx, double dy); void sp_selection_rotate_90 (SPDesktop *desktop, bool ccw); -void sp_selection_rotate (Inkscape::Selection *selection, gdouble angle); -void sp_selection_rotate_screen (Inkscape::Selection *selection, gdouble angle); +void sp_selection_rotate (Inkscape::Selection *selection, double angle); +void sp_selection_rotate_screen (Inkscape::Selection *selection, double angle); -void sp_selection_scale (Inkscape::Selection *selection, gdouble grow); -void sp_selection_scale_screen (Inkscape::Selection *selection, gdouble grow_pixels); -void sp_selection_scale_times (Inkscape::Selection *selection, gdouble times); +void sp_selection_scale (Inkscape::Selection *selection, double grow); +void sp_selection_scale_screen (Inkscape::Selection *selection, double grow_pixels); +void sp_selection_scale_times (Inkscape::Selection *selection, double times); -void sp_selection_move (Inkscape::Selection *selection, gdouble dx, gdouble dy); -void sp_selection_move_screen (Inkscape::Selection *selection, gdouble dx, gdouble dy); +void sp_selection_move (Inkscape::Selection *selection, double dx, double dy); +void sp_selection_move_screen (Inkscape::Selection *selection, double dx, double dy); void sp_selection_item_next (SPDesktop *desktop); void sp_selection_item_prev (SPDesktop *desktop); diff --git a/src/selection-describer.h b/src/selection-describer.h index b4174edd8..5514ce4b1 100644 --- a/src/selection-describer.h +++ b/src/selection-describer.h @@ -16,11 +16,10 @@ #include <sigc++/sigc++.h> #include "message-context.h" -namespace Inkscape { class Selection; } - namespace Inkscape { class MessageStack; +class Selection; class SelectionDescriber : public sigc::trackable { public: @@ -29,7 +28,7 @@ public: private: void _updateMessageFromSelection(Inkscape::Selection *selection); - void _selectionModified(Inkscape::Selection *selection, guint /*flags*/); + void _selectionModified(Inkscape::Selection *selection, unsigned int /*flags*/); sigc::connection *_selection_changed_connection; sigc::connection *_selection_modified_connection; @@ -43,6 +42,7 @@ private: } #endif + /* Local Variables: mode:c++ diff --git a/src/selection.h b/src/selection.h index ba38bec08..5964b20e8 100644 --- a/src/selection.h +++ b/src/selection.h @@ -30,6 +30,7 @@ class SPDesktop; class SPItem; class SPBox3D; class Persp3D; +typedef struct _GSList GSList; namespace Inkscape { class LayerModel; @@ -256,10 +257,10 @@ public: std::list<SPBox3D *> const box3DList(Persp3D *persp = NULL); /** Returns the number of layers in which there are selected objects. */ - guint numberOfLayers(); + unsigned int numberOfLayers(); /** Returns the number of parents to which the selected objects belong. */ - guint numberOfParents(); + unsigned int numberOfParents(); /** Returns the bounding rectangle of the selection. */ Geom::OptRect bounds(SPItem::BBoxType type) const; @@ -317,11 +318,11 @@ public: * @return the resulting connection * */ - sigc::connection connectModified(sigc::slot<void, Selection *, guint> const &slot) + sigc::connection connectModified(sigc::slot<void, Selection *, unsigned int> const &slot) { return _modified_signal.connect(slot); } - sigc::connection connectModifiedFirst(sigc::slot<void, Selection *, guint> const &slot) + sigc::connection connectModifiedFirst(sigc::slot<void, Selection *, unsigned int> const &slot) { return _modified_signal.slots().insert(_modified_signal.slots().begin(), slot); } @@ -333,12 +334,12 @@ private: void operator=(Selection const &); /** Issues modification notification signals. */ - static gboolean _emit_modified(Selection *selection); + static int _emit_modified(Selection *selection); /** Schedules an item modification signal to be sent. */ - void _schedule_modified(SPObject *obj, guint flags); + void _schedule_modified(SPObject *obj, unsigned int flags); /** Issues modified selection signal. */ - void _emitModified(guint flags); + void _emitModified(unsigned int flags); /** Issues changed selection signal. */ void _emitChanged(bool persist_selection_context = false); @@ -374,15 +375,15 @@ private: LayerModel *_layers; GC::soft_ptr<SPDesktop> _desktop; SPObject* _selection_context; - guint _flags; - guint _idle; + unsigned int _flags; + unsigned int _idle; std::map<SPObject *, sigc::connection> _modified_connections; std::map<SPObject *, sigc::connection> _release_connections; sigc::connection _context_release_connection; sigc::signal<void, Selection *> _changed_signal; - sigc::signal<void, Selection *, guint> _modified_signal; + sigc::signal<void, Selection *, unsigned int> _modified_signal; }; } diff --git a/src/seltrans-handles.h b/src/seltrans-handles.h index 740729a6e..ebd5758c8 100644 --- a/src/seltrans-handles.h +++ b/src/seltrans-handles.h @@ -14,11 +14,13 @@ #include <2geom/forward.h> #include <gdk/gdk.h> + #include "enums.h" -namespace Inkscape -{ - class SelTrans; +typedef unsigned int guint32; + +namespace Inkscape { + class SelTrans; } guint32 const DEF_COLOR[] = { 0xff, 0xff6600, 0xff6600, 0xff, 0xff, 0xff }; @@ -34,7 +36,7 @@ enum SPSelTransType { struct SPSelTransTypeInfo { guint32 const *color; - gchar const *tip; + char const *tip; }; // One per handle type in order extern SPSelTransTypeInfo const handtypes[5]; @@ -45,7 +47,7 @@ struct SPSelTransHandle { SPSelTransType type; SPAnchorType anchor; GdkCursorType cursor; - guint control; + unsigned int control; gdouble x, y; }; // These are 4 * each handle type + 1 for center @@ -64,5 +66,3 @@ extern SPSelTransHandle const hands[17]; End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : - - diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 6b8cd19bb..e15249f94 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -9,7 +9,7 @@ * Abhishek Sharma * * Copyright (C) 1999-2002 Lauris Kaplinski - * Copyright (C) 1999-2008 Authors + * Copyright (C) 1999-2014 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -1109,10 +1109,17 @@ gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, Geom::P break; } + // _point and _origin are noisy, ranging from 1 to 1e-9 or even smaller; this is due to the + // limited SVG output precision, which can be arbitrarily set in the preferences Geom::Point const initial_delta = _point - _origin; - if (fabs(initial_delta[dim_a]) < 1e-15) { - return false; + // The handle and the origin shouldn't be too close to each other; let's check for that! + // Due to the limited resolution though (see above), we'd better use a relative error here + if (_bbox) { + Geom::Coord d = (*_bbox).dimensions()[dim_a]; + if (fabs(initial_delta[dim_a]/d) < 1e-4) { + return false; + } } // Calculate the scale factors, which can be either visual or geometric diff --git a/src/seltrans.h b/src/seltrans.h index 44268ed69..d5db1542d 100644 --- a/src/seltrans.h +++ b/src/seltrans.h @@ -15,32 +15,33 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <stddef.h> -#include <sigc++/sigc++.h> #include <2geom/point.h> #include <2geom/affine.h> #include <2geom/rect.h> +#include <cstddef> +#include <sigc++/sigc++.h> +#include <vector> + #include "knot.h" -#include "selcue.h" #include "message-context.h" -#include <vector> -#include "sp-item.h" #include "seltrans-handles.h" +#include "selcue.h" +#include "sp-item.h" + class SPKnot; class SPDesktop; struct SPCanvasItem; struct SPCtrlLine; struct SPSelTransHandle; +typedef struct _GSList GSList; -namespace Inkscape -{ +namespace Inkscape { Geom::Scale calcScaleFactors(Geom::Point const &initial_point, Geom::Point const &new_point, Geom::Point const &origin, bool const skew = false); -namespace XML -{ - class Node; +namespace XML { + class Node; } class SelTrans @@ -56,26 +57,26 @@ public: void increaseState(); void resetState(); void setCenter(Geom::Point const &p); - void grab(Geom::Point const &p, gdouble x, gdouble y, bool show_handles, bool translating); + void grab(Geom::Point const &p, double x, double y, bool show_handles, bool translating); void transform(Geom::Affine const &rel_affine, Geom::Point const &norm); void ungrab(); void stamp(); - void moveTo(Geom::Point const &xy, guint state); - void stretch(SPSelTransHandle const &handle, Geom::Point &pt, guint state); - void scale(Geom::Point &pt, guint state); - void skew(SPSelTransHandle const &handle, Geom::Point &pt, guint state); - void rotate(Geom::Point &pt, guint state); - gboolean request(SPSelTransHandle const &handle, Geom::Point &pt, guint state); - gboolean scaleRequest(Geom::Point &pt, guint state); - gboolean stretchRequest(SPSelTransHandle const &handle, Geom::Point &pt, guint state); - gboolean skewRequest(SPSelTransHandle const &handle, Geom::Point &pt, guint state); - gboolean rotateRequest(Geom::Point &pt, guint state); - gboolean centerRequest(Geom::Point &pt, guint state); - - gboolean handleRequest(SPKnot *knot, Geom::Point *position, guint state, SPSelTransHandle const &handle); - void handleGrab(SPKnot *knot, guint state, SPSelTransHandle const &handle); - void handleClick(SPKnot *knot, guint state, SPSelTransHandle const &handle); - void handleNewEvent(SPKnot *knot, Geom::Point *position, guint state, SPSelTransHandle const &handle); + void moveTo(Geom::Point const &xy, unsigned int state); + void stretch(SPSelTransHandle const &handle, Geom::Point &pt, unsigned int state); + void scale(Geom::Point &pt, unsigned int state); + void skew(SPSelTransHandle const &handle, Geom::Point &pt, unsigned int state); + void rotate(Geom::Point &pt, unsigned int state); + int request(SPSelTransHandle const &handle, Geom::Point &pt, unsigned int state); + int scaleRequest(Geom::Point &pt, unsigned int state); + int stretchRequest(SPSelTransHandle const &handle, Geom::Point &pt, unsigned int state); + int skewRequest(SPSelTransHandle const &handle, Geom::Point &pt, unsigned int state); + int rotateRequest(Geom::Point &pt, unsigned int state); + int centerRequest(Geom::Point &pt, unsigned int state); + + int handleRequest(SPKnot *knot, Geom::Point *position, unsigned int state, SPSelTransHandle const &handle); + void handleGrab(SPKnot *knot, unsigned int state, SPSelTransHandle const &handle); + void handleClick(SPKnot *knot, unsigned int state, SPSelTransHandle const &handle); + void handleNewEvent(SPKnot *knot, Geom::Point *position, unsigned int state, SPSelTransHandle const &handle); enum Show { @@ -115,7 +116,7 @@ private: void _updateHandles(); void _updateVolatileState(); void _selChanged(Inkscape::Selection *selection); - void _selModified(Inkscape::Selection *selection, guint flags); + void _selModified(Inkscape::Selection *selection, unsigned int flags); void _boundingBoxPrefsChanged(int prefs_bbox); void _makeHandles(); void _showHandles(SPSelTransType type); @@ -156,7 +157,7 @@ private: Geom::OptRect _bbox; Geom::OptRect _visual_bbox; Geom::OptRect _geometric_bbox; - gdouble _strokewidth; + double _strokewidth; Geom::Affine _current_relative_affine; Geom::Affine _absolute_affine; @@ -173,8 +174,8 @@ private: Geom::Point _origin_for_specpoints; Geom::Point _origin_for_bboxpoints; - gdouble _handle_x; - gdouble _handle_y; + double _handle_x; + double _handle_y; boost::optional<Geom::Point> _center; bool _center_is_set; ///< we've already set _center, no need to reread it from items @@ -184,8 +185,8 @@ private: SPCanvasItem *_norm; SPCanvasItem *_grip; SPCtrlLine *_l[4]; - guint _sel_changed_id; - guint _sel_modified_id; + unsigned int _sel_changed_id; + unsigned int _sel_modified_id; GSList *_stamp_cache; Geom::Point _origin; ///< position of origin for transforms diff --git a/src/shape-editor.h b/src/shape-editor.h index df0dbfa3a..d2611b111 100644 --- a/src/shape-editor.h +++ b/src/shape-editor.h @@ -12,8 +12,6 @@ * */ -#include <glib.h> - namespace Inkscape { namespace XML { class Node; } } class KnotHolder; @@ -37,10 +35,10 @@ public: bool knot_mouseover() const; - static void blockSetItem(bool b) { _blockSetItem = b; } // kludge? + static void blockSetItem(bool b) { _blockSetItem = b; } // kludge - static void event_attr_changed(Inkscape::XML::Node * /*repr*/, gchar const *name, gchar const * /*old_value*/, - gchar const * /*new_value*/, bool /*is_interactive*/, void *data); + static void event_attr_changed(Inkscape::XML::Node * /*repr*/, char const *name, char const * /*old_value*/, + char const * /*new_value*/, bool /*is_interactive*/, void *data); private: bool has_knotholder(); void reset_item (bool keep_knotholder = true); diff --git a/src/shortcuts.h b/src/shortcuts.h index 406768f97..f24a82603 100644 --- a/src/shortcuts.h +++ b/src/shortcuts.h @@ -1,5 +1,5 @@ -#ifndef __SP_SHORTCUTS_H__ -#define __SP_SHORTCUTS_H__ +#ifndef SEEN_SP_SHORTCUTS_H +#define SEEN_SP_SHORTCUTS_H /* * Keyboard shortcut processing @@ -16,9 +16,6 @@ typedef struct _GtkAccelGroup GtkAccelGroup; typedef struct _GtkWidget GtkWidget; -struct _GtkAccelGroup; -struct _GtkWidget; - namespace Inkscape { class Verb; namespace UI { @@ -42,14 +39,14 @@ bool sp_shortcut_invoke (unsigned int shortcut, Inkscape::UI::View::View *view); void sp_shortcut_init(); Inkscape::Verb * sp_shortcut_get_verb (unsigned int shortcut); unsigned int sp_shortcut_get_primary (Inkscape::Verb * verb); // Returns GDK_VoidSymbol if no shortcut is found. -gchar* sp_shortcut_get_label (unsigned int shortcut); // Returns the human readable form of the shortcut (or NULL), for example Shift+Ctrl+F. Free the returned string with g_free. +char* sp_shortcut_get_label (unsigned int shortcut); // Returns the human readable form of the shortcut (or NULL), for example Shift+Ctrl+F. Free the returned string with g_free. void sp_shortcut_set(unsigned int const shortcut, Inkscape::Verb *const verb, bool const is_primary, bool const is_user_set=false); void sp_shortcut_unset(unsigned int const shortcut); void sp_shortcut_add_to_file(char const *action, unsigned int const shortcut); void sp_shortcut_delete_from_file(char const *action, unsigned int const shortcut); void sp_shortcuts_delete_all_from_file(); Glib::ustring sp_shortcut_to_label(unsigned int const shortcut); -unsigned int sp_gdkmodifier_to_shortcut(guint accel_key, Gdk::ModifierType gdkmodifier, guint hardware_keycode); +unsigned int sp_gdkmodifier_to_shortcut(unsigned int accel_key, Gdk::ModifierType gdkmodifier, unsigned int hardware_keycode); void sp_shortcut_get_file_names(std::vector<Glib::ustring> *names, std::vector<Glib::ustring> *paths); bool sp_shortcut_is_user_set(Inkscape::Verb *verb); void sp_shortcut_file_export(); diff --git a/src/snap-candidate.h b/src/snap-candidate.h index 8bb7cb52f..54e33e1a8 100644 --- a/src/snap-candidate.h +++ b/src/snap-candidate.h @@ -14,7 +14,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -//#include "snapped-point.h" +#include <2geom/point.h> +#include <2geom/rect.h> +#include <cstdio> + #include "snap-enums.h" class SPItem; // forward declaration diff --git a/src/snap-preferences.h b/src/snap-preferences.h index a7a2e2926..7bdeea52e 100644 --- a/src/snap-preferences.h +++ b/src/snap-preferences.h @@ -49,13 +49,13 @@ public: void setSnapPerp(bool enabled) {_snap_perp = enabled;} void setSnapTang(bool enabled) {_snap_tang = enabled;} - gdouble getGridTolerance() const {return _grid_tolerance;} - gdouble getGuideTolerance() const {return _guide_tolerance;} - gdouble getObjectTolerance() const {return _object_tolerance;} + double getGridTolerance() const {return _grid_tolerance;} + double getGuideTolerance() const {return _guide_tolerance;} + double getObjectTolerance() const {return _object_tolerance;} - void setGridTolerance(gdouble val) {_grid_tolerance = val;} - void setGuideTolerance(gdouble val) {_guide_tolerance = val;} - void setObjectTolerance(gdouble val) {_object_tolerance = val;} + void setGridTolerance(double val) {_grid_tolerance = val;} + void setGuideTolerance(double val) {_guide_tolerance = val;} + void setObjectTolerance(double val) {_object_tolerance = val;} private: @@ -91,9 +91,9 @@ private: bool _snap_perp; bool _snap_tang; - gdouble _grid_tolerance; - gdouble _guide_tolerance; - gdouble _object_tolerance; + double _grid_tolerance; + double _guide_tolerance; + double _object_tolerance; }; } diff --git a/src/snap.cpp b/src/snap.cpp index e067cf8f7..fb87aae6b 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -274,7 +274,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapCandidatePoint /* See the documentation for constrainedSnap() directly above for more details. * The difference is that multipleConstrainedSnaps() will take a list of constraints instead of a single one, - * and will try to snap the SnapCandidatePoint to all of the provided constraints and see which one fits best + * and will try to snap the SnapCandidatePoint to only the closest constraint * \param p Source point to be snapped * \param constraints List of directions or lines along which snapping must occur * \param dont_snap If true then we will only apply the constraint, without snapping @@ -293,16 +293,11 @@ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandi return no_snap; } - IntermSnapResults isr; - SnapperList const snappers = getSnappers(); - std::vector<Geom::Point> projections; - bool snapping_is_futile = !someSnapperMightSnap() || dont_snap; - - Inkscape::SnappedPoint result = no_snap; - - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - bool snap_mouse = prefs->getBool("/options/snapmousepointer/value", false); + // We haven't tried to snap yet; we will first determine which constraint is closest to where we are now, + // i.e. lets find out which of the constraints yields the closest projection of point p + // Project the mouse pointer on each of the constraints + std::vector<Geom::Point> projections; for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); ++c) { // Project the mouse pointer onto the constraint; In case we don't snap then we will // return the projection onto the constraint, such that the constraint is always enforced @@ -310,55 +305,47 @@ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandi projections.push_back(pp); } - if (snap_mouse && p.isSingleHandle() && !dont_snap) { + // Select the closest constraint + no_snap.setPoint(projections.front()); + Inkscape::Snapper::SnapConstraint cc = constraints.front(); //closest constraint + + std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); + std::vector<Geom::Point>::iterator pp = projections.begin(); + for (; pp != projections.end(); ++pp) { + if (Geom::L2(*pp - p.getPoint()) < Geom::L2(no_snap.getPoint() - p.getPoint())) { + no_snap.setPoint(*pp); // Remember the projection onto the closest constraint + cc = *c; // Remember the closest constraint itself + } + ++c; + } + + if (!someSnapperMightSnap() || dont_snap) { + return no_snap; + } + + IntermSnapResults isr; + SnapperList const snappers = getSnappers(); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool snap_mouse = prefs->getBool("/options/snapmousepointer/value", false); + + Inkscape::SnappedPoint result = no_snap; + if (snap_mouse && p.isSingleHandle()) { // Snapping the mouse pointer instead of the constrained position of the knot allows // to snap to things which don't intersect with the constraint line; this is basically // then just a freesnap with the constraint applied afterwards // We'll only to this if we're dragging a single handle, and for example not when transforming an object in the selector tool result = freeSnap(p, bbox_to_snap); + // Now apply the constraint afterwards + result.setPoint(cc.projection(result.getPoint())); } else { - // Iterate over the constraints - for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); ++c) { - // Try to snap to the constraint - if (!snapping_is_futile) { - for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); ++i) { - (*i)->constrainedSnap(isr, p, bbox_to_snap, *c, &_items_to_ignore,_unselected_nodes); - } - } + // Try to snap along the closest constraint + for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); ++i) { + (*i)->constrainedSnap(isr, p, bbox_to_snap, cc, &_items_to_ignore,_unselected_nodes); } result = findBestSnap(p, isr, true); } - if (result.getSnapped()) { - if (snap_mouse) { - // If "snap_mouse" then we still have to apply the constraint, because so far we only tried a freeSnap - Geom::Point result_closest; - for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); ++c) { - // Project the mouse pointer onto the constraint; In case we don't snap then we will - // return the projection onto the constraint, such that the constraint is always enforced - Geom::Point result_p = (*c).projection(result.getPoint()); - if (c == constraints.begin() || (Geom::L2(result_p - p.getPoint()) < Geom::L2(result_closest - p.getPoint()))) { - result_closest = result_p; - } - } - result.setPoint(result_closest); - } - return result; - } - - // So we didn't snap, but we still need to return a point on one of the constraints - // Find out which of the constraints yielded the closest projection of point p - for (std::vector<Geom::Point>::iterator pp = projections.begin(); pp != projections.end(); ++pp) { - if (pp != projections.begin()) { - if (Geom::L2(*pp - p.getPoint()) < Geom::L2(no_snap.getPoint() - p.getPoint())) { - no_snap.setPoint(*pp); - } - } else { - no_snap.setPoint(projections.front()); - } - } - - return no_snap; + return result.getSnapped() ? result : no_snap; } Inkscape::SnappedPoint SnapManager::constrainedAngularSnap(Inkscape::SnapCandidatePoint const &p, diff --git a/src/snap.h b/src/snap.h index 67af20063..20b2b246f 100644 --- a/src/snap.h +++ b/src/snap.h @@ -32,6 +32,7 @@ enum SPGuideDragType { // used both here and in desktop-events.cpp class SPGuide; class SPNamedView; +typedef struct _GSList GSList; /** * Class to coordinate snapping operations. diff --git a/src/snapped-curve.h b/src/snapped-curve.h index 6bb8bfeca..0e3a1c747 100644 --- a/src/snapped-curve.h +++ b/src/snapped-curve.h @@ -11,14 +11,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information. */ +#include <2geom/forward.h> #include <vector> #include <list> + #include "snapped-point.h" #include "snapped-line.h" -#include <2geom/forward.h> -namespace Inkscape -{ +namespace Inkscape { /// Class describing the result of an attempt to snap to a curve. class SnappedCurve : public SnappedPoint diff --git a/src/snapped-point.h b/src/snapped-point.h index bf440c450..9d77ab162 100644 --- a/src/snapped-point.h +++ b/src/snapped-point.h @@ -12,10 +12,11 @@ * Released under GNU GPL, read the file 'COPYING' for more information. */ -#include <vector> -#include <list> #include <2geom/geom.h> -#include <snap-candidate.h> +#include <list> +#include <vector> + +#include "snap-candidate.h" namespace Inkscape { diff --git a/src/snapper.h b/src/snapper.h index c609239cf..9616d0954 100644 --- a/src/snapper.h +++ b/src/snapper.h @@ -12,15 +12,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information. */ -#include <map> -#include <list> #include <boost/optional.hpp> -#include <glib.h> // for g_assert +#include <cstdio> +#include <list> +#include "snap-candidate.h" #include "snapped-point.h" #include "snapped-line.h" #include "snapped-curve.h" -#include "snap-candidate.h" struct IntermSnapResults { std::list<Inkscape::SnappedPoint> points; @@ -86,7 +85,7 @@ public: bool hasPoint() const {return _type != DIRECTION && _type != UNDEFINED;} Geom::Point getPoint() const { - g_assert(_type != DIRECTION && _type != UNDEFINED); + assert(_type != DIRECTION && _type != UNDEFINED); return _point; } @@ -95,7 +94,7 @@ public: } Geom::Coord getRadius() const { - g_assert(_type == CIRCLE); + assert(_type == CIRCLE); return _radius; } @@ -121,7 +120,7 @@ public: Geom::Point const p2_on_cl = p1_on_cl + _direction; return Geom::projection(p, Geom::Line(p1_on_cl, p2_on_cl)); } else { - g_warning("Bug: trying to find the projection onto an undefined constraint"); + printf("WARNING: Bug: trying to find the projection onto an undefined constraint"); return Geom::Point(); } } diff --git a/src/sp-anchor.h b/src/sp-anchor.h index 778640032..d17718344 100644 --- a/src/sp-anchor.h +++ b/src/sp-anchor.h @@ -1,5 +1,5 @@ -#ifndef __SP_ANCHOR_H__ -#define __SP_ANCHOR_H__ +#ifndef SEEN_SP_ANCHOR_H +#define SEEN_SP_ANCHOR_H /* * SVG <a> element implementation @@ -23,16 +23,16 @@ public: SPAnchor(); virtual ~SPAnchor(); - gchar *href; + char *href; virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void set(unsigned int key, gchar const* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual const char* displayName() const; - virtual gchar* description() const; - virtual gint event(SPEvent *event); + virtual char* description() const; + virtual int event(SPEvent *event); }; #endif diff --git a/src/sp-clippath.h b/src/sp-clippath.h index ba7a90a57..eb8b14174 100644 --- a/src/sp-clippath.h +++ b/src/sp-clippath.h @@ -19,6 +19,9 @@ #define SP_IS_CLIPPATH(obj) (dynamic_cast<const SPClipPath*>((SPObject*)obj) != NULL) struct SPClipPathView; +typedef struct _GSList GSList; + +#include <cstdio> #include "sp-object-group.h" #include "uri-references.h" @@ -42,8 +45,8 @@ public: unsigned int clipPathUnits : 1; SPClipPathView *display; - static const gchar *create(GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform); - static GType sp_clippath_get_type(void); + static char const *create(GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform); + //static GType sp_clippath_get_type(void); Inkscape::DrawingItem *show(Inkscape::Drawing &drawing, unsigned int key); void hide(unsigned int key); @@ -57,12 +60,12 @@ protected: virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); - 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 void modified(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); }; @@ -90,10 +93,10 @@ protected: Inkscape::XML::Node * const owner_repr = owner->getRepr(); //XML Tree being used directly here while it shouldn't be... Inkscape::XML::Node * const obj_repr = obj->getRepr(); - gchar const * owner_name = NULL; - gchar const * owner_clippath = NULL; - gchar const * obj_name = NULL; - gchar const * obj_id = NULL; + char const * owner_name = NULL; + char const * owner_clippath = NULL; + char const * obj_name = NULL; + char const * obj_id = NULL; if (owner_repr != NULL) { owner_name = owner_repr->name(); owner_clippath = owner_repr->attribute("clippath"); @@ -102,7 +105,7 @@ protected: obj_name = obj_repr->name(); obj_id = obj_repr->attribute("id"); } - g_warning("Ignoring recursive clippath reference " + printf("WARNING: Ignoring recursive clippath reference " "<%s clippath=\"%s\"> in <%s id=\"%s\">", owner_name, owner_clippath, obj_name, obj_id); diff --git a/src/sp-conn-end-pair.h b/src/sp-conn-end-pair.h index 9f7f5a5d2..93f54378c 100644 --- a/src/sp-conn-end-pair.h +++ b/src/sp-conn-end-pair.h @@ -11,12 +11,10 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> -#include <stddef.h> -#include <sigc++/connection.h> -#include <sigc++/functors/slot.h> -#include <sigc++/signal.h> +#include <cstddef> +#include <sigc++/sigc++.h> + #include "libavoid/connector.h" @@ -33,21 +31,21 @@ class Node; } } -extern void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, gdouble curvature); +extern void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, double curvature); class SPConnEndPair { public: SPConnEndPair(SPPath *); ~SPConnEndPair(); void release(); - void setAttr(unsigned const key, gchar const *const value); + void setAttr(unsigned const key, char const *const value); void writeRepr(Inkscape::XML::Node *const repr) const; void getAttachedItems(SPItem *[2]) const; void getEndpoints(Geom::Point endPts[]) const; - gdouble getCurvature(void) const; + double getCurvature(void) const; SPConnEnd** getConnEnds(void); bool isOrthogonal(void) const; - friend void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, gdouble curvature); + friend void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, double curvature); void tellLibavoidNewEndpoints(const bool processTransaction = false); bool reroutePathFromLibavoid(void); void makePathInvalid(void); @@ -64,7 +62,7 @@ private: Avoid::ConnRef *_connRef; int _connType; - gdouble _connCurvature; + double _connCurvature; // A sigc connection for transformed signal. sigc::connection _transformed_connection; diff --git a/src/sp-conn-end.h b/src/sp-conn-end.h index a0b1ba5df..2b89a159d 100644 --- a/src/sp-conn-end.h +++ b/src/sp-conn-end.h @@ -1,8 +1,7 @@ #ifndef SEEN_SP_CONN_END #define SEEN_SP_CONN_END -#include <glib.h> -#include <stddef.h> +#include <cstddef> #include <sigc++/connection.h> #include "sp-use-reference.h" @@ -15,7 +14,7 @@ public: SPConnEnd(SPObject *owner); SPUseReference ref; - gchar *href; + char *href; /** Change of href string (not a modification of the attributes of the referrent). */ sigc::connection _changed_connection; @@ -29,13 +28,13 @@ public: /** A sigc connection for owning group transformed, used to do move compensation. */ sigc::connection _group_connection; - void setAttacherHref(gchar const *, SPPath *); - void setAttacherEndpoint(gchar const *, SPPath *); + void setAttacherHref(char const * value, SPPath * unused); + //void setAttacherEndpoint(char const *, SPPath *); // not defined private: - SPConnEnd(SPConnEnd const &); - SPConnEnd &operator=(SPConnEnd const &); + SPConnEnd(SPConnEnd const &); // no copy + SPConnEnd &operator=(SPConnEnd const &); // no assign }; void sp_conn_end_href_changed(SPObject *old_ref, SPObject *ref, diff --git a/src/sp-cursor.cpp b/src/sp-cursor.cpp index ea73da00c..16659d1cf 100644 --- a/src/sp-cursor.cpp +++ b/src/sp-cursor.cpp @@ -17,13 +17,14 @@ */ #include <cstring> +#include <gdk/gdk.h> #include <map> #include <sstream> #include "color.h" #include "sp-cursor.h" -static void free_cursor_data(guchar *pixels, gpointer /*data*/) { +static void free_cursor_data(unsigned char *pixels, void* /*data*/) { delete [] reinterpret_cast<guint32*>(pixels); } @@ -53,7 +54,7 @@ struct RGBA { } }; -GdkPixbuf *sp_cursor_pixbuf_from_xpm(gchar const *const *xpm, GdkColor const& black, GdkColor const& white, guint32 fill, guint32 stroke) +GdkPixbuf *sp_cursor_pixbuf_from_xpm(char const *const *xpm, GdkColor const& black, GdkColor const& white, guint32 fill, guint32 stroke) { int height = 0; int width = 0; @@ -72,7 +73,7 @@ GdkPixbuf *sp_cursor_pixbuf_from_xpm(gchar const *const *xpm, GdkColor const& bl char const *p = xpm[1 + i]; g_assert(*p >=0); - guchar const ccode = (guchar) *p; + unsigned char const ccode = (guchar) *p; p++; while (isspace(*p)) { @@ -110,7 +111,7 @@ GdkPixbuf *sp_cursor_pixbuf_from_xpm(gchar const *const *xpm, GdkColor const& bl return gdk_pixbuf_new_from_data(reinterpret_cast<guchar*>(pixmap_buffer), GDK_COLORSPACE_RGB, TRUE, 8, width, height, width * sizeof(guint32), free_cursor_data, NULL); } -GdkCursor *sp_cursor_new_from_xpm(gchar const *const *xpm, gint hot_x, gint hot_y) +GdkCursor *sp_cursor_new_from_xpm(char const *const *xpm, int hot_x, int hot_y) { GdkCursor *cursor = 0; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)xpm); diff --git a/src/sp-cursor.h b/src/sp-cursor.h index f445127ad..c0b8b46a3 100644 --- a/src/sp-cursor.h +++ b/src/sp-cursor.h @@ -1,10 +1,13 @@ #ifndef SP_CURSOR_H #define SP_CURSOR_H -#include <gdk/gdk.h> +typedef unsigned int guint32; +typedef struct _GdkPixbuf GdkPixbuf; +typedef struct _GdkCursor GdkCursor; +typedef struct _GdkColor GdkColor; -GdkPixbuf* sp_cursor_pixbuf_from_xpm(gchar const *const *xpm, GdkColor const& black, GdkColor const& white, guint32 fill, guint32 stroke); -GdkCursor *sp_cursor_new_from_xpm(gchar const *const *xpm, gint hot_x, gint hot_y); +GdkPixbuf* sp_cursor_pixbuf_from_xpm(char const *const *xpm, GdkColor const& black, GdkColor const& white, guint32 fill, guint32 stroke); +GdkCursor *sp_cursor_new_from_xpm(char const *const *xpm, int hot_x, int hot_y); #endif diff --git a/src/sp-defs.h b/src/sp-defs.h index 6efdea1f3..c122cb2a9 100644 --- a/src/sp-defs.h +++ b/src/sp-defs.h @@ -27,7 +27,7 @@ protected: virtual void release(); virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(unsigned int flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; #endif // !SEEN_SP_DEFS_H diff --git a/src/sp-desc.h b/src/sp-desc.h index 2bb42b333..40888bee4 100644 --- a/src/sp-desc.h +++ b/src/sp-desc.h @@ -1,5 +1,5 @@ -#ifndef __SP_DESC_H__ -#define __SP_DESC_H__ +#ifndef SEEN_SP_DESC_H +#define SEEN_SP_DESC_H /* * SVG <desc> implementation @@ -23,7 +23,7 @@ public: virtual ~SPDesc(); protected: - 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 diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index cda59e057..b5c6e4af8 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -14,26 +14,25 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "svg/svg.h" -#include "svg/path-string.h" -#include "xml/repr.h" -#include "attributes.h" -#include "style.h" -#include "display/curve.h" +#include <glibmm.h> #include <glibmm/i18n.h> + #include <2geom/angle.h> #include <2geom/ellipse.h> -#include <2geom/transforms.h> -#include <2geom/pathvector.h> #include <2geom/path-sink.h> +#include <2geom/pathvector.h> +#include <2geom/transforms.h> + +#include "attributes.h" +#include "display/curve.h" #include "document.h" -#include "sp-ellipse.h" #include "preferences.h" #include "snap-candidate.h" +#include "sp-ellipse.h" +#include "style.h" +#include "svg/svg.h" +#include "svg/path-string.h" +#include "xml/repr.h" #include "sp-factory.h" @@ -42,21 +41,21 @@ SPObject *create_ellipse() { SPGenericEllipse *ellipse = new SPGenericEllipse(); ellipse->type = SP_GENERIC_ELLIPSE_ELLIPSE; - return (SPObject*)ellipse; + return ellipse; } SPObject *create_circle() { SPGenericEllipse *circle = new SPGenericEllipse(); circle->type = SP_GENERIC_ELLIPSE_CIRCLE; - return (SPObject*)circle; + return circle; } SPObject *create_arc() { SPGenericEllipse *arc = new SPGenericEllipse(); arc->type = SP_GENERIC_ELLIPSE_ARC; - return (SPObject*)arc; + return arc; } bool ellipse_registered = SPFactory::instance().registerObject("svg:ellipse", create_ellipse); @@ -695,4 +694,4 @@ bool SPGenericEllipse::_isSlice() const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/sp-ellipse.h b/src/sp-ellipse.h index cb988b8bb..09768fd6d 100644 --- a/src/sp-ellipse.h +++ b/src/sp-ellipse.h @@ -1,7 +1,4 @@ -#ifndef __SP_ELLIPSE_H__ -#define __SP_ELLIPSE_H__ - -/* +/** * SVG <ellipse> and related implementations * * Authors: @@ -16,15 +13,18 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifndef SEEN_SP_ELLIPSE_H +#define SEEN_SP_ELLIPSE_H + #include "svg/svg-length.h" #include "sp-shape.h" /* Common parent class */ -#define SP_GENERICELLIPSE(obj) (dynamic_cast<SPGenericEllipse*>((SPObject*)obj)) -#define SP_IS_GENERICELLIPSE(obj) (dynamic_cast<const SPGenericEllipse*>((SPObject*)obj) != NULL) +#define SP_GENERICELLIPSE(obj) (dynamic_cast<SPGenericEllipse*>(obj)) +#define SP_IS_GENERICELLIPSE(obj) (dynamic_cast<const SPGenericEllipse*>((obj)) != NULL) enum GenericEllipseType { - SP_GENERIC_ELLIPSE_UNDEFINED, + SP_GENERIC_ELLIPSE_UNDEFINED, // FIXME shouldn't exist SP_GENERIC_ELLIPSE_ARC, SP_GENERIC_ELLIPSE_CIRCLE, SP_GENERIC_ELLIPSE_ELLIPSE @@ -53,10 +53,10 @@ public: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual void set(unsigned int key, gchar const *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 *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node *write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual const char *displayName() const; virtual void set_shape(); @@ -76,7 +76,7 @@ public: Geom::Point getPointAtAngle(double arg) const; bool set_elliptical_path_attribute(Inkscape::XML::Node *repr); - void position_set(gdouble x, gdouble y, gdouble rx, gdouble ry); + void position_set(double x, double y, double rx, double ry); protected: /** @@ -98,4 +98,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/sp-filter-primitive.cpp b/src/sp-filter-primitive.cpp index ceb91c984..1f85c8193 100644 --- a/src/sp-filter-primitive.cpp +++ b/src/sp-filter-primitive.cpp @@ -19,14 +19,15 @@ #include <string.h> +#include "display/nr-filter-primitive.h" +#include "display/nr-filter-types.h" + #include "attributes.h" #include "style.h" #include "sp-filter-primitive.h" #include "xml/repr.h" #include "sp-filter.h" #include "sp-item.h" -#include "display/nr-filter-primitive.h" -#include "display/nr-filter-types.h" // CPPIFY: Make pure virtual. diff --git a/src/sp-filter-primitive.h b/src/sp-filter-primitive.h index 040e2f31f..d81adbd10 100644 --- a/src/sp-filter-primitive.h +++ b/src/sp-filter-primitive.h @@ -1,5 +1,5 @@ -#ifndef __SP_FILTER_PRIMITIVE_H__ -#define __SP_FILTER_PRIMITIVE_H__ +#ifndef SEEN_SP_FILTER_PRIMITIVE_H +#define SEEN_SP_FILTER_PRIMITIVE_H /** \file * Document level base class for all SVG filter primitives. @@ -40,11 +40,11 @@ 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); public: virtual void build_renderer(Inkscape::Filters::Filter* filter) = 0; @@ -54,8 +54,8 @@ public: void sp_filter_primitive_renderer_common(SPFilterPrimitive *sp_prim, Inkscape::Filters::FilterPrimitive *nr_prim); int sp_filter_primitive_name_previous_out(SPFilterPrimitive *prim); -int sp_filter_primitive_read_in(SPFilterPrimitive *prim, gchar const *name); -int sp_filter_primitive_read_result(SPFilterPrimitive *prim, gchar const *name); +int sp_filter_primitive_read_in(SPFilterPrimitive *prim, char const *name); +int sp_filter_primitive_read_result(SPFilterPrimitive *prim, char const *name); #endif /* diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index e8319baca..9a184952c 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -22,8 +22,9 @@ using std::map; using std::pair; -#include <glibmm/stringutils.h> +#include <glibmm.h> #include "attributes.h" +#include "display/nr-filter.h" #include "document.h" #include "sp-filter.h" #include "sp-filter-reference.h" @@ -37,8 +38,6 @@ using std::pair; #define SP_MACROS_SILENT #include "macros.h" -#include "display/nr-filter.h" - static void filter_ref_changed(SPObject *old_ref, SPObject *ref, SPFilter *filter); static void filter_ref_modified(SPObject *href, guint flags, SPFilter *filter); diff --git a/src/sp-filter.h b/src/sp-filter.h index 0d087c5bf..e6318c569 100644 --- a/src/sp-filter.h +++ b/src/sp-filter.h @@ -12,6 +12,7 @@ #ifndef SP_FILTER_H_SEEN #define SP_FILTER_H_SEEN +#include <glibmm/ustring.h> #include <map> #include "number-opt-number.h" @@ -19,8 +20,6 @@ #include "sp-filter-units.h" #include "svg/svg-length.h" -#include <glibmm/ustring.h> - #define SP_FILTER(obj) (dynamic_cast<SPFilter*>((SPObject*)obj)) #define SP_IS_FILTER(obj) (dynamic_cast<const SPFilter*>((SPObject*)obj) != NULL) @@ -45,9 +44,9 @@ public: virtual ~SPFilter(); SPFilterUnits filterUnits; - guint filterUnits_set : 1; + unsigned int filterUnits_set : 1; SPFilterUnits primitiveUnits; - guint primitiveUnits_set : 1; + unsigned int primitiveUnits_set : 1; SVGLength x; SVGLength y; SVGLength width; @@ -68,11 +67,11 @@ protected: virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); virtual void remove_child(Inkscape::XML::Node* child); - virtual void set(unsigned int key, const gchar* value); + virtual void set(unsigned int key, const char* 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); }; void sp_filter_set_filter_units(SPFilter *filter, SPFilterUnits filterUnits); @@ -88,14 +87,14 @@ void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr int sp_filter_primitive_count(SPFilter *filter); /// Returns a slot number for given image name, or -1 for unknown name. -int sp_filter_get_image_name(SPFilter *filter, gchar const *name); +int sp_filter_get_image_name(SPFilter *filter, char const *name); /// Returns slot number for given image name, even if it's unknown. -int sp_filter_set_image_name(SPFilter *filter, gchar const *name); +int sp_filter_set_image_name(SPFilter *filter, char const *name); /** Finds image name based on it's slot number. Returns 0 for unknown slot * numbers. */ -gchar const *sp_filter_name_for_image(SPFilter const *filter, int const image); +char const *sp_filter_name_for_image(SPFilter const *filter, int const image); /// Returns a result image name that is not in use inside this filter. Glib::ustring sp_filter_get_new_result_name(SPFilter *filter); diff --git a/src/sp-flowdiv.h b/src/sp-flowdiv.h index d00cfc51b..4a3690726 100644 --- a/src/sp-flowdiv.h +++ b/src/sp-flowdiv.h @@ -1,5 +1,5 @@ -#ifndef __SP_ITEM_FLOWDIV_H__ -#define __SP_ITEM_FLOWDIV_H__ +#ifndef SEEN_SP_ITEM_FLOWDIV_H +#define SEEN_SP_ITEM_FLOWDIV_H /* */ @@ -31,11 +31,11 @@ public: protected: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void update(SPCtx* ctx, guint flags); + virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(unsigned int flags); - virtual void set(unsigned int key, gchar const* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; class SPFlowtspan : public SPItem { @@ -46,11 +46,11 @@ public: protected: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void update(SPCtx* ctx, guint flags); + virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(unsigned int flags); - virtual void set(unsigned int key, gchar const* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; class SPFlowpara : public SPItem { @@ -61,11 +61,11 @@ public: protected: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void update(SPCtx* ctx, guint flags); + virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(unsigned int flags); - virtual void set(unsigned int key, gchar const* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; // these do not need any style @@ -78,7 +78,7 @@ protected: virtual void release(); virtual void modified(unsigned int flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; class SPFlowregionbreak : public SPObject { @@ -90,7 +90,7 @@ protected: virtual void release(); virtual void modified(unsigned int flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; #endif diff --git a/src/sp-flowregion.h b/src/sp-flowregion.h index 721eb0432..024a298b8 100644 --- a/src/sp-flowregion.h +++ b/src/sp-flowregion.h @@ -1,5 +1,5 @@ -#ifndef __SP_ITEM_FLOWREGION_H__ -#define __SP_ITEM_FLOWREGION_H__ +#ifndef SEEN_SP_ITEM_FLOWREGION_H +#define SEEN_SP_ITEM_FLOWREGION_H /* */ @@ -30,7 +30,7 @@ public: virtual void remove_child(Inkscape::XML::Node *child); virtual void update(SPCtx *ctx, unsigned int flags); virtual void modified(guint flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual const char* displayName() const; }; @@ -47,7 +47,7 @@ public: virtual void remove_child(Inkscape::XML::Node *child); virtual void update(SPCtx *ctx, unsigned int flags); virtual void modified(guint flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual const char* displayName() const; }; diff --git a/src/sp-flowtext.h b/src/sp-flowtext.h index a5b7db22e..743d55030 100644 --- a/src/sp-flowtext.h +++ b/src/sp-flowtext.h @@ -4,10 +4,10 @@ /* */ -#include "sp-item.h" - #include <2geom/forward.h> + #include "libnrtype/Layout-TNG.h" +#include "sp-item.h" #define SP_FLOWTEXT(obj) (dynamic_cast<SPFlowtext*>((SPObject*)obj)) #define SP_IS_FLOWTEXT(obj) (dynamic_cast<const SPFlowtext*>((SPObject*)obj) != NULL) @@ -63,18 +63,18 @@ public: virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); virtual void remove_child(Inkscape::XML::Node* child); - virtual void set(unsigned int key, const gchar* value); + virtual void set(unsigned int key, const char* value); virtual Geom::Affine set_transform(Geom::Affine const& xform); virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(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); virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const; virtual void print(SPPrintContext *ctx); virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); virtual void hide(unsigned int key); virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const; diff --git a/src/sp-font-face.h b/src/sp-font-face.h index 531dd5843..669b93197 100644 --- a/src/sp-font-face.h +++ b/src/sp-font-face.h @@ -1,9 +1,5 @@ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#ifndef __SP_FONTFACE_H__ -#define __SP_FONTFACE_H__ +#ifndef SEEN_SP_FONTFACE_H +#define SEEN_SP_FONTFACE_H #include <vector> @@ -117,11 +113,11 @@ protected: virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); virtual void remove_child(Inkscape::XML::Node* child); - virtual void set(unsigned int key, const gchar* value); + virtual void set(unsigned int key, const char* 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 //#ifndef __SP_FONTFACE_H__ diff --git a/src/sp-font.h b/src/sp-font.h index 6e6f4eec2..6e26a02b2 100644 --- a/src/sp-font.h +++ b/src/sp-font.h @@ -1,7 +1,3 @@ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - #ifndef SP_FONT_H_SEEN #define SP_FONT_H_SEEN @@ -40,11 +36,11 @@ protected: virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); virtual void remove_child(Inkscape::XML::Node* child); - 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 //#ifndef SP_FONT_H_SEEN diff --git a/src/sp-glyph-kerning.cpp b/src/sp-glyph-kerning.cpp index be47c7621..f33d3c509 100644 --- a/src/sp-glyph-kerning.cpp +++ b/src/sp-glyph-kerning.cpp @@ -1,18 +1,12 @@ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define __SP_ANCHOR_C__ - -/* +/** * SVG <hkern> and <vkern> elements implementation * W3C SVG 1.1 spec, page 476, section 20.7 * - * Author: + * Authors: * Felipe C. da S. Sanches <juca@members.fsf.org> * Abhishek Sharma * - * Copyright (C) 2008, Felipe C. da S. Sanches + * Copyright (C) 2008 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -26,45 +20,49 @@ #include <cstring> -SPGlyphKerning::SPGlyphKerning() : SPObject() { +SPGlyphKerning::SPGlyphKerning() + : SPObject() //TODO: correct these values: - this->u1 = NULL; - this->g1 = NULL; - this->u2 = NULL; - this->g2 = NULL; - this->k = 0; -} - -SPGlyphKerning::~SPGlyphKerning() { + , u1(NULL) + , g1(NULL) + , u2(NULL) + , g2(NULL) + , k(0) +{ } -void SPGlyphKerning::build(SPDocument *document, Inkscape::XML::Node *repr) { - SPObject::build(document, repr); +void SPGlyphKerning::build(SPDocument *document, Inkscape::XML::Node *repr) +{ + SPObject::build(document, repr); - this->readAttr( "u1" ); - this->readAttr( "g1" ); - this->readAttr( "u2" ); - this->readAttr( "g2" ); - this->readAttr( "k" ); + this->readAttr( "u1" ); + this->readAttr( "g1" ); + this->readAttr( "u2" ); + this->readAttr( "g2" ); + this->readAttr( "k" ); } -void SPGlyphKerning::release() { - SPObject::release(); +void SPGlyphKerning::release() +{ + SPObject::release(); } -GlyphNames::GlyphNames(const gchar* value){ +GlyphNames::GlyphNames(const gchar* value) +{ if (value) { - this->names = strdup(value); + names = g_strdup(value); } } -GlyphNames::~GlyphNames(){ - if (this->names) { - g_free(this->names); +GlyphNames::~GlyphNames() +{ + if (names) { + g_free(names); } } -bool GlyphNames::contains(const char* name){ +bool GlyphNames::contains(const char* name) +{ if (!(this->names) || !name) { return false; } @@ -75,14 +73,15 @@ bool GlyphNames::contains(const char* name){ while (is >> str) { if (str == s) { - return true; + return true; } } return false; } -void SPGlyphKerning::set(unsigned int key, const gchar *value) { +void SPGlyphKerning::set(unsigned int key, const gchar *value) +{ switch (key) { case SP_ATTR_U1: { @@ -143,15 +142,16 @@ void SPGlyphKerning::set(unsigned int key, const gchar *value) { } /** - * * Receives update notifications. - * */ -void SPGlyphKerning::update(SPCtx *ctx, guint flags) { + * Receives update notifications. + */ +void SPGlyphKerning::update(SPCtx *ctx, guint flags) +{ if (flags & SP_OBJECT_MODIFIED_FLAG) { /* do something to trigger redisplay, updates? */ - this->readAttr( "u1" ); - this->readAttr( "u2" ); - this->readAttr( "g2" ); - this->readAttr( "k" ); + this->readAttr( "u1" ); + this->readAttr( "u2" ); + this->readAttr( "g2" ); + this->readAttr( "k" ); } SPObject::update(ctx, flags); @@ -159,37 +159,26 @@ void SPGlyphKerning::update(SPCtx *ctx, guint flags) { #define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key)); -Inkscape::XML::Node* SPGlyphKerning::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = xml_doc->createElement("svg:glyphkerning");//fix this! - } - - /* I am commenting out this part because I am not certain how does it work. I will have to study it later. Juca - repr->setAttribute("unicode", glyph->unicode); - repr->setAttribute("glyph-name", glyph->glyph_name); - repr->setAttribute("d", glyph->d); - sp_repr_set_svg_double(repr, "orientation", (double) glyph->orientation); - sp_repr_set_svg_double(repr, "arabic-form", (double) glyph->arabic_form); - repr->setAttribute("lang", glyph->lang); - sp_repr_set_svg_double(repr, "horiz-adv-x", glyph->horiz_adv_x); - sp_repr_set_svg_double(repr, "vert-origin-x", glyph->vert_origin_x); - sp_repr_set_svg_double(repr, "vert-origin-y", glyph->vert_origin_y); - sp_repr_set_svg_double(repr, "vert-adv-y", glyph->vert_adv_y); - */ - if (repr != this->getRepr()) { - // All the COPY_ATTR functions below use - // XML Tree directly, while they shouldn't. - COPY_ATTR(repr, this->getRepr(), "u1"); - COPY_ATTR(repr, this->getRepr(), "g1"); - COPY_ATTR(repr, this->getRepr(), "u2"); - COPY_ATTR(repr, this->getRepr(), "g2"); - COPY_ATTR(repr, this->getRepr(), "k"); - } - - SPObject::write(xml_doc, repr, flags); - - return repr; +Inkscape::XML::Node* SPGlyphKerning::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +{ + if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { + repr = xml_doc->createElement("svg:glyphkerning"); // fix this! + } + + if (repr != this->getRepr()) { + // All the COPY_ATTR functions below use + // XML Tree directly, while they shouldn't. + COPY_ATTR(repr, this->getRepr(), "u1"); + COPY_ATTR(repr, this->getRepr(), "g1"); + COPY_ATTR(repr, this->getRepr(), "u2"); + COPY_ATTR(repr, this->getRepr(), "g2"); + COPY_ATTR(repr, this->getRepr(), "k"); + } + SPObject::write(xml_doc, repr, flags); + + return repr; } + /* Local Variables: mode:c++ diff --git a/src/sp-glyph-kerning.h b/src/sp-glyph-kerning.h index 5cae6b9dd..c96c0b6e4 100644 --- a/src/sp-glyph-kerning.h +++ b/src/sp-glyph-kerning.h @@ -1,10 +1,3 @@ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#ifndef __SP_GLYPH_KERNING_H__ -#define __SP_GLYPH_KERNING_H__ - /* * SVG <hkern> and <vkern> elements implementation * @@ -16,41 +9,35 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifndef SEEN_SP_GLYPH_KERNING_H +#define SEEN_SP_GLYPH_KERNING_H + #include "sp-object.h" #include "unicoderange.h" -//#define SP_HKERN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_HKERN, SPHkern)) -//#define SP_HKERN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_HKERN, SPGlyphKerningClass)) -//#define SP_IS_HKERN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_HKERN)) -//#define SP_IS_HKERN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_HKERN)) +#define SP_HKERN(obj) (dynamic_cast<SPHkern*>(obj)) +#define SP_IS_HKERN(obj) (dynamic_cast<const SPHkern*>(obj) != NULL) -#define SP_HKERN(obj) (dynamic_cast<SPHkern*>((SPObject*)obj)) -#define SP_IS_HKERN(obj) (dynamic_cast<const SPHkern*>((SPObject*)obj) != NULL) - -//#define SP_VKERN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_VKERN, SPVkern)) -//#define SP_VKERN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_VKERN, SPGlyphKerningClass)) -//#define SP_IS_VKERN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_VKERN)) -//#define SP_IS_VKERN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_VKERN)) - -#define SP_VKERN(obj) (dynamic_cast<SPVkern*>((SPObject*)obj)) -#define SP_IS_VKERN(obj) (dynamic_cast<const SPVkern*>((SPObject*)obj) != NULL) +#define SP_VKERN(obj) (dynamic_cast<SPVkern*>(obj)) +#define SP_IS_VKERN(obj) (dynamic_cast<const SPVkern*>(obj) != NULL) // CPPIFY: These casting macros are buggy, as Vkern and Hkern aren't "real" classes. -class GlyphNames{ +class GlyphNames { public: -GlyphNames(const gchar* value); -~GlyphNames(); -bool contains(const char* name); + GlyphNames(char const* value); + ~GlyphNames(); + bool contains(char const* name); private: -gchar* names; + char* names; }; class SPGlyphKerning : public SPObject { public: - SPGlyphKerning(); - virtual ~SPGlyphKerning(); + SPGlyphKerning(); + virtual ~SPGlyphKerning() {} + // FIXME encapsulation UnicodeRange* u1; GlyphNames* g1; UnicodeRange* u2; @@ -58,22 +45,30 @@ public: double k; protected: - virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void release(); - - virtual void set(unsigned int key, const gchar* 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 void build(SPDocument* doc, Inkscape::XML::Node* repr); + virtual void release(); + 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, unsigned int flags); }; class SPHkern : public SPGlyphKerning { - + virtual ~SPHkern() {} }; class SPVkern : public SPGlyphKerning { - + virtual ~SPVkern() {} }; -#endif //#ifndef __SP_GLYPH_KERNING_H__ +#endif // !SEEN_SP_GLYPH_KERNING_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/sp-glyph.cpp b/src/sp-glyph.cpp index 695af03ba..eaa69d486 100644 --- a/src/sp-glyph.cpp +++ b/src/sp-glyph.cpp @@ -2,8 +2,6 @@ # include <config.h> #endif -#define __SP_GLYPH_C__ - /* * SVG <glyph> element implementation * @@ -25,46 +23,44 @@ #include "sp-factory.h" namespace { - SPObject* createGlyph() { - return new SPGlyph(); - } - - bool glyphRegistered = SPFactory::instance().registerObject("svg:glyph", createGlyph); + SPObject* createGlyph() { + return new SPGlyph(); + } + bool glyphRegistered = SPFactory::instance().registerObject("svg:glyph", createGlyph); } -SPGlyph::SPGlyph() : SPObject() { +SPGlyph::SPGlyph() + : SPObject() //TODO: correct these values: - - this->d = NULL; - this->orientation = GLYPH_ORIENTATION_BOTH; - this->arabic_form = GLYPH_ARABIC_FORM_INITIAL; - this->lang = NULL; - this->horiz_adv_x = 0; - this->vert_origin_x = 0; - this->vert_origin_y = 0; - this->vert_adv_y = 0; -} - -SPGlyph::~SPGlyph() { + , d(NULL) + , orientation(GLYPH_ORIENTATION_BOTH) + , arabic_form(GLYPH_ARABIC_FORM_INITIAL) + , lang(NULL) + , horiz_adv_x(0) + , vert_origin_x(0) + , vert_origin_y(0) + , vert_adv_y(0) +{ } -void SPGlyph::build(SPDocument *document, Inkscape::XML::Node *repr) { - SPObject::build(document, repr); +void SPGlyph::build(SPDocument *document, Inkscape::XML::Node *repr) +{ + SPObject::build(document, repr); - this->readAttr( "unicode" ); - this->readAttr( "glyph-name" ); - this->readAttr( "d" ); - this->readAttr( "orientation" ); - this->readAttr( "arabic-form" ); - this->readAttr( "lang" ); - this->readAttr( "horiz-adv-x" ); - this->readAttr( "vert-origin-x" ); - this->readAttr( "vert-origin-y" ); - this->readAttr( "vert-adv-y" ); + this->readAttr( "unicode" ); + this->readAttr( "glyph-name" ); + this->readAttr( "d" ); + this->readAttr( "orientation" ); + this->readAttr( "arabic-form" ); + this->readAttr( "lang" ); + this->readAttr( "horiz-adv-x" ); + this->readAttr( "vert-origin-x" ); + this->readAttr( "vert-origin-y" ); + this->readAttr( "vert-adv-y" ); } void SPGlyph::release() { - SPObject::release(); + SPObject::release(); } static glyphArabicForm sp_glyph_read_arabic_form(gchar const *value){ @@ -97,7 +93,8 @@ static glyphArabicForm sp_glyph_read_arabic_form(gchar const *value){ return GLYPH_ARABIC_FORM_INITIAL; //TODO: VERIFY DEFAULT! } -static glyphOrientation sp_glyph_read_orientation(gchar const *value){ +static glyphOrientation sp_glyph_read_orientation(gchar const *value) +{ if (!value) { return GLYPH_ORIENTATION_BOTH; } @@ -115,7 +112,8 @@ static glyphOrientation sp_glyph_read_orientation(gchar const *value){ return GLYPH_ORIENTATION_BOTH; } -void SPGlyph::set(unsigned int key, const gchar *value) { +void SPGlyph::set(unsigned int key, const gchar *value) +{ switch (key) { case SP_ATTR_UNICODE: { @@ -228,21 +226,22 @@ void SPGlyph::set(unsigned int key, const gchar *value) { } /** - * * Receives update notifications. - * */ -void SPGlyph::update(SPCtx *ctx, guint flags) { + * Receives update notifications. + */ +void SPGlyph::update(SPCtx *ctx, guint flags) +{ if (flags & SP_OBJECT_MODIFIED_FLAG) { /* do something to trigger redisplay, updates? */ - this->readAttr( "unicode" ); - this->readAttr( "glyph-name" ); - this->readAttr( "d" ); - this->readAttr( "orientation" ); - this->readAttr( "arabic-form" ); - this->readAttr( "lang" ); - this->readAttr( "horiz-adv-x" ); - this->readAttr( "vert-origin-x" ); - this->readAttr( "vert-origin-y" ); - this->readAttr( "vert-adv-y" ); + this->readAttr( "unicode" ); + this->readAttr( "glyph-name" ); + this->readAttr( "d" ); + this->readAttr( "orientation" ); + this->readAttr( "arabic-form" ); + this->readAttr( "lang" ); + this->readAttr( "horiz-adv-x" ); + this->readAttr( "vert-origin-x" ); + this->readAttr( "vert-origin-y" ); + this->readAttr( "vert-adv-y" ); } SPObject::update(ctx, flags); @@ -250,42 +249,45 @@ void SPGlyph::update(SPCtx *ctx, guint flags) { #define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key)); -Inkscape::XML::Node* SPGlyph::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = xml_doc->createElement("svg:glyph"); - } +Inkscape::XML::Node* SPGlyph::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +{ + if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { + repr = xml_doc->createElement("svg:glyph"); + } - /* I am commenting out this part because I am not certain how does it work. I will have to study it later. Juca - repr->setAttribute("unicode", glyph->unicode); - repr->setAttribute("glyph-name", glyph->glyph_name); - repr->setAttribute("d", glyph->d); - sp_repr_set_svg_double(repr, "orientation", (double) glyph->orientation); - sp_repr_set_svg_double(repr, "arabic-form", (double) glyph->arabic_form); - repr->setAttribute("lang", glyph->lang); - sp_repr_set_svg_double(repr, "horiz-adv-x", glyph->horiz_adv_x); - sp_repr_set_svg_double(repr, "vert-origin-x", glyph->vert_origin_x); - sp_repr_set_svg_double(repr, "vert-origin-y", glyph->vert_origin_y); - sp_repr_set_svg_double(repr, "vert-adv-y", glyph->vert_adv_y); - */ - if (repr != this->getRepr()) { - // All the COPY_ATTR functions below use - // XML Tree directly while they shouldn't. - COPY_ATTR(repr, this->getRepr(), "unicode"); - COPY_ATTR(repr, this->getRepr(), "glyph-name"); - COPY_ATTR(repr, this->getRepr(), "d"); - COPY_ATTR(repr, this->getRepr(), "orientation"); - COPY_ATTR(repr, this->getRepr(), "arabic-form"); - COPY_ATTR(repr, this->getRepr(), "lang"); - COPY_ATTR(repr, this->getRepr(), "horiz-adv-x"); - COPY_ATTR(repr, this->getRepr(), "vert-origin-x"); - COPY_ATTR(repr, this->getRepr(), "vert-origin-y"); - COPY_ATTR(repr, this->getRepr(), "vert-adv-y"); - } + /* I am commenting out this part because I am not certain how does it work. I will have to study it later. Juca + repr->setAttribute("unicode", glyph->unicode); + repr->setAttribute("glyph-name", glyph->glyph_name); + repr->setAttribute("d", glyph->d); + sp_repr_set_svg_double(repr, "orientation", (double) glyph->orientation); + sp_repr_set_svg_double(repr, "arabic-form", (double) glyph->arabic_form); + repr->setAttribute("lang", glyph->lang); + sp_repr_set_svg_double(repr, "horiz-adv-x", glyph->horiz_adv_x); + sp_repr_set_svg_double(repr, "vert-origin-x", glyph->vert_origin_x); + sp_repr_set_svg_double(repr, "vert-origin-y", glyph->vert_origin_y); + sp_repr_set_svg_double(repr, "vert-adv-y", glyph->vert_adv_y); + */ - SPObject::write(xml_doc, repr, flags); + if (repr != this->getRepr()) { + // All the COPY_ATTR functions below use + // XML Tree directly while they shouldn't. + COPY_ATTR(repr, this->getRepr(), "unicode"); + COPY_ATTR(repr, this->getRepr(), "glyph-name"); + COPY_ATTR(repr, this->getRepr(), "d"); + COPY_ATTR(repr, this->getRepr(), "orientation"); + COPY_ATTR(repr, this->getRepr(), "arabic-form"); + COPY_ATTR(repr, this->getRepr(), "lang"); + COPY_ATTR(repr, this->getRepr(), "horiz-adv-x"); + COPY_ATTR(repr, this->getRepr(), "vert-origin-x"); + COPY_ATTR(repr, this->getRepr(), "vert-origin-y"); + COPY_ATTR(repr, this->getRepr(), "vert-adv-y"); + } - return repr; + SPObject::write(xml_doc, repr, flags); + + return repr; } + /* Local Variables: mode:c++ diff --git a/src/sp-glyph.h b/src/sp-glyph.h index 798d9ff2f..297ac930e 100644 --- a/src/sp-glyph.h +++ b/src/sp-glyph.h @@ -1,13 +1,4 @@ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#ifndef __SP_GLYPH_H__ -#define __SP_GLYPH_H__ - -/* - * SVG <glyph> element implementation - * +/** * Authors: * Felipe C. da S. Sanches <juca@members.fsf.org> * @@ -16,6 +7,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifndef SEEN_SP_GLYPH_H +#define SEEN_SP_GLYPH_H + #include "sp-object.h" #define SP_GLYPH(obj) (dynamic_cast<SPGlyph*>((SPObject*)obj)) @@ -34,11 +28,16 @@ enum glyphOrientation { GLYPH_ORIENTATION_BOTH }; +/* + * SVG <glyph> element + */ + class SPGlyph : public SPObject { public: - SPGlyph(); - virtual ~SPGlyph(); + SPGlyph(); + virtual ~SPGlyph() {} + // FIXME encapsulation Glib::ustring unicode; Glib::ustring glyph_name; char* d; @@ -51,14 +50,23 @@ public: double vert_adv_y; protected: - virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void release(); - - virtual void set(unsigned int key, const gchar* value); + virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); + virtual void release(); + virtual void set(unsigned int key, const char* value); + virtual void update(SPCtx* ctx, unsigned int flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); - virtual void update(SPCtx* ctx, unsigned int flags); - - virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); }; -#endif //#ifndef __SP_GLYPH_H__ +#endif // !SEEN_SP_GLYPH_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/sp-gradient-vector.h b/src/sp-gradient-vector.h index 8e860c169..e57820b56 100644 --- a/src/sp-gradient-vector.h +++ b/src/sp-gradient-vector.h @@ -1,7 +1,6 @@ #ifndef SEEN_SP_GRADIENT_VECTOR_H #define SEEN_SP_GRADIENT_VECTOR_H -#include <glib.h> #include <vector> #include "color.h" @@ -14,9 +13,9 @@ * copying from SPStop to SPGradientStop. */ struct SPGradientStop { - gdouble offset; + double offset; SPColor color; - gfloat opacity; + float opacity; }; /** diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp index 70c54451a..b3e885560 100644 --- a/src/sp-gradient.cpp +++ b/src/sp-gradient.cpp @@ -54,9 +54,6 @@ #include "style.h" #include "display/grayscale.h" -#define SP_MACROS_SILENT -#include "macros.h" - /// Has to be power of 2 Seems to be unused. //#define NCOLORS NR_GRADIENT_VECTOR_LENGTH @@ -107,11 +104,11 @@ void SPGradient::setSwatch( bool swatch ) * Equivalent meaning they have the same stop count, same stop colors and same stop opacity * @param that - A gradient to compare this to */ -gboolean SPGradient::isEquivalent(SPGradient *that) +bool SPGradient::isEquivalent(SPGradient *that) { //TODO Make this work for mesh gradients - bool status = FALSE; + bool status = false; while(1){ // not really a loop, used to avoid deep nesting or multiple exit points from function if (this->getStopCount() != that->getStopCount()) { break; } @@ -132,11 +129,11 @@ gboolean SPGradient::isEquivalent(SPGradient *that) SPStop *as = this->getVector()->getFirstStop(); SPStop *bs = that->getVector()->getFirstStop(); - bool effective = TRUE; + bool effective = true; while (effective && (as && bs)) { if (!as->getEffectiveColor().isClose(bs->getEffectiveColor(), 0.001) || as->offset != bs->offset) { - effective = FALSE; + effective = false; break; } else { @@ -144,9 +141,9 @@ gboolean SPGradient::isEquivalent(SPGradient *that) bs = bs->getNextStop(); } } - if(!effective)break; + if (!effective) break; - status = TRUE; + status = true; break; } return status; @@ -157,9 +154,9 @@ gboolean SPGradient::isEquivalent(SPGradient *that) * Aligned means that they have exactly the same coordinates and transform. * @param that - A gradient to compare this to */ -gboolean SPGradient::isAligned(SPGradient *that) +bool SPGradient::isAligned(SPGradient *that) { - bool status = FALSE; + bool status = false; /* Some gradients have coordinates/other values specified, some don't. yes/yes check the coordinates/other values @@ -223,7 +220,7 @@ gboolean SPGradient::isAligned(SPGradient *that) } else { break; } - status = TRUE; + status = true; break; } return status; diff --git a/src/sp-gradient.h b/src/sp-gradient.h index 1dfff22ee..fbb48df62 100644 --- a/src/sp-gradient.h +++ b/src/sp-gradient.h @@ -14,30 +14,18 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <vector> -#include <gdk/gdk.h> -#include <glibmm/ustring.h> #include <2geom/affine.h> +#include <cstddef> +#include <glibmm/ustring.h> +#include <sigc++/connection.h> +#include <vector> + #include "sp-paint-server.h" #include "sp-gradient-spread.h" #include "sp-gradient-units.h" #include "sp-gradient-vector.h" #include "sp-mesh-array.h" -#include <stddef.h> -#include <sigc++/connection.h> - - - -//#include <glib.h> -//#include <glib-object.h> -//#include <2geom/forward.h> -//#include "sp-gradient-spread.h" -//#include "sp-gradient-units.h" -// -//class SPGradient; -//struct SPMeshGradient; - class SPGradientReference; class SPStop; @@ -109,30 +97,30 @@ public: private: /** gradientUnits attribute */ SPGradientUnits units; - guint units_set : 1; + unsigned int units_set : 1; public: /** gradientTransform attribute */ Geom::Affine gradientTransform; - guint gradientTransform_set : 1; + unsigned int gradientTransform_set : 1; private: /** spreadMethod attribute */ SPGradientSpread spread; - guint spread_set : 1; + unsigned int spread_set : 1; /** Gradient stops */ - guint has_stops : 1; + unsigned int has_stops : 1; /** Gradient patches */ - guint has_patches : 1; + unsigned int has_patches : 1; public: /** Reference (href) */ SPGradientReference *ref; /** State in Inkscape gradient system */ - guint state; + unsigned int state; /** Linear and Radial Gradients */ @@ -146,8 +134,8 @@ public: SPStop* getFirstStop(); int getStopCount() const; - gboolean isEquivalent(SPGradient *b); - gboolean isAligned(SPGradient *b); + bool isEquivalent(SPGradient *b); + bool isAligned(SPGradient *b); /** Mesh Gradients **************/ @@ -175,7 +163,7 @@ public: */ SPGradient *getVector(bool force_private = false); - static GType getType(); + //static GType getType(); /** Forces vector to be built, if not present (i.e. changed) */ void ensureVector(); @@ -196,7 +184,7 @@ public: void setSwatch(bool swatch = true); - static void gradientRefModified(SPObject *href, guint flags, SPGradient *gradient); + static void gradientRefModified(SPObject *href, unsigned int flags, SPGradient *gradient); static void gradientRefChanged(SPObject *old_ref, SPObject *ref, SPGradient *gr); private: @@ -208,13 +196,13 @@ private: protected: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void modified(guint flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void modified(unsigned int flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref); virtual void remove_child(Inkscape::XML::Node *child); - virtual void set(unsigned key, gchar const *value); + virtual void set(unsigned key, char const *value); }; void diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 60f15a79d..0e83c2acf 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -341,7 +341,7 @@ void SPGuide::hideSPGuide(SPCanvas *canvas) g_assert_not_reached(); } -void SPGuide::sensitize(SPCanvas *canvas, gboolean sensitive) +void SPGuide::sensitize(SPCanvas *canvas, bool sensitive) { g_assert(canvas != NULL); g_assert(SP_IS_CANVAS(canvas)); diff --git a/src/sp-guide.h b/src/sp-guide.h index fa4f0033b..cd67df222 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -13,12 +13,15 @@ * */ +#include <2geom/point.h> #include <vector> -#include <2geom/point.h> #include "sp-object.h" #include "sp-guide-attachment.h" +typedef unsigned int guint32; +typedef void (*GCallback) (void); + struct SPCanvas; struct SPCanvasGroup; class SPDesktop; @@ -52,14 +55,14 @@ public: static SPGuide *createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::Point const &pt2); void showSPGuide(SPCanvasGroup *group, GCallback handler); void hideSPGuide(SPCanvas *canvas); - void sensitize(SPCanvas *canvas, gboolean sensitive); + void sensitize(SPCanvas *canvas, bool sensitive); Geom::Point getPositionFrom(Geom::Point const &pt) const; double getDistanceFrom(Geom::Point const &pt) const; 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, const char* value); }; void sp_guide_pt_pairs_to_guides(SPDocument *doc, std::list<std::pair<Geom::Point, Geom::Point> > &pts); diff --git a/src/sp-image.cpp b/src/sp-image.cpp index cb8ede2b2..b6177fae6 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -20,6 +20,7 @@ #include <cstring> #include <algorithm> #include <string> +#include <glibmm.h> #include <glib/gstdio.h> #include <2geom/rect.h> #include <2geom/transforms.h> diff --git a/src/sp-image.h b/src/sp-image.h index 17262d74f..9fa33b5de 100644 --- a/src/sp-image.h +++ b/src/sp-image.h @@ -14,7 +14,6 @@ #ifndef SEEN_INKSCAPE_SP_IMAGE_H #define SEEN_INKSCAPE_SP_IMAGE_H -#include <gdk-pixbuf/gdk-pixbuf.h> #include <glibmm/ustring.h> #include "svg/svg-length.h" #include "display/curve.h" @@ -43,24 +42,24 @@ public: SPCurve *curve; // This curve is at the image's boundary for snapping - gchar *href; + char *href; #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gchar *color_profile; + char *color_profile; #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) Inkscape::Pixbuf *pixbuf; virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void set(unsigned int key, gchar const* value); - virtual void update(SPCtx *ctx, guint flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + 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 *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual void modified(unsigned int flags); virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const; virtual void print(SPPrintContext *ctx); virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const; virtual Geom::Affine set_transform(Geom::Affine const &transform); diff --git a/src/sp-item-group.h b/src/sp-item-group.h index 68bbd083a..97423630d 100644 --- a/src/sp-item-group.h +++ b/src/sp-item-group.h @@ -1,5 +1,5 @@ -#ifndef __SP_ITEM_GROUP_H__ -#define __SP_ITEM_GROUP_H__ +#ifndef SEEN_SP_ITEM_GROUP_H +#define SEEN_SP_ITEM_GROUP_H /* * SVG <g> implementation @@ -25,6 +25,7 @@ namespace Inkscape { class Drawing; class DrawingItem; +typedef struct _GSList GSList; } // namespace Inkscape @@ -62,7 +63,7 @@ public: void translateChildItems(Geom::Translate const &tr); void scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p); - gint getItemCount() const; + int getItemCount() const; virtual void _showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags); private: @@ -77,15 +78,15 @@ public: virtual void order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref); virtual void update(SPCtx *ctx, unsigned int flags); - virtual void modified(guint flags); - virtual void set(unsigned int key, gchar const* value); + virtual void modified(unsigned int flags); + virtual void set(unsigned int key, char const* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const; virtual void print(SPPrintContext *ctx); virtual const char* displayName() const; - virtual gchar *description() const; + virtual char *description() const; virtual Inkscape::DrawingItem *show (Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); virtual void hide (unsigned int key); @@ -98,7 +99,7 @@ void sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done = tr GSList *sp_item_group_item_list (SPGroup *group); -SPObject *sp_item_group_get_child_by_name (SPGroup *group, SPObject *ref, const gchar *name); +SPObject *sp_item_group_get_child_by_name (SPGroup *group, SPObject *ref, const char *name); #endif diff --git a/src/sp-item-notify-moveto.cpp b/src/sp-item-notify-moveto.cpp index 0f5117289..90fd676ee 100644 --- a/src/sp-item-notify-moveto.cpp +++ b/src/sp-item-notify-moveto.cpp @@ -9,6 +9,7 @@ #include <sp-item-notify-moveto.h> using std::vector; +#define return_if_fail(test) if (!(test)) { printf("WARNING: assertion '%s' failed", #test); return; } /** * Called by sp_guide_moveto to indicate that the guide line corresponding to g has been moved, and @@ -19,15 +20,15 @@ using std::vector; void sp_item_notify_moveto(SPItem &item, SPGuide const &mv_g, int const snappoint_ix, double const position, bool const commit) { - g_return_if_fail(SP_IS_ITEM(&item)); - g_return_if_fail( unsigned(snappoint_ix) < 8 ); + return_if_fail(SP_IS_ITEM(&item)); + return_if_fail( unsigned(snappoint_ix) < 8 ); Geom::Point const dir( mv_g.normal_to_line ); double const dir_lensq(dot(dir, dir)); - g_return_if_fail( dir_lensq != 0 ); + return_if_fail( dir_lensq != 0 ); std::vector<Inkscape::SnapCandidatePoint> snappoints; item.getSnappoints(snappoints, NULL); - g_return_if_fail( snappoint_ix < int(snappoints.size()) ); + return_if_fail( snappoint_ix < int(snappoints.size()) ); double const pos0 = dot(dir, snappoints[snappoint_ix].getPoint()); /// \todo effic: skip if mv_g is already satisfied. diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 086da56ff..86beee907 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -18,6 +18,8 @@ #include "sp-item.h" #include "sp-item-transform.h" +#include <glib.h> + void sp_item_rotate_rel(SPItem *item, Geom::Rotate const &rotation) { Geom::Point center = item->getCenter(); diff --git a/src/sp-item-transform.h b/src/sp-item-transform.h index 230d5a3dd..d563c9768 100644 --- a/src/sp-item-transform.h +++ b/src/sp-item-transform.h @@ -1,9 +1,8 @@ #ifndef SEEN_SP_ITEM_TRANSFORM_H #define SEEN_SP_ITEM_TRANSFORM_H -#include <glib.h> - #include <2geom/forward.h> + class SPItem; void sp_item_rotate_rel(SPItem *item, Geom::Rotate const &rotation); @@ -11,9 +10,9 @@ void sp_item_scale_rel (SPItem *item, Geom::Scale const &scale); void sp_item_skew_rel (SPItem *item, double skewX, double skewY); void sp_item_move_rel(SPItem *item, Geom::Translate const &tr); -Geom::Affine get_scale_transform_for_uniform_stroke (Geom::Rect const &bbox_visual, gdouble stroke_x, gdouble stroke_y, bool transform_stroke, bool preserve, gdouble x0, gdouble y0, gdouble x1, gdouble y1); -Geom::Affine get_scale_transform_for_variable_stroke (Geom::Rect const &bbox_visual, Geom::Rect const &bbox_geom, bool transform_stroke, bool preserve, gdouble x0, gdouble y0, gdouble x1, gdouble y1); -Geom::Rect get_visual_bbox (Geom::OptRect const &initial_geom_bbox, Geom::Affine const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke); +Geom::Affine get_scale_transform_for_uniform_stroke (Geom::Rect const &bbox_visual, double stroke_x, double stroke_y, bool transform_stroke, bool preserve, double x0, double y0, double x1, double y1); +Geom::Affine get_scale_transform_for_variable_stroke (Geom::Rect const &bbox_visual, Geom::Rect const &bbox_geom, bool transform_stroke, bool preserve, double x0, double y0, double x1, double y1); +Geom::Rect get_visual_bbox (Geom::OptRect const &initial_geom_bbox, Geom::Affine const &abs_affine, double const initial_strokewidth, bool const transform_stroke); #endif // SEEN_SP_ITEM_TRANSFORM_H diff --git a/src/sp-item.cpp b/src/sp-item.cpp index c7f4e0902..67a0eac13 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -382,7 +382,7 @@ void SPItem::lowerToBottom() { * \param target - the SPItem to move into or after * \param intoafter - move to after the target (false), move inside (sublayer) of the target (true) */ -void SPItem::moveTo(SPItem *target, gboolean intoafter) { +void SPItem::moveTo(SPItem *target, bool intoafter) { Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : NULL ); Inkscape::XML::Node *our_ref = getRepr(); diff --git a/src/sp-item.h b/src/sp-item.h index c8420155e..1e4f5f4c6 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -18,10 +18,11 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <vector> + #include <2geom/forward.h> #include <2geom/affine.h> #include <2geom/rect.h> +#include <vector> #include "sp-object.h" #include "snap-preferences.h" @@ -34,6 +35,7 @@ class SPClipPathReference; class SPMaskReference; class SPAvoidRef; struct SPPrintContext; +typedef unsigned int guint32; namespace Inkscape { @@ -72,7 +74,7 @@ enum PatternTransform { class SPEvent { public: unsigned int type; - gpointer data; + void* data; }; /// SPItemView @@ -192,7 +194,7 @@ public: void lowerOne(); void raiseToTop(); void lowerToBottom(); - void moveTo(SPItem *target, gboolean intoafter); + void moveTo(SPItem *target, bool intoafter); sigc::connection connectTransformed(sigc::slot<void, Geom::Affine const *, SPItem *> slot) { return _transformed_signal.connect(slot); @@ -211,7 +213,7 @@ public: unsigned int pos_in_parent() const; - gchar *detailedDescription() const; + char *detailedDescription() const; bool isFiltered() const; @@ -222,14 +224,14 @@ public: void getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs=0) const; void adjust_pattern(/* Geom::Affine const &premul, */ Geom::Affine const &postmul, bool set = false, PatternTransform = TRANSFORM_BOTH); void adjust_gradient(/* Geom::Affine const &premul, */ Geom::Affine const &postmul, bool set = false); - void adjust_stroke(gdouble ex); - void adjust_stroke_width_recursive(gdouble ex); + void adjust_stroke(double ex); + void adjust_stroke_width_recursive(double ex); void freeze_stroke_width_recursive(bool freeze); void adjust_paint_recursive(Geom::Affine advertized_transform, Geom::Affine t_ancestors, bool is_pattern); void adjust_livepatheffect(Geom::Affine const &postmul, bool set = false); void doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &transform, Geom::Affine const *adv = NULL, bool compensate = true); void set_item_transform(Geom::Affine const &transform_matrix); - gint emitEvent (SPEvent &event); + int emitEvent (SPEvent &event); Inkscape::DrawingItem *get_arenaitem(unsigned int key); Geom::Affine i2doc_affine() const; @@ -237,7 +239,7 @@ public: void set_i2d_affine(Geom::Affine const &transform); Geom::Affine dt2i_affine() const; - gchar *_highlightColor; + char *_highlightColor; private: enum EvaluatedStatus { @@ -254,14 +256,14 @@ private: public: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void set(unsigned int key, gchar const* value); - virtual void update(SPCtx *ctx, guint flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + 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 *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const; virtual void print(SPPrintContext *ctx); virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); virtual void hide(unsigned int key); virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const; @@ -269,7 +271,7 @@ public: virtual void convert_to_guides() const; - virtual gint event(SPEvent *event); + virtual int event(SPEvent *event); }; diff --git a/src/sp-line.h b/src/sp-line.h index c1932d3ee..d6a075659 100644 --- a/src/sp-line.h +++ b/src/sp-line.h @@ -31,13 +31,13 @@ public: SVGLength y2; virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); - virtual void set(unsigned int key, gchar const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); + virtual void set(unsigned int key, char const* value); virtual const char* displayName() const; virtual Geom::Affine set_transform(Geom::Affine const &transform); virtual void convert_to_guides() const; - virtual void update(SPCtx* ctx, guint flags); + virtual void update(SPCtx* ctx, unsigned int flags); virtual void set_shape(); }; diff --git a/src/sp-linear-gradient.cpp b/src/sp-linear-gradient.cpp index 959e8d733..6e9f5e6dd 100644 --- a/src/sp-linear-gradient.cpp +++ b/src/sp-linear-gradient.cpp @@ -1,3 +1,5 @@ +#include <cairo.h> + #include "sp-linear-gradient.h" #include "attributes.h" diff --git a/src/sp-linear-gradient.h b/src/sp-linear-gradient.h index ac3fdb04a..a152e7fe2 100644 --- a/src/sp-linear-gradient.h +++ b/src/sp-linear-gradient.h @@ -26,8 +26,8 @@ public: protected: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual void set(unsigned key, gchar const *value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned key, char const *value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; #endif /* !SP_LINEAR_GRADIENT_H */ diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h index 3e858748d..fbac467fd 100644 --- a/src/sp-lpe-item.h +++ b/src/sp-lpe-item.h @@ -14,14 +14,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "sp-item.h" - #include <list> +#include "sp-item.h" #define SP_LPE_ITEM(obj) (dynamic_cast<SPLPEItem*>((SPObject*)obj)) #define SP_IS_LPE_ITEM(obj) (dynamic_cast<const SPLPEItem*>((SPObject*)obj) != NULL) -class CLPEItem; class LivePathEffectObject; class SPCurve; class SPDesktop; @@ -58,7 +56,7 @@ public: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); virtual void release(); - virtual void set(unsigned int key, gchar const* value); + virtual void set(unsigned int key, char const* value); virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(unsigned int flags); @@ -66,7 +64,7 @@ public: virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); virtual void remove_child(Inkscape::XML::Node* child); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual void update_patheffect(bool write); @@ -90,7 +88,7 @@ public: bool setCurrentPathEffect(Inkscape::LivePathEffect::LPEObjectReference* lperef); void removeCurrentPathEffect(bool keep_paths); void removeAllPathEffects(bool keep_paths); - void addPathEffect(gchar *value, bool reset); + void addPathEffect(char *value, bool reset); void addPathEffect(LivePathEffectObject * new_lpeobj); bool forkPathEffectsIfNecessary(unsigned int nr_of_allowed_users = 1); diff --git a/src/sp-mask.h b/src/sp-mask.h index e08d1e81e..e991fedb6 100644 --- a/src/sp-mask.h +++ b/src/sp-mask.h @@ -55,12 +55,12 @@ protected: virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); - virtual void set(unsigned int key, const gchar* value); + virtual void set(unsigned int key, const char* value); virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(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); }; class SPMaskReference : public Inkscape::URIReference { @@ -86,10 +86,10 @@ protected: Inkscape::XML::Node * const owner_repr = owner->getRepr(); //XML Tree being used directly here while it shouldn't be... Inkscape::XML::Node * const obj_repr = obj->getRepr(); - gchar const * owner_name = NULL; - gchar const * owner_mask = NULL; - gchar const * obj_name = NULL; - gchar const * obj_id = NULL; + char const * owner_name = NULL; + char const * owner_mask = NULL; + char const * obj_name = NULL; + char const * obj_id = NULL; if (owner_repr != NULL) { owner_name = owner_repr->name(); owner_mask = owner_repr->attribute("mask"); @@ -98,7 +98,7 @@ protected: obj_name = obj_repr->name(); obj_id = obj_repr->attribute("id"); } - g_warning("Ignoring recursive mask reference " + printf("WARNING: Ignoring recursive mask reference " "<%s mask=\"%s\"> in <%s id=\"%s\">", owner_name, owner_mask, obj_name, obj_id); @@ -108,6 +108,6 @@ protected: } }; -const gchar *sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform); +const char *sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform); #endif // SEEN_SP_MASK_H diff --git a/src/sp-mesh-array.cpp b/src/sp-mesh-array.cpp index ab14e75d2..8bfe23656 100644 --- a/src/sp-mesh-array.cpp +++ b/src/sp-mesh-array.cpp @@ -37,6 +37,15 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <glibmm.h> + +// For color picking +#include "display/drawing.h" +#include "display/drawing-context.h" +#include "display/cairo-utils.h" +#include "document.h" +#include "sp-root.h" + #include "sp-mesh-array.h" #include "sp-mesh-gradient.h" #include "sp-mesh-row.h" @@ -51,13 +60,6 @@ // For writing color/opacity to style #include "svg/css-ostringstream.h" -// For color picking -#include "display/drawing.h" -#include "display/drawing-context.h" -#include "display/cairo-utils.h" -#include "document.h" -#include "sp-root.h" - // For default color #include "style.h" #include "svg/svg-color.h" diff --git a/src/sp-mesh-array.h b/src/sp-mesh-array.h index b10974e7e..330f6d87b 100644 --- a/src/sp-mesh-array.h +++ b/src/sp-mesh-array.h @@ -39,8 +39,6 @@ an array which simplifies things like inserting new rows or columns. */ -#include <gdk/gdk.h> -#include <glibmm/ustring.h> #include <2geom/point.h> #include "color.h" @@ -89,13 +87,13 @@ public: opacity = 0.0; } NodeType node_type; - guint node_edge; + unsigned int node_edge; bool set; Geom::Point p; - guint draggable; // index of on-screen node - gchar path_type; + unsigned int draggable; // index of on-screen node + char path_type; SPColor color; - gdouble opacity; + double opacity; }; @@ -110,21 +108,21 @@ private: public: SPMeshPatchI( std::vector<std::vector< SPMeshNode* > > *n, int r, int c ); - Geom::Point getPoint( guint side, guint point ); - std::vector< Geom::Point > getPointsForSide( guint i ); - void setPoint( guint side, guint point, Geom::Point p, bool set = true ); - gchar getPathType( guint i ); - void setPathType( guint, gchar t ); - Geom::Point getTensorPoint( guint i ); - void setTensorPoint( guint i, Geom::Point p ); + Geom::Point getPoint( unsigned int side, unsigned int point ); + std::vector< Geom::Point > getPointsForSide( unsigned int i ); + void setPoint( unsigned int side, unsigned int point, Geom::Point p, bool set = true ); + char getPathType( unsigned int i ); + void setPathType( unsigned int, char t ); + Geom::Point getTensorPoint( unsigned int i ); + void setTensorPoint( unsigned int i, Geom::Point p ); bool tensorIsSet(); - bool tensorIsSet( guint i ); - Geom::Point coonsTensorPoint( guint i ); + bool tensorIsSet( unsigned int i ); + Geom::Point coonsTensorPoint( unsigned int i ); void updateNodes(); - SPColor getColor( guint i ); - void setColor( guint i, SPColor c ); - gdouble getOpacity( guint i ); - void setOpacity( guint i, gdouble o ); + SPColor getColor( unsigned int i ); + void setColor( unsigned int i, SPColor c ); + double getOpacity( unsigned int i ); + void setOpacity( unsigned int i, double o ); }; class SPMeshGradient; @@ -160,26 +158,26 @@ public: void print(); // Get size of patch - guint patch_rows(); - guint patch_columns(); + unsigned int patch_rows(); + unsigned int patch_columns(); - SPMeshNode * node( guint i, guint j ) { return nodes[i][j]; } + SPMeshNode * node( unsigned int i, unsigned int j ) { return nodes[i][j]; } // Operations on corners - bool adjacent_corners( guint i, guint j, SPMeshNode* n[4] ); - guint side_toggle( std::vector< guint > ); - guint side_arc( std::vector< guint > ); - guint tensor_toggle( std::vector< guint > ); - guint color_smooth( std::vector< guint > ); - guint color_pick( std::vector< guint >, SPItem* ); + bool adjacent_corners( unsigned int i, unsigned int j, SPMeshNode* n[4] ); + unsigned int side_toggle( std::vector< unsigned int > ); + unsigned int side_arc( std::vector< unsigned int > ); + unsigned int tensor_toggle( std::vector< unsigned int > ); + unsigned int color_smooth( std::vector< unsigned int > ); + unsigned int color_pick( std::vector< unsigned int >, SPItem* ); // Update other nodes in response to a node move. - void update_handles( guint corner, std::vector< guint > selected_corners, Geom::Point old_p, MeshNodeOperation op ); + void update_handles( unsigned int corner, std::vector< unsigned int > selected_corners, Geom::Point old_p, MeshNodeOperation op ); - void split_row( guint i, guint n ); - void split_column( guint j, guint n ); - void split_row( guint i, double coord ); - void split_column( guint j, double coord ); + void split_row( unsigned int i, unsigned int n ); + void split_column( unsigned int j, unsigned int n ); + void split_row( unsigned int i, double coord ); + void split_column( unsigned int j, double coord ); }; #endif /* !SEEN_SP_MESH_ARRAY_H */ diff --git a/src/sp-mesh-gradient.cpp b/src/sp-mesh-gradient.cpp index eb5ed1bd0..bf28164a9 100644 --- a/src/sp-mesh-gradient.cpp +++ b/src/sp-mesh-gradient.cpp @@ -1,8 +1,10 @@ -#include "sp-mesh-gradient.h" +#include <glibmm.h> #include "attributes.h" -#include "xml/repr.h" #include "display/cairo-utils.h" +#include "xml/repr.h" + +#include "sp-mesh-gradient.h" #include "sp-factory.h" diff --git a/src/sp-mesh-gradient.h b/src/sp-mesh-gradient.h index 0b570c4dd..4df753f62 100644 --- a/src/sp-mesh-gradient.h +++ b/src/sp-mesh-gradient.h @@ -24,8 +24,8 @@ public: protected: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual void set(unsigned key, gchar const *value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned key, char const *value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; #endif /* !SP_MESH_GRADIENT_H */ diff --git a/src/sp-mesh-patch.h b/src/sp-mesh-patch.h index ddade6503..e57ad1699 100644 --- a/src/sp-mesh-patch.h +++ b/src/sp-mesh-patch.h @@ -12,9 +12,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> #include <glibmm/ustring.h> -//#include "svg/svg-length.h" #include "sp-object.h" #define SP_MESHPATCH(obj) (dynamic_cast<SPMeshPatch*>((SPObject*)obj)) @@ -34,8 +32,8 @@ public: protected: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void set(unsigned int key, const gchar* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); + virtual void set(unsigned int key, const char* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); }; #endif /* !SEEN_SP_MESHPATCH_H */ diff --git a/src/sp-mesh-row.h b/src/sp-mesh-row.h index e39bdc631..793b5a645 100644 --- a/src/sp-mesh-row.h +++ b/src/sp-mesh-row.h @@ -11,7 +11,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> #include "sp-object.h" #define SP_MESHROW(obj) (dynamic_cast<SPMeshRow*>((SPObject*)obj)) @@ -28,8 +27,8 @@ public: protected: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void set(unsigned int key, const gchar* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); + virtual void set(unsigned int key, const char* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); }; #endif /* !SEEN_SP_MESHROW_H */ diff --git a/src/sp-metadata.h b/src/sp-metadata.h index 2a9d58e11..a89020390 100644 --- a/src/sp-metadata.h +++ b/src/sp-metadata.h @@ -1,5 +1,5 @@ -#ifndef __SP_METADATA_H__ -#define __SP_METADATA_H__ +#ifndef SEEN_SP_METADATA_H +#define SEEN_SP_METADATA_H /* * SVG <metadata> implementation @@ -14,7 +14,6 @@ #include "sp-object.h" - /* Metadata base class */ #define SP_METADATA(obj) (dynamic_cast<SPMetadata*>((SPObject*)obj)) @@ -29,9 +28,9 @@ 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, const char* 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); }; SPMetadata * sp_document_metadata (SPDocument *document); diff --git a/src/sp-missing-glyph.h b/src/sp-missing-glyph.h index a72ed0e99..06bc92231 100644 --- a/src/sp-missing-glyph.h +++ b/src/sp-missing-glyph.h @@ -1,9 +1,5 @@ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#ifndef __SP_MISSING_GLYPH_H__ -#define __SP_MISSING_GLYPH_H__ +#ifndef SEEN_SP_MISSING_GLYPH_H +#define SEEN_SP_MISSING_GLYPH_H /* * SVG <missing-glyph> element implementation @@ -31,8 +27,8 @@ public: protected: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); virtual void release(); - virtual void set(unsigned int key, const gchar* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); private: double horiz_adv_x; diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index a01ba891e..1d9fa06a3 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -935,7 +935,7 @@ void SPNamedView::hide(SPDesktop const *desktop) views = g_slist_remove(views, desktop); } -void SPNamedView::activateGuides(gpointer desktop, gboolean active) +void SPNamedView::activateGuides(void* desktop, bool active) { g_assert(desktop != NULL); g_assert(g_slist_find(views, desktop)); diff --git a/src/sp-namedview.h b/src/sp-namedview.h index 05cbcc398..37310dc76 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -29,6 +29,9 @@ namespace Inkscape { } } +typedef unsigned int guint32; +typedef guint32 GQuark; + enum { SP_BORDER_LAYER_BOTTOM, SP_BORDER_LAYER_TOP @@ -48,11 +51,11 @@ public: double zoom; double cx; double cy; - gint window_width; - gint window_height; - gint window_x; - gint window_y; - gint window_maximized; + int window_width; + int window_height; + int window_x; + int window_y; + int window_maximized; SnapManager snap_manager; GSList * grids; @@ -74,13 +77,13 @@ public: GSList *guides; GSList *views; - gint viewcount; + int viewcount; void show(SPDesktop *desktop); void hide(SPDesktop const *desktop); - void activateGuides(gpointer desktop, gboolean active); - gchar const *getName() const; - guint getViewCount(); + void activateGuides(void* desktop, bool active); + char const *getName() const; + unsigned int getViewCount(); GSList const *getViewList() const; Inkscape::Util::Unit const * getDefaultUnit() const; @@ -100,17 +103,17 @@ private: protected: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void set(unsigned int key, gchar const* value); + virtual void set(unsigned int key, char const* value); virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); virtual void remove_child(Inkscape::XML::Node* child); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; -SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name); -SPNamedView const *sp_document_namedview(SPDocument const *document, gchar const *name); +SPNamedView *sp_document_namedview(SPDocument *document, char const *name); +SPNamedView const *sp_document_namedview(SPDocument const *document, char const *name); void sp_namedview_window_from_document(SPDesktop *desktop); void sp_namedview_document_from_window(SPDesktop *desktop); diff --git a/src/sp-object-group.h b/src/sp-object-group.h index 4df346228..dcaa8a1d0 100644 --- a/src/sp-object-group.h +++ b/src/sp-object-group.h @@ -30,7 +30,7 @@ protected: virtual void order_changed(Inkscape::XML::Node* child, Inkscape::XML::Node* old, Inkscape::XML::Node* new_repr); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; #endif // SEEN_SP_OBJECTGROUP_H diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 65228ec0a..fcff43aa5 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -1406,12 +1406,12 @@ bool SPObject::setDesc(gchar const *desc, bool verbatim) return setTitleOrDesc(desc, "svg:desc", verbatim); } -gchar * SPObject::getTitleOrDesc(gchar const *svg_tagname) const +char * SPObject::getTitleOrDesc(gchar const *svg_tagname) const { - gchar *result = 0; + char *result = NULL; SPObject *elem = findFirstChild(svg_tagname); if ( elem ) { - result = g_string_free(elem->textualContent(), FALSE); + result = elem->textualContent(); } return result; } @@ -1493,7 +1493,7 @@ SPObject * SPObject::findFirstChild(gchar const *tagname) const return NULL; } -GString * SPObject::textualContent() const +char* SPObject::textualContent() const { GString* text = g_string_new(""); @@ -1502,15 +1502,15 @@ GString * SPObject::textualContent() const Inkscape::XML::NodeType child_type = child->repr->type(); if (child_type == Inkscape::XML::ELEMENT_NODE) { - GString * new_text = child->textualContent(); - g_string_append(text, new_text->str); - g_string_free(new_text, TRUE); + char* new_string = child->textualContent(); + g_string_append(text, new_string); + g_free(new_string); } else if (child_type == Inkscape::XML::TEXT_NODE) { g_string_append(text, child->repr->content()); } } - return text; + return g_string_free(text, FALSE); } /* diff --git a/src/sp-object.h b/src/sp-object.h index a308caeae..575198f36 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -47,7 +47,7 @@ class SPObject; #define SP_OBJECT_WRITE_ALL (1 << 2) #define SP_OBJECT_WRITE_NO_CHILDREN (1 << 3) -#include <glib-object.h> +#include <cassert> #include <stddef.h> #include <sigc++/connection.h> #include <sigc++/functors/slot.h> @@ -58,6 +58,7 @@ class SPObject; class SPCSSAttr; class SPStyle; +typedef struct _GSList GSList; namespace Inkscape { namespace XML { @@ -110,8 +111,8 @@ class SPDocument; class SPIXmlSpace { public: SPIXmlSpace(): set(0), value(SP_XML_SPACE_DEFAULT) {}; - guint set : 1; - guint value : 1; + unsigned int set : 1; + unsigned int value : 1; }; /* @@ -153,7 +154,7 @@ SPObject *sp_object_unref(SPObject *object, SPObject *owner=NULL); * \pre object points to real object * @todo need to move this to be a member of SPObject. */ -SPObject *sp_object_href(SPObject *object, gpointer owner); +SPObject *sp_object_href(SPObject *object, void* owner); /** * Decrease weak refcount. @@ -165,7 +166,7 @@ SPObject *sp_object_href(SPObject *object, gpointer owner); * \pre object points to real object and hrefcount>0 * @todo need to move this to be a member of SPObject. */ -SPObject *sp_object_hunref(SPObject *object, gpointer owner); +SPObject *sp_object_hunref(SPObject *object, void* owner); /** * SPObject is an abstract base class of all of the document nodes at the @@ -184,7 +185,7 @@ SPObject *sp_object_hunref(SPObject *object, gpointer owner); * provides document level functionality such as the undo stack, * dictionary and so on. Source: doc/architecture.txt */ -class SPObject { // : public GObject { +class SPObject { public: enum CollectionPolicy { COLLECT_WITH_PARENT, @@ -210,7 +211,7 @@ private: SPObject(const SPObject&); SPObject& operator=(const SPObject&); - gchar *id; /* Our very own unique id */ + char *id; /* Our very own unique id */ Inkscape::XML::Node *repr; /* Our xml representation */ public: int refCount; @@ -218,7 +219,7 @@ public: /** * Returns the objects current ID string. */ - gchar const* getId() const; + char const* getId() const; /** * Returns the XML representation of tree @@ -282,7 +283,7 @@ public: typedef Inkscape::Util::ForwardPointerIterator<SPObject const, SiblingIteratorStrategy> ConstSiblingIterator; bool isSiblingOf(SPObject const *object) const { - g_return_val_if_fail(object != NULL, false); + if (object == NULL) return false; return this->parent && this->parent == object->parent; } @@ -333,26 +334,26 @@ public: * Gets the author-visible label property for the object or a default if * no label is defined. */ - gchar const *label() const; + char const *label() const; /** * Returns a default label property for this object. */ - gchar const *defaultLabel() const; + char const *defaultLabel() const; /** * Sets the author-visible label for this object. * * @param label the new label. */ - void setLabel(gchar const *label); + void setLabel(char const *label); /** * Returns the title of this object, or NULL if there is none. * The caller must free the returned string using g_free() - see comment * for getTitleOrDesc() below. */ - gchar *title() const; + char *title() const; /** * Sets the title of this object. @@ -360,14 +361,14 @@ public: * (if any) should be deleted. * The second argument is optional - @see setTitleOrDesc() below for details. */ - bool setTitle(gchar const *title, bool verbatim = false); + bool setTitle(char const *title, bool verbatim = false); /** * Returns the description of this object, or NULL if there is none. * The caller must free the returned string using g_free() - see comment * for getTitleOrDesc() below. */ - gchar *desc() const; + char *desc() const; /** * Sets the description of this object. @@ -375,7 +376,7 @@ public: * description (if any) should be deleted. * The second argument is optional - @see setTitleOrDesc() below for details. */ - bool setDesc(gchar const *desc, bool verbatim=false); + bool setDesc(char const *desc, bool verbatim=false); /** * Set the policy under which this object will be orphan-collected. @@ -502,9 +503,9 @@ public: * Indicates that another object supercedes this one. */ void setSuccessor(SPObject *successor) { - g_assert(successor != NULL); - g_assert(_successor == NULL); - g_assert(successor->_successor == NULL); + assert(successor != NULL); + assert(_successor == NULL); + assert(successor->_successor == NULL); sp_object_ref(successor, NULL); _successor = successor; } @@ -656,8 +657,8 @@ public: sigc::signal<void, SPObject *, unsigned int> _modified_signal; SPObject *_successor; CollectionPolicy _collection_policy; - gchar *_label; - mutable gchar *_default_label; + char *_label; + mutable char *_default_label; // WARNING: // Methods below should not be used outside of the SP tree, @@ -691,7 +692,7 @@ public: unsigned getPosition(); - gchar const * getAttribute(gchar const *name,SPException *ex=NULL) const; + char const * getAttribute(char const *name,SPException *ex=NULL) const; void appendChild(Inkscape::XML::Node *child); @@ -700,18 +701,18 @@ public: /** * Call virtual set() function of object. */ - void setKeyValue(unsigned int key, gchar const *value); + void setKeyValue(unsigned int key, char const *value); - void setAttribute(gchar const *key, gchar const *value, SPException *ex=NULL); + void setAttribute(char const *key, char const *value, SPException *ex=NULL); /** * Read value of key attribute from XML node into object. */ - void readAttr(gchar const *key); + void readAttr(char const *key); - gchar const *getTagName(SPException *ex) const; + char const *getTagName(SPException *ex) const; - void removeAttribute(gchar const *key, SPException *ex=NULL); + void removeAttribute(char const *key, SPException *ex=NULL); /** * Returns an object style property. @@ -741,13 +742,13 @@ public: * <use> element instead), we should probably make the caller * responsible for ascending the repr tree as necessary. */ - gchar const *getStyleProperty(gchar const *key, gchar const *def) const; + char const *getStyleProperty(char const *key, char const *def) const; - void setCSS(SPCSSAttr *css, gchar const *attr); + void setCSS(SPCSSAttr *css, char const *attr); - void changeCSS(SPCSSAttr *css, gchar const *attr); + void changeCSS(SPCSSAttr *css, char const *attr); - bool storeAsDouble( gchar const *key, double *val ) const; + bool storeAsDouble( char const *key, double *val ) const; private: // Private member functions used in the definitions of setTitle(), @@ -770,7 +771,7 @@ private: * The return value is true if a change was made to the title/description, * and usually false otherwise. */ - bool setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool verbatim); + bool setTitleOrDesc(char const *value, char const *svg_tagname, bool verbatim); /** * Returns the title or description of this object, or NULL if there is none. @@ -782,20 +783,20 @@ private: * Consequently, the return value is a newly allocated string (or NULL), and * must be freed (using g_free()) by the caller. */ - gchar * getTitleOrDesc(gchar const *svg_tagname) const; + char * getTitleOrDesc(char const *svg_tagname) const; /** * Find the first child of this object with a given tag name, * and return it. Returns NULL if there is no matching child. */ - SPObject * findFirstChild(gchar const *tagname) const; + SPObject * findFirstChild(char const *tagname) const; /** * Return the full textual content of an element (typically all the * content except the tags). * Must not be used on anything except elements. */ - GString * textualContent() const; + char * textualContent() const; /* Real handlers of repr signals */ @@ -803,17 +804,17 @@ public: /** * Callback for attr_changed node event. */ - static void repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gchar const *oldval, gchar const *newval, bool is_interactive, gpointer data); + static void repr_attr_changed(Inkscape::XML::Node *repr, char const *key, char const *oldval, char const *newval, bool is_interactive, void* data); /** * Callback for content_changed node event. */ - static void repr_content_changed(Inkscape::XML::Node *repr, gchar const *oldcontent, gchar const *newcontent, gpointer data); + static void repr_content_changed(Inkscape::XML::Node *repr, char const *oldcontent, char const *newcontent, void* data); /** * Callback for child_added node event. */ - static void repr_child_added(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, gpointer data); + static void repr_child_added(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, void* data); /** * Callback for remove_child node event. @@ -825,7 +826,7 @@ public: * * \todo fixme: */ - static void repr_order_changed(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *old, Inkscape::XML::Node *newer, gpointer data); + static void repr_order_changed(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *old, Inkscape::XML::Node *newer, void* data); friend class SPObjectImpl; @@ -839,12 +840,12 @@ protected: virtual void order_changed(Inkscape::XML::Node* child, Inkscape::XML::Node* old_repr, Inkscape::XML::Node* new_repr); - virtual void set(unsigned int key, const gchar* value); + virtual void set(unsigned int key, const char* value); virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(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); public: virtual void read_content(); diff --git a/src/sp-offset.h b/src/sp-offset.h index 259a69b78..eb3fe227c 100644 --- a/src/sp-offset.h +++ b/src/sp-offset.h @@ -11,11 +11,11 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "sp-shape.h" - -#include <stddef.h> +#include <cstddef> #include <sigc++/sigc++.h> +#include "sp-shape.h" + #define SP_OFFSET(obj) (dynamic_cast<SPOffset*>((SPObject*)obj)) #define SP_IS_OFFSET(obj) (dynamic_cast<const SPOffset*>((SPObject*)obj) != NULL) @@ -54,7 +54,7 @@ public: SPOffset(); virtual ~SPOffset(); - void *originalPath; ///< will be a livarot Path, just don't declare it here to please the gcc linker + void *originalPath; ///< will be a livarot Path, just don't declare it here to please the gcc linker FIXME what? char *original; ///< SVG description of the source path float rad; ///< offset radius @@ -65,7 +65,7 @@ public: bool sourceDirty; bool isUpdating; - gchar *sourceHref; + char *sourceHref; SPUseReference *sourceRef; Inkscape::XML::Node *sourceRepr; ///< the repr associated with that id SPObject *sourceObject; @@ -76,14 +76,14 @@ public: sigc::connection _transformed_connection; virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual void set(unsigned int key, gchar const* value); - virtual void update(SPCtx *ctx, guint flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + 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 *xml_doc, Inkscape::XML::Node *repr, unsigned flags); virtual void release(); virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const; virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; virtual void set_shape(); }; diff --git a/src/sp-paint-server-reference.h b/src/sp-paint-server-reference.h index e08694c2f..bbd9c25fa 100644 --- a/src/sp-paint-server-reference.h +++ b/src/sp-paint-server-reference.h @@ -15,9 +15,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "sp-object.h" #include "uri-references.h" +class SPDocument; +class SPObject; class SPPaintServer; class SPPaintServerReference : public Inkscape::URIReference { diff --git a/src/sp-paint-server.h b/src/sp-paint-server.h index c1c8d651e..beac72af5 100644 --- a/src/sp-paint-server.h +++ b/src/sp-paint-server.h @@ -15,10 +15,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <cairo.h> #include <2geom/rect.h> #include "sp-object.h" +typedef struct _cairo cairo_t; +typedef struct _cairo_pattern cairo_pattern_t; + #define SP_PAINT_SERVER(obj) (dynamic_cast<SPPaintServer*>((SPObject*)obj)) #define SP_IS_PAINT_SERVER(obj) (dynamic_cast<const SPPaintServer*>((SPObject*)obj) != NULL) diff --git a/src/sp-path.h b/src/sp-path.h index 5f8a91d98..572fd648d 100644 --- a/src/sp-path.h +++ b/src/sp-path.h @@ -32,7 +32,7 @@ public: SPPath(); virtual ~SPPath(); - gint nodesInPath() const; + int nodesInPath() const; // still in lowercase because the names should be clearer on whether curve, curve->copy or curve-ref is returned. void set_original_curve (SPCurve *curve, unsigned int owner, bool write); @@ -49,13 +49,13 @@ public: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void update(SPCtx* ctx, guint flags); + virtual void update(SPCtx* ctx, unsigned int flags); - virtual void set(unsigned int key, gchar const* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; virtual Geom::Affine set_transform(Geom::Affine const &transform); virtual void convert_to_guides() const; diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 9b7330a24..961ab0f84 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -18,7 +18,9 @@ #include <cstring> #include <string> +#include <glibmm.h> #include <2geom/transforms.h> + #include "macros.h" #include "svg/svg.h" #include "display/cairo-utils.h" diff --git a/src/sp-pattern.h b/src/sp-pattern.h index eb34b6714..f021101e2 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -13,21 +13,18 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gtk/gtk.h> - -#include "sp-item.h" - #define SP_PATTERN(obj) (dynamic_cast<SPPattern*>((SPObject*)obj)) #define SP_IS_PATTERN(obj) (dynamic_cast<const SPPattern*>((SPObject*)obj) != NULL) class SPPatternReference; +class SPItem; +typedef struct _GSList GSList; #include "svg/svg-length.h" #include "sp-paint-server.h" #include "uri-references.h" #include "viewbox.h" -#include <stddef.h> #include <sigc++/connection.h> @@ -37,17 +34,17 @@ public: virtual ~SPPattern(); /* Reference (href) */ - gchar *href; + char *href; SPPatternReference *ref; /* patternUnits and patternContentUnits attribute */ - guint patternUnits : 1; - guint patternUnits_set : 1; - guint patternContentUnits : 1; - guint patternContentUnits_set : 1; + unsigned int patternUnits : 1; + unsigned int patternUnits_set : 1; + unsigned int patternContentUnits : 1; + unsigned int patternContentUnits_set : 1; /* patternTransform attribute */ Geom::Affine patternTransform; - guint patternTransform_set : 1; + unsigned int patternTransform_set : 1; /* Tile rectangle */ SVGLength x; SVGLength y; @@ -87,22 +84,22 @@ enum { SP_PATTERN_UNITS_OBJECTBOUNDINGBOX }; -guint pattern_users (SPPattern *pattern); +unsigned int pattern_users (SPPattern *pattern); SPPattern *pattern_chain (SPPattern *pattern); -SPPattern *sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const gchar *property); +SPPattern *sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const char *property); void sp_pattern_transform_multiply (SPPattern *pattern, Geom::Affine postmul, bool set); -const gchar *pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Affine transform, Geom::Affine move); +const char *pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Affine transform, Geom::Affine move); SPPattern *pattern_getroot (SPPattern *pat); -guint pattern_patternUnits (SPPattern const *pat); -guint pattern_patternContentUnits (SPPattern const *pat); +unsigned int pattern_patternUnits (SPPattern const *pat); +unsigned int pattern_patternContentUnits (SPPattern const *pat); Geom::Affine const &pattern_patternTransform(SPPattern const *pat); -gdouble pattern_x (SPPattern const *pat); -gdouble pattern_y (SPPattern const *pat); -gdouble pattern_width (SPPattern const *pat); -gdouble pattern_height (SPPattern const *pat); +double pattern_x (SPPattern const *pat); +double pattern_y (SPPattern const *pat); +double pattern_width (SPPattern const *pat); +double pattern_height (SPPattern const *pat); Geom::OptRect pattern_viewBox (SPPattern const *pat); #endif // SEEN_SP_PATTERN_H diff --git a/src/sp-polygon.h b/src/sp-polygon.h index 41ab245bd..438fdf794 100644 --- a/src/sp-polygon.h +++ b/src/sp-polygon.h @@ -1,5 +1,5 @@ -#ifndef __SP_POLYGON_H__ -#define __SP_POLYGON_H__ +#ifndef SEEN_SP_POLYGON_H +#define SEEN_SP_POLYGON_H /* * SVG <polygon> implementation @@ -15,7 +15,6 @@ #include "sp-shape.h" - #define SP_POLYGON(obj) (dynamic_cast<SPPolygon*>((SPObject*)obj)) #define SP_IS_POLYGON(obj) (dynamic_cast<const SPPolygon*>((SPObject*)obj) != NULL) @@ -25,12 +24,12 @@ public: virtual ~SPPolygon(); virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); - virtual void set(unsigned int key, gchar const* value); - virtual gchar* description() const; + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); + virtual void set(unsigned int key, char const* value); + virtual char* description() const; }; // made 'public' so that SPCurve can set it as friend: -void sp_polygon_set(SPObject *object, unsigned int key, const gchar *value); +void sp_polygon_set(SPObject *object, unsigned int key, char const*value); #endif diff --git a/src/sp-polyline.h b/src/sp-polyline.h index e24ea95c7..1ca102a9e 100644 --- a/src/sp-polyline.h +++ b/src/sp-polyline.h @@ -12,10 +12,10 @@ public: virtual ~SPPolyLine(); virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void set(unsigned int key, gchar const* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); - virtual gchar* description() const; + virtual char* description() const; }; #endif // SEEN_SP_POLYLINE_H diff --git a/src/sp-radial-gradient.cpp b/src/sp-radial-gradient.cpp index 7c481fead..2c2b17b7d 100644 --- a/src/sp-radial-gradient.cpp +++ b/src/sp-radial-gradient.cpp @@ -1,3 +1,5 @@ +#include <cairo.h> + #include "sp-radial-gradient.h" #include "attributes.h" diff --git a/src/sp-radial-gradient.h b/src/sp-radial-gradient.h index 42ff109aa..f753623b7 100644 --- a/src/sp-radial-gradient.h +++ b/src/sp-radial-gradient.h @@ -5,10 +5,12 @@ * SPRadialGradient: SVG <radialgradient> implementtion. */ -#include <glib.h> #include "sp-gradient.h" #include "svg/svg-length.h" +typedef struct _cairo cairo_t; +typedef struct _cairo_pattern cairo_pattern_t; + #define SP_RADIALGRADIENT(obj) (dynamic_cast<SPRadialGradient*>((SPObject*)obj)) #define SP_IS_RADIALGRADIENT(obj) (dynamic_cast<const SPRadialGradient*>((SPObject*)obj) != NULL) @@ -28,8 +30,8 @@ public: protected: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual void set(unsigned key, gchar const *value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned key, char const *value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; #endif /* !SP_RADIAL_GRADIENT_H */ diff --git a/src/sp-rect.h b/src/sp-rect.h index aa3f88e42..757229724 100644 --- a/src/sp-rect.h +++ b/src/sp-rect.h @@ -14,10 +14,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "svg/svg-length.h" -#include "sp-shape.h" #include <2geom/forward.h> +#include "svg/svg-length.h" +#include "sp-shape.h" #define SP_RECT(obj) (dynamic_cast<SPRect*>((SPObject*)obj)) #define SP_IS_RECT(obj) (dynamic_cast<const SPRect*>((SPObject*)obj) != NULL) @@ -27,34 +27,34 @@ public: SPRect(); virtual ~SPRect(); - void setPosition(gdouble x, gdouble y, gdouble width, gdouble height); + void setPosition(double x, double y, double width, double height); /* If SET if FALSE, VALUE is just ignored */ - void setRx(bool set, gdouble value); - void setRy(bool set, gdouble value); + void setRx(bool set, double value); + void setRy(bool set, double value); - gdouble getVisibleRx() const; - void setVisibleRx(gdouble rx); + double getVisibleRx() const; + void setVisibleRx(double rx); - gdouble getVisibleRy() const; - void setVisibleRy(gdouble ry); + double getVisibleRy() const; + void setVisibleRy(double ry); Geom::Rect getRect() const; - gdouble getVisibleWidth() const; - void setVisibleWidth(gdouble rx); + double getVisibleWidth() const; + void setVisibleWidth(double rx); - gdouble getVisibleHeight() const; - void setVisibleHeight(gdouble ry); + double getVisibleHeight() const; + void setVisibleHeight(double ry); void compensateRxRy(Geom::Affine xform); virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void set(unsigned key, gchar const *value); + virtual void set(unsigned key, char const *value); virtual void update(SPCtx* ctx, unsigned int flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual const char* displayName() const; virtual void set_shape(); @@ -71,7 +71,7 @@ public: SVGLength ry; private: - static gdouble vectorStretch(Geom::Point p0, Geom::Point p1, Geom::Affine xform); + static double vectorStretch(Geom::Point p0, Geom::Point p1, Geom::Affine xform); }; #endif // SEEN_SP_RECT_H diff --git a/src/sp-root.h b/src/sp-root.h index a25e8030c..2776ae887 100644 --- a/src/sp-root.h +++ b/src/sp-root.h @@ -40,7 +40,7 @@ public: SVGLength width; SVGLength height; - gchar *onload; + char *onload; /** * Primary \<defs\> element where we put new defs (patterns, gradients etc.). @@ -52,9 +52,9 @@ public: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void set(unsigned int key, gchar const* value); - virtual void update(SPCtx *ctx, guint flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + 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 *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual void modified(unsigned int flags); virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); diff --git a/src/sp-script.h b/src/sp-script.h index 36072a0ca..b71f86720 100644 --- a/src/sp-script.h +++ b/src/sp-script.h @@ -1,5 +1,5 @@ -#ifndef __SP_SCRIPT_H__ -#define __SP_SCRIPT_H__ +#ifndef SEEN_SP_SCRIPT_H +#define SEEN_SP_SCRIPT_H /* * SVG <script> implementation @@ -24,15 +24,15 @@ public: SPScript(); virtual ~SPScript(); - gchar *xlinkhref; + char *xlinkhref; 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 void modified(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 diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index de9103dee..d76bd9780 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -288,8 +288,13 @@ sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai) Geom::Affine const m (sp_shape_marker_get_transform_at_start(pathv.begin()->front())); for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START if ( shape->_marker[i] ) { + Geom::Affine m_auto = m; + // Reverse start marker if necessary. + if (SP_MARKER(shape->_marker[i])->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) { + m_auto = Geom::Rotate::from_degrees( 180.0 ) * m; + } sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, - ai->key() + i, counter[i], m, + ai->key() + i, counter[i], m_auto, shape->style->stroke_width.computed); counter[i]++; } @@ -425,7 +430,10 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox if (marker_item) { Geom::Affine tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front())); - if (!marker->orient_auto) { + if (marker->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) { + // Reverse start marker if necessary + tr = Geom::Rotate::from_degrees( 180.0 ) * tr; + } else if (marker->orient_mode == MARKER_ORIENT_ANGLE) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); } @@ -463,7 +471,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox { Geom::Affine tr(sp_shape_marker_get_transform_at_start(path_it->front())); - if (!marker->orient_auto) { + if (marker->orient_mode == MARKER_ORIENT_ANGLE) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); } @@ -493,7 +501,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox if (marker_item) { Geom::Affine tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); - if (!marker->orient_auto) { + if (marker->orient_mode == MARKER_ORIENT_ANGLE) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); } @@ -516,7 +524,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox Geom::Curve const &lastcurve = path_it->back_default(); Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve); - if (!marker->orient_auto) { + if (marker->orient_mode == MARKER_ORIENT_ANGLE) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); } @@ -551,7 +559,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve); - if (!marker->orient_auto) { + if (marker->orient_mode == MARKER_ORIENT_ANGLE) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); } diff --git a/src/sp-shape.h b/src/sp-shape.h index f260c1ee6..da8e4c007 100644 --- a/src/sp-shape.h +++ b/src/sp-shape.h @@ -15,13 +15,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "sp-lpe-item.h" -#include "sp-marker-loc.h" #include <2geom/forward.h> - -#include <stddef.h> +#include <cstddef> #include <sigc++/connection.h> +#include "sp-lpe-item.h" +#include "sp-marker-loc.h" + #define SP_SHAPE(obj) (dynamic_cast<SPShape*>((SPObject*)obj)) #define SP_IS_SHAPE(obj) (dynamic_cast<const SPShape*>((SPObject*)obj) != NULL) @@ -57,11 +57,11 @@ public: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void update(SPCtx* ctx, guint flags); + virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(unsigned int flags); - virtual void set(unsigned int key, gchar const* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const; virtual void print(SPPrintContext* ctx); @@ -75,7 +75,7 @@ public: }; -void sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value); +void sp_shape_set_marker (SPObject *object, unsigned int key, const char *value); Geom::Affine sp_shape_marker_get_transform(Geom::Curve const & c1, Geom::Curve const & c2); Geom::Affine sp_shape_marker_get_transform_at_start(Geom::Curve const & c); diff --git a/src/sp-solid-color.cpp b/src/sp-solid-color.cpp index 9f6692f98..0d6b96b62 100644 --- a/src/sp-solid-color.cpp +++ b/src/sp-solid-color.cpp @@ -8,6 +8,8 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <cairo.h> + #include "sp-solid-color.h" #include "attributes.h" diff --git a/src/sp-solid-color.h b/src/sp-solid-color.h index 0ff09762e..4dbb573b0 100644 --- a/src/sp-solid-color.h +++ b/src/sp-solid-color.h @@ -11,10 +11,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> #include "color.h" #include "sp-paint-server.h" +typedef struct _cairo cairo_t; +typedef struct _cairo_pattern cairo_pattern_t; + #define SP_SOLIDCOLOR(obj) (dynamic_cast<SPSolidColor*>((SPObject*)obj)) #define SP_IS_SOLIDCOLOR(obj) (dynamic_cast<const SPSolidColor*>((SPObject*)obj) != NULL) @@ -28,8 +30,8 @@ public: protected: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void set(unsigned int key, const gchar* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); + virtual void set(unsigned int key, char const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); }; #endif /* !SEEN_SP_SOLIDCOLOR_H */ diff --git a/src/sp-spiral.h b/src/sp-spiral.h index 64b95d951..94724685c 100644 --- a/src/sp-spiral.h +++ b/src/sp-spiral.h @@ -52,29 +52,29 @@ public: float t0; /* Lowlevel interface */ - void setPosition(gdouble cx, gdouble cy, gdouble exp, gdouble revo, gdouble rad, gdouble arg, gdouble t0); + void setPosition(double cx, double cy, double exp, double revo, double rad, double arg, double t0); virtual Geom::Affine set_transform(Geom::Affine const& xform); - Geom::Point getXY(gdouble t) const; + Geom::Point getXY(double t) const; - void getPolar(gdouble t, gdouble* rad, gdouble* arg) const; + void getPolar(double t, double* rad, double* arg) const; bool isInvalid() const; virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); - virtual void update(SPCtx *ctx, guint flags); - virtual void set(unsigned int key, gchar const* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); + virtual void update(SPCtx *ctx, unsigned int flags); + virtual void set(unsigned int key, char const* value); virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const; virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; virtual void set_shape(); virtual void update_patheffect(bool write); private: - Geom::Point getTangent(gdouble t) const; + Geom::Point getTangent(double t) const; void fitAndDraw(SPCurve* c, double dstep, Geom::Point darray[], Geom::Point const& hat1, Geom::Point& hat2, double* t) const; }; diff --git a/src/sp-star.h b/src/sp-star.h index 0070ce685..1ebe3298a 100644 --- a/src/sp-star.h +++ b/src/sp-star.h @@ -1,5 +1,5 @@ -#ifndef __SP_STAR_H__ -#define __SP_STAR_H__ +#ifndef SEEN_SP_STAR_H +#define SEEN_SP_STAR_H /* * <sodipodi:star> implementation @@ -30,7 +30,7 @@ public: SPStar(); virtual ~SPStar(); - gint sides; + int sides; Geom::Point center; double r[2]; @@ -46,12 +46,12 @@ public: // What does polygon have that shape doesn't? virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); - virtual void set(unsigned int key, gchar const* value); - virtual void update(SPCtx* ctx, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); + virtual void set(unsigned int key, char const* value); + virtual void update(SPCtx* ctx, unsigned int flags); virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const; virtual void update_patheffect(bool write); @@ -59,9 +59,9 @@ public: virtual Geom::Affine set_transform(Geom::Affine const& xform); }; -void sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, gdouble r2, gdouble arg1, gdouble arg2, bool isflat, double rounded, double randomized); +void sp_star_position_set (SPStar *star, int sides, Geom::Point center, double r1, double r2, double arg1, double arg2, bool isflat, double rounded, double randomized); -Geom::Point sp_star_get_xy (SPStar const *star, SPStarPoint point, gint index, bool randomized = false); +Geom::Point sp_star_get_xy (SPStar const *star, SPStarPoint point, int index, bool randomized = false); diff --git a/src/sp-stop.h b/src/sp-stop.h index b1996e054..f7b3a677a 100644 --- a/src/sp-stop.h +++ b/src/sp-stop.h @@ -5,12 +5,13 @@ * SPStop: SVG <stop> implementation. */ /* - * Authors? + * Authors: */ #include "sp-object.h" #include "color.h" -#include <glib.h> + +typedef unsigned int guint32; namespace Glib { class ustring; @@ -26,7 +27,7 @@ public: virtual ~SPStop(); /// \todo fixme: Should be SPSVGPercentage - gfloat offset; + float offset; bool currentColor; @@ -37,7 +38,7 @@ public: SPColor specified_color; /// \todo fixme: Implement SPSVGNumber or something similar. - gfloat opacity; + float opacity; Glib::ustring * path_string; //SPCurve path; @@ -53,8 +54,8 @@ public: protected: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void set(unsigned int key, const gchar* value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); + virtual void set(unsigned int key, const char* value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); }; diff --git a/src/sp-string.h b/src/sp-string.h index eabf76353..b80b4b8bf 100644 --- a/src/sp-string.h +++ b/src/sp-string.h @@ -1,5 +1,5 @@ -#ifndef __SP_STRING_H__ -#define __SP_STRING_H__ +#ifndef SEEN_SP_STRING_H +#define SEEN_SP_STRING_H /* * string elements diff --git a/src/sp-style-elem.h b/src/sp-style-elem.h index 8e8a2b3a8..766770216 100644 --- a/src/sp-style-elem.h +++ b/src/sp-style-elem.h @@ -16,9 +16,9 @@ public: bool is_css; virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void set(unsigned int key, gchar const* value); + virtual void set(unsigned int key, char const* value); virtual void read_content(); - 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); }; diff --git a/src/sp-switch.h b/src/sp-switch.h index c35982860..4fce1f5a6 100644 --- a/src/sp-switch.h +++ b/src/sp-switch.h @@ -1,5 +1,5 @@ -#ifndef __SP_SWITCH_H__ -#define __SP_SWITCH_H__ +#ifndef SEEN_SP_SWITCH_H +#define SEEN_SP_SWITCH_H /* * SVG <switch> implementation @@ -12,10 +12,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <cstddef> +#include <sigc++/connection.h> + #include "sp-item-group.h" -#include <stddef.h> -#include <sigc++/connection.h> +typedef struct _GSList GSList; #define SP_SWITCH(obj) (dynamic_cast<SPSwitch*>((SPObject*)obj)) #define SP_IS_SWITCH(obj) (dynamic_cast<const SPSwitch*>((SPObject*)obj) != NULL) diff --git a/src/sp-symbol.h b/src/sp-symbol.h index a2e769cc2..6b46a8c1a 100644 --- a/src/sp-symbol.h +++ b/src/sp-symbol.h @@ -1,5 +1,5 @@ -#ifndef __SP_SYMBOL_H__ -#define __SP_SYMBOL_H__ +#ifndef SEEN_SP_SYMBOL_H +#define SEEN_SP_SYMBOL_H /* * SVG <symbol> implementation @@ -17,14 +17,14 @@ * Maybe we should merge them somehow (Lauris) */ -#define SP_TYPE_SYMBOL (sp_symbol_get_type ()) -#define SP_SYMBOL(obj) (dynamic_cast<SPSymbol*>((SPObject*)obj)) -#define SP_IS_SYMBOL(obj) (dynamic_cast<const SPSymbol*>((SPObject*)obj) != NULL) - #include <2geom/affine.h> #include "sp-item-group.h" #include "viewbox.h" +#define SP_TYPE_SYMBOL (sp_symbol_get_type ()) +#define SP_SYMBOL(obj) (dynamic_cast<SPSymbol*>((SPObject*)obj)) +#define SP_IS_SYMBOL(obj) (dynamic_cast<const SPSymbol*>((SPObject*)obj) != NULL) + class SPSymbol : public SPGroup, public SPViewBox { public: SPSymbol(); @@ -32,9 +32,9 @@ public: virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); - virtual void set(unsigned int key, gchar const* value); - virtual void update(SPCtx *ctx, guint flags); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + 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 *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual void modified(unsigned int flags); virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); diff --git a/src/sp-tag-use-reference.h b/src/sp-tag-use-reference.h index f4c0e6a94..2a59fd6bd 100644 --- a/src/sp-tag-use-reference.h +++ b/src/sp-tag-use-reference.h @@ -9,6 +9,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information. */ +#include <glib.h> #include "sp-object.h" #include "sp-item.h" #include <uri-references.h> diff --git a/src/sp-tag-use.h b/src/sp-tag-use.h index 8a0c3e7fb..3f238d654 100644 --- a/src/sp-tag-use.h +++ b/src/sp-tag-use.h @@ -12,6 +12,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <glib.h> #include <stddef.h> #include <sigc++/sigc++.h> #include "svg/svg-length.h" diff --git a/src/sp-text.h b/src/sp-text.h index b9ae745c9..be48d7fcb 100644 --- a/src/sp-text.h +++ b/src/sp-text.h @@ -1,5 +1,5 @@ -#ifndef __SP_TEXT_H__ -#define __SP_TEXT_H__ +#ifndef SEEN_SP_TEXT_H +#define SEEN_SP_TEXT_H /* * SVG <text> and <tspan> implementation @@ -13,13 +13,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> -#include <stddef.h> +#include <cstddef> #include <sigc++/sigc++.h> -#include "sp-string.h" // Provides many other headers with SP_IS_STRING + +#include "libnrtype/Layout-TNG.h" #include "sp-item.h" +#include "sp-string.h" // Provides many other headers with SP_IS_STRING #include "text-tag-attributes.h" -#include "libnrtype/Layout-TNG.h" #define SP_TEXT(obj) (dynamic_cast<SPText*>((SPObject*)obj)) #define SP_IS_TEXT(obj) (dynamic_cast<const SPText*>((SPObject*)obj) != NULL) @@ -81,15 +81,15 @@ public: virtual void release(); virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref); virtual void remove_child(Inkscape::XML::Node* child); - virtual void set(unsigned int key, const gchar* value); + virtual void set(unsigned int key, const char* value); virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(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); virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const; virtual void print(SPPrintContext *ctx); virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); virtual void hide(unsigned int key); virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const; diff --git a/src/sp-textpath.h b/src/sp-textpath.h index 075743d8e..4457cb8cf 100644 --- a/src/sp-textpath.h +++ b/src/sp-textpath.h @@ -1,14 +1,13 @@ #ifndef INKSCAPE_SP_TEXTPATH_H #define INKSCAPE_SP_TEXTPATH_H -#include <glib.h> #include "svg/svg-length.h" #include "sp-item.h" #include "sp-text.h" + class SPUsePath; class Path; - #define SP_TEXTPATH(obj) (dynamic_cast<SPTextPath*>((SPObject*)obj)) #define SP_IS_TEXTPATH(obj) (dynamic_cast<const SPTextPath*>((SPObject*)obj) != NULL) @@ -26,10 +25,10 @@ public: 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, const char* value); virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(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); }; #define SP_IS_TEXT_TEXTPATH(obj) (SP_IS_TEXT(obj) && obj->firstChild() && SP_IS_TEXTPATH(obj->firstChild())) diff --git a/src/sp-title.h b/src/sp-title.h index 14faf4b0a..04f3829c6 100644 --- a/src/sp-title.h +++ b/src/sp-title.h @@ -1,5 +1,5 @@ -#ifndef __SP_TITLE_H__ -#define __SP_TITLE_H__ +#ifndef SEEN_SP_TITLE_H +#define SEEN_SP_TITLE_H /* * SVG <title> implementation @@ -22,7 +22,7 @@ public: SPTitle(); virtual ~SPTitle(); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); }; #endif diff --git a/src/sp-tref-reference.h b/src/sp-tref-reference.h index 10cc25121..b555ace2d 100644 --- a/src/sp-tref-reference.h +++ b/src/sp-tref-reference.h @@ -12,15 +12,17 @@ * Released under GNU GPL, read the file 'COPYING' for more information. */ -#include "sp-item.h" -#include <uri-references.h> -#include <stddef.h> +#include <cstddef> #include <sigc++/sigc++.h> +#include "sp-item.h" +#include "uri-references.h" + #include "util/share.h" #include "xml/node-observer.h" #include "xml/subtree.h" +typedef unsigned int GQuark; class SPTRefReference : public Inkscape::URIReference, public Inkscape::XML::NodeObserver { diff --git a/src/sp-tref.h b/src/sp-tref.h index f5aed9ba6..1727620cd 100644 --- a/src/sp-tref.h +++ b/src/sp-tref.h @@ -34,7 +34,7 @@ public: TextTagAttributes attributes; // Text stored in the xlink:href attribute - gchar *href; + char *href; // URI reference to original object SPTRefReference *uriOriginalRef; @@ -53,14 +53,14 @@ public: 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 void modified(unsigned int flags); virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags); virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const; virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; }; void sp_tref_update_text(SPTRef *tref); diff --git a/src/sp-tspan.h b/src/sp-tspan.h index 4c23b2eba..1aef4cd0c 100644 --- a/src/sp-tspan.h +++ b/src/sp-tspan.h @@ -5,7 +5,6 @@ * tspan and textpath, based on the flowtext routines */ -#include <glib.h> #include "sp-item.h" #include "text-tag-attributes.h" @@ -23,15 +22,15 @@ public: SPTSpan(); virtual ~SPTSpan(); - guint role : 2; + unsigned int role : 2; TextTagAttributes attributes; 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, const char* value); virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(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); virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const; virtual const char* displayName() const; diff --git a/src/sp-use-reference.h b/src/sp-use-reference.h index d99b425f1..297bdc26c 100644 --- a/src/sp-use-reference.h +++ b/src/sp-use-reference.h @@ -9,11 +9,11 @@ * Released under GNU GPL, read the file 'COPYING' for more information. */ -#include "sp-item.h" -#include <uri-references.h> -#include <stddef.h> #include <sigc++/sigc++.h> +#include "sp-item.h" +#include "uri-references.h" + class Path; namespace Inkscape { @@ -43,7 +43,7 @@ public: bool sourceDirty; SPObject *owner; - gchar *sourceHref; + char *sourceHref; Inkscape::XML::Node *sourceRepr; SPObject *sourceObject; diff --git a/src/sp-use.h b/src/sp-use.h index 215eb44d7..97385b986 100644 --- a/src/sp-use.h +++ b/src/sp-use.h @@ -1,5 +1,5 @@ -#ifndef __SP_USE_H__ -#define __SP_USE_H__ +#ifndef SEEN_SP_USE_H +#define SEEN_SP_USE_H /* * SVG <use> implementation @@ -13,8 +13,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <stddef.h> +#include <cstddef> #include <sigc++/sigc++.h> + #include "svg/svg-length.h" #include "sp-item.h" #include "enums.h" @@ -38,7 +39,7 @@ public: SVGLength y; SVGLength width; SVGLength height; - gchar *href; + char *href; // the reference to the original object SPUseReference *ref; @@ -52,14 +53,14 @@ public: virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); virtual void release(); - virtual void set(unsigned key, gchar const *value); - virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual void set(unsigned key, char const *value); + virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags); virtual void update(SPCtx* ctx, unsigned int flags); virtual void modified(unsigned int flags); virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const; virtual const char* displayName() const; - virtual gchar* description() const; + virtual char* description() const; virtual void print(SPPrintContext *ctx); virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); virtual void hide(unsigned int key); diff --git a/src/splivarot.h b/src/splivarot.h index 329fc65d2..ba314399f 100644 --- a/src/splivarot.h +++ b/src/splivarot.h @@ -1,5 +1,5 @@ -#ifndef __SP_LIVAROT_H__ -#define __SP_LIVAROT_H__ +#ifndef SEEN_SP_LIVAROT_H +#define SEEN_SP_LIVAROT_H /* * boolops and outlines @@ -7,9 +7,10 @@ * public domain */ -#include "livarot/Path.h" #include <2geom/forward.h> #include <2geom/path.h> +#include "livarot/Path.h" + class SPCurve; class SPDesktop; class SPItem; diff --git a/src/streq.h b/src/streq.h index a3524a941..7edc5cfe9 100644 --- a/src/streq.h +++ b/src/streq.h @@ -2,7 +2,6 @@ #define INKSCAPE_STREQ_H #include <cstring> -#include <string> /** Convenience/readability wrapper for strcmp(a,b)==0. */ inline bool diff --git a/src/style-enums.h b/src/style-enums.h index 024943458..f52752018 100644 --- a/src/style-enums.h +++ b/src/style-enums.h @@ -17,7 +17,7 @@ /* SPFontStyle */ -#include "display/canvas-bpath.h" +#include "display/canvas-bpath.h" // FIXME those enums belong here! enum SPCSSFontSize { SP_CSS_FONT_SIZE_XX_SMALL, @@ -227,8 +227,8 @@ enum SPTextRendering { struct SPStyleEnum { - gchar const *key; - gint value; + char const *key; + int value; }; static SPStyleEnum const enum_fill_rule[] = { diff --git a/src/style.h b/src/style.h index 01a9d4b84..48eb55430 100644 --- a/src/style.h +++ b/src/style.h @@ -20,11 +20,9 @@ #include "style-enums.h" #include "style-internal.h" -#include <stddef.h> #include <sigc++/connection.h> #include <iostream> #include <vector> -// #include <map> // Define SPIBasePtr, a Pointer to a data member of SPStyle of type SPIBase; typedef SPIBase SPStyle::*SPIBasePtr; @@ -40,9 +38,6 @@ class Node; #include "libcroco/cr-declaration.h" #include "libcroco/cr-prop-list.h" -//struct CRDeclaration; -//struct CRPropList; - /// An SVG style object. class SPStyle { @@ -55,8 +50,8 @@ public: void read(SPObject *object, Inkscape::XML::Node *repr); void readFromObject(SPObject *object); void readFromPrefs(Glib::ustring const &path); - void readIfUnset( gint id, gchar const *val ); - Glib::ustring write( guint const flags, SPStyle const *const base = NULL ) const; + void readIfUnset( int id, char const *val ); + Glib::ustring write( unsigned int const flags, SPStyle const *const base = NULL ) const; void cascade( SPStyle const *const parent ); void merge( SPStyle const *const parent ); bool operator==(const SPStyle& rhs); @@ -66,7 +61,7 @@ public: //FIXME: Make private public: - void _mergeString( gchar const *const p ); // Rename to readFromString? + void _mergeString( char const *const p ); // Rename to readFromString? private: void _mergeDeclList( CRDeclaration const *const decl_list ); void _mergeDecl( CRDeclaration const *const decl ); @@ -260,15 +255,15 @@ public: SPObject *getFilter() { return (filter.href) ? filter.href->getObject() : NULL; } SPObject const *getFilter() const { return (filter.href) ? filter.href->getObject() : NULL; } - gchar const *getFilterURI() const { return (filter.href) ? filter.href->getURI()->toString() : NULL; } + char const *getFilterURI() const { return (filter.href) ? filter.href->getURI()->toString() : NULL; } SPPaintServer *getFillPaintServer() { return (fill.value.href) ? fill.value.href->getObject() : NULL; } SPPaintServer const *getFillPaintServer() const { return (fill.value.href) ? fill.value.href->getObject() : NULL; } - gchar const *getFillURI() const { return (fill.value.href) ? fill.value.href->getURI()->toString() : NULL; } + char const *getFillURI() const { return (fill.value.href) ? fill.value.href->getURI()->toString() : NULL; } SPPaintServer *getStrokePaintServer() { return (stroke.value.href) ? stroke.value.href->getObject() : NULL; } SPPaintServer const *getStrokePaintServer() const { return (stroke.value.href) ? stroke.value.href->getObject() : NULL; } - gchar const *getStrokeURI() const { return (stroke.value.href) ? stroke.value.href->getURI()->toString() : NULL; } + char const *getStrokeURI() const { return (stroke.value.href) ? stroke.value.href->getURI()->toString() : NULL; } }; SPStyle *sp_style_new(SPDocument *document); // SPStyle::SPStyle( SPDocument *document = NULL ); @@ -283,39 +278,39 @@ void sp_style_read_from_object(SPStyle *style, SPObject *object); //SPStyle::rea void sp_style_read_from_prefs(SPStyle *style, Glib::ustring const &path); // SPStyle::read( ... ); -void sp_style_merge_from_style_string(SPStyle *style, gchar const *p); // SPStyle::merge( ... );? +void sp_style_merge_from_style_string(SPStyle *style, char const *p); // SPStyle::merge( ... );? void sp_style_merge_from_parent(SPStyle *style, SPStyle const *parent); // SPStyle::cascade( ... ); void sp_style_merge_from_dying_parent(SPStyle *style, SPStyle const *parent); // SPStyle::merge( ... ) -gchar *sp_style_write_string(SPStyle const *style, guint flags = SP_STYLE_FLAG_IFSET);//SPStyle::write +char *sp_style_write_string(SPStyle const *style, unsigned int flags = SP_STYLE_FLAG_IFSET);//SPStyle::write -gchar *sp_style_write_difference(SPStyle const *from, SPStyle const *to); // SPStyle::write +char *sp_style_write_difference(SPStyle const *from, SPStyle const *to); // SPStyle::write -void sp_style_set_to_uri_string (SPStyle *style, bool isfill, const gchar *uri); // ? +void sp_style_set_to_uri_string (SPStyle *style, bool isfill, const char *uri); // ? -gchar const *sp_style_get_css_unit_string(int unit); // No change? +char const *sp_style_get_css_unit_string(int unit); // No change? double sp_style_css_size_px_to_units(double size, int unit); // No change? double sp_style_css_size_units_to_px(double size, int unit); // No change? -SPCSSAttr *sp_css_attr_from_style (SPStyle const *const style, guint flags); -SPCSSAttr *sp_css_attr_from_object(SPObject *object, guint flags = SP_STYLE_FLAG_IFSET); +SPCSSAttr *sp_css_attr_from_style (SPStyle const *const style, unsigned int flags); +SPCSSAttr *sp_css_attr_from_object(SPObject *object, unsigned int flags = SP_STYLE_FLAG_IFSET); SPCSSAttr *sp_css_attr_unset_text(SPCSSAttr *css); SPCSSAttr *sp_css_attr_unset_uris(SPCSSAttr *css); SPCSSAttr *sp_css_attr_scale(SPCSSAttr *css, double ex); void sp_style_unset_property_attrs(SPObject *o); -void sp_style_set_property_url (SPObject *item, gchar const *property, SPObject *linked, bool recursive); +void sp_style_set_property_url (SPObject *item, char const *property, SPObject *linked, bool recursive); void css_quote( Glib::ustring &val ); // Add quotes around CSS values void css_unquote( Glib::ustring &val ); // Remove quotes from CSS values (style-internal.cpp, xml/repr-css.cpp) void css_font_family_quote( Glib::ustring &val ); // style-internal.cpp, text-toolbar.cpp void css_font_family_unquote( Glib::ustring &val ); // style-internal.cpp, text-toolbar.cpp -Glib::ustring css2_escape_quote(gchar const *val); +Glib::ustring css2_escape_quote(char const *val); #endif // SEEN_SP_STYLE_H diff --git a/src/svg-view-widget.cpp b/src/svg-view-widget.cpp index 567156fec..c568d3ca7 100644 --- a/src/svg-view-widget.cpp +++ b/src/svg-view-widget.cpp @@ -14,7 +14,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gtk/gtk.h> #include "display/sp-canvas.h" #include "display/sp-canvas-group.h" #include "display/canvas-arena.h" @@ -23,8 +22,6 @@ #include "svg-view-widget.h" #include "util/units.h" -static void sp_svg_view_widget_class_init (SPSVGSPViewWidgetClass *klass); -static void sp_svg_view_widget_init (SPSVGSPViewWidget *widget); static void sp_svg_view_widget_dispose(GObject *object); static void sp_svg_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); @@ -42,28 +39,7 @@ static void sp_svg_view_widget_get_preferred_height(GtkWidget *widget, static void sp_svg_view_widget_view_resized (SPViewWidget *vw, Inkscape::UI::View::View *view, gdouble width, gdouble height); -static SPViewWidgetClass *widget_parent_class; - -GType sp_svg_view_widget_get_type(void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPSVGSPViewWidgetClass), - 0, // base_init - 0, // base_finalize - (GClassInitFunc)sp_svg_view_widget_class_init, - 0, // class_finalize - 0, // class_data - sizeof(SPSVGSPViewWidget), - 0, // n_preallocs - (GInstanceInitFunc)sp_svg_view_widget_init, - 0 // value_table - }; - type = g_type_register_static(SP_TYPE_VIEW_WIDGET, "SPSVGSPViewWidget", &info, static_cast<GTypeFlags>(0)); - } - return type; -} +G_DEFINE_TYPE(SPSVGSPViewWidget, sp_svg_view_widget, SP_TYPE_VIEW_WIDGET); /** * Callback to initialize SPSVGSPViewWidget vtable. @@ -74,8 +50,6 @@ static void sp_svg_view_widget_class_init(SPSVGSPViewWidgetClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); SPViewWidgetClass *vw_class = SP_VIEW_WIDGET_CLASS (klass); - widget_parent_class = static_cast<SPViewWidgetClass *>(g_type_class_peek_parent (klass)); - object_class->dispose = sp_svg_view_widget_dispose; widget_class->size_allocate = sp_svg_view_widget_size_allocate; @@ -94,7 +68,6 @@ static void sp_svg_view_widget_class_init(SPSVGSPViewWidgetClass *klass) */ static void sp_svg_view_widget_init(SPSVGSPViewWidget *vw) { - GtkStyle *style; SPCanvasItem *parent; /* Settings */ @@ -117,14 +90,22 @@ static void sp_svg_view_widget_init(SPSVGSPViewWidget *vw) vw->canvas = SPCanvas::createAA(); -#if !GTK_CHECK_VERSION(3,0,0) +#if GTK_CHECK_VERSION(3,0,0) + GdkRGBA white = {1,1,1,0}; + gtk_widget_override_background_color(vw->canvas, GTK_STATE_FLAG_NORMAL, &white); +#else gtk_widget_pop_colormap (); -#endif - - style = gtk_style_copy (gtk_widget_get_style (vw->canvas)); + GtkStyle *style = gtk_style_copy (gtk_widget_get_style (vw->canvas)); style->bg[GTK_STATE_NORMAL] = style->white; gtk_widget_set_style (vw->canvas, style); +#endif + +#if GTK_CHECK_VERSION(3,8,0) + gtk_container_add (GTK_CONTAINER (vw->sw), vw->canvas); +#else gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (vw->sw), vw->canvas); +#endif + gtk_widget_show (vw->canvas); /* View */ @@ -142,8 +123,8 @@ static void sp_svg_view_widget_dispose(GObject *object) vw->canvas = NULL; - if (((GObjectClass *) (widget_parent_class))->dispose) { - (* ((GObjectClass *) (widget_parent_class))->dispose) (object); + if (G_OBJECT_CLASS(sp_svg_view_widget_parent_class)->dispose) { + G_OBJECT_CLASS(sp_svg_view_widget_parent_class)->dispose(object); } } @@ -156,17 +137,18 @@ static void sp_svg_view_widget_size_request(GtkWidget *widget, GtkRequisition *r Inkscape::UI::View::View *v = SP_VIEW_WIDGET_VIEW (widget); #if GTK_CHECK_VERSION(3,0,0) - if (((GtkWidgetClass *) (widget_parent_class))->get_preferred_width && ((GtkWidgetClass *) (widget_parent_class))->get_preferred_width) { + if (GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->get_preferred_width && + GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->get_preferred_height) { gint width_min, height_min, width_nat, height_nat; - (* ((GtkWidgetClass *) (widget_parent_class))->get_preferred_width) (widget, &width_min, &width_nat); - (* ((GtkWidgetClass *) (widget_parent_class))->get_preferred_height) (widget, &height_min, &height_nat); + GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->get_preferred_width(widget, &width_min, &width_nat); + GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->get_preferred_height(widget, &height_min, &height_nat); req->width=width_min; req->height=height_min; } #else - if (((GtkWidgetClass *) (widget_parent_class))->size_request) { - (* ((GtkWidgetClass *) (widget_parent_class))->size_request) (widget, req); + if (GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->size_request) { + GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->size_request(widget, req); } #endif @@ -220,8 +202,8 @@ static void sp_svg_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *a { SPSVGSPViewWidget *svgvw = SP_SVG_VIEW_WIDGET (widget); - if (((GtkWidgetClass *) (widget_parent_class))->size_allocate) { - (* ((GtkWidgetClass *) (widget_parent_class))->size_allocate) (widget, allocation); + if (GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->size_allocate) { + GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->size_allocate(widget, allocation); } if (!svgvw->resize) { diff --git a/src/svg-view-widget.h b/src/svg-view-widget.h index eab5be75b..34c70f396 100644 --- a/src/svg-view-widget.h +++ b/src/svg-view-widget.h @@ -44,7 +44,7 @@ public: /// Whether to resize automatically bool resize; - gdouble maxwidth, maxheight; + double maxwidth, maxheight; // C++ Wrappers diff --git a/src/svg-view.h b/src/svg-view.h index 89f38ad34..bd6fd683a 100644 --- a/src/svg-view.h +++ b/src/svg-view.h @@ -16,7 +16,6 @@ struct SPCanvasGroup; struct SPCanvasItem; - /** * Generic SVG view. */ @@ -25,12 +24,12 @@ public: unsigned int _dkey; SPCanvasGroup *_parent; SPCanvasItem *_drawing; - gdouble _hscale; ///< horizontal scale - gdouble _vscale; ///< vertical scale + double _hscale; ///< horizontal scale + double _vscale; ///< vertical scale bool _rescale; ///< whether to rescale automatically bool _keepaspect; - gdouble _width; - gdouble _height; + double _width; + double _height; /** @@ -43,12 +42,12 @@ public: /** * Rescales SPSVGView to given proportions. */ - void setScale(gdouble hscale, gdouble vscale); + void setScale(double hscale, double vscale); /** * Rescales SPSVGView and keeps aspect ratio. */ - void setRescale(bool rescale, bool keepaspect, gdouble width, gdouble height); + void setRescale(bool rescale, bool keepaspect, double width, double height); /** * Helper function that sets rescale ratio and emits resize event. diff --git a/src/svg/svg-length.cpp b/src/svg/svg-length.cpp index b9e8e6340..b9b475f4b 100644 --- a/src/svg/svg-length.cpp +++ b/src/svg/svg-length.cpp @@ -1,6 +1,4 @@ -#define __SP_SVG_LENGTH_C__ - -/* +/** * SVG data parser * * Authors: @@ -12,20 +10,15 @@ * This code is in public domain */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - +#include <cmath> #include <cstring> #include <string> -#include <math.h> #include <glib.h> #include "svg.h" #include "stringstream.h" #include "util/units.h" - static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, float *val, float *computed, char **next); #ifndef MAX @@ -570,4 +563,4 @@ void SVGLength::readOrUnset(gchar const *str, Unit u, float v, float c) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/svg/svg-length.h b/src/svg/svg-length.h index 477b3ef81..c34905d07 100644 --- a/src/svg/svg-length.h +++ b/src/svg/svg-length.h @@ -1,11 +1,4 @@ -#ifndef SEEN_SP_SVG_LENGTH_H -#define SEEN_SP_SVG_LENGTH_H - /** - * \file src/svg/svg-length.h - * \brief SVG length type - */ -/* * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * Carl Hetherington <inkscape@carlh.net> @@ -16,10 +9,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> +#ifndef SEEN_SP_SVG_LENGTH_H +#define SEEN_SP_SVG_LENGTH_H -class SVGLength -{ +/** + * SVG length type + */ +class SVGLength { public: SVGLength(); @@ -57,9 +53,9 @@ public: return v; } - bool read(gchar const *str); - void readOrUnset(gchar const *str, Unit u = NONE, float v = 0, float c = 0); - bool readAbsolute(gchar const *str); + bool read(char const *str); + void readOrUnset(char const *str, Unit u = NONE, float v = 0, float c = 0); + bool readAbsolute(char const *str); void set(Unit u, float v, float c); void unset(Unit u = NONE, float v = 0, float c = 0); void update(double em, double ex, double scale); @@ -76,4 +72,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/svg/svg-path.cpp b/src/svg/svg-path.cpp index 59dad9ead..9ba3c0ebd 100644 --- a/src/svg/svg-path.cpp +++ b/src/svg/svg-path.cpp @@ -1,41 +1,25 @@ -#define __SP_SVG_PARSE_C__ /* - svg-path.c: Parse SVG path element data into bezier path. - - Copyright (C) 2000 Eazel, Inc. - Copyright (C) 2000 Lauris Kaplinski - Copyright (C) 2001 Ximian, Inc. - Copyright (C) 2008 Johan Engelen - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - 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 - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Authors: - Johan Engelen - (old nartbpath code that has been deleted: Raph Levien <raph@artofcode.com>) - (old nartbpath code that has been deleted: Lauris Kaplinski <lauris@ximian.com>) -*/ + * svg-path.cpp: Parse SVG path element data into bezier path. + * Authors: + * Johan Engelen + * (old nartbpath code that has been deleted: Raph Levien <raph@artofcode.com>) + * (old nartbpath code that has been deleted: Lauris Kaplinski <lauris@ximian.com>) + * + * Copyright (C) 2000 Eazel, Inc. + * Copyright (C) 2000 Lauris Kaplinski + * Copyright (C) 2001 Ximian, Inc. + * Copyright (C) 2008 Johan Engelen + * + * Copyright (C) 2000-2008 authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ #include <cstring> #include <string> #include <cassert> #include <glib.h> // g_assert() -#include "svg/svg.h" -#include "svg/path-string.h" - #include <2geom/pathvector.h> #include <2geom/path.h> #include <2geom/curves.h> @@ -45,6 +29,9 @@ #include <2geom/exception.h> #include <2geom/angle.h> +#include "svg/svg.h" +#include "svg/path-string.h" + /* * Parses the path in str. When an error is found in the pathstring, this method * returns a truncated path up to where the error was found in the pathstring. @@ -150,4 +137,4 @@ gchar * sp_svg_write_path(Geom::Path const &p) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/text-chemistry.h b/src/text-chemistry.h index 1ae0a1779..c983f005f 100644 --- a/src/text-chemistry.h +++ b/src/text-chemistry.h @@ -1,6 +1,8 @@ #ifndef SEEN_TEXT_CHEMISTRY_H #define SEEN_TEXT_CHEMISTRY_H +// TODO move to selection-chemistry? + /* * Text commands * diff --git a/src/text-editing.h b/src/text-editing.h index 290a39194..3a86bf48e 100644 --- a/src/text-editing.h +++ b/src/text-editing.h @@ -13,7 +13,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> #include <utility> // std::pair #include "libnrtype/Layout-TNG.h" #include "text-tag-attributes.h" @@ -54,14 +53,14 @@ double sp_te_get_average_linespacing (SPItem *text); SPStyle const * sp_te_style_at_position(SPItem const *text, Inkscape::Text::Layout::iterator const &position); SPObject const * sp_te_object_at_position(SPItem const *text, Inkscape::Text::Layout::iterator const &position); -Inkscape::Text::Layout::iterator sp_te_insert(SPItem *item, Inkscape::Text::Layout::iterator const &position, gchar const *utf8); -Inkscape::Text::Layout::iterator sp_te_replace(SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, gchar const *utf8); +Inkscape::Text::Layout::iterator sp_te_insert(SPItem *item, Inkscape::Text::Layout::iterator const &position, char const *utf8); +Inkscape::Text::Layout::iterator sp_te_replace(SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, char const *utf8); Inkscape::Text::Layout::iterator sp_te_insert_line (SPItem *text, Inkscape::Text::Layout::iterator const &position); bool sp_te_delete (SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, iterator_pair &iter_pair); -gchar *sp_te_get_string_multiline(SPItem const *text); +char *sp_te_get_string_multiline(SPItem const *text); Glib::ustring sp_te_get_string_multiline(SPItem const *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end); -void sp_te_set_repr_text_multiline(SPItem *text, gchar const *str); +void sp_te_set_repr_text_multiline(SPItem *text, char const *str); TextTagAttributes* text_tag_attributes_at_position(SPItem *item, Inkscape::Text::Layout::iterator const &position, unsigned *char_index); @@ -70,12 +69,12 @@ void sp_te_adjust_kerning_screen(SPItem *text, Inkscape::Text::Layout::iterator void sp_te_adjust_dx (SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double delta); void sp_te_adjust_dy (SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double delta); -void sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble pixels); -void sp_te_adjust_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble degrees); -void sp_te_set_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble degrees); +void sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double pixels); +void sp_te_adjust_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double degrees); +void sp_te_set_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double degrees); -void sp_te_adjust_tspan_letterspacing_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble by); -void sp_te_adjust_linespacing_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble by); +void sp_te_adjust_tspan_letterspacing_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double by); +void sp_te_adjust_linespacing_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double by); void sp_te_apply_style(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPCSSAttr const *css); bool is_part_of_text_subtree (SPObject *obj); diff --git a/src/transf_mat_3x4.h b/src/transf_mat_3x4.h index 8542e5e00..7c0c72120 100644 --- a/src/transf_mat_3x4.h +++ b/src/transf_mat_3x4.h @@ -35,7 +35,7 @@ public: return Geom::atan2(Geom::Point(vp[0], vp[1])) * 180.0/M_PI; } void set_infinite_direction (Proj::Axis axis, double angle) { // angle is in degrees - g_return_if_fail(tmat[2][axis] == 0); // don't set directions for finite VPs + if (tmat[2][axis] != 0) return; // don't set directions for finite VPs double a = angle * M_PI/180; Geom::Point pt(tmat[0][axis], tmat[1][axis]); @@ -44,7 +44,7 @@ public: } inline bool has_finite_image (Proj::Axis axis) { return (tmat[2][axis] != 0.0); } - gchar * pt_to_str (Proj::Axis axis); + char * pt_to_str (Proj::Axis axis); bool operator==(const TransfMat3x4 &rhs) const; TransfMat3x4 operator*(Geom::Affine const &A) const; diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index a66855b2a..44ed3b58f 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -941,13 +941,13 @@ void AboutBox::initStrings() { } // namespace UI } // namespace Inkscape -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/aboutbox.h b/src/ui/dialog/aboutbox.h index 7b3308672..015e344a1 100644 --- a/src/ui/dialog/aboutbox.h +++ b/src/ui/dialog/aboutbox.h @@ -55,13 +55,13 @@ private: #endif // INKSCAPE_UI_DIALOG_ABOUTBOX_H -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index e02ccd3f1..8352de1e3 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -829,14 +829,14 @@ private : -static void on_tool_changed(Inkscape::Application */*inkscape*/, Inkscape::UI::Tools::ToolBase */*context*/, AlignAndDistribute *daad) +static void on_tool_changed(InkscapeApplication */*inkscape*/, Inkscape::UI::Tools::ToolBase */*context*/, AlignAndDistribute *daad) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop && desktop->getEventContext()) daad->setMode(tools_active(desktop) == TOOLS_NODES); } -static void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, AlignAndDistribute *daad) +static void on_selection_changed(InkscapeApplication */*inkscape*/, Inkscape::Selection */*selection*/, AlignAndDistribute *daad) { daad->randomize_bbox = Geom::OptRect(); } diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index e5f18216c..d9e2c03ba 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -1349,7 +1349,7 @@ void CloneTiler::on_picker_color_changed(guint rgba) is_updating = false; } -void CloneTiler::clonetiler_change_selection(Inkscape::Application * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg) +void CloneTiler::clonetiler_change_selection(InkscapeApplication * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg) { GtkWidget *buttons = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "buttons_on_tiles")); GtkWidget *status = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "status")); @@ -1378,7 +1378,7 @@ void CloneTiler::clonetiler_change_selection(Inkscape::Application * /*inkscape* } } -void CloneTiler::clonetiler_external_change(Inkscape::Application * /*inkscape*/, GtkWidget *dlg) +void CloneTiler::clonetiler_external_change(InkscapeApplication * /*inkscape*/, GtkWidget *dlg) { clonetiler_change_selection (NULL, sp_desktop_selection(SP_ACTIVE_DESKTOP), dlg); } diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h index e2a0240ee..70da86338 100644 --- a/src/ui/dialog/clonetiler.h +++ b/src/ui/dialog/clonetiler.h @@ -11,7 +11,6 @@ #define __SP_CLONE_TILER_H__ #include "ui/widget/panel.h" -#include <gtk/gtk.h> #include "ui/dialog/desktop-tracker.h" #include "ui/widget/color-picker.h" @@ -58,8 +57,8 @@ protected: static void clonetiler_keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/); static void clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg); static void clonetiler_unclump(GtkWidget */*widget*/, void *); - static void clonetiler_change_selection(Inkscape::Application * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg); - static void clonetiler_external_change(Inkscape::Application * /*inkscape*/, GtkWidget *dlg); + static void clonetiler_change_selection(InkscapeApplication * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg); + static void clonetiler_external_change(InkscapeApplication * /*inkscape*/, GtkWidget *dlg); static void clonetiler_disconnect_gsignal(GObject *widget, gpointer source); static void clonetiler_reset(GtkWidget */*widget*/, GtkWidget *dlg); static guint clonetiler_number_of_clones(SPObject *obj); diff --git a/src/ui/dialog/desktop-tracker.cpp b/src/ui/dialog/desktop-tracker.cpp index 8a359dd2d..3ed998252 100644 --- a/src/ui/dialog/desktop-tracker.cpp +++ b/src/ui/dialog/desktop-tracker.cpp @@ -94,7 +94,7 @@ sigc::connection DesktopTracker::connectDesktopChanged( const sigc::slot<void, S return desktopChangedSig.connect(slot); } -gboolean DesktopTracker::activateDesktopCB(Inkscape::Application */*inkscape*/, SPDesktop *desktop, DesktopTracker *self ) +gboolean DesktopTracker::activateDesktopCB(InkscapeApplication */*inkscape*/, SPDesktop *desktop, DesktopTracker *self ) { if (self && self->trackActive) { self->setDesktop(desktop); diff --git a/src/ui/dialog/desktop-tracker.h b/src/ui/dialog/desktop-tracker.h index 7da55cf2f..7b944ddfa 100644 --- a/src/ui/dialog/desktop-tracker.h +++ b/src/ui/dialog/desktop-tracker.h @@ -12,11 +12,10 @@ typedef struct _GtkWidget GtkWidget; class SPDesktop; +struct InkscapeApplication; namespace Inkscape { -struct Application; - namespace UI { namespace Dialog { @@ -37,7 +36,7 @@ public: sigc::connection connectDesktopChanged( const sigc::slot<void, SPDesktop*> & slot ); private: - static gboolean activateDesktopCB(Inkscape::Application *inkscape, SPDesktop *desktop, DesktopTracker *self ); + static gboolean activateDesktopCB(InkscapeApplication *inkscape, SPDesktop *desktop, DesktopTracker *self ); static bool hierarchyChangeCB(GtkWidget *widget, GtkWidget* prev, DesktopTracker *self); void handleHierarchyChange(); diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 5c0437133..7b1b36908 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -72,13 +72,13 @@ inline Dialog *create() { return PanelDialog<B>::template create<T>(); } /** * This class is provided as a container for Inkscape's various - * dialogs. This allows Inkscape::Application to treat the various + * dialogs. This allows InkscapeApplication to treat the various * dialogs it invokes, as abstractions. * * DialogManager is essentially a cache of dialogs. It lets us * initialize dialogs lazily - instead of constructing them during * application startup, they're constructed the first time they're - * actually invoked by Inkscape::Application. The constructed + * actually invoked by InkscapeApplication. The constructed * dialog is held here after that, so future invokations of the * dialog don't need to get re-constructed each time. The memory for * the dialogs are then reclaimed when the DialogManager is destroyed. diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 645294bb5..4f0d9fbe1 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -41,7 +41,7 @@ namespace Inkscape { namespace UI { namespace Dialog { -void sp_retransientize(Inkscape::Application */*inkscape*/, SPDesktop *desktop, gpointer dlgPtr) +void sp_retransientize(InkscapeApplication */*inkscape*/, SPDesktop *desktop, gpointer dlgPtr) { Dialog *dlg = static_cast<Dialog *>(dlgPtr); dlg->onDesktopActivated (desktop); @@ -317,20 +317,8 @@ void Dialog::_apply() void Dialog::_close() { - GtkWidget *dlg = GTK_WIDGET(_behavior->gobj()); - - GdkEventAny event; - event.type = GDK_DELETE; - event.window = gtk_widget_get_window(dlg); - event.send_event = TRUE; - - if (event.window) - g_object_ref(G_OBJECT(event.window)); - - gtk_main_do_event ((GdkEvent*)&event); - - if (event.window) - g_object_unref(G_OBJECT(event.window)); + _behavior->hide(); + _onDeleteEvent(NULL); } void Dialog::_defocus() diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h index ec5d203bc..ccff43a56 100644 --- a/src/ui/dialog/dialog.h +++ b/src/ui/dialog/dialog.h @@ -18,10 +18,10 @@ #include "floating-behavior.h" class SPDesktop; +struct InkscapeApplication; namespace Inkscape { class Selection; -struct Application; } namespace Inkscape { @@ -30,7 +30,7 @@ namespace Dialog { enum BehaviorType { FLOATING, DOCK }; -void sp_retransientize(Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr); +void sp_retransientize(InkscapeApplication *inkscape, SPDesktop *desktop, gpointer dlgPtr); gboolean sp_retransientize_again(gpointer dlgPtr); void sp_dialog_shutdown(GObject *object, gpointer dlgPtr); diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index 09c505860..77ea175d9 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -223,7 +223,7 @@ DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *) } void -DocumentMetadata::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop) +DocumentMetadata::_handleActivateDesktop(InkscapeApplication *, SPDesktop *desktop) { Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->addListener(&_repr_events, this); @@ -231,7 +231,7 @@ DocumentMetadata::_handleActivateDesktop(Inkscape::Application *, SPDesktop *des } void -DocumentMetadata::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop *desktop) +DocumentMetadata::_handleDeactivateDesktop(InkscapeApplication *, SPDesktop *desktop) { Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->removeListenerByData(this); diff --git a/src/ui/dialog/document-metadata.h b/src/ui/dialog/document-metadata.h index 3b7ed1ec8..77084bc3d 100644 --- a/src/ui/dialog/document-metadata.h +++ b/src/ui/dialog/document-metadata.h @@ -56,8 +56,8 @@ protected: void init(); void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document); - void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop); - void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop); + void _handleActivateDesktop(InkscapeApplication *application, SPDesktop *desktop); + void _handleDeactivateDesktop(InkscapeApplication *application, SPDesktop *desktop); Gtk::Notebook _notebook; diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 4e4616724..5ad82644e 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1594,7 +1594,7 @@ void DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument update(); } -void DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop) +void DocumentProperties::_handleActivateDesktop(InkscapeApplication *, SPDesktop *desktop) { Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->addListener(&_repr_events, this); @@ -1603,7 +1603,7 @@ void DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDeskt update(); } -void DocumentProperties::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop *desktop) +void DocumentProperties::_handleDeactivateDesktop(InkscapeApplication *, SPDesktop *desktop) { Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->removeListenerByData(this); diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 495f3177d..ee7e88b18 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -94,8 +94,8 @@ protected: void save_default_metadata(); void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document); - void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop); - void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop); + void _handleActivateDesktop(InkscapeApplication *application, SPDesktop *desktop); + void _handleDeactivateDesktop(InkscapeApplication *application, SPDesktop *desktop); Inkscape::XML::SignalObserver _emb_profiles_observer, _scripts_observer; Gtk::Notebook _notebook; diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index 6f3c0dfac..23af0109b 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -12,20 +12,11 @@ #ifndef SP_EXPORT_H #define SP_EXPORT_H -#include <gtk/gtk.h> -#include <glibmm/i18n.h> - -#include <gtkmm/comboboxtext.h> -#include <gtkmm/expander.h> -#include <gtkmm/frame.h> #include <gtkmm/progressbar.h> -#include <gtkmm/textview.h> -#include "desktop.h" #include "ui/dialog/desktop-tracker.h" #include "ui/widget/panel.h" #include "ui/widget/button.h" -#include "ui/widget/entry.h" namespace Gtk { class Dialog; diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 8ba3ad684..575519848 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -40,6 +40,7 @@ #include <glibmm/i18n.h> #include <glibmm/miscutils.h> +#include "document.h" #include "extension/input.h" #include "extension/output.h" #include "extension/db.h" diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h index 340cb860f..35c98ef9c 100644 --- a/src/ui/dialog/fill-and-stroke.h +++ b/src/ui/dialog/fill-and-stroke.h @@ -41,7 +41,7 @@ public: virtual void setDesktop(SPDesktop *desktop); - void selectionChanged(Inkscape::Application *inkscape, + void selectionChanged(InkscapeApplication *inkscape, Inkscape::Selection *selection); void showPageFill(); diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 72217c729..1417b39fa 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -572,7 +572,7 @@ void GridArrangeTab::updateSelection() ## Experimental ##########################*/ -static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, GridArrangeTab *dlg) +static void updateSelectionCallback(InkscapeApplication */*inkscape*/, Inkscape::Selection */*selection*/, GridArrangeTab *dlg) { dlg->updateSelection(); } diff --git a/src/ui/dialog/grid-arrange-tab.h b/src/ui/dialog/grid-arrange-tab.h index 9d6700b39..a137d1694 100644 --- a/src/ui/dialog/grid-arrange-tab.h +++ b/src/ui/dialog/grid-arrange-tab.h @@ -17,14 +17,16 @@ #ifndef INKSCAPE_UI_DIALOG_GRID_ARRANGE_TAB_H #define INKSCAPE_UI_DIALOG_GRID_ARRANGE_TAB_H -#include <gtkmm.h> - +#include "ui/widget/scalar-unit.h" #include "ui/dialog/arrange-tab.h" #include "ui/widget/anchor-selector.h" -#include "ui/widget/scalar-unit.h" #include "ui/widget/spinbutton.h" +#include <gtkmm/checkbutton.h> +#include <gtkmm/radiobutton.h> +#include <gtkmm/radiobuttongroup.h> + namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 9f37626ed..dcea91741 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -545,9 +545,9 @@ private: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index e65b63e68..eef32d10d 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -44,20 +44,38 @@ namespace Dialogs { FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() : _desktop(NULL), _knotpoint(NULL), _position_visible(false) { - Gtk::Box *mainVBox = this->get_vbox(); +#if WITH_GTKMM_3_0 + Gtk::Box *mainVBox = get_content_area(); +#else + Gtk::Box *mainVBox = get_vbox(); +#endif + mainVBox->set_homogeneous(false); + +#if WITH_GTKMM_3_0 + _layout_table.set_row_spacing(4); + _layout_table.set_column_spacing(4); +#else _layout_table.set_spacings(4); _layout_table.resize(2, 2); +#endif // Layer name widgets _fillet_chamfer_position_entry.set_activates_default(true); _fillet_chamfer_position_label.set_label(_("Radius (pixels):")); _fillet_chamfer_position_label.set_alignment(1.0, 0.5); +#if WITH_GTKMM_3_0 + _layout_table.attach(_fillet_chamfer_position_label, 0, 0, 1, 1); + _layout_table.attach(_fillet_chamfer_position_entry, 1, 0, 1, 1); + _fillet_chamfer_position_entry.set_hexpand(); +#else _layout_table.attach(_fillet_chamfer_position_label, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); _layout_table.attach(_fillet_chamfer_position_entry, 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); +#endif + _fillet_chamfer_type_fillet.set_label(_("Fillet")); _fillet_chamfer_type_fillet.set_group(_fillet_chamfer_type_group); _fillet_chamfer_type_inverse_fillet.set_label(_("Inverse fillet")); diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index d3e859bff..9beca02e1 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -8,10 +8,24 @@ #ifndef INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H #define INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H +#if HAVE_CONFIG_H + #include "config.h" +#endif + +#include <gtkmm/dialog.h> #include <2geom/point.h> -#include <gtkmm.h> #include "live_effects/parameter/filletchamferpointarray.h" +#include <gtkmm/entry.h> +#include <gtkmm/label.h> +#include <gtkmm/radiobutton.h> + +#if WITH_GTKMM_3_0 + #include <gtkmm/grid.h> +#else + #include <gtkmm/table.h> +#endif + class SPDesktop; namespace Inkscape { @@ -46,7 +60,12 @@ protected: Gtk::RadioButton _fillet_chamfer_type_chamfer; Gtk::RadioButton _fillet_chamfer_type_double_chamfer; +#if WITH_GTKMM_3_0 + Gtk::Grid _layout_table; +#else Gtk::Table _layout_table; +#endif + bool _position_visible; double _index; diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp index f326bb3ee..e30b148bb 100644 --- a/src/ui/dialog/new-from-template.cpp +++ b/src/ui/dialog/new-from-template.cpp @@ -8,6 +8,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#if HAVE_CONFIG_H + #include "config.h" +#endif #include "new-from-template.h" #include "file.h" @@ -25,12 +28,22 @@ NewFromTemplate::NewFromTemplate() { set_title(_("New From Template")); resize(400, 400); - + +#if WITH_GTKMM_3_0 + get_content_area()->pack_start(_main_widget); +#else get_vbox()->pack_start(_main_widget); +#endif Gtk::Alignment *align; align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0)); + +#if WITH_GTKMM_3_0 + get_content_area()->pack_end(*align, Gtk::PACK_SHRINK); +#else get_vbox()->pack_end(*align, Gtk::PACK_SHRINK); +#endif + align->set_padding(0, 0, 0, 15); align->add(_create_template_button); diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h index 1fefd811e..b4a355083 100644 --- a/src/ui/dialog/panel-dialog.h +++ b/src/ui/dialog/panel-dialog.h @@ -49,19 +49,19 @@ public: virtual UI::Widget::Panel &getPanel() { return _panel; } protected: - static void handle_deactivate_desktop(Inkscape::Application *application, SPDesktop *desktop, void *data) { + static void handle_deactivate_desktop(InkscapeApplication *application, SPDesktop *desktop, void *data) { g_return_if_fail(data != NULL); static_cast<PanelDialogBase *>(data)->_propagateDesktopDeactivated(application, desktop); } - static void _handle_activate_desktop(Inkscape::Application *application, SPDesktop *desktop, void *data) { + static void _handle_activate_desktop(InkscapeApplication *application, SPDesktop *desktop, void *data) { g_return_if_fail(data != NULL); static_cast<PanelDialogBase *>(data)->_propagateDesktopActivated(application, desktop); } inline virtual void _propagateDocumentReplaced(SPDesktop* desktop, SPDocument *document); - inline virtual void _propagateDesktopActivated(Inkscape::Application *, SPDesktop *); - inline virtual void _propagateDesktopDeactivated(Inkscape::Application *, SPDesktop *); + inline virtual void _propagateDesktopActivated(InkscapeApplication *, SPDesktop *); + inline virtual void _propagateDesktopDeactivated(InkscapeApplication *, SPDesktop *); UI::Widget::Panel &_panel; sigc::connection _document_replaced_connection; @@ -134,14 +134,14 @@ void PanelDialogBase::_propagateDocumentReplaced(SPDesktop *desktop, SPDocument _panel.signalDocumentReplaced().emit(desktop, document); } -void PanelDialogBase::_propagateDesktopActivated(Inkscape::Application *application, SPDesktop *desktop) +void PanelDialogBase::_propagateDesktopActivated(InkscapeApplication *application, SPDesktop *desktop) { _document_replaced_connection = desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialogBase::_propagateDocumentReplaced)); _panel.signalActivateDesktop().emit(application, desktop); } -void PanelDialogBase::_propagateDesktopDeactivated(Inkscape::Application *application, SPDesktop *desktop) +void PanelDialogBase::_propagateDesktopDeactivated(InkscapeApplication *application, SPDesktop *desktop) { _document_replaced_connection.disconnect(); _panel.signalDeactiveDesktop().emit(application, desktop); diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index a00b8fc02..80579c9d3 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -25,6 +25,7 @@ #include "desktop.h" #include "sp-ellipse.h" #include "sp-item-transform.h" +#include <gtkmm/messagedialog.h> namespace Inkscape { namespace UI { @@ -32,7 +33,11 @@ namespace Dialog { PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) : parent(parent_), +#if WITH_GTKMM_3_0 + parametersTable(), +#else parametersTable(3, 3, false), +#endif centerY("", "Y coordinate of the center", UNIT_TYPE_LINEAR), centerX("", "X coordinate of the center", centerY), radiusY("", "Y coordinate of the radius", UNIT_TYPE_LINEAR), @@ -76,7 +81,11 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) pack_start(arrangeOnParametersRadio, false, false); centerLabel.set_text(_("Center X/Y:")); +#if WITH_GTKMM_3_0 + parametersTable.attach(centerLabel, 0, 0, 1, 1); +#else parametersTable.attach(centerLabel, 0, 1, 0, 1, Gtk::FILL); +#endif centerX.setDigits(2); centerX.setIncrements(0.2, 0); centerX.setRange(-10000, 10000); @@ -85,11 +94,20 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) centerY.setIncrements(0.2, 0); centerY.setRange(-10000, 10000); centerY.setValue(0, "px"); +#if WITH_GTKMM_3_0 + parametersTable.attach(centerX, 1, 0, 1, 1); + parametersTable.attach(centerY, 2, 0, 1, 1); +#else parametersTable.attach(centerX, 1, 2, 0, 1, Gtk::FILL); parametersTable.attach(centerY, 2, 3, 0, 1, Gtk::FILL); +#endif radiusLabel.set_text(_("Radius X/Y:")); +#if WITH_GTKMM_3_0 + parametersTable.attach(radiusLabel, 0, 1, 1, 1); +#else parametersTable.attach(radiusLabel, 0, 1, 1, 2, Gtk::FILL); +#endif radiusX.setDigits(2); radiusX.setIncrements(0.2, 0); radiusX.setRange(0.001, 10000); @@ -98,11 +116,20 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) radiusY.setIncrements(0.2, 0); radiusY.setRange(0.001, 10000); radiusY.setValue(100, "px"); +#if WITH_GTKMM_3_0 + parametersTable.attach(radiusX, 1, 1, 1, 1); + parametersTable.attach(radiusY, 2, 1, 1, 1); +#else parametersTable.attach(radiusX, 1, 2, 1, 2, Gtk::FILL); parametersTable.attach(radiusY, 2, 3, 1, 2, Gtk::FILL); +#endif angleLabel.set_text(_("Angle X/Y:")); +#if WITH_GTKMM_3_0 + parametersTable.attach(angleLabel, 0, 2, 1, 1); +#else parametersTable.attach(angleLabel, 0, 1, 2, 3, Gtk::FILL); +#endif angleX.setDigits(2); angleX.setIncrements(0.2, 0); angleX.setRange(-10000, 10000); @@ -111,8 +138,13 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) angleY.setIncrements(0.2, 0); angleY.setRange(-10000, 10000); angleY.setValue(180, "°"); +#if WITH_GTKMM_3_0 + parametersTable.attach(angleX, 1, 2, 1, 1); + parametersTable.attach(angleY, 2, 2, 1, 1); +#else parametersTable.attach(angleX, 1, 2, 2, 3, Gtk::FILL); parametersTable.attach(angleY, 2, 3, 2, 3, Gtk::FILL); +#endif pack_start(parametersTable, false, false); rotateObjectsCheckBox.set_label(_("Rotate objects")); diff --git a/src/ui/dialog/polar-arrange-tab.h b/src/ui/dialog/polar-arrange-tab.h index f6c3b2906..f7d7bf11f 100644 --- a/src/ui/dialog/polar-arrange-tab.h +++ b/src/ui/dialog/polar-arrange-tab.h @@ -10,9 +10,22 @@ #ifndef INKSCAPE_UI_DIALOG_POLAR_ARRANGE_TAB_H #define INKSCAPE_UI_DIALOG_POLAR_ARRANGE_TAB_H +#if HAVE_CONFIG_H + #include "config.h" +#endif + +#include "ui/widget/scalar-unit.h" #include "ui/widget/anchor-selector.h" #include "ui/dialog/arrange-tab.h" -#include "ui/widget/scalar-unit.h" + +#include <gtkmm/radiobutton.h> +#include <gtkmm/radiobuttongroup.h> + +#if WITH_GTKMM_3_0 + #include <gtkmm/grid.h> +#else + #include <gtkmm/table.h> +#endif namespace Inkscape { namespace UI { @@ -62,7 +75,11 @@ private: Gtk::RadioButton arrangeOnLastCircleRadio; Gtk::RadioButton arrangeOnParametersRadio; +#if WITH_GTKMM_3_0 + Gtk::Grid parametersTable; +#else Gtk::Table parametersTable; +#endif Gtk::Label centerLabel; Inkscape::UI::Widget::ScalarUnit centerY; diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index ed39ebb32..a015d28f9 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -14,13 +14,13 @@ # include <config.h> #endif +#include <gtkmm.h> + #ifdef WIN32 #include <io.h> #include <windows.h> #endif -#include <gtkmm.h> - #include "preferences.h" #include "print.h" diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index a7f0b068e..3e135b9b2 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -47,13 +47,13 @@ namespace Inkscape { namespace UI { namespace Dialog { -static void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection *selection, Transformation *daad) +static void on_selection_changed(InkscapeApplication */*inkscape*/, Inkscape::Selection *selection, Transformation *daad) { int page = daad->getCurrentPage(); daad->updateSelection((Inkscape::UI::Dialog::Transformation::PageType)page, selection); } -static void on_selection_modified( Inkscape::Application */*inkscape*/, +static void on_selection_modified( InkscapeApplication */*inkscape*/, Inkscape::Selection *selection, guint /*flags*/, Transformation *daad ) diff --git a/src/ui/tools/flood-tool.h b/src/ui/tools/flood-tool.h index 3ed670e8b..5104a42e9 100644 --- a/src/ui/tools/flood-tool.h +++ b/src/ui/tools/flood-tool.h @@ -11,9 +11,7 @@ * Released under GNU GPL */ -#include <stddef.h> -#include <sigc++/sigc++.h> -#include <gtk/gtk.h> +#include <sigc++/connection.h> #include "ui/tools/tool-base.h" #define SP_FLOOD_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::FloodTool*>((Inkscape::UI::Tools::ToolBase*)obj)) diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index aad924844..72250a550 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -610,13 +610,13 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) if (dc->sa) { SPCurve *s = dc->sa->curve; dc->white_curves = g_slist_remove(dc->white_curves, s); - if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - s = dc->overwriteCurve; - } if (dc->sa->start) { s = reverse_then_unref(s); } + if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || + prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ + dc->overwriteCurve = s; + } s->append_continuous(c, 0.0625); c->unref(); c = s; diff --git a/src/ui/tools/select-tool.h b/src/ui/tools/select-tool.h index edc4069a2..5af99a56a 100644 --- a/src/ui/tools/select-tool.h +++ b/src/ui/tools/select-tool.h @@ -13,7 +13,6 @@ */ #include "ui/tools/tool-base.h" -#include <gtk/gtk.h> #define SP_SELECT_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::SelectTool*>((Inkscape::UI::Tools::ToolBase*)obj)) #define SP_IS_SELECT_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::SelectTool*>((const Inkscape::UI::Tools::ToolBase*)obj) != NULL) diff --git a/src/ui/tools/spiral-tool.h b/src/ui/tools/spiral-tool.h index 416aeb7e4..add92342d 100644 --- a/src/ui/tools/spiral-tool.h +++ b/src/ui/tools/spiral-tool.h @@ -15,17 +15,15 @@ * Released under GNU GPL */ -#include <gtk/gtk.h> -#include <stddef.h> -#include <sigc++/sigc++.h> +#include <sigc++/connection.h> #include <2geom/point.h> #include "ui/tools/tool-base.h" -#include "sp-spiral.h" - #define SP_SPIRAL_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::SpiralTool*>((Inkscape::UI::Tools::ToolBase*)obj)) #define SP_IS_SPIRAL_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::SpiralTool*>((const Inkscape::UI::Tools::ToolBase*)obj) != NULL) +class SPSpiral; + namespace Inkscape { namespace UI { namespace Tools { diff --git a/src/ui/tools/text-tool.h b/src/ui/tools/text-tool.h index ca2b3d19a..289ee180d 100644 --- a/src/ui/tools/text-tool.h +++ b/src/ui/tools/text-tool.h @@ -14,10 +14,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -/* #include <gdk/gdkic.h> */ -#include <stddef.h> -#include <sigc++/sigc++.h> -#include <gtk/gtk.h> +#include <sigc++/connection.h> #include "ui/tools/tool-base.h" #include <2geom/point.h> @@ -26,6 +23,8 @@ #define SP_TEXT_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::TextTool*>((Inkscape::UI::Tools::ToolBase*)obj)) #define SP_IS_TEXT_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::TextTool*>((const Inkscape::UI::Tools::ToolBase*)obj) != NULL) +typedef struct _GtkIMContext GtkIMContext; + struct SPCtrlLine; namespace Inkscape { diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index c23da87c0..c28b86416 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -18,6 +18,8 @@ # include "config.h" #endif +#include "widgets/desktop-widget.h" + #if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H #include <glibmm/threads.h> #endif @@ -40,7 +42,6 @@ #include "desktop-handles.h" #include "desktop-events.h" #include "desktop-style.h" -#include "widgets/desktop-widget.h" #include "sp-namedview.h" #include "selection.h" #include "interface.h" diff --git a/src/ui/view/view-widget.cpp b/src/ui/view/view-widget.cpp index 5cb0df215..671a4afe6 100644 --- a/src/ui/view/view-widget.cpp +++ b/src/ui/view/view-widget.cpp @@ -15,32 +15,9 @@ //using namespace Inkscape::UI::View; // SPViewWidget - -static void sp_view_widget_class_init(SPViewWidgetClass *vwc); -static void sp_view_widget_init(SPViewWidget *widget); static void sp_view_widget_dispose(GObject *object); -static GtkEventBoxClass *widget_parent_class; - -GType sp_view_widget_get_type(void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPViewWidgetClass), - NULL, NULL, - (GClassInitFunc) sp_view_widget_class_init, - NULL, NULL, - sizeof(SPViewWidget), - 0, - (GInstanceInitFunc) sp_view_widget_init, - NULL - }; - type = g_type_register_static (GTK_TYPE_EVENT_BOX, "SPViewWidget", &info, (GTypeFlags)0); - } - - return type; -} +G_DEFINE_TYPE(SPViewWidget, sp_view_widget, GTK_TYPE_EVENT_BOX); /** * Callback to initialize the SPViewWidget vtable. @@ -48,8 +25,6 @@ GType sp_view_widget_get_type(void) static void sp_view_widget_class_init(SPViewWidgetClass *vwc) { GObjectClass *object_class = G_OBJECT_CLASS(vwc); - - widget_parent_class = (GtkEventBoxClass*) g_type_class_peek_parent(vwc); object_class->dispose = sp_view_widget_dispose; } @@ -77,8 +52,8 @@ static void sp_view_widget_dispose(GObject *object) vw->view = NULL; } - if (((GObjectClass *) (widget_parent_class))->dispose) { - (* ((GObjectClass *) (widget_parent_class))->dispose)(object); + if (G_OBJECT_CLASS(sp_view_widget_parent_class)->dispose) { + G_OBJECT_CLASS(sp_view_widget_parent_class)->dispose(object); } Inkscape::GC::request_early_collection(); diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index 82e27ee89..df00b786a 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -28,7 +28,11 @@ void AnchorSelector::setupButton(const Glib::ustring& icon, Gtk::ToggleButton& b AnchorSelector::AnchorSelector() : Gtk::Alignment(0.5, 0, 0, 0), +#if WITH_GTKMM_3_0 + _container() +#else _container(3, 3, true) +#endif { setupButton(INKSCAPE_ICON("boundingbox_top_left"), _buttons[0]); setupButton(INKSCAPE_ICON("boundingbox_top"), _buttons[1]); @@ -40,10 +44,20 @@ AnchorSelector::AnchorSelector() setupButton(INKSCAPE_ICON("boundingbox_bottom"), _buttons[7]); setupButton(INKSCAPE_ICON("boundingbox_bottom_right"), _buttons[8]); +#if WITH_GTKMM_3_0 + _container.set_row_homogeneous(); + _container.set_column_homogeneous(true); +#endif + for(int i = 0; i < 9; ++i) { _buttons[i].signal_clicked().connect( sigc::bind(sigc::mem_fun(*this, &AnchorSelector::btn_activated), i)); + +#if WITH_GTKMM_3_0 + _container.attach(_buttons[i], i % 3, i / 3, 1, 1); +#else _container.attach(_buttons[i], i % 3, i % 3+1, i / 3, i / 3+1, Gtk::FILL, Gtk::FILL); +#endif } _selection = 4; _buttons[4].set_active(); @@ -94,4 +108,4 @@ void AnchorSelector::setAlignment(int horizontal, int vertical) fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/ui/widget/anchor-selector.h b/src/ui/widget/anchor-selector.h index 2263438e3..0a702d296 100644 --- a/src/ui/widget/anchor-selector.h +++ b/src/ui/widget/anchor-selector.h @@ -10,7 +10,18 @@ #ifndef ANCHOR_SELECTOR_H_ #define ANCHOR_SELECTOR_H_ -#include <gtkmm.h> +#if HAVE_CONFIG_H + #include "config.h" +#endif + +#include <gtkmm/alignment.h> +#include <gtkmm/togglebutton.h> + +#if WITH_GTKMM_3_0 + #include <gtkmm/grid.h> +#else + #include <gtkmm/table.h> +#endif namespace Inkscape { namespace UI { @@ -21,7 +32,12 @@ class AnchorSelector : public Gtk::Alignment private: Gtk::ToggleButton _buttons[9]; int _selection; + +#if WITH_GTKMM_3_0 + Gtk::Grid _container; +#else Gtk::Table _container; +#endif sigc::signal<void> _selectionChanged; @@ -56,4 +72,4 @@ public: fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/ui/widget/button.cpp b/src/ui/widget/button.cpp index bac866920..6c2d419cf 100644 --- a/src/ui/widget/button.cpp +++ b/src/ui/widget/button.cpp @@ -51,13 +51,13 @@ RadioButton::RadioButton(Glib::ustring const &label, Glib::ustring const &toolti } // namespace UI } // namespace Inkscape -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/button.h b/src/ui/widget/button.h index a214dd881..471b7d8a2 100644 --- a/src/ui/widget/button.h +++ b/src/ui/widget/button.h @@ -67,13 +67,13 @@ public: #endif // INKSCAPE_UI_WIDGET_BUTTON_H -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index 0f526f77a..c7d5efe29 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -206,9 +206,9 @@ EntityMultiLineEntry::on_changed() Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/entity-entry.h b/src/ui/widget/entity-entry.h index 09289496d..35f6ecfb4 100644 --- a/src/ui/widget/entity-entry.h +++ b/src/ui/widget/entity-entry.h @@ -76,9 +76,9 @@ protected: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index 42f352e3c..7429bb07e 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -160,9 +160,9 @@ void Licensor::update (SPDocument *doc) Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/licensor.h b/src/ui/widget/licensor.h index 0ac3e5ab8..c75c5fe9e 100644 --- a/src/ui/widget/licensor.h +++ b/src/ui/widget/licensor.h @@ -56,9 +56,9 @@ protected: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/notebook-page.cpp b/src/ui/widget/notebook-page.cpp index 6653499b8..2f03ed23b 100644 --- a/src/ui/widget/notebook-page.cpp +++ b/src/ui/widget/notebook-page.cpp @@ -44,13 +44,13 @@ NotebookPage::NotebookPage(int n_rows, int n_columns, bool expand, bool fill, gu } // namespace UI } // namespace Inkscape -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/notebook-page.h b/src/ui/widget/notebook-page.h index 38ae9e054..4f7915423 100644 --- a/src/ui/widget/notebook-page.h +++ b/src/ui/widget/notebook-page.h @@ -67,13 +67,13 @@ protected: #endif // INKSCAPE_UI_WIDGET_NOTEBOOK_PAGE_H -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 537db0fdd..e4cd76345 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -40,7 +40,7 @@ namespace UI { namespace Widget { /*void ObjectCompositeSettings::_on_desktop_activate( - Inkscape::Application *application, + InkscapeApplication *application, SPDesktop *desktop, ObjectCompositeSettings *w ) { @@ -50,7 +50,7 @@ namespace Widget { } void ObjectCompositeSettings::_on_desktop_deactivate( - Inkscape::Application *application, + InkscapeApplication *application, SPDesktop *desktop, ObjectCompositeSettings *w ) { diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index 19a6cb2a5..e375bf24a 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -30,9 +30,9 @@ #include "ui/widget/spinbutton.h" class SPDesktop; +struct InkscapeApplication; namespace Inkscape { -struct Application; namespace UI { namespace Widget { @@ -66,8 +66,8 @@ private: gulong _desktop_activated; sigc::connection _subject_changed; - static void _on_desktop_activate(Inkscape::Application *application, SPDesktop *desktop, ObjectCompositeSettings *w); - static void _on_desktop_deactivate(Inkscape::Application *application, SPDesktop *desktop, ObjectCompositeSettings *w); + static void _on_desktop_activate(InkscapeApplication *application, SPDesktop *desktop, ObjectCompositeSettings *w); + static void _on_desktop_deactivate(InkscapeApplication *application, SPDesktop *desktop, ObjectCompositeSettings *w); void _subjectChanged(); void _blendBlurValueChanged(); void _opacityValueChanged(); diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index eae0d4a95..89b0b8f7e 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -728,9 +728,9 @@ PageSizer::on_units_changed() Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index dc8e34d82..f4bcae4b6 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -277,9 +277,9 @@ protected: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index b37137228..0abd81b16 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -643,13 +643,13 @@ Panel::signalDocumentReplaced() return _signal_document_replaced; } -sigc::signal<void, Inkscape::Application *, SPDesktop *> & +sigc::signal<void, InkscapeApplication *, SPDesktop *> & Panel::signalActivateDesktop() { return _signal_activate_desktop; } -sigc::signal<void, Inkscape::Application *, SPDesktop *> & +sigc::signal<void, InkscapeApplication *, SPDesktop *> & Panel::signalDeactiveDesktop() { return _signal_deactive_desktop; diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 0c3d822b8..177314797 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -45,9 +45,9 @@ namespace Gtk { class MenuItem; } -namespace Inkscape { +struct InkscapeApplication; -struct Application; +namespace Inkscape { class Selection; namespace UI { @@ -116,8 +116,8 @@ public: void setResponseSensitive(int response_id, bool setting); virtual sigc::signal<void, SPDesktop *, SPDocument *> &signalDocumentReplaced(); - virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalActivateDesktop(); - virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalDeactiveDesktop(); + virtual sigc::signal<void, InkscapeApplication *, SPDesktop *> &signalActivateDesktop(); + virtual sigc::signal<void, InkscapeApplication *, SPDesktop *> &signalDeactiveDesktop(); protected: /** @@ -147,8 +147,8 @@ protected: sigc::signal<void, int> _signal_response; sigc::signal<void> _signal_present; sigc::signal<void, SPDesktop *, SPDocument *> _signal_document_replaced; - sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_activate_desktop; - sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_deactive_desktop; + sigc::signal<void, InkscapeApplication *, SPDesktop *> _signal_activate_desktop; + sigc::signal<void, InkscapeApplication *, SPDesktop *> _signal_deactive_desktop; private: void _init(); diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index cb4ce17d1..5d9816e74 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -306,9 +306,9 @@ public: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 8a81b1c02..44d8dcbf3 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -788,9 +788,9 @@ RegisteredRandom::on_value_changed() Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index d8c0e6602..1f505a3cd 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -419,9 +419,9 @@ protected: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/registry.cpp b/src/ui/widget/registry.cpp index 725e52791..ea8198422 100644 --- a/src/ui/widget/registry.cpp +++ b/src/ui/widget/registry.cpp @@ -48,9 +48,9 @@ Registry::setUpdating (bool upd) Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/registry.h b/src/ui/widget/registry.h index 2da29735c..a236b96ad 100644 --- a/src/ui/widget/registry.h +++ b/src/ui/widget/registry.h @@ -39,9 +39,9 @@ protected: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp index 72ec69362..2d7597d7c 100644 --- a/src/ui/widget/rotateable.cpp +++ b/src/ui/widget/rotateable.cpp @@ -173,13 +173,13 @@ Rotateable::~Rotateable() { } // namespace UI } // namespace Inkscape -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/rotateable.h b/src/ui/widget/rotateable.h index 52fb5306c..6404c3550 100644 --- a/src/ui/widget/rotateable.h +++ b/src/ui/widget/rotateable.h @@ -62,9 +62,9 @@ private: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 85538c8c7..a0a163286 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -1571,9 +1571,9 @@ Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop) Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index df0f41507..0b6a14762 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -301,13 +301,13 @@ protected: #endif // INKSCAPE_UI_WIDGET_BUTTON_H -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index ade3d1e60..bb08d67df 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -235,13 +235,13 @@ void DualSpinScale::update_linked() } // namespace UI } // namespace Inkscape -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/spin-scale.h b/src/ui/widget/spin-scale.h index 5fec8b1d8..d0447e4a6 100644 --- a/src/ui/widget/spin-scale.h +++ b/src/ui/widget/spin-scale.h @@ -113,13 +113,13 @@ private: #endif // INKSCAPE_UI_WIDGET_SPIN_SCALE_H -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 1cb59a7b3..9b361ae78 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -262,13 +262,13 @@ void DualSpinSlider::update_linked() } // namespace UI } // namespace Inkscape -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index 5f86fd15a..74982ea58 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -111,13 +111,13 @@ private: #endif // INKSCAPE_UI_WIDGET_SPIN_SLIDER_H -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index 7709a837b..d7669d4e5 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -100,13 +100,13 @@ void SpinButton::undo() } // namespace UI } // namespace Inkscape -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index 812b5f515..cbe33e8ea 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -111,13 +111,13 @@ private: #endif // INKSCAPE_UI_WIDGET_SPINBUTTON_H -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 98f4e47cd..157fd2ad9 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -386,9 +386,9 @@ void StyleSwatch::setStyle(SPStyle *query) Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h index 557ca82e2..582d2ebb3 100644 --- a/src/ui/widget/style-swatch.h +++ b/src/ui/widget/style-swatch.h @@ -108,13 +108,13 @@ friend class ToolObserver; #endif // INKSCAPE_UI_WIDGET_BUTTON_H -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index 5fc588fdc..aac7451f4 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -216,9 +216,9 @@ void ToleranceSlider::update (double val) Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/tolerance-slider.h b/src/ui/widget/tolerance-slider.h index 2184cd52b..7ae8e4712 100644 --- a/src/ui/widget/tolerance-slider.h +++ b/src/ui/widget/tolerance-slider.h @@ -88,9 +88,9 @@ protected: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/unit-menu.cpp b/src/ui/widget/unit-menu.cpp index 7416a2f02..423313a1f 100644 --- a/src/ui/widget/unit-menu.cpp +++ b/src/ui/widget/unit-menu.cpp @@ -140,13 +140,13 @@ bool UnitMenu::isRadial() const } // namespace UI } // namespace Inkscape -/* +/* Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/unit-menu.h b/src/ui/widget/unit-menu.h index 114c536c9..2fd25a6a9 100644 --- a/src/ui/widget/unit-menu.h +++ b/src/ui/widget/unit-menu.h @@ -141,9 +141,9 @@ protected: Local Variables: mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/unit-tracker.h b/src/ui/widget/unit-tracker.h index 61bb556ef..06245930e 100644 --- a/src/ui/widget/unit-tracker.h +++ b/src/ui/widget/unit-tracker.h @@ -16,13 +16,16 @@ #define INKSCAPE_UI_WIDGET_UNIT_TRACKER_H #include <map> -#include <gtk/gtk.h> - #include "util/units.h" using Inkscape::Util::Unit; using Inkscape::Util::UnitType; +typedef struct _GObject GObject; +typedef struct _GtkAction GtkAction; +typedef struct _GtkAdjustment GtkAdjustment; +typedef struct _GtkListStore GtkListStore; + namespace Inkscape { namespace UI { namespace Widget { diff --git a/src/unclump.cpp b/src/unclump.cpp index 1427e8eab..940369d7a 100644 --- a/src/unclump.cpp +++ b/src/unclump.cpp @@ -17,6 +17,7 @@ #include "sp-item.h" #include "unclump.h" +#include <glib.h> // Taking bbox of an item is an expensive operation, and we need to do it many times, so here we // cache the centers, widths, and heights of items diff --git a/src/unclump.h b/src/unclump.h index 18148b215..2411cb713 100644 --- a/src/unclump.h +++ b/src/unclump.h @@ -11,7 +11,7 @@ #ifndef SEEN_DIALOGS_UNCLUMP_H #define SEEN_DIALOGS_UNCLUMP_H -#include <glib.h> +typedef struct _GSList GSList; void unclump(GSList *items); diff --git a/src/unicoderange.h b/src/unicoderange.h index 2f73f7b47..342b3fa3e 100644 --- a/src/unicoderange.h +++ b/src/unicoderange.h @@ -1,17 +1,19 @@ #include <glibmm/ustring.h> -#include <glib-object.h> #include <vector> +// A type which can hold any UTF-32 or UCS-4 character code. +typedef unsigned int gunichar; + struct Urange{ - gchar* start; - gchar* end; + char* start; + char* end; }; class UnicodeRange{ public: -UnicodeRange(const gchar* val); -int add_range(gchar* val); -bool contains(gchar unicode); +UnicodeRange(const char* val); +int add_range(char* val); +bool contains(char unicode); Glib::ustring attribute_string(); gunichar sample_glyph(); diff --git a/src/uri-references.cpp b/src/uri-references.cpp index 6db2ed21f..b23bed74a 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -1,6 +1,4 @@ -#define __SP_URI_REFERENCES_C__ - -/* +/** * Helper methods for resolving URI References * * Authors: @@ -206,4 +204,4 @@ sp_uri_reference_resolve (SPDocument *document, const gchar *uri) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/uri-references.h b/src/uri-references.h index 631d440da..0c51481cc 100644 --- a/src/uri-references.h +++ b/src/uri-references.h @@ -14,7 +14,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <stddef.h> +#include <cstddef> #include <sigc++/connection.h> #include <sigc++/trackable.h> @@ -62,7 +62,7 @@ public: * @param rel_document document for relative URIs * @param uri the URI to watch */ - void attach(const URI &uri) throw(BadURIException); + void attach(URI const& uri) throw(BadURIException); /** * Detaches from the currently attached URI target, if any; @@ -105,7 +105,7 @@ public: * * @returns the currently attached URI, or NULL */ - const URI *getURI() const { + URI const* getURI() const { return _uri; } @@ -140,7 +140,7 @@ private: void _setObject(SPObject *object); void _release(SPObject *object); - void operator=(const URIReference &ref); + void operator=(URIReference const& ref); /* Private and definition-less to prevent accidental use. */ }; @@ -149,9 +149,9 @@ private: /** * Resolves an item referenced by a URI in CSS form contained in "url(...)" */ -SPObject* sp_css_uri_reference_resolve( SPDocument *document, const gchar *uri ); +SPObject* sp_css_uri_reference_resolve( SPDocument *document, const char *uri ); -SPObject *sp_uri_reference_resolve (SPDocument *document, const gchar *uri); +SPObject *sp_uri_reference_resolve (SPDocument *document, const char *uri); #endif // SEEN_SP_URI_REFERENCES_H @@ -164,4 +164,4 @@ SPObject *sp_uri_reference_resolve (SPDocument *document, const gchar *uri); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : @@ -11,7 +11,6 @@ #ifndef INKSCAPE_URI_H #define INKSCAPE_URI_H -#include <glib.h> #include <exception> #include <libxml/uri.h> #include "bad-uri-exception.h" @@ -38,7 +37,7 @@ public: * * @param preformed Properly quoted C-style string to be represented. */ - explicit URI(gchar const *preformed) throw(BadURIException); + explicit URI(char const *preformed) throw(BadURIException); /** * Destructor. @@ -89,25 +88,25 @@ public: */ bool isAbsolutePath() const { return _impl->isAbsolutePath(); } - const gchar *getScheme() const { return _impl->getScheme(); } + const char *getScheme() const { return _impl->getScheme(); } - const gchar *getPath() const { return _impl->getPath(); } + const char *getPath() const { return _impl->getPath(); } - const gchar *getQuery() const { return _impl->getQuery(); } + const char *getQuery() const { return _impl->getQuery(); } - const gchar *getFragment() const { return _impl->getFragment(); } + const char *getFragment() const { return _impl->getFragment(); } - const gchar *getOpaque() const { return _impl->getOpaque(); } + const char *getOpaque() const { return _impl->getOpaque(); } - static URI fromUtf8( gchar const* path ) throw (BadURIException); + static URI fromUtf8( char const* path ) throw (BadURIException); - static URI from_native_filename(gchar const *path) throw(BadURIException); + static URI from_native_filename(char const *path) throw(BadURIException); - static gchar *to_native_filename(gchar const* uri) throw(BadURIException); + static char *to_native_filename(char const* uri) throw(BadURIException); const std::string getFullPath(std::string const base) const; - gchar *toNativeFilename() const throw(BadURIException); + char *toNativeFilename() const throw(BadURIException); /** * Returns a glib string version of this URI. @@ -116,7 +115,7 @@ public: * * @return a glib string version of this URI. */ - gchar *toString() const { return _impl->toString(); } + char *toString() const { return _impl->toString(); } /** * Assignment operator. @@ -135,12 +134,12 @@ private: bool isNetPath() const; bool isRelativePath() const; bool isAbsolutePath() const; - const gchar *getScheme() const; - const gchar *getPath() const; - const gchar *getQuery() const; - const gchar *getFragment() const; - const gchar *getOpaque() const; - gchar *toString() const; + const char *getScheme() const; + const char *getPath() const; + const char *getQuery() const; + const char *getFragment() const; + const char *getOpaque() const; + char *toString() const; private: Impl(xmlURIPtr uri); ~Impl(); diff --git a/src/vanishing-point.h b/src/vanishing-point.h index ca34d9118..7242a94ee 100644 --- a/src/vanishing-point.h +++ b/src/vanishing-point.h @@ -12,8 +12,10 @@ #ifndef SEEN_VANISHING_POINT_H #define SEEN_VANISHING_POINT_H -#include <set> #include <2geom/point.h> +#include <list> +#include <set> + #include "knot.h" #include "selection.h" #include "persp3d.h" @@ -21,6 +23,8 @@ #include "ui/control-manager.h" // TODO break enums out separately class SPBox3D; +typedef struct _GList GList; +typedef struct _GSList GSList; namespace Box3D { @@ -101,7 +105,7 @@ public: g_return_if_fail (_persp); persp3d_get_VP (_persp, _axis).print(""); } - inline gchar const *axisString () { return Proj::string_from_axis(_axis); } + inline char const *axisString () { return Proj::string_from_axis(_axis); } unsigned int my_counter; static unsigned int global_counter; // FIXME: Only to implement operator< so that we can merge lists. Do this in a better way!! @@ -140,7 +144,7 @@ public: void updateTip(); - guint numberOfBoxes(); // the number of boxes linked to all VPs of the dragger + unsigned int numberOfBoxes(); // the number of boxes linked to all VPs of the dragger VanishingPoint *findVPWithBox(SPBox3D *box); std::set<VanishingPoint*, less_ptr> VPsOfSelectedBoxes(); @@ -185,7 +189,7 @@ public: void updateBoxDisplays (); void drawLinesForFace (const SPBox3D *box, Proj::Axis axis); //, guint corner1, guint corner2, guint corner3, guint corner4); bool show_lines; /* whether perspective lines are drawn at all */ - guint front_or_rear_lines; /* whether we draw perspective lines from all corners or only the + unsigned int front_or_rear_lines; /* whether we draw perspective lines from all corners or only the front/rear corners (indicated by the first/second bit, respectively */ diff --git a/src/verbs.h b/src/verbs.h index 84d31fe42..06fc4fb05 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -13,10 +13,13 @@ * This code is GPL if done by Ted or David */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <cstring> #include <string> -#include "config.h" -#include "require-config.h" /* HAVE_GTK_WINDOW_FULLSCREEN */ +//#include "require-config.h" /* HAVE_GTK_WINDOW_FULLSCREEN */ #include <glibmm/ustring.h> struct SPAction; @@ -352,7 +355,7 @@ enum { SP_VERB_LAST }; -gchar *sp_action_get_title (const SPAction *action); +char *sp_action_get_title (const SPAction *action); #include <map> #include <vector> @@ -404,20 +407,20 @@ private: ActionTable * _actions; /** A unique textual ID for the verb. */ - gchar const * _id; + char const * _id; /** The full name of the verb. (shown on menu entries) */ - gchar const * _name; + char const * _name; /** Tooltip for the verb. */ - gchar const * _tip; + char const * _tip; - gchar * _full_tip; // includes shortcut + char * _full_tip; // includes shortcut unsigned int _shortcut; /** Name of the image that represents the verb. */ - gchar const * _image; + char const * _image; /** * Unique numerical representation of the verb. In most cases @@ -427,7 +430,7 @@ private: unsigned int _code; /** Name of the group the verb belongs to. */ - gchar const * _group; + char const * _group; /** * Whether this verb is set to default to sensitive or @@ -457,28 +460,28 @@ public: unsigned int get_code (void) { return _code; } /** Accessor to get the internal variable. */ - gchar const * get_id (void) { return _id; } + char const * get_id (void) { return _id; } /** Accessor to get the internal variable. */ - gchar const * get_name (void) { return _name; } + char const * get_name (void) { return _name; } /** Accessor to get the internal variable. */ - gchar const * get_short_tip (void) { return _tip; }; + char const * get_short_tip (void) { return _tip; }; /** Accessor to get the internal variable. */ - gchar const * get_tip (void) ; + char const * get_tip (void) ; /** Accessor to get the internal variable. */ - gchar const * get_image (void) { return _image; } + char const * get_image (void) { return _image; } /** Get the verbs group */ - gchar const * get_group (void) { return _group; } + char const * get_group (void) { return _group; } /** Set the name after initialization. */ - gchar const * set_name (gchar const * name) { _name = name; return _name; } + char const * set_name (char const * name) { _name = name; return _name; } /** Set the tooltip after initialization. */ - gchar const * set_tip (gchar const * tip) { _tip = tip; return _tip; } + char const * set_tip (char const * tip) { _tip = tip; return _tip; } protected: @@ -509,11 +512,11 @@ public: * @param image Goes to \c _image. */ Verb(const unsigned int code, - gchar const * id, - gchar const * name, - gchar const * tip, - gchar const * image, - gchar const * group) : + char const * id, + char const * name, + char const * tip, + char const * image, + char const * group) : _actions(0), _id(id), _name(name), @@ -528,7 +531,7 @@ public: _verbs.insert(VerbTable::value_type(_code, this)); _verb_ids.insert(VerbIDTable::value_type(_id, this)); } - Verb (gchar const * id, gchar const * name, gchar const * tip, gchar const * image, gchar const * group); + Verb (char const * id, char const * name, char const * tip, char const * image, char const * group); virtual ~Verb (void); SPAction * get_action(Inkscape::ActionContext const & context); diff --git a/src/version.cpp b/src/version.cpp index 68729c62e..abe855ee7 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -12,14 +12,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <glib.h> #include <sstream> - #include "version.h" -gboolean sp_version_from_string(const gchar *string, Inkscape::Version *version) +bool sp_version_from_string(const char *string, Inkscape::Version *version) { if (!string) { - return FALSE; + return false; } try @@ -40,27 +40,27 @@ gboolean sp_version_from_string(const gchar *string, Inkscape::Version *version) } } -gchar *sp_version_to_string(Inkscape::Version version) +char *sp_version_to_string(Inkscape::Version version) { return g_strdup_printf("%u.%u", version._major, version._minor); } -gboolean sp_version_inside_range(Inkscape::Version version, - unsigned major_min, unsigned minor_min, - unsigned major_max, unsigned minor_max) +bool sp_version_inside_range(Inkscape::Version version, + unsigned major_min, unsigned minor_min, + unsigned major_max, unsigned minor_max) { if ( version._major < major_min || version._major > major_max ) { - return FALSE; + return false; } else if ( version._major == major_min && version._minor <= minor_min ) { - return FALSE; + return false; } else if ( version._major == major_max && version._minor >= minor_max ) { - return FALSE; + return false; } else { - return TRUE; + return true; } } diff --git a/src/version.h b/src/version.h index 26fbc11a3..e17688b6d 100644 --- a/src/version.h +++ b/src/version.h @@ -11,8 +11,6 @@ #ifndef SEEN_INKSCAPE_VERSION_H #define SEEN_INKSCAPE_VERSION_H -#include <glib.h> - #define SVG_VERSION "1.1" namespace Inkscape { @@ -49,13 +47,13 @@ public: } -gboolean sp_version_from_string(const gchar *string, Inkscape::Version *version); +bool sp_version_from_string(const char *string, Inkscape::Version *version); -gchar *sp_version_to_string(Inkscape::Version version); +char *sp_version_to_string(Inkscape::Version version); -gboolean sp_version_inside_range(Inkscape::Version version, - unsigned major_min, unsigned minor_min, - unsigned major_max, unsigned minor_max); +bool sp_version_inside_range(Inkscape::Version version, + unsigned major_min, unsigned minor_min, + unsigned major_max, unsigned minor_max); #endif // SEEN_INKSCAPE_VERSION_H /* diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp index a1bd9b792..cda97654e 100644 --- a/src/widgets/button.cpp +++ b/src/widgets/button.cpp @@ -1,6 +1,4 @@ -#define __SP_BUTTON_C__ - -/* +/** * Generic button widget * * Authors: @@ -13,282 +11,257 @@ * This code is in public domain */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - +#include <glibmm.h> #include "icon.h" -#include "shortcuts.h" -#include "interface.h" + +#include "button.h" #include "helper/action-context.h" +#include "interface.h" +#include "shortcuts.h" +#include "helper/action.h" #include <gdk/gdkkeysyms.h> -#include "button.h" - static void sp_button_dispose(GObject *object); -#if GTK_CHECK_VERSION(3,0,0) -static void sp_button_get_preferred_width(GtkWidget *widget, - gint *minimal_width, - gint *natural_width); +#if GTK_CHECK_VERSION(3, 0, 0) +static void sp_button_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width); -static void sp_button_get_preferred_height(GtkWidget *widget, - gint *minimal_height, - gint *natural_height); +static void sp_button_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height); #else -static void sp_button_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void sp_button_size_request(GtkWidget *widget, GtkRequisition *requisition); #endif -static void sp_button_clicked (GtkButton *button); -static void sp_button_perform_action (SPButton *button, gpointer data); -static gint sp_button_process_event (SPButton *button, GdkEvent *event); +static void sp_button_clicked(GtkButton *button); +static void sp_button_perform_action(SPButton *button, gpointer data); +static gint sp_button_process_event(SPButton *button, GdkEvent *event); -static void sp_button_set_action (SPButton *button, SPAction *action); -static void sp_button_set_doubleclick_action (SPButton *button, SPAction *action); -static void sp_button_action_set_active (SPButton *button, bool active); -static void sp_button_set_composed_tooltip (GtkWidget *widget, SPAction *action); +static void sp_button_set_action(SPButton *button, SPAction *action); +static void sp_button_set_doubleclick_action(SPButton *button, SPAction *action); +static void sp_button_action_set_active(SPButton *button, bool active); +static void sp_button_set_composed_tooltip(GtkWidget *widget, SPAction *action); G_DEFINE_TYPE(SPButton, sp_button, GTK_TYPE_TOGGLE_BUTTON); -static void -sp_button_class_init (SPButtonClass *klass) +static void sp_button_class_init(SPButtonClass *klass) { - GObjectClass *object_class=G_OBJECT_CLASS(klass); - GtkWidgetClass *widget_class=GTK_WIDGET_CLASS(klass); - GtkButtonClass *button_class=GTK_BUTTON_CLASS(klass); - - object_class->dispose = sp_button_dispose; -#if GTK_CHECK_VERSION(3,0,0) - widget_class->get_preferred_width = sp_button_get_preferred_width; - widget_class->get_preferred_height = sp_button_get_preferred_height; + GObjectClass *object_class = G_OBJECT_CLASS(klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); + GtkButtonClass *button_class = GTK_BUTTON_CLASS(klass); + + object_class->dispose = sp_button_dispose; +#if GTK_CHECK_VERSION(3, 0, 0) + widget_class->get_preferred_width = sp_button_get_preferred_width; + widget_class->get_preferred_height = sp_button_get_preferred_height; #else - widget_class->size_request = sp_button_size_request; + widget_class->size_request = sp_button_size_request; #endif - button_class->clicked = sp_button_clicked; + button_class->clicked = sp_button_clicked; } -static void -sp_button_init (SPButton *button) +static void sp_button_init(SPButton *button) { - button->action = NULL; - button->doubleclick_action = NULL; - new (&button->c_set_active) sigc::connection(); - new (&button->c_set_sensitive) sigc::connection(); + button->action = NULL; + button->doubleclick_action = NULL; + new (&button->c_set_active) sigc::connection(); + new (&button->c_set_sensitive) sigc::connection(); - gtk_container_set_border_width (GTK_CONTAINER (button), 0); + gtk_container_set_border_width(GTK_CONTAINER(button), 0); - gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE); - gtk_widget_set_can_default (GTK_WIDGET (button), FALSE); + gtk_widget_set_can_focus(GTK_WIDGET(button), FALSE); + gtk_widget_set_can_default(GTK_WIDGET(button), FALSE); - g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (sp_button_perform_action), NULL); - g_signal_connect_after (G_OBJECT (button), "event", G_CALLBACK (sp_button_process_event), NULL); + g_signal_connect_after(G_OBJECT(button), "clicked", G_CALLBACK(sp_button_perform_action), NULL); + g_signal_connect_after(G_OBJECT(button), "event", G_CALLBACK(sp_button_process_event), NULL); } static void sp_button_dispose(GObject *object) { - SPButton *button = SP_BUTTON (object); + SPButton *button = SP_BUTTON(object); - if (button->action) { - sp_button_set_action (button, NULL); - } - if (button->doubleclick_action) { - sp_button_set_doubleclick_action (button, NULL); - } + if (button->action) { + sp_button_set_action(button, NULL); + } + if (button->doubleclick_action) { + sp_button_set_doubleclick_action(button, NULL); + } - button->c_set_active.~connection(); - button->c_set_sensitive.~connection(); + button->c_set_active.~connection(); + button->c_set_sensitive.~connection(); - (G_OBJECT_CLASS(sp_button_parent_class))->dispose(object); + (G_OBJECT_CLASS(sp_button_parent_class))->dispose(object); } - - -#if GTK_CHECK_VERSION(3,0,0) +#if GTK_CHECK_VERSION(3, 0, 0) static void sp_button_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width) { - GtkWidget *child = gtk_bin_get_child(GTK_BIN (widget)); - GtkStyle *style = gtk_widget_get_style(widget); - - if (child) { - gtk_widget_get_preferred_width(GTK_WIDGET(child), minimal_width, natural_width); - } else { - *minimal_width = 0; - *natural_width = 0; - } - - *minimal_width += 2 + 2 * MAX(2, style->xthickness); - *natural_width += 2 + 2 * MAX(2, style->xthickness); + GtkWidget *child = gtk_bin_get_child(GTK_BIN(widget)); + GtkStyle *style = gtk_widget_get_style(widget); + + if (child) { + gtk_widget_get_preferred_width(GTK_WIDGET(child), minimal_width, natural_width); + } else { + *minimal_width = 0; + *natural_width = 0; + } + + *minimal_width += 2 + 2 * MAX(2, style->xthickness); + *natural_width += 2 + 2 * MAX(2, style->xthickness); } static void sp_button_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height) { - GtkWidget *child = gtk_bin_get_child(GTK_BIN (widget)); - GtkStyle *style = gtk_widget_get_style(widget); - - if (child) { - gtk_widget_get_preferred_height(GTK_WIDGET(child), minimal_height, natural_height); - } else { - *minimal_height = 0; - *natural_height = 0; - } + GtkWidget *child = gtk_bin_get_child(GTK_BIN(widget)); + GtkStyle *style = gtk_widget_get_style(widget); - *minimal_height += 2 + 2 * MAX(2, style->ythickness); - *natural_height += 2 + 2 * MAX(2, style->ythickness); + if (child) { + gtk_widget_get_preferred_height(GTK_WIDGET(child), minimal_height, natural_height); + } else { + *minimal_height = 0; + *natural_height = 0; + } + *minimal_height += 2 + 2 * MAX(2, style->ythickness); + *natural_height += 2 + 2 * MAX(2, style->ythickness); } #else static void sp_button_size_request(GtkWidget *widget, GtkRequisition *requisition) { - GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget)); - GtkStyle *style = gtk_widget_get_style (widget); - - if (child) { - gtk_widget_size_request (GTK_WIDGET (child), requisition); - } else { - requisition->width = 0; - requisition->height = 0; - } - - requisition->width += 2 + 2 * MAX (2, style->xthickness); - requisition->height += 2 + 2 * MAX (2, style->ythickness); + GtkWidget *child = gtk_bin_get_child(GTK_BIN(widget)); + GtkStyle *style = gtk_widget_get_style(widget); + + if (child) { + gtk_widget_size_request(GTK_WIDGET(child), requisition); + } else { + requisition->width = 0; + requisition->height = 0; + } + + requisition->width += 2 + 2 * MAX(2, style->xthickness); + requisition->height += 2 + 2 * MAX(2, style->ythickness); } #endif -static void -sp_button_clicked (GtkButton *button) +static void sp_button_clicked(GtkButton *button) { - SPButton *sp_button=SP_BUTTON (button); + SPButton *sp_button = SP_BUTTON(button); - if (sp_button->type == SP_BUTTON_TYPE_TOGGLE) { - (GTK_BUTTON_CLASS(sp_button_parent_class))->clicked (button); - } + if (sp_button->type == SP_BUTTON_TYPE_TOGGLE) { + (GTK_BUTTON_CLASS(sp_button_parent_class))->clicked(button); + } } -static gint -sp_button_process_event (SPButton *button, GdkEvent *event) +static gint sp_button_process_event(SPButton *button, GdkEvent *event) { - switch (event->type) { - case GDK_2BUTTON_PRESS: - if (button->doubleclick_action) { - sp_action_perform (button->doubleclick_action, NULL); - } - return TRUE; - break; - default: - break; - } - - return FALSE; + switch (event->type) { + case GDK_2BUTTON_PRESS: + if (button->doubleclick_action) { + sp_action_perform(button->doubleclick_action, NULL); + } + return TRUE; + break; + default: + break; + } + + return FALSE; } -static void -sp_button_perform_action (SPButton *button, gpointer /*data*/) +static void sp_button_perform_action(SPButton *button, gpointer /*data*/) { - if (button->action) { - sp_action_perform (button->action, NULL); - } + if (button->action) { + sp_action_perform(button->action, NULL); + } } - -GtkWidget * -sp_button_new( Inkscape::IconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action ) +GtkWidget *sp_button_new(Inkscape::IconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action) { - SPButton *button = SP_BUTTON(g_object_new(SP_TYPE_BUTTON, NULL)); + SPButton *button = SP_BUTTON(g_object_new(SP_TYPE_BUTTON, NULL)); - button->type = type; - button->lsize = CLAMP( size, Inkscape::ICON_SIZE_MENU, Inkscape::ICON_SIZE_DECORATION ); + button->type = type; + button->lsize = CLAMP(size, Inkscape::ICON_SIZE_MENU, Inkscape::ICON_SIZE_DECORATION); - sp_button_set_action (button, action); - if (doubleclick_action) - sp_button_set_doubleclick_action (button, doubleclick_action); + sp_button_set_action(button, action); + if (doubleclick_action) + sp_button_set_doubleclick_action(button, doubleclick_action); - // The Inkscape style is no-relief buttons - gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); + // The Inkscape style is no-relief buttons + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); - return GTK_WIDGET(button); + return GTK_WIDGET(button); } -void -sp_button_toggle_set_down (SPButton *button, gboolean down) +void sp_button_toggle_set_down(SPButton *button, gboolean down) { - g_return_if_fail (button->type == SP_BUTTON_TYPE_TOGGLE); - g_signal_handlers_block_by_func (G_OBJECT (button), (gpointer)G_CALLBACK (sp_button_perform_action), NULL); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), (unsigned int)down); - g_signal_handlers_unblock_by_func (G_OBJECT (button), (gpointer)G_CALLBACK (sp_button_perform_action), NULL); + g_return_if_fail(button->type == SP_BUTTON_TYPE_TOGGLE); + g_signal_handlers_block_by_func(G_OBJECT(button), (gpointer)G_CALLBACK(sp_button_perform_action), NULL); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (unsigned int)down); + g_signal_handlers_unblock_by_func(G_OBJECT(button), (gpointer)G_CALLBACK(sp_button_perform_action), NULL); } -static void -sp_button_set_doubleclick_action (SPButton *button, SPAction *action) +static void sp_button_set_doubleclick_action(SPButton *button, SPAction *action) { - if (button->doubleclick_action) { - g_object_unref (button->doubleclick_action); - } - button->doubleclick_action = action; - if (action) { - g_object_ref(action); - } - + if (button->doubleclick_action) { + g_object_unref(button->doubleclick_action); + } + button->doubleclick_action = action; + if (action) { + g_object_ref(action); + } } -static void -sp_button_set_action (SPButton *button, SPAction *action) +static void sp_button_set_action(SPButton *button, SPAction *action) { - GtkWidget *child; - - if (button->action) { - button->c_set_active.disconnect(); - button->c_set_sensitive.disconnect(); - child = gtk_bin_get_child (GTK_BIN (button)); - if (child) { - gtk_container_remove (GTK_CONTAINER (button), child); - } - g_object_unref(button->action); - } - button->action = action; - if (action) { - g_object_ref(action); - button->c_set_active = action->signal_set_active.connect( - sigc::bind<0>( - sigc::ptr_fun(&sp_button_action_set_active), - SP_BUTTON(button))); - button->c_set_sensitive = action->signal_set_sensitive.connect( - sigc::bind<0>( - sigc::ptr_fun(>k_widget_set_sensitive), - GTK_WIDGET(button))); - if (action->image) { - child = sp_icon_new (button->lsize, action->image); - gtk_widget_show (child); - gtk_container_add (GTK_CONTAINER (button), child); - } - } - - sp_button_set_composed_tooltip(GTK_WIDGET(button), action); + GtkWidget *child; + + if (button->action) { + button->c_set_active.disconnect(); + button->c_set_sensitive.disconnect(); + child = gtk_bin_get_child(GTK_BIN(button)); + if (child) { + gtk_container_remove(GTK_CONTAINER(button), child); + } + g_object_unref(button->action); + } + button->action = action; + if (action) { + g_object_ref(action); + button->c_set_active = action->signal_set_active.connect( + sigc::bind<0>(sigc::ptr_fun(&sp_button_action_set_active), SP_BUTTON(button))); + button->c_set_sensitive = action->signal_set_sensitive.connect( + sigc::bind<0>(sigc::ptr_fun(>k_widget_set_sensitive), GTK_WIDGET(button))); + if (action->image) { + child = sp_icon_new(button->lsize, action->image); + gtk_widget_show(child); + gtk_container_add(GTK_CONTAINER(button), child); + } + } + + sp_button_set_composed_tooltip(GTK_WIDGET(button), action); } -static void -sp_button_action_set_active (SPButton *button, bool active) +static void sp_button_action_set_active(SPButton *button, bool active) { - if (button->type != SP_BUTTON_TYPE_TOGGLE) { - return; - } - - /* temporarily lobotomized until SPActions are per-view */ - if (0 && !active != !SP_BUTTON_IS_DOWN (button)) { - sp_button_toggle_set_down (button, active); - } + if (button->type != SP_BUTTON_TYPE_TOGGLE) { + return; + } + + /* temporarily lobotomized until SPActions are per-view */ + if (0 && !active != !SP_BUTTON_IS_DOWN(button)) { + sp_button_toggle_set_down(button, active); + } } static void sp_button_set_composed_tooltip(GtkWidget *widget, SPAction *action) { if (action) { - unsigned int shortcut = sp_shortcut_get_primary (action->verb); + unsigned int shortcut = sp_shortcut_get_primary(action->verb); if (shortcut != GDK_KEY_VoidSymbol) { // there's both action and shortcut gchar *key = sp_shortcut_get_label(shortcut); - gchar *tip = g_strdup_printf ("%s (%s)", action->tip, key); + gchar *tip = g_strdup_printf("%s (%s)", action->tip, key); gtk_widget_set_tooltip_text(widget, tip); g_free(tip); g_free(key); @@ -302,18 +275,14 @@ static void sp_button_set_composed_tooltip(GtkWidget *widget, SPAction *action) } } -GtkWidget * -sp_button_new_from_data( Inkscape::IconSize size, - SPButtonType type, - Inkscape::UI::View::View *view, - const gchar *name, - const gchar *tip ) +GtkWidget *sp_button_new_from_data(Inkscape::IconSize size, SPButtonType type, Inkscape::UI::View::View *view, + const gchar *name, const gchar *tip) { - GtkWidget *button; - SPAction *action=sp_action_new(Inkscape::ActionContext(view), name, name, tip, name, 0); - button = sp_button_new (size, type, action, NULL); - g_object_unref(action); - return button; + GtkWidget *button; + SPAction *action = sp_action_new(Inkscape::ActionContext(view), name, name, tip, name, 0); + button = sp_button_new(size, type, action, NULL); + g_object_unref(action); + return button; } /* @@ -325,4 +294,4 @@ sp_button_new_from_data( Inkscape::IconSize size, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/widgets/button.h b/src/widgets/button.h index 41863357d..2bceb5e97 100644 --- a/src/widgets/button.h +++ b/src/widgets/button.h @@ -1,7 +1,7 @@ -#ifndef __SP_BUTTON_H__ -#define __SP_BUTTON_H__ +#ifndef SEEN_SP_BUTTON_H +#define SEEN_SP_BUTTON_H -/* +/** * Generic button widget * * Author: @@ -17,10 +17,18 @@ #define SP_IS_BUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_BUTTON)) #include <gtk/gtk.h> -#include <sigc++/sigc++.h> -#include "helper/action.h" +#include <sigc++/connection.h> #include "icon-size.h" +struct SPAction; + +namespace Inkscape { +namespace UI { +namespace View { +class View; +} +} +} typedef enum { SP_BUTTON_TYPE_NORMAL, @@ -61,6 +69,15 @@ GtkWidget *sp_button_new_from_data (Inkscape::IconSize size, const gchar *name, const gchar *tip); +#endif // !SEEN_SP_BUTTON_H - -#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 : diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index fec46b188..63978a711 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -98,7 +98,6 @@ enum { //--------------------------------------------------------------------- /* SPDesktopWidget */ -static void sp_desktop_widget_class_init (SPDesktopWidgetClass *klass); static void sp_desktop_widget_dispose(GObject *object); static void sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); @@ -128,8 +127,6 @@ static void sp_dtw_zoom_drawing (GtkMenuItem *item, gpointer data); static void sp_dtw_zoom_selection (GtkMenuItem *item, gpointer data); static void sp_dtw_sticky_zoom_toggled (GtkMenuItem *item, gpointer data); -SPViewWidgetClass *dtw_parent_class; - class CMSPrefWatcher { public: CMSPrefWatcher() : @@ -268,31 +265,19 @@ SPDesktopWidget::window_get_pointer() static GTimer *overallTimer = 0; -/** - * Registers SPDesktopWidget class and returns its type number. - */ -GType SPDesktopWidget::getType(void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPDesktopWidgetClass), - 0, // base_init - 0, // base_finalize - (GClassInitFunc)sp_desktop_widget_class_init, - 0, // class_finalize - 0, // class_data - sizeof(SPDesktopWidget), - 0, // n_preallocs - (GInstanceInitFunc)SPDesktopWidget::init, - 0 // value_table - }; - type = g_type_register_static(SP_TYPE_VIEW_WIDGET, "SPDesktopWidget", &info, static_cast<GTypeFlags>(0)); - // Begin a timer to watch for the first desktop to appear on-screen - overallTimer = g_timer_new(); - } - return type; -} +struct SPDesktopWidgetPrivate +{ + GtkWidget *tool_toolbox; + GtkWidget *aux_toolbox; + GtkWidget *commands_toolbox; + GtkWidget *snap_toolbox; +}; + +G_DEFINE_TYPE_WITH_CODE(SPDesktopWidget, sp_desktop_widget, SP_TYPE_VIEW_WIDGET, + // Begin a timer to watch for the first desktop to appear on-screen + overallTimer = g_timer_new(); + G_ADD_PRIVATE(SPDesktopWidget); + ); /** * SPDesktopWidget vtable initialization @@ -300,8 +285,6 @@ GType SPDesktopWidget::getType(void) static void sp_desktop_widget_class_init (SPDesktopWidgetClass *klass) { - dtw_parent_class = SP_VIEW_WIDGET_CLASS(g_type_class_peek_parent(klass)); - GObjectClass *object_class = G_OBJECT_CLASS(klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); @@ -329,10 +312,12 @@ static void canvas_tbl_size_allocate(GtkWidget * /*widget*/, /** * Callback for SPDesktopWidget object initialization. */ -void SPDesktopWidget::init( SPDesktopWidget *dtw ) +void sp_desktop_widget_init( SPDesktopWidget *dtw ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + dtw->priv = reinterpret_cast<SPDesktopWidgetPrivate *>(sp_desktop_widget_get_instance_private(dtw)); + new (&dtw->modified_connection) sigc::connection(); dtw->window = 0; @@ -377,19 +362,19 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) gtk_box_pack_end( GTK_BOX (dtw->vbox), dtw->hbox, TRUE, TRUE, 0 ); gtk_widget_show(dtw->hbox); - dtw->aux_toolbox = ToolboxFactory::createAuxToolbox(); - gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->aux_toolbox, FALSE, TRUE, 0); + dtw->priv->aux_toolbox = ToolboxFactory::createAuxToolbox(); + gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->priv->aux_toolbox, FALSE, TRUE, 0); - dtw->snap_toolbox = ToolboxFactory::createSnapToolbox(); - ToolboxFactory::setOrientation( dtw->snap_toolbox, GTK_ORIENTATION_VERTICAL ); - gtk_box_pack_end( GTK_BOX(dtw->hbox), dtw->snap_toolbox, FALSE, TRUE, 0 ); + dtw->priv->snap_toolbox = ToolboxFactory::createSnapToolbox(); + ToolboxFactory::setOrientation( dtw->priv->snap_toolbox, GTK_ORIENTATION_VERTICAL ); + gtk_box_pack_end( GTK_BOX(dtw->hbox), dtw->priv->snap_toolbox, FALSE, TRUE, 0 ); - dtw->commands_toolbox = ToolboxFactory::createCommandsToolbox(); - gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->commands_toolbox, FALSE, TRUE, 0); + dtw->priv->commands_toolbox = ToolboxFactory::createCommandsToolbox(); + gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->priv->commands_toolbox, FALSE, TRUE, 0); - dtw->tool_toolbox = ToolboxFactory::createToolToolbox(); - ToolboxFactory::setOrientation( dtw->tool_toolbox, GTK_ORIENTATION_VERTICAL ); - gtk_box_pack_start( GTK_BOX(dtw->hbox), dtw->tool_toolbox, FALSE, TRUE, 0 ); + dtw->priv->tool_toolbox = ToolboxFactory::createToolToolbox(); + ToolboxFactory::setOrientation( dtw->priv->tool_toolbox, GTK_ORIENTATION_VERTICAL ); + gtk_box_pack_start( GTK_BOX(dtw->hbox), dtw->priv->tool_toolbox, FALSE, TRUE, 0 ); /* Horizontal ruler */ GtkWidget *eventbox = gtk_event_box_new (); @@ -804,8 +789,8 @@ static void sp_desktop_widget_dispose(GObject *object) dtw->modified_connection.~connection(); - if (G_OBJECT_CLASS (dtw_parent_class)->dispose) { - (* G_OBJECT_CLASS (dtw_parent_class)->dispose) (object); + if (G_OBJECT_CLASS (sp_desktop_widget_parent_class)->dispose) { + G_OBJECT_CLASS (sp_desktop_widget_parent_class)->dispose(object); } } @@ -908,8 +893,8 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) (allocation->y == widg_allocation.y) && (allocation->width == widg_allocation.width) && (allocation->height == widg_allocation.height)) { - if (GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate) - GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate (widget, allocation); + if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate) + GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate (widget, allocation); return; } @@ -917,8 +902,8 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) Geom::Rect const area = dtw->desktop->get_display_area(); double zoom = dtw->desktop->current_zoom(); - if (GTK_WIDGET_CLASS(dtw_parent_class)->size_allocate) { - GTK_WIDGET_CLASS(dtw_parent_class)->size_allocate (widget, allocation); + if (GTK_WIDGET_CLASS(sp_desktop_widget_parent_class)->size_allocate) { + GTK_WIDGET_CLASS(sp_desktop_widget_parent_class)->size_allocate (widget, allocation); } if (SP_BUTTON_IS_DOWN(dtw->sticky_zoom)) { @@ -936,8 +921,8 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) dtw->desktop->show_dialogs(); } else { - if (GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate) { - GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate (widget, allocation); + if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate) { + GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate (widget, allocation); } // this->size_allocate (widget, allocation); } @@ -952,8 +937,8 @@ sp_desktop_widget_realize (GtkWidget *widget) SPDesktopWidget *dtw = SP_DESKTOP_WIDGET (widget); - if (GTK_WIDGET_CLASS (dtw_parent_class)->realize) - (* GTK_WIDGET_CLASS (dtw_parent_class)->realize) (widget); + if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->realize) + GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->realize(widget); Geom::Rect d = Geom::Rect::from_xywh(Geom::Point(0,0), (dtw->desktop->doc())->getDimensions()); @@ -998,8 +983,8 @@ sp_desktop_widget_event (GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dt } } - if (GTK_WIDGET_CLASS (dtw_parent_class)->event) { - return (* GTK_WIDGET_CLASS (dtw_parent_class)->event) (widget, event); + if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->event) { + return GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->event(widget, event); } else { // The key press/release events need to be passed to desktop handler explicitly, // because otherwise the event contexts only receive key events when the mouse cursor @@ -1499,29 +1484,29 @@ void SPDesktopWidget::layoutWidgets() } if (!prefs->getBool(pref_root + "commands/state", true)) { - gtk_widget_hide (dtw->commands_toolbox); + gtk_widget_hide (dtw->priv->commands_toolbox); } else { - gtk_widget_show_all (dtw->commands_toolbox); + gtk_widget_show_all (dtw->priv->commands_toolbox); } if (!prefs->getBool(pref_root + "snaptoolbox/state", true)) { - gtk_widget_hide (dtw->snap_toolbox); + gtk_widget_hide (dtw->priv->snap_toolbox); } else { - gtk_widget_show_all (dtw->snap_toolbox); + gtk_widget_show_all (dtw->priv->snap_toolbox); } if (!prefs->getBool(pref_root + "toppanel/state", true)) { - gtk_widget_hide (dtw->aux_toolbox); + gtk_widget_hide (dtw->priv->aux_toolbox); } else { // we cannot just show_all because that will show all tools' panels; // this is a function from toolbox.cpp that shows only the current tool's panel - ToolboxFactory::showAuxToolbox(dtw->aux_toolbox); + ToolboxFactory::showAuxToolbox(dtw->priv->aux_toolbox); } if (!prefs->getBool(pref_root + "toolbox/state", true)) { - gtk_widget_hide (dtw->tool_toolbox); + gtk_widget_hide (dtw->priv->tool_toolbox); } else { - gtk_widget_show_all (dtw->tool_toolbox); + gtk_widget_show_all (dtw->priv->tool_toolbox); } if (!prefs->getBool(pref_root + "statusbar/state", true)) { @@ -1558,7 +1543,7 @@ void SPDesktopWidget::layoutWidgets() void SPDesktopWidget::setToolboxFocusTo (const gchar* label) { - gpointer hb = sp_search_by_data_recursive(aux_toolbox, (gpointer) label); + gpointer hb = sp_search_by_data_recursive(priv->aux_toolbox, (gpointer) label); if (hb && GTK_IS_WIDGET(hb)) { gtk_widget_grab_focus(GTK_WIDGET(hb)); @@ -1569,7 +1554,7 @@ void SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value) { GtkAdjustment *a = NULL; - gpointer hb = sp_search_by_data_recursive (aux_toolbox, (gpointer) id); + gpointer hb = sp_search_by_data_recursive (priv->aux_toolbox, (gpointer) id); if (hb && GTK_IS_WIDGET(hb)) { if (GTK_IS_SPIN_BUTTON(hb)) a = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(hb)); @@ -1586,7 +1571,7 @@ SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value) void SPDesktopWidget::setToolboxSelectOneValue (gchar const *id, int value) { - gpointer hb = sp_search_by_data_recursive(aux_toolbox, (gpointer) id); + gpointer hb = sp_search_by_data_recursive(priv->aux_toolbox, (gpointer) id); if (hb) { ege_select_one_action_set_active(EGE_SELECT_ONE_ACTION(hb), value); } @@ -1597,7 +1582,7 @@ bool SPDesktopWidget::isToolboxButtonActive (const gchar* id) { bool isActive = false; - gpointer thing = sp_search_by_data_recursive(aux_toolbox, (gpointer) id); + gpointer thing = sp_search_by_data_recursive(priv->aux_toolbox, (gpointer) id); if ( !thing ) { //g_message( "Unable to locate item for {%s}", id ); } else if ( GTK_IS_TOGGLE_BUTTON(thing) ) { @@ -1618,13 +1603,13 @@ void SPDesktopWidget::setToolboxPosition(Glib::ustring const& id, GtkPositionTyp // Note - later on these won't be individual member variables. GtkWidget* toolbox = 0; if (id == "ToolToolbar") { - toolbox = tool_toolbox; + toolbox = priv->tool_toolbox; } else if (id == "AuxToolbar") { - toolbox = aux_toolbox; + toolbox = priv->aux_toolbox; } else if (id == "CommandsToolbar") { - toolbox = commands_toolbox; + toolbox = priv->commands_toolbox; } else if (id == "SnapToolbar") { - toolbox = snap_toolbox; + toolbox = priv->snap_toolbox; } @@ -1697,10 +1682,10 @@ SPDesktopWidget* SPDesktopWidget::createInstance(SPNamedView *namedview) dtw->layoutWidgets(); std::vector<GtkWidget *> toolboxes; - toolboxes.push_back(dtw->tool_toolbox); - toolboxes.push_back(dtw->aux_toolbox); - toolboxes.push_back(dtw->commands_toolbox); - toolboxes.push_back(dtw->snap_toolbox); + toolboxes.push_back(dtw->priv->tool_toolbox); + toolboxes.push_back(dtw->priv->aux_toolbox); + toolboxes.push_back(dtw->priv->commands_toolbox); + toolboxes.push_back(dtw->priv->snap_toolbox); dtw->panels->setDesktop( dtw->desktop ); @@ -1754,8 +1739,8 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) * * This should solve: https://bugs.launchpad.net/inkscape/+bug/362995 */ - if (GTK_IS_CONTAINER(aux_toolbox)) { - GList *ch = gtk_container_get_children (GTK_CONTAINER(aux_toolbox)); + if (GTK_IS_CONTAINER(priv->aux_toolbox)) { + GList *ch = gtk_container_get_children (GTK_CONTAINER(priv->aux_toolbox)); for (GList *i = ch; i != NULL; i = i->next) { if (GTK_IS_CONTAINER(i->data)) { GList *grch = gtk_container_get_children (GTK_CONTAINER(i->data)); @@ -1781,7 +1766,7 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) gtk_widget_set_tooltip_text(this->vruler_box, gettext(nv->doc_units->name_plural.c_str())); sp_desktop_widget_update_rulers(this); - ToolboxFactory::updateSnapToolbox(this->desktop, 0, this->snap_toolbox); + ToolboxFactory::updateSnapToolbox(this->desktop, 0, priv->snap_toolbox); } } diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index a77d56fc3..9a4834d3d 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -34,15 +34,33 @@ typedef struct _EgeColorProfTracker EgeColorProfTracker; struct SPCanvas; class SPDesktop; struct SPDesktopWidget; +struct SPDesktopWidgetPrivate; class SPObject; +namespace Inkscape { + namespace Widgets { + class LayerSelector; + } -#define SP_TYPE_DESKTOP_WIDGET SPDesktopWidget::getType() -#define SP_DESKTOP_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_DESKTOP_WIDGET, SPDesktopWidget)) -#define SP_DESKTOP_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_DESKTOP_WIDGET, SPDesktopWidgetClass)) -#define SP_IS_DESKTOP_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_DESKTOP_WIDGET)) + namespace UI { + namespace Widget { + class SelectedStyle; + } + + namespace Dialogs { + class SwatchesPanel; + } + } +} + +#define SP_TYPE_DESKTOP_WIDGET (sp_desktop_widget_get_type ()) +#define SP_DESKTOP_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_DESKTOP_WIDGET, SPDesktopWidget)) +#define SP_DESKTOP_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_DESKTOP_WIDGET, SPDesktopWidgetClass)) +#define SP_IS_DESKTOP_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_DESKTOP_WIDGET)) #define SP_IS_DESKTOP_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_DESKTOP_WIDGET)) +GType sp_desktop_widget_get_type(); + void sp_desktop_widget_show_decorations(SPDesktopWidget *dtw, gboolean show); void sp_desktop_widget_iconify(SPDesktopWidget *dtw); void sp_desktop_widget_maximize(SPDesktopWidget *dtw); @@ -62,12 +80,6 @@ bool sp_desktop_widget_color_prof_adj_enabled( SPDesktopWidget *dtw ); void sp_dtw_desktop_activate (SPDesktopWidget *dtw); void sp_dtw_desktop_deactivate (SPDesktopWidget *dtw); -namespace Inkscape { namespace Widgets { class LayerSelector; } } - -namespace Inkscape { namespace UI { namespace Widget { class SelectedStyle; } } } - -namespace Inkscape { namespace UI { namespace Dialogs { class SwatchesPanel; } } } - /// A GtkEventBox on an SPDesktop. struct SPDesktopWidget { SPViewWidget viewwidget; @@ -248,22 +260,15 @@ struct SPDesktopWidget { Inkscape::UI::Widget::Dock* getDock(); - static GType getType(); static SPDesktopWidget* createInstance(SPNamedView *namedview); void updateNamedview(); + SPDesktopWidgetPrivate *priv; private: - GtkWidget *tool_toolbox; - GtkWidget *aux_toolbox; - GtkWidget *commands_toolbox; - GtkWidget *snap_toolbox; - - static void init(SPDesktopWidget *widget); void layoutWidgets(); void namedviewModified(SPObject *obj, guint flags); - }; /// The SPDesktopWidget vtable diff --git a/src/widgets/eek-preview.h b/src/widgets/eek-preview.h index e4c724cc5..883ce713e 100644 --- a/src/widgets/eek-preview.h +++ b/src/widgets/eek-preview.h @@ -37,7 +37,6 @@ #ifndef SEEN_EEK_PREVIEW_H #define SEEN_EEK_PREVIEW_H -#include <gdk/gdk.h> #include <gtk/gtk.h> /** diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index 327349844..943434868 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -1,6 +1,4 @@ -#define __SP_FONT_SELECTOR_C__ - -/* +/** * Font selection widgets * * Authors: @@ -38,7 +36,11 @@ struct SPFontSelector { +#if GTK_CHECK_VERSION(3,0,0) + GtkBox hbox; +#else GtkHBox hbox; +#endif unsigned int block_emit : 1; @@ -59,7 +61,11 @@ struct SPFontSelector struct SPFontSelectorClass { +#if GTK_CHECK_VERSION(3,0,0) + GtkBoxClass parent_class; +#else GtkHBoxClass parent_class; +#endif void (* font_set) (SPFontSelector *fsel, gchar *fontspec); }; @@ -69,8 +75,6 @@ enum { LAST_SIGNAL }; -static void sp_font_selector_class_init (SPFontSelectorClass *c); -static void sp_font_selector_init (SPFontSelector *fsel); static void sp_font_selector_dispose (GObject *object); static void sp_font_selector_family_select_row (GtkTreeSelection *selection, @@ -85,36 +89,18 @@ static void sp_font_selector_size_changed (GtkComboBox *combobo static void sp_font_selector_emit_set (SPFontSelector *fsel); static void sp_font_selector_set_sizes( SPFontSelector *fsel ); -static GtkHBoxClass *fs_parent_class = NULL; static guint fs_signals[LAST_SIGNAL] = { 0 }; -GType sp_font_selector_get_type() -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPFontSelectorClass), - 0, // base_init - 0, // base_finalize - (GClassInitFunc)sp_font_selector_class_init, - 0, // class_finalize - 0, // class_data - sizeof(SPFontSelector), - 0, // n_preallocs - (GInstanceInitFunc)sp_font_selector_init, - 0 // value_table - }; - type = g_type_register_static(GTK_TYPE_HBOX, "SPFontSelector", &info, static_cast<GTypeFlags>(0)); - } - return type; -} +#if GTK_CHECK_VERSION(3,0,0) +G_DEFINE_TYPE(SPFontSelector, sp_font_selector, GTK_TYPE_BOX); +#else +G_DEFINE_TYPE(SPFontSelector, sp_font_selector, GTK_TYPE_HBOX); +#endif static void sp_font_selector_class_init(SPFontSelectorClass *c) { GObjectClass *object_class = G_OBJECT_CLASS(c); - fs_parent_class = (GtkHBoxClass* )g_type_class_peek_parent (c); - fs_signals[FONT_SET] = g_signal_new ("font_set", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)G_SIGNAL_RUN_FIRST, @@ -285,8 +271,8 @@ static void sp_font_selector_dispose(GObject *object) fsel->styles.length = 0; } - if (G_OBJECT_CLASS(fs_parent_class)->dispose) { - G_OBJECT_CLASS(fs_parent_class)->dispose(object); + if (G_OBJECT_CLASS(sp_font_selector_parent_class)->dispose) { + G_OBJECT_CLASS(sp_font_selector_parent_class)->dispose(object); } } @@ -554,4 +540,4 @@ double sp_font_selector_get_size(SPFontSelector *fsel) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/widgets/font-selector.h b/src/widgets/font-selector.h index 66715f048..ff5472d2d 100644 --- a/src/widgets/font-selector.h +++ b/src/widgets/font-selector.h @@ -54,7 +54,7 @@ Glib::ustring sp_font_selector_get_fontspec (SPFontSelector *fsel); double sp_font_selector_get_size (SPFontSelector *fsel); -#endif // SP_FONT_SELECTOR_H +#endif // !SP_FONT_SELECTOR_H /* Local Variables: @@ -65,4 +65,4 @@ double sp_font_selector_get_size (SPFontSelector *fsel); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/widgets/gradient-image.cpp b/src/widgets/gradient-image.cpp index 64b058f62..6901b8549 100644 --- a/src/widgets/gradient-image.cpp +++ b/src/widgets/gradient-image.cpp @@ -1,6 +1,4 @@ -#define __SP_GRADIENT_IMAGE_C__ - -/* +/** * A simple gradient preview * * Author: @@ -12,18 +10,15 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "macros.h" +#include <sigc++/sigc++.h> + #include "display/cairo-utils.h" #include "gradient-image.h" +#include "macros.h" #include "sp-gradient.h" -#include <sigc++/functors/ptr_fun.h> -#include <sigc++/adaptors/bind.h> - #define VBLOCK 16 -static void sp_gradient_image_class_init (SPGradientImageClass *klass); -static void sp_gradient_image_init (SPGradientImage *image); static void sp_gradient_image_size_request (GtkWidget *widget, GtkRequisition *requisition); #if GTK_CHECK_VERSION(3,0,0) @@ -45,35 +40,13 @@ static void sp_gradient_image_gradient_release (SPObject *, SPGradientImage *im) static void sp_gradient_image_gradient_modified (SPObject *, guint flags, SPGradientImage *im); static void sp_gradient_image_update (SPGradientImage *img); -static GtkWidgetClass *parent_class; - -GType sp_gradient_image_get_type(void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof (SPGradientImageClass), - NULL, NULL, - (GClassInitFunc) sp_gradient_image_class_init, - NULL, NULL, - sizeof (SPGradientImage), - 0, - (GInstanceInitFunc) sp_gradient_image_init, - NULL - }; - type = g_type_register_static (GTK_TYPE_WIDGET, "SPGradientImage", &info, (GTypeFlags)0); - } - return type; -} +G_DEFINE_TYPE(SPGradientImage, sp_gradient_image, GTK_TYPE_WIDGET); static void sp_gradient_image_class_init(SPGradientImageClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); - parent_class = GTK_WIDGET_CLASS(g_type_class_peek_parent (klass)); #if GTK_CHECK_VERSION(3,0,0) -// GObjectClass *object_class = G_OBJECT_CLASS(klass); - widget_class->get_preferred_width = sp_gradient_image_get_preferred_width; widget_class->get_preferred_height = sp_gradient_image_get_preferred_height; widget_class->draw = sp_gradient_image_draw; @@ -116,11 +89,11 @@ static void sp_gradient_image_destroy(GtkObject *object) image->modified_connection.~connection(); #if GTK_CHECK_VERSION(3,0,0) - if (parent_class->destroy) - (* (parent_class)->destroy) (object); + if (GTK_WIDGET_CLASS(sp_gradient_image_parent_class)->destroy) + GTK_WIDGET_CLASS(sp_gradient_image_parent_class)->destroy(object); #else - if ((GTK_OBJECT_CLASS(parent_class))->destroy) - (* (GTK_OBJECT_CLASS(parent_class))->destroy) (object); + if (GTK_OBJECT_CLASS(sp_gradient_image_parent_class)->destroy) + GTK_OBJECT_CLASS(sp_gradient_image_parent_class)->destroy(object); #endif } @@ -269,3 +242,14 @@ sp_gradient_image_update (SPGradientImage *image) gtk_widget_queue_draw (GTK_WIDGET (image)); } } + +/* + 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/widgets/gradient-image.h b/src/widgets/gradient-image.h index 904ce4cac..0d3833441 100644 --- a/src/widgets/gradient-image.h +++ b/src/widgets/gradient-image.h @@ -1,7 +1,7 @@ -#ifndef __SP_GRADIENT_IMAGE_H__ -#define __SP_GRADIENT_IMAGE_H__ +#ifndef SEEN_SP_GRADIENT_IMAGE_H +#define SEEN_SP_GRADIENT_IMAGE_H -/* +/** * A simple gradient preview * * Author: @@ -17,9 +17,6 @@ class SPGradient; -#include <glib.h> - -#include <stddef.h> #include <sigc++/connection.h> #define SP_TYPE_GRADIENT_IMAGE (sp_gradient_image_get_type ()) @@ -29,15 +26,15 @@ class SPGradient; #define SP_IS_GRADIENT_IMAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_GRADIENT_IMAGE)) struct SPGradientImage { - GtkWidget widget; - SPGradient *gradient; + GtkWidget widget; + SPGradient *gradient; - sigc::connection release_connection; - sigc::connection modified_connection; + sigc::connection release_connection; + sigc::connection modified_connection; }; struct SPGradientImageClass { - GtkWidgetClass parent_class; + GtkWidgetClass parent_class; }; GType sp_gradient_image_get_type (void); @@ -47,3 +44,14 @@ GdkPixbuf *sp_gradient_to_pixbuf (SPGradient *gr, int width, int height); void sp_gradient_image_set_gradient (SPGradientImage *gi, SPGradient *gr); #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 : diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index 511478111..a5e16aed2 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -16,8 +16,10 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif + +#include <gtkmm/treeview.h> + #include "gradient-vector.h" -#include <gtk/gtk.h> #include "document.h" #include "document-undo.h" @@ -47,8 +49,6 @@ enum { }; -static void sp_gradient_selector_class_init (SPGradientSelectorClass *klass); -static void sp_gradient_selector_init (SPGradientSelector *selector); static void sp_gradient_selector_dispose(GObject *object); /* Signal handlers */ @@ -57,41 +57,18 @@ static void sp_gradient_selector_edit_vector_clicked (GtkWidget *w, SPGradientSe static void sp_gradient_selector_add_vector_clicked (GtkWidget *w, SPGradientSelector *sel); static void sp_gradient_selector_delete_vector_clicked (GtkWidget *w, SPGradientSelector *sel); - -static GtkVBoxClass *parent_class; static guint signals[LAST_SIGNAL] = {0}; -GType sp_gradient_selector_get_type(void) -{ - static GType type = 0; - if (!type) { - static const GTypeInfo info = { - sizeof(SPGradientSelectorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_gradient_selector_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(SPGradientSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) sp_gradient_selector_init, - 0, /* value_table */ - }; - - type = g_type_register_static( GTK_TYPE_VBOX, - "SPGradientSelector", - &info, - static_cast< GTypeFlags > (0) ); - } - return type; -} +#if GTK_CHECK_VERSION(3,0,0) +G_DEFINE_TYPE(SPGradientSelector, sp_gradient_selector, GTK_TYPE_BOX); +#else +G_DEFINE_TYPE(SPGradientSelector, sp_gradient_selector, GTK_TYPE_VBOX); +#endif static void sp_gradient_selector_class_init(SPGradientSelectorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); - parent_class = GTK_VBOX_CLASS(g_type_class_peek_parent (klass)); - signals[GRABBED] = g_signal_new ("grabbed", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), @@ -128,6 +105,11 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) { sel->safelyInit = true; sel->blocked = false; + +#if GTK_CHECK_VERSION(3,0,0) + gtk_orientable_set_orientation(GTK_ORIENTABLE(sel), GTK_ORIENTATION_VERTICAL); +#endif + new (&sel->nonsolid) std::vector<GtkWidget*>(); new (&sel->swatch_widgets) std::vector<GtkWidget*>(); @@ -269,8 +251,8 @@ static void sp_gradient_selector_dispose(GObject *object) sel->text_renderer = NULL; } - if ((G_OBJECT_CLASS(parent_class))->dispose) { - (* (G_OBJECT_CLASS(parent_class))->dispose) (object); + if ((G_OBJECT_CLASS(sp_gradient_selector_parent_class))->dispose) { + (G_OBJECT_CLASS(sp_gradient_selector_parent_class))->dispose(object); } } diff --git a/src/widgets/gradient-selector.h b/src/widgets/gradient-selector.h index ee8980be9..e090d7cbd 100644 --- a/src/widgets/gradient-selector.h +++ b/src/widgets/gradient-selector.h @@ -19,27 +19,23 @@ # include <config.h> #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - -#include <glib.h> -#include <gtk/gtk.h> - -#include <gtkmm/entry.h> -#include <gtkmm/label.h> -#include <gtkmm/table.h> #include <gtkmm/liststore.h> -#include <gtkmm/treeview.h> #include <gtkmm/scrolledwindow.h> #include <vector> -#include "sp-gradient.h" #include "sp-gradient-spread.h" #include "sp-gradient-units.h" +class SPDocument; class SPGradient; +namespace Gtk { +class CellRendererPixbuf; +class CellRendererText; +class ScrolledWindow; +class TreeView; +} + #define SP_TYPE_GRADIENT_SELECTOR (sp_gradient_selector_get_type ()) #define SP_GRADIENT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_GRADIENT_SELECTOR, SPGradientSelector)) #define SP_GRADIENT_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_GRADIENT_SELECTOR, SPGradientSelectorClass)) @@ -49,7 +45,11 @@ class SPGradient; struct SPGradientSelector { +#if GTK_CHECK_VERSION(3,0,0) + GtkBox vbox; +#else GtkVBox vbox; +#endif enum SelectorMode { MODE_LINEAR, @@ -131,7 +131,11 @@ struct SPGradientSelector { }; struct SPGradientSelectorClass { +#if GTK_CHECK_VERSION(3,0,0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif void (* grabbed) (SPGradientSelector *sel); void (* dragged) (SPGradientSelector *sel); diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 17ac887c4..53ce8ceac 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -23,6 +23,7 @@ # include "config.h" #endif +#include <glibmm.h> #include "gradient-vector.h" #include "ui/widget/color-preview.h" #include "verbs.h" @@ -30,17 +31,17 @@ #include "macros.h" #include <glibmm/i18n.h> #include <set> -#include "../widgets/gradient-image.h" -#include "../inkscape.h" -#include "../document-private.h" -#include "../gradient-chemistry.h" -#include "../helper/window.h" +#include "widgets/gradient-image.h" +#include "inkscape.h" +#include "document-private.h" +#include "gradient-chemistry.h" +#include "helper/window.h" #include "io/resource.h" #include "xml/repr.h" -#include "../dialogs/dialog-events.h" -#include "../preferences.h" +#include "dialogs/dialog-events.h" +#include "preferences.h" #include "svg/css-ostringstream.h" #include "sp-stop.h" #include "selection-chemistry.h" @@ -50,8 +51,7 @@ #include "desktop.h" #include "layer-manager.h" -#include <sigc++/functors/ptr_fun.h> -#include <sigc++/adaptors/bind.h> +#include <sigc++/sigc++.h> #include "document-undo.h" using Inkscape::DocumentUndo; @@ -61,9 +61,6 @@ enum { LAST_SIGNAL }; -static void sp_gradient_vector_selector_class_init(SPGradientVectorSelectorClass *klass); -static void sp_gradient_vector_selector_init(SPGradientVectorSelector *gvs); - #if GTK_CHECK_VERSION(3,0,0) static void sp_gradient_vector_selector_destroy(GtkWidget *object); #else @@ -79,7 +76,6 @@ static SPStop *get_selected_stop( GtkWidget *vb); void gr_get_usage_counts(SPDocument *doc, std::map<SPGradient *, gint> *mapUsageCount ); unsigned long sp_gradient_to_hhssll(SPGradient *gr); -static GtkVBoxClass *parent_class; static guint signals[LAST_SIGNAL] = {0}; // TODO FIXME kill these globals!!! @@ -88,35 +84,15 @@ static win_data wd; static gint x = -1000, y = -1000, w = 0, h = 0; // impossible original values to make sure they are read from prefs static Glib::ustring const prefs_path = "/dialogs/gradienteditor/"; -GType sp_gradient_vector_selector_get_type(void) -{ - static GType type = 0; - if (!type) { - static const GTypeInfo info = { - sizeof(SPGradientVectorSelectorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - reinterpret_cast<GClassInitFunc>(sp_gradient_vector_selector_class_init), - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(SPGradientVectorSelector), - 0, /* n_preallocs */ - reinterpret_cast<GInstanceInitFunc>(sp_gradient_vector_selector_init), - 0, /* value_table */ - }; - - type = g_type_register_static( GTK_TYPE_VBOX, - "SPGradientVectorSelector", - &info, - static_cast< GTypeFlags >(0) ); - } - return type; -} +#if GTK_CHECK_VERSION(3,0,0) +G_DEFINE_TYPE(SPGradientVectorSelector, sp_gradient_vector_selector, GTK_TYPE_BOX); +#else +G_DEFINE_TYPE(SPGradientVectorSelector, sp_gradient_vector_selector, GTK_TYPE_VBOX); +#endif static void sp_gradient_vector_selector_class_init(SPGradientVectorSelectorClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS(klass); - parent_class = static_cast<GtkVBoxClass*>(g_type_class_peek_parent(klass)); signals[VECTOR_SET] = g_signal_new( "vector_set", G_TYPE_FROM_CLASS(gobject_class), @@ -138,6 +114,10 @@ static void sp_gradient_vector_selector_class_init(SPGradientVectorSelectorClass static void sp_gradient_vector_selector_init(SPGradientVectorSelector *gvs) { +#if GTK_CHECK_VERSION(3,0,0) + gtk_orientable_set_orientation(GTK_ORIENTABLE(gvs), GTK_ORIENTATION_VERTICAL); +#endif + gvs->idlabel = TRUE; gvs->swatched = false; @@ -181,12 +161,12 @@ static void sp_gradient_vector_selector_destroy(GtkObject *object) gvs->tree_select_connection.~connection(); #if GTK_CHECK_VERSION(3,0,0) - if ((reinterpret_cast<GtkWidgetClass *>(parent_class))->destroy) { - (* (reinterpret_cast<GtkWidgetClass *>(parent_class))->destroy) (object); + if ((GTK_WIDGET_CLASS(sp_gradient_vector_selector_parent_class))->destroy) { + (GTK_WIDGET_CLASS(sp_gradient_vector_selector_parent_class))->destroy(object); } #else - if ((reinterpret_cast<GtkObjectClass *>(parent_class))->destroy) { - (* (reinterpret_cast<GtkObjectClass *>(parent_class))->destroy) (object); + if ((GTK_OBJECT_CLASS(sp_gradient_vector_selector_parent_class))->destroy) { + (GTK_OBJECT_CLASS(sp_gradient_vector_selector_parent_class))->destroy(object); } #endif } @@ -488,10 +468,10 @@ void SPGradientVectorSelector::setSwatched() ### Vector Editing Widget ##################################################################*/ -#include "../widgets/sp-color-notebook.h" -#include "../widgets/widget-sizes.h" -#include "../xml/node-event-vector.h" -#include "../svg/svg-color.h" +#include "widgets/sp-color-notebook.h" +#include "widgets/widget-sizes.h" +#include "xml/node-event-vector.h" +#include "svg/svg-color.h" #define PAD 4 diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h index b63120a6e..5ae90b28f 100644 --- a/src/widgets/gradient-vector.h +++ b/src/widgets/gradient-vector.h @@ -19,16 +19,8 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/liststore.h> - -#include <stddef.h> #include <sigc++/connection.h> - -#include <gtk/gtk.h> #include "gradient-selector.h" #define SP_TYPE_GRADIENT_VECTOR_SELECTOR (sp_gradient_vector_selector_get_type ()) @@ -43,7 +35,11 @@ class SPGradient; class SPStop; struct SPGradientVectorSelector { +#if GTK_CHECK_VERSION(3,0,0) + GtkBox vbox; +#else GtkVBox vbox; +#endif guint idlabel : 1; @@ -65,7 +61,11 @@ struct SPGradientVectorSelector { }; struct SPGradientVectorSelectorClass { +#if GTK_CHECK_VERSION(3,0,0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif void (* vector_set) (SPGradientVectorSelector *gvs, SPGradient *gr); }; diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index a96f47124..a6e53d638 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -247,7 +247,11 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr) bool unref_image = false; /* copied from the expose function of GtkImage */ +#if GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_state_flags (GTK_WIDGET(icon)) != GTK_STATE_FLAG_NORMAL && image) { +#else if (gtk_widget_get_state (GTK_WIDGET(icon)) != GTK_STATE_NORMAL && image) { +#endif GtkIconSource *source = gtk_icon_source_new(); gtk_icon_source_set_pixbuf(source, icon->pb); gtk_icon_source_set_size(source, GTK_ICON_SIZE_SMALL_TOOLBAR); // note: this is boilerplate and not used diff --git a/src/widgets/icon.h b/src/widgets/icon.h index e1dae0d6a..5838d8de4 100644 --- a/src/widgets/icon.h +++ b/src/widgets/icon.h @@ -14,14 +14,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm/widget.h> #include "icon-size.h" diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index f4ceee187..6ef910f61 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -72,8 +72,6 @@ enum { LAST_SIGNAL }; -static void sp_paint_selector_class_init(SPPaintSelectorClass *klass); -static void sp_paint_selector_init(SPPaintSelector *slider); static void sp_paint_selector_dispose(GObject *object); static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, gchar const *px, SPPaintSelector::Mode mode, gchar const *tip); @@ -92,7 +90,6 @@ static void sp_paint_selector_set_mode_unset(SPPaintSelector *psel); static void sp_paint_selector_set_style_buttons(SPPaintSelector *psel, GtkWidget *active); -static GtkVBoxClass *parent_class; static guint psel_signals[LAST_SIGNAL] = {0}; #ifdef SP_PS_VERBOSE @@ -140,34 +137,17 @@ static SPGradientSelector *getGradientFromData(SPPaintSelector const *psel) return grad; } -GType sp_paint_selector_get_type(void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPPaintSelectorClass), - 0, // base_init - 0, // base_finalize - (GClassInitFunc)sp_paint_selector_class_init, - 0, // class_finalize - 0, // class_data - sizeof(SPPaintSelector), - 0, // n_preallocs - (GInstanceInitFunc)sp_paint_selector_init, - 0 // value_table - }; - type = g_type_register_static(GTK_TYPE_VBOX, "SPPaintSelector", &info, static_cast<GTypeFlags>(0)); - } - return type; -} +#if GTK_CHECK_VERSION(3,0,0) +G_DEFINE_TYPE(SPPaintSelector, sp_paint_selector, GTK_TYPE_BOX); +#else +G_DEFINE_TYPE(SPPaintSelector, sp_paint_selector, GTK_TYPE_VBOX); +#endif static void sp_paint_selector_class_init(SPPaintSelectorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); - parent_class = GTK_VBOX_CLASS(g_type_class_peek_parent(klass)); - psel_signals[MODE_CHANGED] = g_signal_new("mode_changed", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), @@ -220,6 +200,10 @@ sp_paint_selector_class_init(SPPaintSelectorClass *klass) static void sp_paint_selector_init(SPPaintSelector *psel) { +#if GTK_CHECK_VERSION(3,0,0) + gtk_orientable_set_orientation(GTK_ORIENTABLE(psel), GTK_ORIENTATION_VERTICAL); +#endif + psel->mode = static_cast<SPPaintSelector::Mode>(-1); // huh? do you mean 0xff? -- I think this means "not in the enum" /* Paint style button box */ @@ -322,8 +306,8 @@ static void sp_paint_selector_dispose(GObject *object) // clean up our long-living pattern menu g_object_set_data(G_OBJECT(psel),"patternmenu",NULL); - if ((G_OBJECT_CLASS(parent_class))->dispose) - (* (G_OBJECT_CLASS(parent_class))->dispose)(object); + if ((G_OBJECT_CLASS(sp_paint_selector_parent_class))->dispose) + (G_OBJECT_CLASS(sp_paint_selector_parent_class))->dispose(object); } static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, @@ -691,8 +675,8 @@ static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelec /* Create new color selector */ /* Create vbox */ #if GTK_CHECK_VERSION(3,0,0) - GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); - gtk_box_set_homogeneous(GTK_BOX(vb), FALSE); + GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); + gtk_box_set_homogeneous(GTK_BOX(vb), FALSE); #else GtkWidget *vb = gtk_vbox_new(FALSE, 4); #endif @@ -1045,8 +1029,8 @@ static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSel /* Create vbox */ #if GTK_CHECK_VERSION(3,0,0) - tbl = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); - gtk_box_set_homogeneous(GTK_BOX(tbl), FALSE); + tbl = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); + gtk_box_set_homogeneous(GTK_BOX(tbl), FALSE); #else tbl = gtk_vbox_new(FALSE, 4); #endif diff --git a/src/widgets/paint-selector.h b/src/widgets/paint-selector.h index a2a303a47..788aa673e 100644 --- a/src/widgets/paint-selector.h +++ b/src/widgets/paint-selector.h @@ -12,7 +12,6 @@ * */ -#include <glib.h> #include <gtk/gtk.h> #include "color.h" @@ -35,7 +34,11 @@ class SPStyle; * Generic paint selector widget. */ struct SPPaintSelector { +#if GTK_CHECK_VERSION(3,0,0) + GtkBox vbox; +#else GtkVBox vbox; +#endif enum Mode { MODE_EMPTY, @@ -118,7 +121,11 @@ enum {COMBO_COL_LABEL=0, COMBO_COL_STOCK=1, COMBO_COL_PATTERN=2, COMBO_COL_SEP=3 /// The SPPaintSelector vtable struct SPPaintSelectorClass { +#if GTK_CHECK_VERSION(3,0,0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif void (* mode_changed) (SPPaintSelector *psel, SPPaintSelector::Mode mode); diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 53e73dd57..d0d302ff4 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -67,10 +67,7 @@ extern guint update_in_progress; G_BEGIN_DECLS -static void sp_color_icc_selector_class_init (SPColorICCSelectorClass *klass); -static void sp_color_icc_selector_init (SPColorICCSelector *cs); static void sp_color_icc_selector_dispose(GObject *object); - static void sp_color_icc_selector_show_all (GtkWidget *widget); static void sp_color_icc_selector_hide(GtkWidget *widget); @@ -161,9 +158,6 @@ public: #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) }; - -static SPColorSelectorClass *parent_class; - #define XPAD 4 #define YPAD 1 @@ -205,8 +199,14 @@ void attachToGridOrTable(GtkWidget *parent, guint ypadding = YPAD) { #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start( child, xpadding ); + gtk_widget_set_margin_end( child, xpadding ); + #else gtk_widget_set_margin_left( child, xpadding ); gtk_widget_set_margin_right( child, xpadding ); + #endif + gtk_widget_set_margin_top( child, ypadding ); gtk_widget_set_margin_bottom( child, ypadding ); if (hexpand) { @@ -227,30 +227,7 @@ void attachToGridOrTable(GtkWidget *parent, } // namespace -GType sp_color_icc_selector_get_type(void) -{ - static GType type = 0; - if (!type) { - static const GTypeInfo info = { - sizeof (SPColorICCSelectorClass), - NULL, // base_init - NULL, // base_finalize - (GClassInitFunc) sp_color_icc_selector_class_init, - NULL, // class_finalize - NULL, // class_data - sizeof (SPColorICCSelector), - 0, // n_preallocs - (GInstanceInitFunc) sp_color_icc_selector_init, - 0, // value_table - }; - - type = g_type_register_static (SP_TYPE_COLOR_SELECTOR, - "SPColorICCSelector", - &info, - static_cast< GTypeFlags > (0) ); - } - return type; -} +G_DEFINE_TYPE(SPColorICCSelector, sp_color_icc_selector, SP_TYPE_COLOR_SELECTOR); static void sp_color_icc_selector_class_init(SPColorICCSelectorClass *klass) { @@ -259,8 +236,6 @@ static void sp_color_icc_selector_class_init(SPColorICCSelectorClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); SPColorSelectorClass *selector_class = SP_COLOR_SELECTOR_CLASS (klass); - parent_class = SP_COLOR_SELECTOR_CLASS (g_type_class_peek_parent (klass)); - selector_class->name = nameset; selector_class->submode_count = 1; @@ -599,8 +574,8 @@ void ColorICCSelector::init() static void sp_color_icc_selector_dispose(GObject *object) { - if ((G_OBJECT_CLASS(parent_class))->dispose) { - (* (G_OBJECT_CLASS(parent_class))->dispose)(object); + if (G_OBJECT_CLASS(sp_color_icc_selector_parent_class)->dispose) { + G_OBJECT_CLASS(sp_color_icc_selector_parent_class)->dispose(object); } } diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h index f63ab0853..6cdaff639 100644 --- a/src/widgets/sp-color-icc-selector.h +++ b/src/widgets/sp-color-icc-selector.h @@ -2,8 +2,6 @@ #define SEEN_SP_COLOR_ICC_SELECTOR_H #include <glib.h> -#include <gtk/gtk.h> - #include "sp-color-selector.h" namespace Inkscape { diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index e081f98e0..9f927b51f 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -53,46 +53,21 @@ struct SPColorNotebookTracker { SPColorNotebook *backPointer; }; -static void sp_color_notebook_class_init (SPColorNotebookClass *klass); -static void sp_color_notebook_init (SPColorNotebook *colorbook); static void sp_color_notebook_dispose(GObject *object); static void sp_color_notebook_show_all (GtkWidget *widget); static void sp_color_notebook_hide(GtkWidget *widget); -static SPColorSelectorClass *parent_class; - #define XPAD 4 #define YPAD 1 -GType sp_color_notebook_get_type(void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPColorNotebookClass), - 0, // base_init - 0, // base_finalize - (GClassInitFunc)sp_color_notebook_class_init, - 0, // class_finalize - 0, // class_data - sizeof(SPColorNotebook), - 0, // n_preallocs - (GInstanceInitFunc)sp_color_notebook_init, - 0 // value_table - }; - type = g_type_register_static(SP_TYPE_COLOR_SELECTOR, "SPColorNotebook", &info, static_cast<GTypeFlags>(0)); - } - return type; -} +G_DEFINE_TYPE(SPColorNotebook, sp_color_notebook, SP_TYPE_COLOR_SELECTOR); static void sp_color_notebook_class_init(SPColorNotebookClass *klass) { GObjectClass *object_class = reinterpret_cast<GObjectClass *>(klass); GtkWidgetClass *widget_class = reinterpret_cast<GtkWidgetClass *>(klass); - parent_class = SP_COLOR_SELECTOR_CLASS(g_type_class_peek_parent(klass)); - object_class->dispose = sp_color_notebook_dispose; widget_class->show_all = sp_color_notebook_show_all; @@ -289,8 +264,13 @@ void ColorNotebook::init() sp_set_font_size_smaller (_buttonbox); #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(_buttonbox, XPAD); + gtk_widget_set_margin_end(_buttonbox, XPAD); + #else gtk_widget_set_margin_left(_buttonbox, XPAD); gtk_widget_set_margin_right(_buttonbox, XPAD); + #endif gtk_widget_set_margin_top(_buttonbox, YPAD); gtk_widget_set_margin_bottom(_buttonbox, YPAD); gtk_widget_set_hexpand(_buttonbox, TRUE); @@ -306,8 +286,13 @@ void ColorNotebook::init() row++; #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(_book, XPAD*2); + gtk_widget_set_margin_end(_book, XPAD*2); + #else gtk_widget_set_margin_left(_book, XPAD*2); gtk_widget_set_margin_right(_book, XPAD*2); + #endif gtk_widget_set_margin_top(_book, YPAD); gtk_widget_set_margin_bottom(_book, YPAD); gtk_widget_set_hexpand(_book, TRUE); @@ -434,8 +419,13 @@ void ColorNotebook::init() #endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(rgbabox, XPAD); + gtk_widget_set_margin_end(rgbabox, XPAD); + #else gtk_widget_set_margin_left(rgbabox, XPAD); gtk_widget_set_margin_right(rgbabox, XPAD); + #endif gtk_widget_set_margin_top(rgbabox, YPAD); gtk_widget_set_margin_bottom(rgbabox, YPAD); gtk_grid_attach(GTK_GRID(table), rgbabox, 0, row, 2, 1); @@ -457,8 +447,8 @@ void ColorNotebook::init() static void sp_color_notebook_dispose(GObject *object) { - if (((GObjectClass *) (parent_class))->dispose) - (* ((GObjectClass *) (parent_class))->dispose) (object); + if (G_OBJECT_CLASS(sp_color_notebook_parent_class)->dispose) + G_OBJECT_CLASS(sp_color_notebook_parent_class)->dispose(object); } ColorNotebook::~ColorNotebook() diff --git a/src/widgets/sp-color-notebook.h b/src/widgets/sp-color-notebook.h index 6e5111132..469bb56e8 100644 --- a/src/widgets/sp-color-notebook.h +++ b/src/widgets/sp-color-notebook.h @@ -12,14 +12,10 @@ * This code is in public domain */ -#include <gtk/gtk.h> -#include "../color.h" #include "sp-color-selector.h" #include <glib.h> - - struct SPColorNotebook; class ColorNotebook: public ColorSelector diff --git a/src/widgets/sp-color-scales.cpp b/src/widgets/sp-color-scales.cpp index c3f9d511c..5fddacf59 100644 --- a/src/widgets/sp-color-scales.cpp +++ b/src/widgets/sp-color-scales.cpp @@ -10,6 +10,7 @@ #include <glibmm/i18n.h> #include "../dialogs/dialog-events.h" #include "sp-color-scales.h" +#include "sp-color-slider.h" #include "svg/svg-icc-color.h" #define CSC_CHANNEL_R (1 << 0) @@ -30,8 +31,6 @@ G_BEGIN_DECLS -static void sp_color_scales_class_init (SPColorScalesClass *klass); -static void sp_color_scales_init (SPColorScales *cs); static void sp_color_scales_dispose(GObject *object); static void sp_color_scales_show_all (GtkWidget *widget); @@ -41,38 +40,12 @@ static const gchar *sp_color_scales_hue_map (void); G_END_DECLS -static SPColorSelectorClass *parent_class; - #define XPAD 4 #define YPAD 1 #define noDUMP_CHANGE_INFO 1 -GType -sp_color_scales_get_type (void) -{ - static GType type = 0; - if (!type) { - static const GTypeInfo info = { - sizeof (SPColorScalesClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_color_scales_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (SPColorScales), - 0, /* n_preallocs */ - (GInstanceInitFunc) sp_color_scales_init, - NULL - }; - - type = g_type_register_static (SP_TYPE_COLOR_SELECTOR, - "SPColorScales", - &info, - static_cast< GTypeFlags > (0) ); - } - return type; -} +G_DEFINE_TYPE(SPColorScales, sp_color_scales, SP_TYPE_COLOR_SELECTOR); static void sp_color_scales_class_init (SPColorScalesClass *klass) @@ -82,8 +55,6 @@ sp_color_scales_class_init (SPColorScalesClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); SPColorSelectorClass *selector_class = SP_COLOR_SELECTOR_CLASS (klass); - parent_class = SP_COLOR_SELECTOR_CLASS (g_type_class_peek_parent (klass)); - selector_class->name = nameset; selector_class->submode_count = 3; @@ -151,8 +122,13 @@ void ColorScales::init() gtk_widget_show (_l[i]); #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(_l[i], XPAD); + gtk_widget_set_margin_end(_l[i], XPAD); + #else gtk_widget_set_margin_left(_l[i], XPAD); gtk_widget_set_margin_right(_l[i], XPAD); + #endif gtk_widget_set_margin_top(_l[i], YPAD); gtk_widget_set_margin_bottom(_l[i], YPAD); gtk_grid_attach(GTK_GRID(t), _l[i], 0, i, 1, 1); @@ -167,8 +143,13 @@ void ColorScales::init() gtk_widget_show (_s[i]); #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(_s[i], XPAD); + gtk_widget_set_margin_end(_s[i], XPAD); + #else gtk_widget_set_margin_left(_s[i], XPAD); gtk_widget_set_margin_right(_s[i], XPAD); + #endif gtk_widget_set_margin_top(_s[i], YPAD); gtk_widget_set_margin_bottom(_s[i], YPAD); gtk_widget_set_hexpand(_s[i], TRUE); @@ -184,8 +165,13 @@ void ColorScales::init() gtk_widget_show (_b[i]); #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(_b[i], XPAD); + gtk_widget_set_margin_end(_b[i], XPAD); + #else gtk_widget_set_margin_left(_b[i], XPAD); gtk_widget_set_margin_right(_b[i], XPAD); + #endif gtk_widget_set_margin_top(_b[i], YPAD); gtk_widget_set_margin_bottom(_b[i], YPAD); gtk_widget_set_halign(_b[i], GTK_ALIGN_CENTER); @@ -214,8 +200,8 @@ void ColorScales::init() static void sp_color_scales_dispose(GObject *object) { - if ((G_OBJECT_CLASS(parent_class))->dispose) - (* (G_OBJECT_CLASS(parent_class))->dispose) (object); + if (G_OBJECT_CLASS(sp_color_scales_parent_class)->dispose) + G_OBJECT_CLASS(sp_color_scales_parent_class)->dispose(object); } static void diff --git a/src/widgets/sp-color-scales.h b/src/widgets/sp-color-scales.h index 3b11bc05e..72cbafa2f 100644 --- a/src/widgets/sp-color-scales.h +++ b/src/widgets/sp-color-scales.h @@ -2,15 +2,12 @@ #define SEEN_SP_COLOR_SCALES_H #include <glib.h> -#include <gtk/gtk.h> -#include <color.h> -#include <widgets/sp-color-slider.h> #include <widgets/sp-color-selector.h> - struct SPColorScales; struct SPColorScalesClass; +struct SPColorSlider; typedef enum { SP_COLOR_SCALES_MODE_NONE = 0, diff --git a/src/widgets/sp-color-selector.cpp b/src/widgets/sp-color-selector.cpp index 6d62acecd..e97c36431 100644 --- a/src/widgets/sp-color-selector.cpp +++ b/src/widgets/sp-color-selector.cpp @@ -22,42 +22,20 @@ enum { #define noDUMP_CHANGE_INFO #define FOO_NAME(x) g_type_name( G_TYPE_FROM_INSTANCE(x) ) -static void sp_color_selector_class_init( SPColorSelectorClass *klass ); -static void sp_color_selector_init( SPColorSelector *csel ); static void sp_color_selector_dispose(GObject *object); static void sp_color_selector_show_all( GtkWidget *widget ); static void sp_color_selector_hide( GtkWidget *widget ); -static GtkVBoxClass *parent_class; static guint csel_signals[LAST_SIGNAL] = {0}; double ColorSelector::_epsilon = 1e-4; -GType sp_color_selector_get_type( void ) -{ - static GType type = 0; - if (!type) { - static const GTypeInfo info = { - sizeof(SPColorSelectorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_color_selector_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(SPColorSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) sp_color_selector_init, - NULL - }; - - type = g_type_register_static( GTK_TYPE_VBOX, - "SPColorSelector", - &info, - static_cast<GTypeFlags>(0) ); - } - return type; -} +#if GTK_CHECK_VERSION(3,0,0) +G_DEFINE_TYPE(SPColorSelector, sp_color_selector, GTK_TYPE_BOX); +#else +G_DEFINE_TYPE(SPColorSelector, sp_color_selector, GTK_TYPE_VBOX); +#endif void sp_color_selector_class_init( SPColorSelectorClass *klass ) { @@ -66,8 +44,6 @@ void sp_color_selector_class_init( SPColorSelectorClass *klass ) GtkWidgetClass *widget_class; widget_class = GTK_WIDGET_CLASS(klass); - parent_class = GTK_VBOX_CLASS( g_type_class_peek_parent(klass) ); - csel_signals[GRABBED] = g_signal_new( "grabbed", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), @@ -109,6 +85,10 @@ void sp_color_selector_class_init( SPColorSelectorClass *klass ) void sp_color_selector_init( SPColorSelector *csel ) { +#if GTK_CHECK_VERSION(3,0,0) + gtk_orientable_set_orientation(GTK_ORIENTABLE(csel), GTK_ORIENTATION_VERTICAL); +#endif + if ( csel->base ) { csel->base->init(); @@ -125,8 +105,8 @@ void sp_color_selector_dispose(GObject *object) csel->base = 0; } - if ( (G_OBJECT_CLASS(parent_class))->dispose ) { - (* (G_OBJECT_CLASS(parent_class))->dispose)(object); + if ((G_OBJECT_CLASS(sp_color_selector_parent_class))->dispose ) { + (G_OBJECT_CLASS(sp_color_selector_parent_class))->dispose(object); } } diff --git a/src/widgets/sp-color-selector.h b/src/widgets/sp-color-selector.h index 616d5a9e7..30061774a 100644 --- a/src/widgets/sp-color-selector.h +++ b/src/widgets/sp-color-selector.h @@ -2,9 +2,7 @@ #define SEEN_SP_COLOR_SELECTOR_H #include <gtk/gtk.h> -#include "../color.h" - -#include <glib.h> +#include "color.h" struct SPColorSelector; @@ -62,13 +60,21 @@ private: #define SP_COLOR_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SP_TYPE_COLOR_SELECTOR, SPColorSelectorClass)) struct SPColorSelector { +#if GTK_CHECK_VERSION(3,0,0) + GtkBox vbox; +#else GtkVBox vbox; +#endif ColorSelector* base; }; struct SPColorSelectorClass { +#if GTK_CHECK_VERSION(3,0,0) + GtkBoxClass parent_class; +#else GtkVBoxClass parent_class; +#endif const gchar **name; guint submode_count; diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp index 9b13ba1c5..ab7e2cd84 100644 --- a/src/widgets/sp-color-slider.cpp +++ b/src/widgets/sp-color-slider.cpp @@ -12,6 +12,7 @@ #include <gtk/gtk.h> #include "sp-color-scales.h" +#include "sp-color-slider.h" #include "preferences.h" #define SLIDER_WIDTH 96 @@ -26,8 +27,6 @@ enum { LAST_SIGNAL }; -static void sp_color_slider_class_init (SPColorSliderClass *klass); -static void sp_color_slider_init (SPColorSlider *slider); static void sp_color_slider_dispose(GObject *object); static void sp_color_slider_realize (GtkWidget *widget); @@ -61,36 +60,15 @@ static const guchar *sp_color_slider_render_gradient (gint x0, gint y0, gint wid static const guchar *sp_color_slider_render_map (gint x0, gint y0, gint width, gint height, guchar *map, gint start, gint step, guint b0, guint b1, guint mask); -static GtkWidgetClass *parent_class; static guint slider_signals[LAST_SIGNAL] = {0}; -GType -sp_color_slider_get_type (void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof (SPColorSliderClass), - NULL, NULL, - (GClassInitFunc) sp_color_slider_class_init, - NULL, NULL, - sizeof (SPColorSlider), - 0, - (GInstanceInitFunc) sp_color_slider_init, - NULL - }; - type = g_type_register_static (GTK_TYPE_WIDGET, "SPColorSlider", &info, (GTypeFlags)0); - } - return type; -} +G_DEFINE_TYPE(SPColorSlider, sp_color_slider, GTK_TYPE_WIDGET); static void sp_color_slider_class_init(SPColorSliderClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); - parent_class = GTK_WIDGET_CLASS(g_type_class_peek_parent(klass)); - slider_signals[GRABBED] = g_signal_new ("grabbed", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), @@ -183,8 +161,8 @@ static void sp_color_slider_dispose(GObject *object) slider->adjustment = NULL; } - if ((G_OBJECT_CLASS(parent_class))->dispose) - (* (G_OBJECT_CLASS(parent_class))->dispose) (object); + if (G_OBJECT_CLASS(sp_color_slider_parent_class)->dispose) + G_OBJECT_CLASS(sp_color_slider_parent_class)->dispose (object); } static void diff --git a/src/widgets/sp-color-slider.h b/src/widgets/sp-color-slider.h index 591d8368a..b81d62e41 100644 --- a/src/widgets/sp-color-slider.h +++ b/src/widgets/sp-color-slider.h @@ -14,13 +14,6 @@ #include <gtk/gtk.h> -#include <glib.h> - - - -struct SPColorSlider; -struct SPColorSliderClass; - #define SP_TYPE_COLOR_SLIDER (sp_color_slider_get_type ()) #define SP_COLOR_SLIDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_COLOR_SLIDER, SPColorSlider)) #define SP_COLOR_SLIDER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_SLIDER, SPColorSliderClass)) diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 7c8bb1df7..404874db7 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -7,14 +7,13 @@ #include "../dialogs/dialog-events.h" #include "sp-color-wheel-selector.h" #include "sp-color-scales.h" +#include "sp-color-slider.h" #include "sp-color-icc-selector.h" #include "../svg/svg-icc-color.h" #include "ui/widget/gimpcolorwheel.h" G_BEGIN_DECLS -static void sp_color_wheel_selector_class_init (SPColorWheelSelectorClass *klass); -static void sp_color_wheel_selector_init (SPColorWheelSelector *cs); static void sp_color_wheel_selector_dispose(GObject *object); static void sp_color_wheel_selector_show_all (GtkWidget *widget); @@ -23,36 +22,10 @@ static void sp_color_wheel_selector_hide(GtkWidget *widget); G_END_DECLS -static SPColorSelectorClass *parent_class; - #define XPAD 4 #define YPAD 1 -GType -sp_color_wheel_selector_get_type (void) -{ - static GType type = 0; - if (!type) { - static const GTypeInfo info = { - sizeof (SPColorWheelSelectorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_color_wheel_selector_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (SPColorWheelSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) sp_color_wheel_selector_init, - 0, /* value_table */ - }; - - type = g_type_register_static (SP_TYPE_COLOR_SELECTOR, - "SPColorWheelSelector", - &info, - static_cast< GTypeFlags > (0) ); - } - return type; -} +G_DEFINE_TYPE(SPColorWheelSelector, sp_color_wheel_selector, SP_TYPE_COLOR_SELECTOR); static void sp_color_wheel_selector_class_init(SPColorWheelSelectorClass *klass) { @@ -61,8 +34,6 @@ static void sp_color_wheel_selector_class_init(SPColorWheelSelectorClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); SPColorSelectorClass *selector_class = SP_COLOR_SELECTOR_CLASS (klass); - parent_class = SP_COLOR_SELECTOR_CLASS (g_type_class_peek_parent (klass)); - selector_class->name = nameset; selector_class->submode_count = 1; @@ -142,8 +113,13 @@ void ColorWheelSelector::init() gtk_widget_show (_label); #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(_label, XPAD); + gtk_widget_set_margin_end(_label, XPAD); + #else gtk_widget_set_margin_left(_label, XPAD); gtk_widget_set_margin_right(_label, XPAD); + #endif gtk_widget_set_margin_top(_label, YPAD); gtk_widget_set_margin_bottom(_label, YPAD); gtk_widget_set_halign(_label, GTK_ALIGN_FILL); @@ -162,8 +138,13 @@ void ColorWheelSelector::init() gtk_widget_show (_slider); #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(_slider, XPAD); + gtk_widget_set_margin_end(_slider, XPAD); + #else gtk_widget_set_margin_left(_slider, XPAD); gtk_widget_set_margin_right(_slider, XPAD); + #endif gtk_widget_set_margin_top(_slider, YPAD); gtk_widget_set_margin_bottom(_slider, YPAD); gtk_widget_set_hexpand(_slider, TRUE); @@ -188,8 +169,13 @@ void ColorWheelSelector::init() gtk_widget_show (_sbtn); #if GTK_CHECK_VERSION(3,0,0) + #if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(_sbtn, XPAD); + gtk_widget_set_margin_end(_sbtn, XPAD); + #else gtk_widget_set_margin_left(_sbtn, XPAD); gtk_widget_set_margin_right(_sbtn, XPAD); + #endif gtk_widget_set_margin_top(_sbtn, YPAD); gtk_widget_set_margin_bottom(_sbtn, YPAD); gtk_widget_set_halign(_sbtn, GTK_ALIGN_CENTER); @@ -216,8 +202,8 @@ void ColorWheelSelector::init() static void sp_color_wheel_selector_dispose(GObject *object) { - if ((G_OBJECT_CLASS(parent_class))->dispose) - (* (G_OBJECT_CLASS(parent_class))->dispose) (object); + if (G_OBJECT_CLASS(sp_color_wheel_selector_parent_class)->dispose) + G_OBJECT_CLASS(sp_color_wheel_selector_parent_class)->dispose(object); } static void diff --git a/src/widgets/sp-color-wheel-selector.h b/src/widgets/sp-color-wheel-selector.h index bbd377422..12b060dbe 100644 --- a/src/widgets/sp-color-wheel-selector.h +++ b/src/widgets/sp-color-wheel-selector.h @@ -1,15 +1,12 @@ #ifndef SEEN_SP_COLOR_WHEEL_SELECTOR_H #define SEEN_SP_COLOR_WHEEL_SELECTOR_H -#include <glib.h> #include <gtk/gtk.h> -#include "sp-color-slider.h" #include "sp-color-selector.h" - - typedef struct _GimpColorWheel GimpColorWheel; +struct SPColorSlider; struct SPColorWheelSelector; struct SPColorWheelSelectorClass; diff --git a/src/widgets/sp-widget.cpp b/src/widgets/sp-widget.cpp index 0e2295e36..fdf5ec500 100644 --- a/src/widgets/sp-widget.cpp +++ b/src/widgets/sp-widget.cpp @@ -36,8 +36,6 @@ public: SPWidgetImpl(SPWidget &target); ~SPWidgetImpl(); - static void classInit(SPWidgetClass *klass); - static void init(SPWidget *widget); static void dispose(GObject *object); static void show(GtkWidget *widget); static void hide(GtkWidget *widget); @@ -61,64 +59,27 @@ public: static void changeSelectionCB(Application *inkscape, Selection *selection, SPWidget *spw); static void setSelectionCB(Application *inkscape, Selection *selection, SPWidget *spw); - static GtkWidget *constructGlobal(SPWidget *spw, Inkscape::Application *inkscape); + static GtkWidget *constructGlobal(SPWidget *spw, InkscapeApplication *inkscape); void modifySelection(Application *inkscape, Selection *selection, guint flags); void changeSelection(Application *inkscape, Selection *selection); void setSelection(Application *inkscape, Selection *selection); private: - static GtkBinClass *parentClass; - static guint signals[LAST_SIGNAL]; - SPWidget &_target; }; - -GtkBinClass *SPWidgetImpl::parentClass = 0; -guint SPWidgetImpl::signals[LAST_SIGNAL] = {0}; - } // namespace Inkscape -GType SPWidget::getType() -{ - static GType type = 0; - if (!type) { - static GTypeInfo const info = { - sizeof(SPWidgetClass), - NULL, NULL, - reinterpret_cast<GClassInitFunc>(SPWidgetImpl::classInit), - NULL, NULL, - sizeof(SPWidget), - 0, - reinterpret_cast<GInstanceInitFunc>(SPWidgetImpl::init), - NULL - }; - type = g_type_register_static(GTK_TYPE_BIN, - "SPWidget", - &info, - static_cast<GTypeFlags>(0)); - } - return type; -} +G_DEFINE_TYPE(SPWidget, sp_widget, GTK_TYPE_BIN); -namespace Inkscape { +static guint signals[LAST_SIGNAL] = {0}; -SPWidgetImpl::SPWidgetImpl(SPWidget &target) : - _target(target) -{ -} - -SPWidgetImpl::~SPWidgetImpl() -{ -} - -void SPWidgetImpl::classInit(SPWidgetClass *klass) +static void +sp_widget_class_init(SPWidgetClass *klass) { GObjectClass *object_class = reinterpret_cast<GObjectClass *>(klass); GtkWidgetClass *widget_class = reinterpret_cast<GtkWidgetClass *>(klass); - parentClass = reinterpret_cast<GtkBinClass *>(g_type_class_peek_parent(klass)); - object_class->dispose = SPWidgetImpl::dispose; signals[CONSTRUCT] = g_signal_new ("construct", @@ -169,13 +130,23 @@ void SPWidgetImpl::classInit(SPWidgetClass *klass) widget_class->size_allocate = SPWidgetImpl::sizeAllocate; } -void SPWidgetImpl::init(SPWidget *spw) +static void sp_widget_init(SPWidget *spw) { spw->inkscape = NULL; - spw->_impl = new SPWidgetImpl(*spw); // ctor invoked after all other init } +namespace Inkscape { + +SPWidgetImpl::SPWidgetImpl(SPWidget &target) : + _target(target) +{ +} + +SPWidgetImpl::~SPWidgetImpl() +{ +} + void SPWidgetImpl::dispose(GObject *object) { SPWidget *spw = reinterpret_cast<SPWidget *>(object); @@ -194,8 +165,8 @@ void SPWidgetImpl::dispose(GObject *object) delete spw->_impl; spw->_impl = 0; - if (reinterpret_cast<GObjectClass *>(parentClass)->dispose) { - (*reinterpret_cast<GObjectClass *>(parentClass)->dispose)(object); + if (G_OBJECT_CLASS(sp_widget_parent_class)->dispose) { + G_OBJECT_CLASS(sp_widget_parent_class)->dispose(object); } } @@ -210,8 +181,8 @@ void SPWidgetImpl::show(GtkWidget *widget) g_signal_connect(spw->inkscape, "set_selection", G_CALLBACK(SPWidgetImpl::setSelectionCB), spw); } - if (reinterpret_cast<GtkWidgetClass *>(parentClass)->show) { - (*reinterpret_cast<GtkWidgetClass *>(parentClass)->show)(widget); + if (GTK_WIDGET_CLASS(sp_widget_parent_class)->show) { + GTK_WIDGET_CLASS(sp_widget_parent_class)->show(widget); } } @@ -224,8 +195,8 @@ void SPWidgetImpl::hide(GtkWidget *widget) sp_signal_disconnect_by_data(spw->inkscape, spw); } - if (reinterpret_cast<GtkWidgetClass *>(parentClass)->hide) { - (*reinterpret_cast<GtkWidgetClass *>(parentClass)->hide)(widget); + if (GTK_WIDGET_CLASS(sp_widget_parent_class)->hide) { + GTK_WIDGET_CLASS(sp_widget_parent_class)->hide(widget); } } @@ -293,7 +264,7 @@ void SPWidgetImpl::sizeAllocate(GtkWidget *widget, GtkAllocation *allocation) } } -GtkWidget *SPWidgetImpl::constructGlobal(SPWidget *spw, Inkscape::Application *inkscape) +GtkWidget *SPWidgetImpl::constructGlobal(SPWidget *spw, InkscapeApplication *inkscape) { g_return_val_if_fail(!spw->inkscape, NULL); @@ -345,7 +316,7 @@ void SPWidgetImpl::setSelection(Application * /*inkscape*/, Selection *selection // Methods -GtkWidget *sp_widget_new_global(Inkscape::Application *inkscape) +GtkWidget *sp_widget_new_global(InkscapeApplication *inkscape) { SPWidget *spw = reinterpret_cast<SPWidget*>(g_object_new(SP_TYPE_WIDGET, NULL)); diff --git a/src/widgets/sp-widget.h b/src/widgets/sp-widget.h index 3a23a92c5..6227c3a72 100644 --- a/src/widgets/sp-widget.h +++ b/src/widgets/sp-widget.h @@ -15,35 +15,27 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <glib.h> #include <gtk/gtk.h> -#define SP_TYPE_WIDGET (SPWidget::getType()) +#define SP_TYPE_WIDGET (sp_widget_get_type()) #define SP_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_WIDGET, SPWidget)) #define SP_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_WIDGET, SPWidgetClass)) #define SP_IS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_WIDGET)) #define SP_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_WIDGET)) +struct InkscapeApplication; namespace Inkscape { - -struct Application; class Selection; class SPWidgetImpl; - } struct SPWidget { friend class Inkscape::SPWidgetImpl; - static GType getType(); - - // - GtkBin bin; - Inkscape::Application *inkscape; + InkscapeApplication *inkscape; -private: Inkscape::SPWidgetImpl *_impl; }; @@ -58,10 +50,10 @@ struct SPWidgetClass { void (* set_selection) (SPWidget *spw, Inkscape::Selection *selection); }; -/* fixme: Think (Lauris) */ +GType sp_widget_get_type(); /** Generic constructor for global widget. */ -GtkWidget *sp_widget_new_global(Inkscape::Application *inkscape); +GtkWidget *sp_widget_new_global(InkscapeApplication *inkscape); #endif // SEEN_SP_WIDGET_H /* diff --git a/src/widgets/sp-xmlview-attr-list.cpp b/src/widgets/sp-xmlview-attr-list.cpp index 47b0ebb9d..dd763aea5 100644 --- a/src/widgets/sp-xmlview-attr-list.cpp +++ b/src/widgets/sp-xmlview-attr-list.cpp @@ -20,9 +20,6 @@ #include "../xml/node-event-vector.h" #include "sp-xmlview-attr-list.h" -static void sp_xmlview_attr_list_class_init (SPXMLViewAttrListClass * klass); -static void sp_xmlview_attr_list_init (SPXMLViewAttrList * list); - #if GTK_CHECK_VERSION(3,0,0) static void sp_xmlview_attr_list_destroy(GtkWidget * object); #else @@ -31,8 +28,6 @@ static void sp_xmlview_attr_list_destroy(GtkObject * object); static void event_attr_changed (Inkscape::XML::Node * repr, const gchar * name, const gchar * old_value, const gchar * new_value, bool is_interactive, gpointer data); -static GtkTreeViewClass * parent_class = NULL; - static Inkscape::XML::NodeEventVector repr_events = { NULL, /* child_added */ NULL, /* child_removed */ @@ -88,28 +83,7 @@ sp_xmlview_attr_list_set_repr (SPXMLViewAttrList * list, Inkscape::XML::Node * r } } -GType sp_xmlview_attr_list_get_type(void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof(SPXMLViewAttrListClass), - 0, // base_init - 0, // base_finalize - (GClassInitFunc)sp_xmlview_attr_list_class_init, - 0, // class_finalize - 0, // class_data - sizeof(SPXMLViewAttrList), - 0, // n_preallocs - (GInstanceInitFunc)sp_xmlview_attr_list_init, - 0 // value_table - }; - type = g_type_register_static(GTK_TYPE_TREE_VIEW, "SPXMLViewAttrList", &info, static_cast<GTypeFlags>(0)); - } - - return type; -} +G_DEFINE_TYPE(SPXMLViewAttrList, sp_xmlview_attr_list, GTK_TYPE_TREE_VIEW); void sp_xmlview_attr_list_class_init (SPXMLViewAttrListClass * klass) { @@ -121,8 +95,6 @@ void sp_xmlview_attr_list_class_init (SPXMLViewAttrListClass * klass) object_class->destroy = sp_xmlview_attr_list_destroy; #endif - parent_class = GTK_TREE_VIEW_CLASS(g_type_class_peek_parent (klass)); - g_signal_new("row-value-changed", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, @@ -154,9 +126,9 @@ void sp_xmlview_attr_list_destroy(GtkObject * object) sp_xmlview_attr_list_set_repr (list, NULL); #if GTK_CHECK_VERSION(3,0,0) - GTK_WIDGET_CLASS(parent_class)->destroy (object); + GTK_WIDGET_CLASS(sp_xmlview_attr_list_parent_class)->destroy (object); #else - GTK_OBJECT_CLASS(parent_class)->destroy (object); + GTK_OBJECT_CLASS(sp_xmlview_attr_list_parent_class)->destroy (object); #endif } diff --git a/src/widgets/sp-xmlview-attr-list.h b/src/widgets/sp-xmlview-attr-list.h index 367ef1a12..08b115bfa 100644 --- a/src/widgets/sp-xmlview-attr-list.h +++ b/src/widgets/sp-xmlview-attr-list.h @@ -12,10 +12,8 @@ * Released under the GNU GPL; see COPYING for details */ -#include <stdio.h> #include <gtk/gtk.h> - #define SP_TYPE_XMLVIEW_ATTR_LIST (sp_xmlview_attr_list_get_type ()) #define SP_XMLVIEW_ATTR_LIST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_XMLVIEW_ATTR_LIST, SPXMLViewAttrList)) #define SP_IS_XMLVIEW_ATTR_LIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_XMLVIEW_ATTR_LIST)) @@ -23,7 +21,6 @@ struct SPXMLViewAttrList { - GtkTreeView list; GtkListStore *store; diff --git a/src/widgets/sp-xmlview-content.cpp b/src/widgets/sp-xmlview-content.cpp index ac64dabdb..9243760bd 100644 --- a/src/widgets/sp-xmlview-content.cpp +++ b/src/widgets/sp-xmlview-content.cpp @@ -23,9 +23,6 @@ using Inkscape::DocumentUndo; -static void sp_xmlview_content_class_init (SPXMLViewContentClass * klass); -static void sp_xmlview_content_init (SPXMLViewContent * text); - #if GTK_CHECK_VERSION(3,0,0) static void sp_xmlview_content_destroy(GtkWidget * object); #else @@ -36,8 +33,6 @@ void sp_xmlview_content_changed (GtkTextBuffer *tb, SPXMLViewContent *text); static void event_content_changed (Inkscape::XML::Node * repr, const gchar * old_content, const gchar * new_content, gpointer data); -static GtkTextViewClass * parent_class = NULL; - static Inkscape::XML::NodeEventVector repr_events = { NULL, /* child_added */ NULL, /* child_removed */ @@ -81,28 +76,7 @@ sp_xmlview_content_set_repr (SPXMLViewContent * text, Inkscape::XML::Node * repr } } -GType sp_xmlview_content_get_type(void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof(SPXMLViewContentClass), - 0, // base_init - 0, // base_finalize - (GClassInitFunc)sp_xmlview_content_class_init, - 0, // class_finalize - 0, // class_data - sizeof(SPXMLViewContent), - 0, // n_preallocs - (GInstanceInitFunc)sp_xmlview_content_init, - 0 // value_table - }; - type = g_type_register_static(GTK_TYPE_TEXT_VIEW, "SPXMLViewContent", &info, static_cast<GTypeFlags>(0)); - } - - return type; -} +G_DEFINE_TYPE(SPXMLViewContent, sp_xmlview_content, GTK_TYPE_TEXT_VIEW); void sp_xmlview_content_class_init(SPXMLViewContentClass * klass) { @@ -113,8 +87,6 @@ void sp_xmlview_content_class_init(SPXMLViewContentClass * klass) GtkObjectClass * object_class = GTK_OBJECT_CLASS(klass); object_class->destroy = sp_xmlview_content_destroy; #endif - - parent_class = GTK_TEXT_VIEW_CLASS(g_type_class_peek_parent (klass)); } void @@ -135,9 +107,9 @@ void sp_xmlview_content_destroy(GtkObject * object) sp_xmlview_content_set_repr (text, NULL); #if GTK_CHECK_VERSION(3,0,0) - GTK_WIDGET_CLASS (parent_class)->destroy (object); + GTK_WIDGET_CLASS (sp_xmlview_content_parent_class)->destroy (object); #else - GTK_OBJECT_CLASS (parent_class)->destroy (object); + GTK_OBJECT_CLASS (sp_xmlview_content_parent_class)->destroy (object); #endif } diff --git a/src/widgets/sp-xmlview-content.h b/src/widgets/sp-xmlview-content.h index 8b1342c5e..140eacf46 100644 --- a/src/widgets/sp-xmlview-content.h +++ b/src/widgets/sp-xmlview-content.h @@ -13,10 +13,7 @@ */ #include <config.h> -#include <stdio.h> #include <gtk/gtk.h> -#include <glib.h> - #define SP_TYPE_XMLVIEW_CONTENT (sp_xmlview_content_get_type ()) #define SP_XMLVIEW_CONTENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_XMLVIEW_CONTENT, SPXMLViewContent)) diff --git a/src/widgets/sp-xmlview-tree.cpp b/src/widgets/sp-xmlview-tree.cpp index 43b7dc289..5dff9adf3 100644 --- a/src/widgets/sp-xmlview-tree.cpp +++ b/src/widgets/sp-xmlview-tree.cpp @@ -1,6 +1,4 @@ -#define __SP_XMLVIEW_TREE_C__ - -/* +/** * Specialization of GtkTreeView for the XML tree view * * Authors: @@ -14,7 +12,7 @@ #include <cstring> #include <string> -#include "../xml/node-event-vector.h" +#include "xml/node-event-vector.h" #include "sp-xmlview-tree.h" struct NodeData { @@ -25,9 +23,6 @@ struct NodeData { enum { STORE_TEXT_COL = 0, STORE_DATA_COL, STORE_REPR_COL, STORE_N_COLS }; -static void sp_xmlview_tree_class_init (SPXMLViewTreeClass * klass); -static void sp_xmlview_tree_init (SPXMLViewTree * tree); - #if GTK_CHECK_VERSION(3,0,0) static void sp_xmlview_tree_destroy(GtkWidget * object); #else @@ -92,8 +87,6 @@ static const Inkscape::XML::NodeEventVector pi_repr_events = { NULL /* order_changed */ }; -static GtkTreeViewClass * parent_class = NULL; - GtkWidget *sp_xmlview_tree_new(Inkscape::XML::Node * repr, void * /*factory*/, void * /*data*/) { SPXMLViewTree *tree = SP_XMLVIEW_TREE(g_object_new (SP_TYPE_XMLVIEW_TREE, NULL)); @@ -124,28 +117,7 @@ GtkWidget *sp_xmlview_tree_new(Inkscape::XML::Node * repr, void * /*factory*/, v return GTK_WIDGET(tree); } -GType -sp_xmlview_tree_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (SPXMLViewTreeClass), - NULL, NULL, - (GClassInitFunc) sp_xmlview_tree_class_init, - NULL, NULL, - sizeof (SPXMLViewTree), - 0, - (GInstanceInitFunc) sp_xmlview_tree_init, - NULL - }; - type = g_type_register_static (GTK_TYPE_TREE_VIEW, "SPXMLViewTree", &info, (GTypeFlags)0); - } - - - return type; -} +G_DEFINE_TYPE(SPXMLViewTree, sp_xmlview_tree, GTK_TYPE_TREE_VIEW); void sp_xmlview_tree_class_init(SPXMLViewTreeClass * klass) { @@ -157,8 +129,6 @@ void sp_xmlview_tree_class_init(SPXMLViewTreeClass * klass) object_class->destroy = sp_xmlview_tree_destroy; #endif - parent_class = GTK_TREE_VIEW_CLASS(g_type_class_peek_parent (klass)); - // Signal for when a tree drag and drop has completed g_signal_new ( "tree_move", G_TYPE_FROM_CLASS(klass), @@ -190,9 +160,9 @@ void sp_xmlview_tree_destroy(GtkObject * object) sp_xmlview_tree_set_repr (tree, NULL); #if GTK_CHECK_VERSION(3,0,0) - GTK_WIDGET_CLASS(parent_class)->destroy (object); + GTK_WIDGET_CLASS(sp_xmlview_tree_parent_class)->destroy (object); #else - GTK_OBJECT_CLASS(parent_class)->destroy (object); + GTK_OBJECT_CLASS(sp_xmlview_tree_parent_class)->destroy (object); #endif } @@ -734,4 +704,4 @@ gboolean search_equal_func(GtkTreeModel *model, gint /*column*/, const gchar *ke fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/widgets/sp-xmlview-tree.h b/src/widgets/sp-xmlview-tree.h index 69228fa88..7ecbcb471 100644 --- a/src/widgets/sp-xmlview-tree.h +++ b/src/widgets/sp-xmlview-tree.h @@ -1,9 +1,4 @@ -#ifndef __SP_XMLVIEW_TREE_H__ -#define __SP_XMLVIEW_TREE_H__ - -/* - * Specialization of GtkTreeView for the XML editor - * +/** * Authors: * MenTaLguY <mental@rydia.net> * @@ -12,9 +7,15 @@ * Released under the GNU GPL; see COPYING for details */ +#ifndef SEEN_SP_XMLVIEW_TREE_H +#define SEEN_SP_XMLVIEW_TREE_H + #include <gtk/gtk.h> #include <glib.h> +/** + * Specialization of GtkTreeView for the XML editor + */ #define SP_TYPE_XMLVIEW_TREE (sp_xmlview_tree_get_type ()) #define SP_XMLVIEW_TREE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_XMLVIEW_TREE, SPXMLViewTree)) @@ -49,7 +50,7 @@ Inkscape::XML::Node * sp_xmlview_tree_node_get_repr (GtkTreeModel *model, GtkTre gboolean sp_xmlview_tree_get_repr_node (SPXMLViewTree * tree, Inkscape::XML::Node * repr, GtkTreeIter *node); -#endif +#endif // !SEEN_SP_XMLVIEW_TREE_H /* Local Variables: @@ -60,4 +61,4 @@ gboolean sp_xmlview_tree_get_repr_node (SPXMLViewTree * tree, Inkscape::XML::Nod fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/widgets/spinbutton-events.h b/src/widgets/spinbutton-events.h index c1df88c8a..9bf50d87c 100644 --- a/src/widgets/spinbutton-events.h +++ b/src/widgets/spinbutton-events.h @@ -10,7 +10,9 @@ */ #include <glib.h> -#include <gtk/gtk.h> /* GtkWidget */ + +typedef struct _GdkEventKey GdkEventKey; +typedef struct _GtkWidget GtkWidget; gboolean spinbutton_focus_in (GtkWidget *w, GdkEventKey *event, gpointer data); void spinbutton_undo (GtkWidget *w); diff --git a/src/widgets/spw-utilities.cpp b/src/widgets/spw-utilities.cpp index 9c0c8d7c6..f87889bb1 100644 --- a/src/widgets/spw-utilities.cpp +++ b/src/widgets/spw-utilities.cpp @@ -64,8 +64,15 @@ Gtk::Label * spw_label(Gtk::Table *table, const gchar *label_text, int col, int label_widget->set_hexpand(); label_widget->set_halign(Gtk::ALIGN_FILL); label_widget->set_valign(Gtk::ALIGN_CENTER); + + #if GTK_CHECK_VERSION(3,12,0) + label_widget->set_margin_start(4); + label_widget->set_margin_end(4); + #else label_widget->set_margin_left(4); label_widget->set_margin_right(4); + #endif + table->attach(*label_widget, col, row, 1, 1); #else table->attach(*label_widget, col, col+1, row, row+1, (Gtk::EXPAND | Gtk::FILL), static_cast<Gtk::AttachOptions>(0), 4, 0); @@ -238,7 +245,11 @@ sp_set_font_size_recursive (GtkWidget *w, gpointer font) PangoFontDescription* pan = pango_font_description_new (); pango_font_description_set_size (pan, size); +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_override_font (w, pan); +#else gtk_widget_modify_font (w, pan); +#endif if (GTK_IS_CONTAINER(w)) { gtk_container_foreach (GTK_CONTAINER(w), (GtkCallback) sp_set_font_size_recursive, font); diff --git a/src/widgets/toolbox.h b/src/widgets/toolbox.h index fb749bfb5..db9130034 100644 --- a/src/widgets/toolbox.h +++ b/src/widgets/toolbox.h @@ -13,15 +13,15 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include <gtk/gtk.h> #include <glibmm/ustring.h> #include "icon-size.h" -#include "../ege-adjustment-action.h" -#include "../preferences.h" +#include "preferences.h" #define TOOLBAR_SLIDER_HINT "full" +typedef struct _EgeAdjustmentAction EgeAdjustmentAction; + class SPDesktop; namespace Inkscape { |
