diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-08-01 12:35:39 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-08-01 12:35:39 +0000 |
| commit | db53a4b489fbcf45eee9f54a0b1231e6092374dc (patch) | |
| tree | e87805ae8b154021b1e3125ef9c633d3b9e50f2b /src | |
| parent | Replacement of unnecessary variables. (diff) | |
| download | inkscape-db53a4b489fbcf45eee9f54a0b1231e6092374dc.tar.gz inkscape-db53a4b489fbcf45eee9f54a0b1231e6092374dc.zip | |
Fixed more mismatched-tags; replaced GObject-properties in SPGuide
(bzr r11608.1.115)
Diffstat (limited to 'src')
| -rw-r--r-- | src/box3d-side.h | 2 | ||||
| -rw-r--r-- | src/box3d.h | 2 | ||||
| -rw-r--r-- | src/cms-system.h | 2 | ||||
| -rw-r--r-- | src/document.h | 2 | ||||
| -rw-r--r-- | src/draw-anchor.h | 2 | ||||
| -rw-r--r-- | src/extension/internal/latex-text-renderer.h | 2 | ||||
| -rw-r--r-- | src/persp3d.h | 2 | ||||
| -rw-r--r-- | src/profile-manager.h | 2 | ||||
| -rw-r--r-- | src/selection.h | 2 | ||||
| -rw-r--r-- | src/sp-guide.cpp | 88 | ||||
| -rw-r--r-- | src/sp-guide.h | 5 | ||||
| -rw-r--r-- | src/sp-namedview.cpp | 32 | ||||
| -rw-r--r-- | src/widgets/sp-color-icc-selector.h | 2 |
13 files changed, 95 insertions, 50 deletions
diff --git a/src/box3d-side.h b/src/box3d-side.h index 106f3770c..fcd7eb08c 100644 --- a/src/box3d-side.h +++ b/src/box3d-side.h @@ -21,7 +21,7 @@ #define SP_IS_BOX3D_SIDE(obj) (dynamic_cast<const Box3DSide*>((SPObject*)obj)) class SPBox3D; -struct Persp3D; +class Persp3D; // FIXME: Would it be better to inherit from SPPath instead? class Box3DSide : public SPPolygon { diff --git a/src/box3d.h b/src/box3d.h index 6763bb271..53fd1852b 100644 --- a/src/box3d.h +++ b/src/box3d.h @@ -24,7 +24,7 @@ #define SP_BOX3D(obj) ((SPBox3D*)obj) #define SP_IS_BOX3D(obj) (dynamic_cast<const SPBox3D*>((SPObject*)obj)) -struct Persp3D; +class Persp3D; class Persp3DReference; class SPBox3D : public SPGroup { diff --git a/src/cms-system.h b/src/cms-system.h index ecaba956e..c528deb94 100644 --- a/src/cms-system.h +++ b/src/cms-system.h @@ -15,7 +15,7 @@ class SPDocument; namespace Inkscape { -struct ColorProfile; +class ColorProfile; class CMSSystem { public: diff --git a/src/document.h b/src/document.h index 423dd2aba..f23bf4713 100644 --- a/src/document.h +++ b/src/document.h @@ -51,7 +51,7 @@ namespace Inkscape { class SPDefs; class SP3DBox; -struct Persp3D; +class Persp3D; class Persp3DImpl; class SPItemCtx; diff --git a/src/draw-anchor.h b/src/draw-anchor.h index 89ff8b180..1ca2b9888 100644 --- a/src/draw-anchor.h +++ b/src/draw-anchor.h @@ -8,7 +8,7 @@ #include <glib.h> #include <2geom/point.h> -struct SPDrawContext; +class SPDrawContext; class SPCurve; struct SPCanvasItem; diff --git a/src/extension/internal/latex-text-renderer.h b/src/extension/internal/latex-text-renderer.h index 0fa94c9e6..e51c2d245 100644 --- a/src/extension/internal/latex-text-renderer.h +++ b/src/extension/internal/latex-text-renderer.h @@ -22,7 +22,7 @@ #include <stack> class SPItem; -struct SPRoot; +class SPRoot; namespace Inkscape { namespace Extension { diff --git a/src/persp3d.h b/src/persp3d.h index e0c742123..a1e8928f8 100644 --- a/src/persp3d.h +++ b/src/persp3d.h @@ -24,7 +24,7 @@ #include "inkscape.h" class SPBox3D; -struct Box3DContext; +class Box3DContext; class Persp3DImpl { public: diff --git a/src/profile-manager.h b/src/profile-manager.h index 9d361f40c..be9446c17 100644 --- a/src/profile-manager.h +++ b/src/profile-manager.h @@ -17,7 +17,7 @@ class SPDocument; namespace Inkscape { -struct ColorProfile; +class ColorProfile; class ProfileManager : public DocumentSubset, public GC::Finalized diff --git a/src/selection.h b/src/selection.h index 32eade21f..394ab64ff 100644 --- a/src/selection.h +++ b/src/selection.h @@ -31,7 +31,7 @@ class SPDesktop; class SPItem; class SPBox3D; -struct Persp3D; +class Persp3D; namespace Inkscape { class LayerModel; diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index b0f4aab49..36989e0c9 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -47,14 +47,14 @@ using Inkscape::DocumentUndo; using std::vector; -enum { - PROP_0, - PROP_COLOR, - PROP_HICOLOR -}; - -static void sp_guide_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +//enum { +// PROP_0, +// PROP_COLOR, +// PROP_HICOLOR +//}; +// +//static void sp_guide_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); +//static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); #include "sp-factory.h" @@ -104,38 +104,58 @@ SPGuide::SPGuide() : SPObject() { SPGuide::~SPGuide() { } -static void sp_guide_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec */*pspec*/) -{ - SPGuide &guide = *SP_GUIDE(object); - - switch (prop_id) { - case PROP_COLOR: - guide.color = g_value_get_uint(value); - for (GSList *l = guide.views; l != NULL; l = l->next) { - sp_guideline_set_color(SP_GUIDELINE(l->data), guide.color); - } - break; +guint32 SPGuide::getColor() const { + return color; +} - case PROP_HICOLOR: - guide.hicolor = g_value_get_uint(value); - break; - } +guint32 SPGuide::getHiColor() const { + return hicolor; } -static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec */*pspec*/) -{ - SPGuide const &guide = *SP_GUIDE(object); +void SPGuide::setColor(guint32 c) { + color = c; - switch (prop_id) { - case PROP_COLOR: - g_value_set_uint(value, guide.color); - break; - case PROP_HICOLOR: - g_value_set_uint(value, guide.hicolor); - break; - } + for (GSList *l = this->views; l != NULL; l = l->next) { + sp_guideline_set_color(SP_GUIDELINE(l->data), this->color); + } +} + +void SPGuide::setHiColor(guint32 h) { + this->hicolor = h; } +//static void sp_guide_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec */*pspec*/) +//{ +// SPGuide &guide = *SP_GUIDE(object); +// +// switch (prop_id) { +// case PROP_COLOR: +// guide.color = g_value_get_uint(value); +// for (GSList *l = guide.views; l != NULL; l = l->next) { +// sp_guideline_set_color(SP_GUIDELINE(l->data), guide.color); +// } +// break; +// +// case PROP_HICOLOR: +// guide.hicolor = g_value_get_uint(value); +// break; +// } +//} +// +//static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec */*pspec*/) +//{ +// SPGuide const &guide = *SP_GUIDE(object); +// +// switch (prop_id) { +// case PROP_COLOR: +// g_value_set_uint(value, guide.color); +// break; +// case PROP_HICOLOR: +// g_value_set_uint(value, guide.hicolor); +// break; +// } +//} + void SPGuide::build(SPDocument *document, Inkscape::XML::Node *repr) { SPObject::build(document, repr); diff --git a/src/sp-guide.h b/src/sp-guide.h index 18e07d719..9af56d12b 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -41,6 +41,11 @@ public: GSList *views; std::vector<SPGuideAttachment> attached_items; + guint32 getColor() const; + guint32 getHiColor() const; + void setColor(guint32 c); + void setHiColor(guint32 h); + inline bool isHorizontal() const { return (normal_to_line[Geom::X] == 0.); }; inline bool isVertical() const { return (normal_to_line[Geom::Y] == 0.); }; inline double angle() const { return std::atan2( - normal_to_line[Geom::X], normal_to_line[Geom::Y] ); }; diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 452c640b3..576de312f 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -260,7 +260,9 @@ void SPNamedView::build(SPDocument *document, Inkscape::XML::Node *repr) { if (SP_IS_GUIDE(o)) { SPGuide * g = SP_GUIDE(o); nv->guides = g_slist_prepend(nv->guides, g); - g_object_set(G_OBJECT(g), "color", nv->guidecolor, "hicolor", nv->guidehicolor, NULL); + //g_object_set(G_OBJECT(g), "color", nv->guidecolor, "hicolor", nv->guidehicolor, NULL); + g->setColor(nv->guidecolor); + g->setHiColor(nv->guidehicolor); } } @@ -330,38 +332,52 @@ void SPNamedView::set(unsigned int key, const gchar* value) { break; case SP_ATTR_GUIDECOLOR: nv->guidecolor = (nv->guidecolor & 0xff) | (DEFAULTGUIDECOLOR & 0xffffff00); + if (value) { nv->guidecolor = (nv->guidecolor & 0xff) | sp_svg_read_color(value, nv->guidecolor); } + for (GSList *l = nv->guides; l != NULL; l = l->next) { - g_object_set(G_OBJECT(l->data), "color", nv->guidecolor, NULL); + //g_object_set(G_OBJECT(l->data), "color", nv->guidecolor, NULL); + SP_GUIDE(l->data)->setColor(nv->guidecolor); } + object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_GUIDEOPACITY: nv->guidecolor = (nv->guidecolor & 0xffffff00) | (DEFAULTGUIDECOLOR & 0xff); sp_nv_read_opacity(value, &nv->guidecolor); + for (GSList *l = nv->guides; l != NULL; l = l->next) { - g_object_set(G_OBJECT(l->data), "color", nv->guidecolor, NULL); + //g_object_set(G_OBJECT(l->data), "color", nv->guidecolor, NULL); + SP_GUIDE(l->data)->setColor(nv->guidecolor); } + object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_GUIDEHICOLOR: nv->guidehicolor = (nv->guidehicolor & 0xff) | (DEFAULTGUIDEHICOLOR & 0xffffff00); + if (value) { nv->guidehicolor = (nv->guidehicolor & 0xff) | sp_svg_read_color(value, nv->guidehicolor); } + for (GSList *l = nv->guides; l != NULL; l = l->next) { - g_object_set(G_OBJECT(l->data), "hicolor", nv->guidehicolor, NULL); + //g_object_set(G_OBJECT(l->data), "hicolor", nv->guidehicolor, NULL); + SP_GUIDE(l->data)->setHiColor(nv->guidehicolor); } + object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_GUIDEHIOPACITY: nv->guidehicolor = (nv->guidehicolor & 0xffffff00) | (DEFAULTGUIDEHICOLOR & 0xff); sp_nv_read_opacity(value, &nv->guidehicolor); + for (GSList *l = nv->guides; l != NULL; l = l->next) { - g_object_set(G_OBJECT(l->data), "hicolor", nv->guidehicolor, NULL); + //g_object_set(G_OBJECT(l->data), "hicolor", nv->guidehicolor, NULL); + SP_GUIDE(l->data)->setHiColor(nv->guidehicolor); } + object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_SHOWBORDER: @@ -667,7 +683,11 @@ void SPNamedView::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *r if (SP_IS_GUIDE(no)) { SPGuide *g = (SPGuide *) no; nv->guides = g_slist_prepend(nv->guides, g); - g_object_set(G_OBJECT(g), "color", nv->guidecolor, "hicolor", nv->guidehicolor, NULL); + + //g_object_set(G_OBJECT(g), "color", nv->guidecolor, "hicolor", nv->guidehicolor, NULL); + g->setColor(nv->guidecolor); + g->setHiColor(nv->guidehicolor); + if (nv->editable) { for (GSList *l = nv->views; l != NULL; l = l->next) { g->SPGuide::showSPGuide(static_cast<SPDesktop*>(l->data)->guides, (GCallback) sp_dt_guide_event); diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h index 404bc7265..3eb12222c 100644 --- a/src/widgets/sp-color-icc-selector.h +++ b/src/widgets/sp-color-icc-selector.h @@ -8,7 +8,7 @@ #include "sp-color-selector.h" namespace Inkscape { -struct ColorProfile; +class ColorProfile; } struct SPColorICCSelector; |
