summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2013-01-22 14:40:50 +0000
committer~suv <suv-sf@users.sourceforge.net>2013-01-22 14:40:50 +0000
commit34baadb48632ee5c2f39cba0411b7810265bdc6a (patch)
treec7a76b25fd57605c40082d32644ff9a0da22d20e /src
parentmerge from trunk (r12005) (diff)
parentFilters. Add missing inkscape namespace declaration for 'Channel Painting' (diff)
downloadinkscape-34baadb48632ee5c2f39cba0411b7810265bdc6a.tar.gz
inkscape-34baadb48632ee5c2f39cba0411b7810265bdc6a.zip
merge from trunk (r12051)
(bzr r11668.1.48)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile_insert1
-rw-r--r--src/attributes-test.h1
-rw-r--r--src/color-profile.cpp2
-rw-r--r--src/conn-avoid-ref.cpp243
-rw-r--r--src/conn-avoid-ref.h16
-rw-r--r--src/connection-points.cpp37
-rw-r--r--src/connection-points.h70
-rw-r--r--src/connector-context.cpp595
-rw-r--r--src/connector-context.h20
-rw-r--r--src/desktop.cpp15
-rw-r--r--src/device-manager.cpp9
-rw-r--r--src/dialogs/find.cpp150
-rw-r--r--src/dialogs/find.h2
-rw-r--r--src/display/cairo-utils.cpp11
-rw-r--r--src/display/cairo-utils.h6
-rw-r--r--src/display/canvas-grid.cpp8
-rw-r--r--src/display/canvas-grid.h10
-rw-r--r--src/display/drawing.cpp29
-rw-r--r--src/display/drawing.h5
-rw-r--r--src/dom/prop-css2.cpp3
-rw-r--r--src/doxygen-main.cpp2
-rw-r--r--src/draw-context.cpp36
-rw-r--r--src/draw-context.h4
-rw-r--r--src/dropper-context.cpp164
-rw-r--r--src/dropper-context.h15
-rw-r--r--src/ege-adjustment-action.cpp6
-rw-r--r--src/ege-select-one-action.cpp20
-rw-r--r--src/eraser-context.cpp45
-rw-r--r--src/eraser-context.h4
-rw-r--r--src/extension/internal/filter/color.h2
-rw-r--r--src/filters/flood.cpp47
-rw-r--r--src/filters/flood.h14
-rw-r--r--src/ink-comboboxentry-action.cpp12
-rw-r--r--src/knot-holder-entity.cpp16
-rw-r--r--src/knot-holder-entity.h8
-rw-r--r--src/knot.cpp1
-rw-r--r--src/knot.h2
-rw-r--r--src/libavoid/orthogonal.cpp6
-rw-r--r--src/libnrtype/FontFactory.cpp12
-rw-r--r--src/libnrtype/FontInstance.cpp7
-rw-r--r--src/live_effects/effect.cpp22
-rw-r--r--src/live_effects/effect.h32
-rw-r--r--src/live_effects/lpe-angle_bisector.cpp12
-rw-r--r--src/live_effects/lpe-bendpath.cpp4
-rw-r--r--src/live_effects/lpe-bendpath.h4
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp16
-rw-r--r--src/live_effects/lpe-copy_rotate.h2
-rw-r--r--src/live_effects/lpe-curvestitch.cpp2
-rw-r--r--src/live_effects/lpe-curvestitch.h2
-rw-r--r--src/live_effects/lpe-envelope.cpp4
-rw-r--r--src/live_effects/lpe-envelope.h4
-rw-r--r--src/live_effects/lpe-extrude.cpp2
-rw-r--r--src/live_effects/lpe-extrude.h2
-rw-r--r--src/live_effects/lpe-interpolate.cpp2
-rw-r--r--src/live_effects/lpe-interpolate.h2
-rw-r--r--src/live_effects/lpe-knot.cpp8
-rw-r--r--src/live_effects/lpe-knot.h2
-rw-r--r--src/live_effects/lpe-lattice.cpp4
-rw-r--r--src/live_effects/lpe-lattice.h4
-rw-r--r--src/live_effects/lpe-line_segment.cpp2
-rw-r--r--src/live_effects/lpe-line_segment.h2
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp2
-rw-r--r--src/live_effects/lpe-mirror_symmetry.h2
-rw-r--r--src/live_effects/lpe-offset.cpp2
-rw-r--r--src/live_effects/lpe-offset.h2
-rw-r--r--src/live_effects/lpe-parallel.cpp14
-rw-r--r--src/live_effects/lpe-parallel.h2
-rw-r--r--src/live_effects/lpe-perp_bisector.cpp14
-rw-r--r--src/live_effects/lpe-perp_bisector.h2
-rw-r--r--src/live_effects/lpe-perspective_path.cpp8
-rw-r--r--src/live_effects/lpe-perspective_path.h2
-rw-r--r--src/live_effects/lpe-powerstroke.cpp2
-rw-r--r--src/live_effects/lpe-powerstroke.h2
-rw-r--r--src/live_effects/lpe-rough-hatches.cpp4
-rw-r--r--src/live_effects/lpe-rough-hatches.h4
-rw-r--r--src/live_effects/lpe-skeleton.cpp2
-rw-r--r--src/live_effects/lpe-sketch.cpp2
-rw-r--r--src/live_effects/lpe-sketch.h2
-rw-r--r--src/live_effects/lpe-spiro.h2
-rw-r--r--src/live_effects/lpe-tangent_to_curve.cpp18
-rw-r--r--src/live_effects/lpe-vonkoch.cpp4
-rw-r--r--src/live_effects/lpe-vonkoch.h4
-rw-r--r--src/live_effects/lpegroupbbox.cpp2
-rw-r--r--src/live_effects/lpegroupbbox.h2
-rw-r--r--src/live_effects/parameter/bool.h5
-rw-r--r--src/live_effects/parameter/enum.h5
-rw-r--r--src/live_effects/parameter/originalpath.h2
-rw-r--r--src/live_effects/parameter/parameter.h7
-rw-r--r--src/live_effects/parameter/path.cpp4
-rw-r--r--src/live_effects/parameter/path.h4
-rw-r--r--src/live_effects/parameter/point.cpp4
-rw-r--r--src/live_effects/parameter/point.h2
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.cpp6
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.h6
-rw-r--r--src/live_effects/parameter/random.h3
-rw-r--r--src/live_effects/parameter/text.h2
-rw-r--r--src/live_effects/parameter/unit.cpp2
-rw-r--r--src/live_effects/parameter/unit.h4
-rw-r--r--src/live_effects/parameter/vector.cpp4
-rw-r--r--src/live_effects/parameter/vector.h2
-rw-r--r--src/object-edit.cpp118
-rw-r--r--src/preferences-skeleton.h1
-rw-r--r--src/selection-chemistry.cpp2
-rw-r--r--src/shortcuts.cpp2
-rw-r--r--src/sp-animation.cpp270
-rw-r--r--src/sp-animation.h75
-rw-r--r--src/sp-clippath.cpp5
-rw-r--r--src/sp-conn-end-pair.cpp17
-rw-r--r--src/sp-conn-end.cpp106
-rw-r--r--src/sp-conn-end.h13
-rw-r--r--src/sp-guide.cpp39
-rw-r--r--src/sp-guide.h3
-rw-r--r--src/sp-image.cpp12
-rw-r--r--src/sp-item.cpp3
-rw-r--r--src/sp-mask.cpp2
-rw-r--r--src/sp-mesh-array.cpp6
-rw-r--r--src/sp-object-group.cpp98
-rw-r--r--src/sp-object-group.h25
-rw-r--r--src/sp-object-repr.cpp1
-rw-r--r--src/sp-object.cpp184
-rw-r--r--src/sp-object.h83
-rw-r--r--src/sp-offset.cpp2
-rw-r--r--src/sp-offset.h2
-rw-r--r--src/sp-pattern.cpp90
-rw-r--r--src/sp-pattern.h14
-rw-r--r--src/sp-rect.cpp46
-rw-r--r--src/sp-rect.h6
-rw-r--r--src/sp-star.cpp2
-rw-r--r--src/sp-star.h2
-rw-r--r--src/sp-switch.cpp30
-rw-r--r--src/sp-switch.h10
-rw-r--r--src/sp-text.cpp64
-rw-r--r--src/sp-tspan.cpp135
-rw-r--r--src/sp-tspan.h5
-rw-r--r--src/splivarot.cpp4
-rw-r--r--src/text-chemistry.cpp12
-rw-r--r--src/trace/imagemap.cpp82
-rw-r--r--src/ui/dialog/color-item.cpp57
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp5
-rw-r--r--src/ui/dialog/guides.cpp4
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp20
-rw-r--r--src/ui/dialog/input.cpp2
-rw-r--r--src/ui/dialog/layers.cpp2
-rw-r--r--src/ui/dialog/object-properties.cpp30
-rw-r--r--src/ui/dialog/object-properties.h1
-rw-r--r--src/ui/dialog/ocaldialogs.cpp15
-rw-r--r--src/ui/dialog/ocaldialogs.h13
-rw-r--r--src/ui/dialog/symbols.cpp4
-rw-r--r--src/ui/widget/Makefile_insert2
-rw-r--r--src/ui/widget/gimpcolorwheel.c1598
-rw-r--r--src/ui/widget/gimpcolorwheel.h95
-rw-r--r--src/ui/widget/spin-scale.cpp3
-rw-r--r--src/widgets/connector-toolbar.cpp67
-rw-r--r--src/widgets/eek-preview.cpp862
-rw-r--r--src/widgets/eek-preview.h31
-rw-r--r--src/widgets/fill-style.cpp2
-rw-r--r--src/widgets/gradient-selector.cpp4
-rw-r--r--src/widgets/icon.cpp2
-rw-r--r--src/widgets/sp-color-notebook.cpp2
-rw-r--r--src/widgets/sp-color-wheel-selector.cpp73
-rw-r--r--src/widgets/sp-color-wheel-selector.h4
-rw-r--r--src/widgets/sp-xmlview-tree.cpp10
-rw-r--r--src/widgets/spinbutton-events.cpp184
-rw-r--r--src/widgets/stroke-style.cpp12
-rw-r--r--src/widgets/toolbox.cpp60
166 files changed, 3223 insertions, 3466 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ddfed3e75..3cc3df1bc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,7 +12,6 @@ set(sp_SRC
attribute-rel-svg.cpp
attribute-rel-util.cpp
sp-anchor.cpp
- # sp-animation.cpp
sp-clippath.cpp
sp-conn-end-pair.cpp
sp-conn-end.cpp
@@ -88,7 +87,6 @@ set(sp_SRC
attribute-rel-svg.h
attribute-rel-util.h
sp-anchor.h
- sp-animation.h
sp-clippath.h
sp-conn-end-pair.h
sp-conn-end.h
diff --git a/src/Makefile_insert b/src/Makefile_insert
index 2d557158b..c6955c92a 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -25,7 +25,6 @@ ink_common_sources += \
composite-undo-stack-observer.cpp \
composite-undo-stack-observer.h \
conditions.cpp conditions.h \
- connection-points.cpp connection-points.h \
conn-avoid-ref.cpp conn-avoid-ref.h \
connection-pool.h \
connector-context.cpp connector-context.h \
diff --git a/src/attributes-test.h b/src/attributes-test.h
index 5a036fd41..78e0ea48f 100644
--- a/src/attributes-test.h
+++ b/src/attributes-test.h
@@ -383,7 +383,6 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
{"inkscape:connector-type", true},
{"inkscape:connection-start", true},
{"inkscape:connection-end", true},
- {"inkscape:connection-points", true},
{"inkscape:connector-curvature", true},
{"inkscape:connector-avoid", true},
{"inkscape:connector-spacing", true},
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 981d527f0..42b6e86dd 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -5,7 +5,7 @@
#define noDEBUG_LCMS
#include <glib/gstdio.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <gdkmm/color.h>
#include <glib/gi18n.h>
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index c0882c526..15a8392c4 100644
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
@@ -23,7 +23,6 @@
#include "helper/geom-curves.h"
#include "svg/stringstream.h"
#include "conn-avoid-ref.h"
-#include "connection-points.h"
#include "sp-conn-end.h"
#include "sp-path.h"
#include "libavoid/router.h"
@@ -86,206 +85,6 @@ void SPAvoidRef::setAvoid(char const *value)
}
}
-static void print_connection_points(std::map<int, ConnectionPoint>& cp)
-{
- std::map<int, ConnectionPoint>::iterator i;
- for (i=cp.begin(); i!=cp.end(); ++i)
- {
- const ConnectionPoint& p = i->second;
- std::cout<<p.id<<" "<<p.type<<" "<<p.pos[Geom::X]<<" "<<p.pos[Geom::Y]<<std::endl;
- }
-}
-
-void SPAvoidRef::setConnectionPoints(gchar const *value)
-{
- std::set<int> updates;
- std::set<int> deletes;
- std::set<int> seen;
-
- if (value)
- {
- /* Rebuild the connection points list.
- Update the connectors for which
- the endpoint has changed.
- */
-
- gchar ** strarray = g_strsplit(value, "|", 0);
- gchar ** iter = strarray;
-
- while (*iter != NULL) {
- ConnectionPoint cp;
- Inkscape::SVGIStringStream is(*iter);
- is>>cp;
- cp.type = ConnPointUserDefined;
-
- /* Mark this connection point as seen, so we can delete
- the other ones.
- */
- seen.insert(cp.id);
- if ( connection_points.find(cp.id) != connection_points.end() )
- {
- /* An already existing connection point.
- Check to see if changed, and, if it is
- the case, trigger connector update for
- the connector attached to this connection
- point. This is done by adding the
- connection point to a list of connection
- points to be updated.
- */
- if ( connection_points[cp.id] != cp )
- // The connection point got updated.
- // Put it in the update list.
- updates.insert(cp.id);
- }
- connection_points[cp.id] = cp;
- ++iter;
- }
- /* Delete the connection points that didn't appear
- in the new connection point list.
- */
- std::map<int, ConnectionPoint>::iterator it;
-
- for (it=connection_points.begin(); it!=connection_points.end(); ++it)
- if ( seen.find(it->first) == seen.end())
- deletes.insert(it->first);
- g_strfreev(strarray);
- }
- else
- {
- /* Delete all the user-defined connection points
- Actually we do this by adding them to the list
- of connection points to be deleted.
- */
- std::map<int, ConnectionPoint>::iterator it;
-
- for (it=connection_points.begin(); it!=connection_points.end(); ++it)
- deletes.insert(it->first);
- }
- /* Act upon updates and deletes.
- */
- if (deletes.empty() && updates.empty())
- // Nothing to do, just return.
- return;
- // Get a list of attached connectors.
- GSList* conns = getAttachedConnectors(Avoid::runningToAndFrom);
- for (GSList *i = conns; i != NULL; i = i->next)
- {
- SPPath* path = SP_PATH(i->data);
- SPConnEnd** connEnds = path->connEndPair.getConnEnds();
- for (int ix=0; ix<2; ++ix) {
- if (connEnds[ix]->type == ConnPointUserDefined) {
- if (updates.find(connEnds[ix]->id) != updates.end()) {
- if (path->connEndPair.isAutoRoutingConn()) {
- path->connEndPair.tellLibavoidNewEndpoints();
- } else {
- }
- }
- else if (deletes.find(connEnds[ix]->id) != deletes.end()) {
- sp_conn_end_detach(path, ix);
- }
- }
- }
- }
- g_slist_free(conns);
- // Remove all deleted connection points
- if (deletes.size())
- for (std::set<int>::iterator it = deletes.begin(); it != deletes.end(); ++it)
- connection_points.erase(*it);
-}
-
-void SPAvoidRef::setConnectionPointsAttrUndoable(const gchar* value, const gchar* action)
-{
- SPDocument* doc = item->document;
-
- item->setAttribute( "inkscape:connection-points", value, 0 );
- item->updateRepr();
- doc->ensureUpToDate();
- DocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, action);
-}
-
-void SPAvoidRef::addConnectionPoint(ConnectionPoint &cp)
-{
- Inkscape::SVGOStringStream ostr;
- bool first = true;
- int newId = 1;
- if ( connection_points.size() )
- {
- for (IdConnectionPointMap::iterator it = connection_points.begin(); ; )
- {
- if ( first )
- {
- first = false;
- ostr<<it->second;
- }
- else
- ostr<<'|'<<it->second;
- IdConnectionPointMap::iterator prev_it = it;
- ++it;
- if ( it == connection_points.end() || prev_it->first + 1 != it->first )
- {
- newId = prev_it->first + 1;
- break;
- }
- }
- }
- cp.id = newId;
- if ( first )
- {
- first = false;
- ostr<<cp;
- }
- else
- ostr<<'|'<<cp;
-
- this->setConnectionPointsAttrUndoable( ostr.str().c_str(), _("Add a new connection point") );
-}
-
-void SPAvoidRef::updateConnectionPoint(ConnectionPoint &cp)
-{
- Inkscape::SVGOStringStream ostr;
- IdConnectionPointMap::iterator cp_pos = connection_points.find( cp.id );
- if ( cp_pos != connection_points.end() )
- {
- bool first = true;
- for (IdConnectionPointMap::iterator it = connection_points.begin(); it != connection_points.end(); ++it)
- {
- ConnectionPoint* to_write;
- if ( it != cp_pos )
- to_write = &it->second;
- else
- to_write = &cp;
- if ( first )
- {
- first = false;
- ostr<<*to_write;
- }
- else
- ostr<<'|'<<*to_write;
- }
- this->setConnectionPointsAttrUndoable( ostr.str().c_str(), _("Move a connection point") );
- }
-}
-
-void SPAvoidRef::deleteConnectionPoint(ConnectionPoint &cp)
-{
- Inkscape::SVGOStringStream ostr;
- IdConnectionPointMap::iterator cp_pos = connection_points.find( cp.id );
- if ( cp_pos != connection_points.end() ) {
- bool first = true;
- for (IdConnectionPointMap::iterator it = connection_points.begin(); it != connection_points.end(); ++it) {
- if ( it != cp_pos ) {
- if ( first ) {
- first = false;
- ostr<<it->second;
- } else {
- ostr<<'|'<<it->second;
- }
- }
- }
- this->setConnectionPointsAttrUndoable( ostr.str().c_str(), _("Remove a connection point") );
- }
-}
-
void SPAvoidRef::handleSettingChange(void)
{
SPDesktop *desktop = inkscape_active_desktop();
@@ -387,45 +186,13 @@ GSList *SPAvoidRef::getAttachedConnectors(const unsigned int type)
return list;
}
-Geom::Point SPAvoidRef::getConnectionPointPos(const int type, const int id)
+Geom::Point SPAvoidRef::getConnectionPointPos()
{
g_assert(item);
- Geom::Point pos;
- const Geom::Affine& transform = item->i2doc_affine();
-
- if ( type == ConnPointDefault )
- {
- // For now, just default to the centre of the item
- Geom::OptRect bbox = item->documentVisualBounds();
- pos = (bbox) ? bbox->midpoint() : Geom::Point(0, 0);
- }
- else
- {
- // Get coordinates from the list of connection points
- // that are attached to the item
- pos = connection_points[id].pos * transform;
- }
-
- return pos;
-}
-
-bool SPAvoidRef::isValidConnPointId( const int type, const int id )
-{
- if ( type < 0 || type > 1 )
- return false;
- else
- {
- if ( type == ConnPointDefault )
- if ( id < 0 || id > 8 )
- return false;
- else
- {
- }
- else
- return connection_points.find( id ) != connection_points.end();
- }
-
- return true;
+ // the center is all we are interested in now; we used to care
+ // about non-center points, but that's moot.
+ Geom::OptRect bbox = item->documentVisualBounds();
+ return (bbox) ? bbox->midpoint() : Geom::Point(0, 0);
}
static std::vector<Geom::Point> approxCurveWithPoints(SPCurve *curve)
diff --git a/src/conn-avoid-ref.h b/src/conn-avoid-ref.h
index 4d38f2845..30b380eb7 100644
--- a/src/conn-avoid-ref.h
+++ b/src/conn-avoid-ref.h
@@ -13,14 +13,13 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#include <2geom/point.h>
#include <glib.h>
#include <stddef.h>
#include <sigc++/connection.h>
class SPDesktop;
class SPItem;
-struct ConnectionPoint;
-typedef std::map<int, ConnectionPoint> IdConnectionPointMap;
namespace Avoid { class ShapeRef; }
class SPAvoidRef {
@@ -31,16 +30,11 @@ public:
// libavoid's internal representation of the item.
Avoid::ShapeRef *shapeRef;
- // Used for holding connection points for item
- IdConnectionPointMap connection_points;
-
void setAvoid(char const *value);
- void setConnectionPoints(gchar const *value);
- void addConnectionPoint(ConnectionPoint &cp);
- void updateConnectionPoint(ConnectionPoint &cp);
- void deleteConnectionPoint(ConnectionPoint &cp);
void handleSettingChange(void);
+ Geom::Point getConnectionPointPos(void);
+
// Returns a list of SPItems of all connectors/shapes attached to
// this object. Pass one of the following for 'type':
// Avoid::runningTo
@@ -48,9 +42,6 @@ public:
// Avoid::runningToAndFrom
GSList *getAttachedShapes(const unsigned int type);
GSList *getAttachedConnectors(const unsigned int type);
- Geom::Point getConnectionPointPos(const int type, const int id);
-
- bool isValidConnPointId( const int type, const int id );
private:
SPItem *item;
@@ -61,7 +52,6 @@ private:
// A sigc connection for transformed signal.
sigc::connection _transformed_connection;
- void setConnectionPointsAttrUndoable(const gchar* value, const gchar* action);
};
extern GSList *get_avoided_items(GSList *list, SPObject *from,
diff --git a/src/connection-points.cpp b/src/connection-points.cpp
deleted file mode 100644
index 9ed98d211..000000000
--- a/src/connection-points.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "connection-points.h"
-
-
-bool ConnectionPoint::operator!=(ConnectionPoint& cp)
-{
- return (id!=cp.id || type!=cp.type || dir!=cp.dir || pos!=cp.pos);
-}
-
-bool ConnectionPoint::operator==(ConnectionPoint& cp)
-{
- return (id==cp.id && type==cp.type && dir==cp.dir && pos==cp.pos);
-}
-
-
-namespace Inkscape{
-
-SVGIStringStream&
-operator>>(SVGIStringStream& istr, ConnectionPoint& cp)
-{
- istr>>cp.id>>cp.dir>>cp.pos[Geom::X]>>cp.pos[Geom::Y];
-
- return istr;
-}
-
-SVGOStringStream&
-operator<<(SVGOStringStream& ostr, const ConnectionPoint& cp)
-{
- ostr<<cp.id<<' '<<cp.dir<<' ';
- ::operator<<( ostr, cp.pos[Geom::X] );
- ostr<<' ';
- ::operator<<( ostr, cp.pos[Geom::Y] );
-
- return ostr;
-}
-
-
-}
diff --git a/src/connection-points.h b/src/connection-points.h
deleted file mode 100644
index c1ddeb481..000000000
--- a/src/connection-points.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef INKSCAPE_CONNECTION_POINT_H
-#define INKSCAPE_CONNECTION_POINT_H
-
-#include <2geom/point.h>
-//#include <libavoid/vertices.h>
-#include <libavoid/connector.h>
-
-#include "svg/stringstream.h"
-
-
-enum ConnPointType {
- ConnPointDefault = 0,
- ConnPointUserDefined = 1
-};
-enum ConnPointDefaultPos{
- ConnPointPosTL, // Top Left
- ConnPointPosTC, // Top Centre
- ConnPointPosTR, // Top Right
- ConnPointPosCL, // Centre Left
- ConnPointPosCC, // Centre Centre
- ConnPointPosCR, // Centre Right
- ConnPointPosBL, // Bottom Left
- ConnPointPosBC, // Bottom Centre
- ConnPointPosBR, // Bottom Right
-};
-
-
-struct ConnectionPoint
-{
- ConnectionPoint():
- type(ConnPointDefault), // default to a default connection point
- id(ConnPointPosCC), // default to the centre point
- pos(),
- dir(Avoid::ConnDirAll) // allow any direction
- {
- }
- // type of the connection point
- // default or user-defined
- int type;
-
- /* id of the connection point
- in the case of default
- connection points it specifies
- which of the 9 types the
- connection point is.
- */
- int id;
-
- /* position related to parent item
- in the case of default connection
- points, these positions should be
- computed by the item's avoidRef
- */
- Geom::Point pos;
-
- // directions from which connections can occur
- Avoid::ConnDirFlags dir;
-
- bool operator!=(ConnectionPoint&);
- bool operator==(ConnectionPoint&);
-};
-
-namespace Inkscape{
-
-SVGIStringStream& operator>>(SVGIStringStream& istr, ConnectionPoint& cp);
-SVGOStringStream& operator<<(SVGOStringStream& ostr, const ConnectionPoint& cp);
-
-}
-
-#endif \ No newline at end of file
diff --git a/src/connector-context.cpp b/src/connector-context.cpp
index db2e049c7..24a7203ac 100644
--- a/src/connector-context.cpp
+++ b/src/connector-context.cpp
@@ -5,10 +5,11 @@
* Michael Wybrow <mjwybrow@users.sourceforge.net>
* Abhishek Sharma
* Jon A. Cruz <jon@joncruz.org>
+ * Martin Owens <doctormo@ubuntu.com>
*
* Copyright (C) 2005-2008 Michael Wybrow
* Copyright (C) 2009 Monash University
- * Copyright (C) 2010 authors
+ * Copyright (C) 2012 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*
@@ -22,7 +23,6 @@
* in the connector tool. Perhaps have a way to convert between.
* o Only call libavoid's updateEndPoint as required. Currently we do it
* for both endpoints, even if only one is moving.
- * o Allow user-placeable connection points.
* o Deal sanely with connectors with both endpoints attached to the
* same connection point, and drawing of connectors attaching
* overlapping shapes (currently tries to adjust connector to be
@@ -41,30 +41,17 @@
* o Fix up libavoid's representation after undo actions. It doesn't see
* any transform signals and hence doesn't know shapes have moved back to
* there earlier positions.
- * o Decide whether drawing/editing mode should be an Inkscape preference
- * or the connector tool should always start in drawing mode.
- * o Correct the problem with switching to the select tool when pressing
- * space bar (there are moments when it refuses to do so).
*
* ----------------------------------------------------------------------------
*
- * mjwybrow's observations on acracan's Summer of Code connector work:
+ * Notes:
*
- * - GUI comments:
- *
- * - Buttons for adding and removing user-specified connection
- * points should probably have "+" and "-" symbols on them so they
- * are consistent with the similar buttons for the node tool.
- * - Controls on the connector tool be should be reordered logically,
- * possibly as follows:
- *
- * *Connector*: [Polyline-radio-button] [Orthgonal-radio-button]
- * [Curvature-control] | *Shape*: [Avoid-button] [Dont-avoid-button]
- * [Spacing-control] | *Connection pts*: [Edit-mode] [Add-pt] [Rm-pt]
- *
- * I think that the network layout controls be moved to the
- * Align and Distribute dialog (there is already the layout button
- * there, but no options are exposed).
+ * Much of the way connectors work for user-defined points has been
+ * changed so that it no longer defines special attributes to record
+ * the points. Instead it uses single node paths to define points
+ * who are then seperate objects that can be fixed on the canvas,
+ * grouped into objects and take full advantage of all tranform, snap
+ * and align functionality of all other objects.
*
* I think that the style change between polyline and orthogonal
* would be much clearer with two buttons (radio behaviour -- just
@@ -74,80 +61,9 @@
* depending on whether an object is selected. We could consider
* this but there may not be space.
*
- * The Add-pt and Rm-pt buttons should be greyed out (inactive) if
- * we are not in connection point editing mode. And probably also
- * if there is no shape selected, i.e. at the times they have no
- * effect when clicked.
- *
* Likewise for the avoid/ignore shapes buttons. These should be
* inactive when a shape is not selected in the connector context.
*
- * - When creating/editing connection points:
- *
- * - Strange things can happen if you have connectors selected, or
- * try rerouting connectors by dragging their endpoints when in
- * connection point editing mode.
- *
- * - Possibly the selected shape's connection points should always
- * be shown (i.e., have knots) when in editing mode.
- *
- * - It is a little strange to be able to place connection points
- * competely outside shapes. Especially when you later can't draw
- * connectors to them since the knots are only visible when you
- * are over the shape. I think that you should only be able to
- * place connection points inside or on the boundary of the shape
- * itself.
- *
- * - The intended ability to place a new point at the current cursor
- * position by pressing RETURN does not seem to work.
- *
- * - The Status bar tooltip should change to reflect editing mode
- * and tell the user about RETURN and how to use the tool.
- *
- * - Connection points general:
- *
- * - Connection points that were inside the shape can end up outside
- * after a rotation is applied to the shape in the select tool.
- * It doesn't seem like the correct transform is being applied to
- * these, or it is being applied at the wrong time. I'd expect
- * connection points to rotate with the shape, and stay at the
- * same position "on the shape"
- *
- * - I was able to make the connectors attached to a shape fall off
- * the shape after scaling it. Not sure the exact cause, but may
- * require more investigation/debugging.
- *
- * - The user-defined connection points should be either absolute
- * (as the current ones are) or defined as a percentage of the
- * shape. These would be based on a toggle setting on the
- * toolbar, and they would be placed in exactly the same way by
- * the user. The only difference would be that they would be
- * store as percentage positions in the SVG connection-points
- * property and that they would update/move automatically if the
- * object was resized or scaled.
- *
- * - Thinking more, I think you always want to store and think about
- * the positions of connection points to be pre-transform, but
- * obviously the shape transform is applied to them. That way,
- * they will rotate and scale automatically with the shape, when
- * the shape transform is altered. The Percentage version would
- * compute their position from the pre-transform dimensions and
- * then have the transform applied to them, for example.
- *
- * - The connection points in the test_connection_points.svg file
- * seem to follow the shape when it is moved, but connection
- * points I add to new shapes, do not follow the shape, either
- * when the shape is just moved or transformed. There is
- * something wrong here. What exactly should the behaviour be
- * currently?
- *
- * - I see that connection points are specified at absolute canvas
- * positions. I really think that they should be specified in
- * shape coordinated relative to the shapes. There may be
- * transforms applied to layers and the canvas which would make
- * specifying them quite difficult. I'd expect a position of 0, 0
- * to be on the shape in question or very close to it, for example.
- *
*/
@@ -158,7 +74,6 @@
#include "connector-context.h"
#include "pixmaps/cursor-connector.xpm"
-#include "pixmaps/cursor-node.xpm"
#include "xml/node-event-vector.h"
#include "xml/repr.h"
#include "svg/svg.h"
@@ -219,12 +134,13 @@ static gint connector_handle_motion_notify(SPConnectorContext *const cc, GdkEven
static gint connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton const &revent);
static gint connector_handle_key_press(SPConnectorContext *const cc, guint const keyval);
-static void cc_active_shape_add_knot(SPDesktop* desktop, SPItem* item, ConnectionPointMap &cphandles, ConnectionPoint& cp);
+static void cc_active_shape_add_knot(SPConnectorContext *cc, SPItem* item);
static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item);
+static void cc_clear_active_knots(SPKnotList k);
static void cc_clear_active_shape(SPConnectorContext *cc);
static void cc_set_active_conn(SPConnectorContext *cc, SPItem *item);
static void cc_clear_active_conn(SPConnectorContext *cc);
-static bool conn_pt_handle_test(SPConnectorContext *cc, Geom::Point& p, gchar **href, gchar **cpid);
+static bool conn_pt_handle_test(SPConnectorContext *cc, Geom::Point& p, gchar **href);
static void cc_select_handle(SPKnot* knot);
static void cc_deselect_handle(SPKnot* knot);
static bool cc_item_is_shape(SPItem *item);
@@ -238,10 +154,6 @@ static void shape_event_attr_changed(Inkscape::XML::Node *repr, gchar const *nam
gchar const *old_value, gchar const *new_value, bool is_interactive,
gpointer data);
-
-static char* cc_knot_tips[] = { _("<b>Connection point</b>: click or drag to create a new connector"),
- _("<b>Connection point</b>: click to select, drag to move") };
-
/*static Geom::Point connector_drag_origin_w(0, 0);
static bool connector_within_tolerance = false;*/
static SPEventContextClass *parent_class;
@@ -313,9 +225,6 @@ sp_connector_context_init(SPConnectorContext *cc)
ec->xp = 0;
ec->yp = 0;
- cc->mode = SP_CONNECTOR_CONTEXT_DRAWING_MODE;
- cc->knot_tip = 0;
-
cc->red_color = 0xff00007f;
cc->newconn = NULL;
@@ -338,16 +247,14 @@ sp_connector_context_init(SPConnectorContext *cc)
cc->clickeditem = NULL;
cc->clickedhandle = NULL;
- new (&cc->connpthandles) ConnectionPointMap();
+ new (&cc->knots) SPKnotList();
for (int i = 0; i < 2; ++i) {
cc->endpt_handle[i] = NULL;
cc->endpt_handler_id[i] = 0;
}
cc->shref = NULL;
- cc->scpid = NULL;
cc->ehref = NULL;
- cc->ecpid = NULL;
cc->npoints = 0;
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
}
@@ -360,14 +267,6 @@ sp_connector_context_dispose(GObject *object)
cc->sel_changed_connection.disconnect();
- if (!cc->connpthandles.empty()) {
- for (ConnectionPointMap::iterator it = cc->connpthandles.begin();
- it != cc->connpthandles.end(); ++it) {
- g_object_unref(it->first);
- }
- cc->connpthandles.clear();
- }
- cc->connpthandles.~ConnectionPointMap();
for (int i = 0; i < 2; ++i) {
if (cc->endpt_handle[1]) {
g_object_unref(cc->endpt_handle[i]);
@@ -378,18 +277,10 @@ sp_connector_context_dispose(GObject *object)
g_free(cc->shref);
cc->shref = NULL;
}
- if (cc->scpid) {
- g_free(cc->scpid);
- cc->scpid = NULL;
- }
if (cc->ehref) {
g_free(cc->shref);
cc->shref = NULL;
}
- if (cc->ecpid) {
- g_free(cc->scpid);
- cc->scpid = NULL;
- }
g_assert( cc->newConnRef == NULL );
G_OBJECT_CLASS(parent_class)->dispose(object);
@@ -432,8 +323,6 @@ sp_connector_context_setup(SPEventContext *ec)
sp_event_context_read(ec, "curvature");
sp_event_context_read(ec, "orthogonal");
- sp_event_context_read(ec, "mode");
- cc->knot_tip = cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE ? cc_knot_tips[0] : cc_knot_tips[1];
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/tools/connector/selcue", 0)) {
ec->enableSelectionCue();
@@ -459,50 +348,8 @@ sp_connector_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val)
else if ( name == "orthogonal" ) {
cc->isOrthogonal = val->getBool();
}
- else if ( name == "mode")
- {
- sp_connector_context_switch_mode(ec, val->getBool() ? SP_CONNECTOR_CONTEXT_EDITING_MODE : SP_CONNECTOR_CONTEXT_DRAWING_MODE);
- }
}
-void sp_connector_context_switch_mode(SPEventContext* ec, unsigned int newMode)
-{
- SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(ec);
-
- cc->mode = newMode;
- if ( cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE )
- {
- ec->cursor_shape = cursor_connector_xpm;
- cc->knot_tip = cc_knot_tips[0];
- if (cc->selected_handle)
- cc_deselect_handle( cc->selected_handle );
- cc->selected_handle = NULL;
- // Show all default connection points
-
- }
- else if ( cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE )
- {
- ec->cursor_shape = cursor_node_xpm;
- cc->knot_tip = cc_knot_tips[1];
-/* if (cc->active_shape)
- {
- cc->selection->set( cc->active_shape );
- }
- else
- {
- SPItem* item = cc->selection->singleItem();
- if ( item )
- {
- cc_set_active_shape(cc, item);
- cc->selection->set( item );
- }
- }*/
- }
- sp_event_context_update_cursor(ec);
-
-}
-
-
static void
sp_connector_context_finish(SPEventContext *ec)
{
@@ -551,16 +398,20 @@ cc_clear_active_shape(SPConnectorContext *cc)
cc->active_shape_layer_repr = NULL;
}
+ cc_clear_active_knots(cc->knots);
+}
+
+static void
+cc_clear_active_knots(SPKnotList k)
+{
// Hide the connection points if they exist.
- if (cc->connpthandles.size()) {
- for (ConnectionPointMap::iterator it = cc->connpthandles.begin();
- it != cc->connpthandles.end(); ++it) {
+ if (k.size()) {
+ for (SPKnotList::iterator it = k.begin(); it != k.end(); ++it) {
sp_knot_hide(it->first);
}
}
}
-
static void
cc_clear_active_conn(SPConnectorContext *cc)
{
@@ -587,21 +438,15 @@ cc_clear_active_conn(SPConnectorContext *cc)
static bool
-conn_pt_handle_test(SPConnectorContext *cc, Geom::Point& p, gchar **href, gchar **cpid)
+conn_pt_handle_test(SPConnectorContext *cc, Geom::Point& p, gchar **href)
{
- // TODO: this will need to change when there are more connection
- // points available for each shape.
-
- if (cc->active_handle && (cc->connpthandles.find(cc->active_handle) != cc->connpthandles.end()))
+ if (cc->active_handle && (cc->knots.find(cc->active_handle) != cc->knots.end()))
{
p = cc->active_handle->pos;
- const ConnectionPoint& cp = cc->connpthandles[cc->active_handle];
- *href = g_strdup_printf("#%s", cc->active_shape->getId());
- *cpid = g_strdup_printf("%c%d", cp.type == ConnPointDefault ? 'd' : 'u' , cp.id);
+ *href = g_strdup_printf("#%s", cc->active_handle->owner->getId());
return true;
}
*href = NULL;
- *cpid = NULL;
return false;
}
@@ -657,14 +502,8 @@ sp_connector_context_item_handler(SPEventContext *event_context, SPItem *item, G
cc->selection->toggle(item);
} else {
cc->selection->set(item);
- if ( cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE && cc->selected_handle )
- {
- cc_deselect_handle( cc->selected_handle );
- cc->selected_handle = NULL;
- }
- /* When selecting a new item,
- do not allow showing connection points
- on connectors. (yet?)
+ /* When selecting a new item, do not allow showing
+ connection points on connectors. (yet?)
*/
if ( item != cc->active_shape && !cc_item_is_connector( item ) )
cc_set_active_shape( cc, item );
@@ -675,20 +514,9 @@ sp_connector_context_item_handler(SPEventContext *event_context, SPItem *item, G
break;
case GDK_ENTER_NOTIFY:
{
- if (cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE || (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE && !cc->selected_handle))
+ if (!cc->selected_handle)
{
if (cc_item_is_shape(item)) {
-
- // I don't really understand what the above does,
- // so I commented it.
- // This is a shape, so show connection point(s).
- /* if (!(cc->active_shape)
- // Don't show handle for another handle.
- // || (cc->connpthandles.find((SPKnot*) item) != cc->connpthandles.end())
- )
- {
- cc_set_active_shape(cc, item);
- }*/
cc_set_active_shape(cc, item);
}
ret = TRUE;
@@ -751,8 +579,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
SPEventContext *event_context = SP_EVENT_CONTEXT(cc);
gint ret = FALSE;
- if ( cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE )
- {
+
if ( bevent.button == 1 && !event_context->space_panning ) {
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
@@ -763,7 +590,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
Geom::Point const event_w(bevent.x,
bevent.y);
-// connector_drag_origin_w = event_w;
+
cc->xp = bevent.x;
cc->yp = bevent.y;
cc->within_tolerance = true;
@@ -787,7 +614,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
Geom::Point p = event_dt;
// Test whether we clicked on a connection point
- bool found = conn_pt_handle_test(cc, p, &cc->shref, &cc->scpid);
+ bool found = conn_pt_handle_test(cc, p, &cc->shref);
if (!found) {
// This is the first point, so just snap it to the grid
@@ -812,8 +639,8 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
spcc_connector_set_subsequent_point(cc, p);
spcc_connector_finish_segment(cc, p);
- // Test whether we clicked on a connection point
- /*bool found = */conn_pt_handle_test(cc, p, &cc->ehref, &cc->ecpid);
+
+ conn_pt_handle_test(cc, p, &cc->ehref);
if (cc->npoints != 0) {
spcc_connector_finish(cc);
}
@@ -847,73 +674,9 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
ret = TRUE;
}
}
- }
- else if ( cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE )
- {
- if ( bevent.button == 1 && !event_context->space_panning )
- {
- // Initialize variables in case of dragging
-
- SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
-
- if (Inkscape::have_viable_layer(desktop, cc->_message_context) == false) {
- return TRUE;
- }
-
- cc->xp = bevent.x;
- cc->yp = bevent.y;
- cc->within_tolerance = true;
-
- ConnectionPointMap::iterator const& active_knot_it = cc->connpthandles.find( cc->active_handle );
-
- switch (cc->state)
- {
- case SP_CONNECTOR_CONTEXT_IDLE:
- if ( active_knot_it != cc->connpthandles.end() )
- {
- // We do not allow selecting and, thereby, moving default knots
- if ( active_knot_it->second.type != ConnPointDefault)
- {
- if (cc->selected_handle != cc->active_handle)
- {
- if ( cc->selected_handle )
- cc_deselect_handle( cc->selected_handle );
- cc->selected_handle = cc->active_handle;
- cc_select_handle( cc->selected_handle );
- }
- }
- else
- // Just ignore the default connection point
- return FALSE;
- }
- else
- if ( cc->selected_handle )
- {
- cc_deselect_handle( cc->selected_handle );
- cc->selected_handle = NULL;
- }
-
- if ( cc->selected_handle )
- {
- cc->state = SP_CONNECTOR_CONTEXT_DRAGGING;
- cc->selection->set( cc->active_shape );
- }
-
- ret = TRUE;
- break;
- // Dragging valid because of the way we create
- // new connection points.
- case SP_CONNECTOR_CONTEXT_DRAGGING:
- // Do nothing.
- ret = TRUE;
- break;
- }
- }
- }
return ret;
}
-
static gint
connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion const &mevent)
{
@@ -945,8 +708,6 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
/* Find desktop coordinates */
Geom::Point p = dt->w2d(event_w);
- if ( cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE )
- {
SnapManager &m = dt->namedview->snap_manager;
switch (cc->state) {
@@ -1007,26 +768,9 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
}
break;
}
- }
- else if ( cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE )
- {
- switch ( cc->state )
- {
- case SP_CONNECTOR_CONTEXT_DRAGGING:
- sp_knot_set_position(cc->selected_handle, p, 0);
- ret = TRUE;
- break;
- case SP_CONNECTOR_CONTEXT_NEWCONNPOINT:
- sp_knot_set_position(cc->selected_handle, p, 0);
- ret = TRUE;
- break;
- }
- }
-
return ret;
}
-
static gint
connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton const &revent)
{
@@ -1043,8 +787,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
/* Find desktop coordinates */
Geom::Point p = cc->desktop->w2d(event_w);
- if ( cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE )
- {
+
switch (cc->state) {
//case SP_CONNECTOR_CONTEXT_POINT:
case SP_CONNECTOR_CONTEXT_DRAGGING:
@@ -1062,7 +805,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
spcc_connector_set_subsequent_point(cc, p);
spcc_connector_finish_segment(cc, p);
// Test whether we clicked on a connection point
- /*bool found = */conn_pt_handle_test(cc, p, &cc->ehref, &cc->ecpid);
+ conn_pt_handle_test(cc, p, &cc->ehref);
if (cc->npoints != 0) {
spcc_connector_finish(cc);
}
@@ -1090,68 +833,14 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
}
ret = TRUE;
}
- else if ( cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE )
- {
- switch ( cc->state )
- {
- case SP_CONNECTOR_CONTEXT_DRAGGING:
-
- if (!cc->within_tolerance)
- {
- m.setup(desktop);
- m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
- m.unSetup();
- sp_knot_set_position(cc->selected_handle, p, 0);
- ConnectionPoint& cp = cc->connpthandles[cc->selected_handle];
- cp.pos = p * (cc->active_shape)->dt2i_affine();
- cc->active_shape->avoidRef->updateConnectionPoint(cp);
- }
-
- cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- ret = TRUE;
- break;
-
-
- case SP_CONNECTOR_CONTEXT_NEWCONNPOINT:
- m.setup(desktop);
- m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
- m.unSetup();
-
- sp_knot_set_position(cc->selected_handle, p, 0);
-
- ConnectionPoint cp;
- cp.type = ConnPointUserDefined;
- cp.pos = p * (cc->active_shape)->dt2i_affine();
- cp.dir = Avoid::ConnDirAll;
- g_object_unref(cc->selected_handle);
- cc->active_shape->avoidRef->addConnectionPoint(cp);
- doc->ensureUpToDate();
- for (ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end(); ++it)
- if (it->second.type == ConnPointUserDefined && it->second.id == cp.id)
- {
- cc->selected_handle = it->first;
- break;
- }
- cc_select_handle( cc->selected_handle );
- cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- ret = TRUE;
- break;
- }
- }
- }
-
-
return ret;
}
-
static gint
connector_handle_key_press(SPConnectorContext *const cc, guint const keyval)
{
gint ret = FALSE;
- /* fixme: */
- if ( cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE )
- {
+
switch (keyval) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
@@ -1186,100 +875,6 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval)
default:
break;
}
- }
- else if ( cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE )
- {
- switch ( cc->state )
- {
- case SP_CONNECTOR_CONTEXT_DRAGGING:
- if ( keyval == GDK_KEY_Escape )
- {
- // Cancel connection point dragging
-
- // Obtain original position
- ConnectionPoint const& cp = cc->connpthandles[cc->selected_handle];
- SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
- const Geom::Affine& i2doc = (cc->active_shape)->i2doc_affine();
- sp_knot_set_position(cc->selected_handle, cp.pos * i2doc * desktop->doc2dt(), 0);
- cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- desktop->messageStack()->flash( Inkscape::NORMAL_MESSAGE,
- _("Connection point drag cancelled."));
- ret = TRUE;
- }
- else if ( keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter )
- {
- // Put connection point at current position
-
- Geom::Point p = cc->selected_handle->pos;
-
- if (!cc->within_tolerance)
- {
- SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
- SnapManager &m = desktop->namedview->snap_manager;
- m.setup(desktop);
- m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
- m.unSetup();
- sp_knot_set_position(cc->selected_handle, p, 0);
- ConnectionPoint& cp = cc->connpthandles[cc->selected_handle];
- cp.pos = p * (cc->active_shape)->dt2i_affine();
- cc->active_shape->avoidRef->updateConnectionPoint(cp);
- }
-
- cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- ret = TRUE;
- }
- break;
- case SP_CONNECTOR_CONTEXT_NEWCONNPOINT:
- if ( keyval == GDK_KEY_Escape )
- {
- // Just destroy the knot
- g_object_unref( cc->selected_handle );
- cc->selected_handle = NULL;
- cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- ret = TRUE;
- }
- else if ( keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter )
- {
- SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
- SPDocument *doc = sp_desktop_document(desktop);
- SnapManager &m = desktop->namedview->snap_manager;
- m.setup(desktop);
- Geom::Point p = cc->selected_handle->pos;
- m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
- m.unSetup();
- sp_knot_set_position(cc->selected_handle, p, 0);
-
- ConnectionPoint cp;
- cp.type = ConnPointUserDefined;
- cp.pos = p * (cc->active_shape)->dt2i_affine();
- cp.dir = Avoid::ConnDirAll;
- g_object_unref(cc->selected_handle);
- cc->active_shape->avoidRef->addConnectionPoint(cp);
- doc->ensureUpToDate();
- for (ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end(); ++it)
- if (it->second.type == ConnPointUserDefined && it->second.id == cp.id)
- {
- cc->selected_handle = it->first;
- break;
- }
- cc_select_handle( cc->selected_handle );
- cc->state = SP_CONNECTOR_CONTEXT_IDLE;
- ret = TRUE;
- }
-
- break;
- case SP_CONNECTOR_CONTEXT_IDLE:
- if ( keyval == GDK_KEY_Delete && cc->selected_handle )
- {
- cc->active_shape->avoidRef->deleteConnectionPoint(cc->connpthandles[cc->selected_handle]);
- cc->selected_handle = NULL;
- ret = TRUE;
- }
-
- break;
- }
- }
-
return ret;
}
@@ -1297,17 +892,15 @@ cc_connector_rerouting_finish(SPConnectorContext *const cc, Geom::Point *const p
if (p != NULL)
{
// Test whether we clicked on a connection point
- gchar *shape_label, *cpid;
- bool found = conn_pt_handle_test(cc, *p, &shape_label, &cpid);
+ gchar *shape_label;
+ bool found = conn_pt_handle_test(cc, *p, &shape_label);
if (found) {
if (cc->clickedhandle == cc->endpt_handle[0]) {
cc->clickeditem->setAttribute("inkscape:connection-start", shape_label, NULL);
- cc->clickeditem->setAttribute("inkscape:connection-start-point", cpid, NULL);
}
else {
cc->clickeditem->setAttribute("inkscape:connection-end", shape_label, NULL);
- cc->clickeditem->setAttribute("inkscape:connection-end-point", cpid, NULL);
}
g_free(shape_label);
}
@@ -1453,18 +1046,12 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc)
if (cc->shref)
{
cc->newconn->setAttribute( "inkscape:connection-start", cc->shref, NULL);
- if (cc->scpid) {
- cc->newconn->setAttribute( "inkscape:connection-start-point", cc->scpid, NULL);
- }
connection = true;
}
if (cc->ehref)
{
cc->newconn->setAttribute( "inkscape:connection-end", cc->ehref, NULL);
- if (cc->ecpid) {
- cc->newconn->setAttribute( "inkscape:connection-end-point", cc->ecpid, NULL);
- }
connection = true;
}
// Process pending updates.
@@ -1537,7 +1124,7 @@ cc_generic_knot_handler(SPCanvasItem *, GdkEvent *event, SPKnot *knot)
gboolean consumed = FALSE;
- gchar* knot_tip = knot->tip ? knot->tip : cc->knot_tip;
+ gchar const *knot_tip = "Click to join at this point";
switch (event->type) {
case GDK_ENTER_NOTIFY:
sp_knot_set_flag(knot, SP_KNOT_MOUSEOVER, TRUE);
@@ -1621,10 +1208,12 @@ endpt_handler(SPKnot */*knot*/, GdkEvent *event, SPConnectorContext *cc)
return consumed;
}
-static void cc_active_shape_add_knot(SPDesktop* desktop, SPItem* item, ConnectionPointMap &cphandles, ConnectionPoint& cp)
+static void cc_active_shape_add_knot(SPConnectorContext *cc, SPItem* item)
{
+ SPDesktop *desktop = cc->desktop;
SPKnot *knot = sp_knot_new(desktop, 0);
+ knot->owner = item;
knot->setShape(SP_KNOT_SHAPE_SQUARE);
knot->setSize(8);
knot->setAnchor(SP_ANCHOR_CENTER);
@@ -1638,17 +1227,15 @@ static void cc_active_shape_add_knot(SPDesktop* desktop, SPItem* item, Connectio
g_signal_connect(G_OBJECT(knot->item), "event",
G_CALLBACK(cc_generic_knot_handler), knot);
- sp_knot_set_position(knot, item->avoidRef->getConnectionPointPos(cp.type, cp.id) * desktop->doc2dt(), 0);
+ sp_knot_set_position(knot, item->avoidRef->getConnectionPointPos() * desktop->doc2dt(), 0);
sp_knot_show(knot);
- cphandles[knot] = cp;
+ cc->knots[knot] = 1;
}
static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item)
{
g_assert(item != NULL );
- std::map<int, ConnectionPoint>* connpts = &item->avoidRef->connection_points;
-
if (cc->active_shape != item)
{
// The active shape has changed
@@ -1674,84 +1261,23 @@ static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item)
sp_repr_add_listener(cc->active_shape_layer_repr, &layer_repr_events, cc);
}
+ cc_clear_active_knots(cc->knots);
+
+ // The idea here is to try and add a group's children to solidify
+ // connection handling. We react to path objects with only one node.
+ for (SPObject *child = item->firstChild() ; child ; child = child->getNext() ) {
+ if (SP_IS_PATH(child) && SP_PATH(child)->nodesInPath() == 1) {
+ cc_active_shape_add_knot(cc, (SPItem *) child);
+ }
+ }
+ cc_active_shape_add_knot(cc, item);
- // Set the connection points.
- if ( cc->connpthandles.size() )
- // destroy the old list
- while (! cc->connpthandles.empty() )
- {
- g_object_unref(cc->connpthandles.begin()->first);
- cc->connpthandles.erase(cc->connpthandles.begin());
- }
- // build the new one
- if ( connpts->size() )
- for (std::map<int, ConnectionPoint>::iterator it = connpts->begin(); it != connpts->end(); ++it)
- cc_active_shape_add_knot(cc->desktop, item, cc->connpthandles, it->second);
-
- // Also add default connection points
- // For now, only centre default connection point will
- // be available
- ConnectionPoint centre;
- centre.type = ConnPointDefault;
- centre.id = ConnPointPosCC;
- cc_active_shape_add_knot(cc->desktop, item, cc->connpthandles, centre);
}
else
{
- // The active shape didn't change
- // Update only the connection point knots
-
// Ensure the item's connection_points map
// has been updated
item->document->ensureUpToDate();
-
- std::set<int> seen;
- for ( ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end() ;)
- {
- bool removed = false;
- if ( it->second.type == ConnPointUserDefined )
- {
- std::map<int, ConnectionPoint>::iterator p = connpts->find(it->second.id);
- if (p != connpts->end())
- {
- if ( it->second != p->second )
- // Connection point position has changed
- // Update knot position
- sp_knot_set_position(it->first,
- item->avoidRef->getConnectionPointPos(it->second.type, it->second.id) * cc->desktop->doc2dt(), 0);
- seen.insert(it->second.id);
- sp_knot_show(it->first);
- }
- else
- {
- // This connection point does no longer exist,
- // remove the knot
- ConnectionPointMap::iterator curr = it;
- ++it;
- g_object_unref( curr->first );
- cc->connpthandles.erase(curr);
- removed = true;
- }
- }
- else
- {
- // It's a default connection point
- // Just make sure it's position is correct
- sp_knot_set_position(it->first,
- item->avoidRef->getConnectionPointPos(it->second.type, it->second.id) * cc->desktop->doc2dt(), 0);
- sp_knot_show(it->first);
-
- }
- if ( !removed )
- ++it;
- }
- // Add knots for new connection points.
- if (connpts->size())
- for ( std::map<int, ConnectionPoint>::iterator it = connpts->begin(); it != connpts->end(); ++it )
- if ( seen.find(it->first) == seen.end() )
- // A new connection point has been added
- // to the shape. Add a knot for it.
- cc_active_shape_add_knot(cc->desktop, item, cc->connpthandles, it->second);
}
}
@@ -1882,15 +1408,6 @@ void cc_create_connection_point(SPConnectorContext* cc)
}
}
-void cc_remove_connection_point(SPConnectorContext* cc)
-{
- if (cc->selected_handle && cc->state == SP_CONNECTOR_CONTEXT_IDLE )
- {
- cc->active_shape->avoidRef->deleteConnectionPoint(cc->connpthandles[cc->selected_handle]);
- cc->selected_handle = NULL;
- }
-}
-
static bool cc_item_is_shape(SPItem *item)
{
if (SP_IS_PATH(item)) {
@@ -2029,12 +1546,6 @@ shape_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name,
cc_set_active_conn(cc, cc->active_conn);
}
}
- else
- if ( !strcmp(name, "inkscape:connection-points") )
- if (repr == cc->active_shape_repr)
- // The connection points of the active shape
- // have changed. Update them.
- cc_set_active_shape(cc, cc->active_shape);
}
diff --git a/src/connector-context.h b/src/connector-context.h
index 128f2bbeb..e157bbf50 100644
--- a/src/connector-context.h
+++ b/src/connector-context.h
@@ -18,7 +18,6 @@
#include "event-context.h"
#include <2geom/point.h>
#include "libavoid/connector.h"
-#include "connection-points.h"
#include <glibmm/i18n.h>
#define SP_TYPE_CONNECTOR_CONTEXT (sp_connector_context_get_type())
@@ -44,12 +43,7 @@ enum {
SP_CONNECTOR_CONTEXT_NEWCONNPOINT
};
-enum {
- SP_CONNECTOR_CONTEXT_DRAWING_MODE,
- SP_CONNECTOR_CONTEXT_EDITING_MODE
-};
-
-typedef std::map<SPKnot *, ConnectionPoint> ConnectionPointMap;
+typedef std::map<SPKnot *, int> SPKnotList;
struct SPConnectorContext : public SPEventContext {
Inkscape::Selection *selection;
@@ -57,14 +51,8 @@ struct SPConnectorContext : public SPEventContext {
/** \invar npoints in {0, 2}. */
gint npoints;
- /* The tool mode can be connector drawing or
- connection points editing.
- */
- unsigned int mode : 1;
unsigned int state : 4;
- gchar* knot_tip;
-
// Red curve
SPCanvasItem *red_bpath;
SPCurve *red_curve;
@@ -89,7 +77,6 @@ struct SPConnectorContext : public SPEventContext {
Inkscape::XML::Node *active_conn_repr;
sigc::connection sel_changed_connection;
-
// The activehandle
SPKnot *active_handle;
@@ -99,13 +86,11 @@ struct SPConnectorContext : public SPEventContext {
SPItem *clickeditem;
SPKnot *clickedhandle;
- ConnectionPointMap connpthandles;
+ SPKnotList knots;
SPKnot *endpt_handle[2];
guint endpt_handler_id[2];
gchar *shref;
- gchar *scpid;
gchar *ehref;
- gchar *ecpid;
SPCanvasItem *c0, *c1, *cl0, *cl1;
};
@@ -113,7 +98,6 @@ struct SPConnectorContextClass : public SPEventContextClass { };
GType sp_connector_context_get_type();
-void sp_connector_context_switch_mode(SPEventContext* ec, unsigned int newMode);
void cc_selection_set_avoid(bool const set_ignore);
void cc_create_connection_point(SPConnectorContext* cc);
void cc_remove_connection_point(SPConnectorContext* cc);
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 2f8f3e4b6..ea23ebb9c 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -433,6 +433,20 @@ void SPDesktop::_setDisplayMode(Inkscape::RenderMode mode) {
_widget->setTitle( sp_desktop_document(this)->getName() );
}
void SPDesktop::_setDisplayColorMode(Inkscape::ColorMode mode) {
+ // reload grayscale matrix from prefs
+ if (mode == Inkscape::COLORMODE_GRAYSCALE) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ gdouble r = prefs->getDoubleLimited("/options/rendering/grayscale/red-factor",0.21,0.,1.);
+ gdouble g = prefs->getDoubleLimited("/options/rendering/grayscale/green-factor",0.72,0.,1.);
+ gdouble b = prefs->getDoubleLimited("/options/rendering/grayscale/blue-factor",0.072,0.,1.);
+ gdouble grayscale_value_matrix[20] = { r, g, b, 0, 0,
+ r, g, b, 0, 0,
+ r, g, b, 0, 0,
+ 0, 0, 0, 1, 0 };
+ g_message("%g",grayscale_value_matrix[0]);
+ SP_CANVAS_ARENA (drawing)->drawing.setGrayscaleMatrix(grayscale_value_matrix);
+ }
+
SP_CANVAS_ARENA (drawing)->drawing.setColorMode(mode);
canvas->colorrendermode = mode;
_display_color_mode = mode;
@@ -1139,6 +1153,7 @@ SPDesktop::zoom_drawing()
SPItem *docitem = doc()->getRoot();
g_return_if_fail (docitem != NULL);
+ docitem->bbox_valid = FALSE;
Geom::OptRect d = docitem->desktopVisualBounds();
/* Note that the second condition here indicates that
diff --git a/src/device-manager.cpp b/src/device-manager.cpp
index 29efa2627..a9394a5f6 100644
--- a/src/device-manager.cpp
+++ b/src/device-manager.cpp
@@ -42,12 +42,7 @@ static bool isValidDevice(GdkDevice *device)
gboolean source_matches = (gdk_device_get_source (device) == fakeout[i].source);
gboolean mode_matches = (gdk_device_get_mode (device) == fakeout[i].mode);
gboolean num_axes_matches = (gdk_device_get_n_axes (device) == fakeout[i].num_axes);
-
-#if GTK_CHECK_VERSION (2, 24, 0)
gboolean num_keys_matches = (gdk_device_get_n_keys (device) == fakeout[i].num_keys);
-#else
- gboolean num_keys_matches = (device->num_keys == fakeout[i].num_keys);
-#endif
if (name_matches && source_matches && mode_matches
&& num_axes_matches && num_keys_matches)
@@ -683,11 +678,7 @@ static void createFakeList() {
fakeout[4].mode = gdk_device_get_mode (device);
fakeout[4].has_cursor = gdk_device_get_has_cursor (device);
fakeout[4].num_axes = gdk_device_get_n_axes (device);
-#if GTK_CHECK_VERSION (2, 24, 0)
fakeout[4].num_keys = gdk_device_get_n_keys (device);
-#else
- fakeout[4].num_keys = device->num_keys;
-#endif
} else {
fakeout[4].name = g_strdup("Core Pointer");
fakeout[4].source = GDK_SOURCE_MOUSE;
diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp
index 2810f065c..3fabe4d97 100644
--- a/src/dialogs/find.cpp
+++ b/src/dialogs/find.cpp
@@ -15,18 +15,6 @@
#include "widgets/icon.h"
#include "message-stack.h"
-//TODO : delete this
-GtkWidget * sp_find_dialog_old (void);
-
-static void
-//GtkWidget *
-sp_find_dialog(){
- // DialogFind::get().present();
- sp_find_dialog_old ();
- return;
-}
-
-
#include <gtk/gtk.h>
#include <glibmm/i18n.h>
@@ -684,144 +672,6 @@ sp_find_types ()
}
-GtkWidget *
-sp_find_dialog_old (void)
-{
- if (!dlg)
- {
- gchar title[500];
- sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_FIND), title);
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
-
- dlg = sp_window_new (title, TRUE);
- if (x == -1000 || y == -1000) {
- x = prefs->getInt(prefs_path + "x", -1000);
- y = prefs->getInt(prefs_path + "y", -1000);
- }
- if (w ==0 || h == 0) {
- w = prefs->getInt(prefs_path + "w", 0);
- h = prefs->getInt(prefs_path + "h", 0);
- }
-
- prefs->setInt(prefs_path + "visible", 1);
-
-// if (x<0) x=0;
-// if (y<0) y=0;
-
- if (w && h)
- gtk_window_resize(GTK_WINDOW(dlg), w, h);
- if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) {
- gtk_window_move(GTK_WINDOW(dlg), x, y);
- } else {
- gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER);
- }
-
- sp_transientize (dlg);
- wd.win = dlg;
- wd.stop = 0;
- g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd );
-
- g_signal_connect ( G_OBJECT (dlg), "event", G_CALLBACK (sp_dialog_event_handler), dlg);
-
- g_signal_connect ( G_OBJECT (dlg), "destroy", G_CALLBACK (sp_find_dialog_destroy), NULL );
- g_signal_connect ( G_OBJECT (dlg), "delete_event", G_CALLBACK (sp_find_dialog_delete), dlg);
- g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (sp_find_dialog_delete), dlg);
-
- g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg);
- g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg);
-
- gtk_container_set_border_width (GTK_CONTAINER (dlg), 4);
-
- /* Toplevel vbox */
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
-#else
- GtkWidget *vb = gtk_vbox_new (FALSE, 0);
-#endif
- gtk_container_add (GTK_CONTAINER (dlg), vb);
-
- sp_find_new_searchfield (dlg, vb, _("_Text:"), "text", _("Find objects by their text content (exact or partial match)"));
- sp_find_new_searchfield (dlg, vb, _("_ID:"), "id", _("Find objects by the value of the id attribute (exact or partial match)"));
- sp_find_new_searchfield (dlg, vb, _("_Style:"), "style", _("Find objects by the value of the style attribute (exact or partial match)"));
- sp_find_new_searchfield (dlg, vb, _("_Attribute:"), "attr", _("Find objects by the name of an attribute (exact or partial match)"));
-
- gtk_widget_show_all (vb);
-
- GtkWidget *types = sp_find_types ();
- g_object_set_data (G_OBJECT (dlg), "types", types);
- gtk_box_pack_start (GTK_BOX (vb), types, FALSE, FALSE, 0);
-
- {
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *w = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
-#else
- GtkWidget *w = gtk_hseparator_new ();
-#endif
- gtk_widget_show (w);
- gtk_box_pack_start (GTK_BOX (vb), w, FALSE, FALSE, 3);
-
- {
- GtkWidget *b = gtk_check_button_new_with_mnemonic (_("Search in s_election"));
- gtk_widget_show (b);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b), FALSE);
- g_object_set_data (G_OBJECT (dlg), "inselection", b);
- gtk_widget_set_tooltip_text (b, _("Limit search to the current selection"));
- gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *b = gtk_check_button_new_with_mnemonic (_("Search in current _layer"));
- gtk_widget_show (b);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b), FALSE);
- g_object_set_data (G_OBJECT (dlg), "inlayer", b);
- gtk_widget_set_tooltip_text (b, _("Limit search to the current layer"));
- gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *b = gtk_check_button_new_with_mnemonic (_("Include _hidden"));
- gtk_widget_show (b);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b), FALSE);
- g_object_set_data (G_OBJECT (dlg), "includehidden", b);
- gtk_widget_set_tooltip_text (b, _("Include hidden objects in search"));
- gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *b = gtk_check_button_new_with_mnemonic (_("Include l_ocked"));
- gtk_widget_show (b);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b), FALSE);
- g_object_set_data (G_OBJECT (dlg), "includelocked", b);
- gtk_widget_set_tooltip_text (b, _("Include locked objects in search"));
- gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0);
- }
- }
-
- {
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
-#endif
- gtk_widget_show (hb);
- gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0);
-
- // TRANSLATORS: "Clear" is a verb here
- sp_find_new_button (dlg, hb, _("_Clear"), _("Clear values"), sp_find_dialog_reset);
- sp_find_new_button (dlg, hb, _("_Find"), _("Select objects matching all of the fields you filled in"), sp_find_dialog_find);
- }
- }
-
- gtk_widget_show(GTK_WIDGET(dlg));
- gtk_window_present(GTK_WINDOW(dlg));
- sp_find_dialog_reset (NULL, G_OBJECT (dlg));
-
- return dlg;
-}
-
-
/*
Local Variables:
mode:c++
diff --git a/src/dialogs/find.h b/src/dialogs/find.h
index 219c36bf2..c06d3735f 100644
--- a/src/dialogs/find.h
+++ b/src/dialogs/find.h
@@ -14,8 +14,6 @@
#include <gtk/gtk.h>
-void sp_find_dialog();
-
#endif /* !SEEN_FIND_H */
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp
index 692e31837..9655fc194 100644
--- a/src/display/cairo-utils.cpp
+++ b/src/display/cairo-utils.cpp
@@ -27,6 +27,17 @@
#include "style.h"
#include "helper/geom-curves.h"
+namespace {
+
+/**
+ * Key for cairo_surface_t to keep track of current color interpolation value
+ * Only the address of the structure is used, it is never initialized. See:
+ * http://www.cairographics.org/manual/cairo-Types.html#cairo-user-data-key-t
+ */
+cairo_user_data_key_t ci_key;
+
+} // namespace
+
namespace Inkscape {
CairoGroup::CairoGroup(cairo_t *_ct) : ct(_ct), pushed(false) {}
diff --git a/src/display/cairo-utils.h b/src/display/cairo-utils.h
index d240545eb..af4727c01 100644
--- a/src/display/cairo-utils.h
+++ b/src/display/cairo-utils.h
@@ -82,12 +82,6 @@ public:
} // namespace Inkscape
-/**
- * Key for cairo_surface_t to keep track of current color interpolation value
- * Only the address of the structure is used, it is never initialized. See:
- * http://www.cairographics.org/manual/cairo-Types.html#cairo-user-data-key-t
- */
-static cairo_user_data_key_t ci_key;
SPColorInterpolation get_cairo_surface_ci(cairo_surface_t *surface);
void set_cairo_surface_ci(cairo_surface_t *surface, SPColorInterpolation cif);
void copy_cairo_surface_ci(cairo_surface_t *in, cairo_surface_t *out);
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 329b621ae..5fd38a473 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -183,19 +183,19 @@ CanvasGrid::~CanvasGrid()
}
const char *
-CanvasGrid::getName()
+CanvasGrid::getName() const
{
return _(grid_name[gridtype]);
}
const char *
-CanvasGrid::getSVGName()
+CanvasGrid::getSVGName() const
{
return grid_svgname[gridtype];
}
GridType
-CanvasGrid::getGridType()
+CanvasGrid::getGridType() const
{
return gridtype;
}
@@ -369,7 +369,7 @@ CanvasGrid::on_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gc
(static_cast<CanvasGrid*>(data))->onReprAttrChanged(repr, key, oldval, newval, is_interactive);
}
-bool CanvasGrid::isEnabled()
+bool CanvasGrid::isEnabled() const
{
if (snapper == NULL) {
return false;
diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h
index bba9b7e95..7eaef407f 100644
--- a/src/display/canvas-grid.h
+++ b/src/display/canvas-grid.h
@@ -61,9 +61,9 @@ public:
virtual ~CanvasGrid();
// TODO: see effect.h and effect.cpp from live_effects how to link enums to SVGname to typename properly. (johan)
- const char * getName();
- const char * getSVGName();
- GridType getGridType();
+ const char * getName() const;
+ const char * getSVGName() const;
+ GridType getGridType() const;
static const char * getName(GridType type);
static const char * getSVGName(GridType type);
static GridType getGridTypeFromSVGName(const char * typestr);
@@ -97,8 +97,8 @@ public:
static void on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data);
- bool isVisible() { return (isEnabled() &&visible); };
- bool isEnabled();
+ bool isVisible() const { return (isEnabled() &&visible); };
+ bool isEnabled() const;
protected:
CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type);
diff --git a/src/display/drawing.cpp b/src/display/drawing.cpp
index 171cc014f..c192e4565 100644
--- a/src/display/drawing.cpp
+++ b/src/display/drawing.cpp
@@ -16,13 +16,20 @@
#include "nr-filter-types.h"
//grayscale colormode:
-#include "nr-filter-colormatrix.h"
#include "cairo-templates.h"
#include "drawing-context.h"
namespace Inkscape {
+// hardcoded grayscale color matrix values as default
+static const gdouble grayscale_value_matrix[20] = {
+ 0.21, 0.72, 0.072, 0, 0,
+ 0.21, 0.72, 0.072, 0, 0,
+ 0.21, 0.72, 0.072, 0, 0,
+ 0 , 0 , 0 , 1, 0
+};
+
Drawing::Drawing(SPCanvasArena *arena)
: _root(NULL)
, outlinecolor(0x000000ff)
@@ -34,6 +41,7 @@ Drawing::Drawing(SPCanvasArena *arena)
, _filter_quality(Filters::FILTER_QUALITY_BEST)
, _cache_score_threshold(50000.0)
, _cache_budget(0)
+ , _grayscale_colormatrix(std::vector<gdouble> (grayscale_value_matrix, grayscale_value_matrix + 20 ))
, _canvasarena(arena)
{
@@ -143,6 +151,12 @@ Drawing::setCacheBudget(size_t bytes)
}
void
+Drawing::setGrayscaleMatrix(gdouble value_matrix[20]) {
+ _grayscale_colormatrix = Filters::FilterColorMatrix::ColorMatrixMatrix(
+ std::vector<gdouble> (value_matrix, value_matrix + 20) );
+}
+
+void
Drawing::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset)
{
if (_root) {
@@ -152,17 +166,6 @@ Drawing::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigned fl
_pickItemsForCaching();
}
-// hardcoded grayscale color matrix values. could be turned into preference settings in future.
-static const gdouble grayscale_value_matrix[] = {
- 0.21, 0.72, 0.072, 0, 0,
- 0.21, 0.72, 0.072, 0, 0,
- 0.21, 0.72, 0.072, 0, 0,
- 0 , 0 , 0 , 1, 0
-};
-static Filters::FilterColorMatrix::ColorMatrixMatrix grayscale_colormatrix(
- std::vector<gdouble> (grayscale_value_matrix, grayscale_value_matrix + sizeof(grayscale_value_matrix) / sizeof(grayscale_value_matrix[0]) )
-);
-
void
Drawing::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flags)
{
@@ -174,7 +177,7 @@ Drawing::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flags)
// apply grayscale filter on top of everything
cairo_surface_t *input = ct.rawTarget();
cairo_surface_t *out = ink_cairo_surface_create_identical(input);
- ink_cairo_surface_filter(input, out, grayscale_colormatrix);
+ ink_cairo_surface_filter(input, out, _grayscale_colormatrix);
Geom::Point origin = ct.targetLogicalBounds().min();
ct.setSource(out, origin[Geom::X], origin[Geom::Y]);
ct.setOperator(CAIRO_OPERATOR_SOURCE);
diff --git a/src/display/drawing.h b/src/display/drawing.h
index 8154f0783..74ab57fae 100644
--- a/src/display/drawing.h
+++ b/src/display/drawing.h
@@ -20,7 +20,7 @@
#include <2geom/rect.h>
#include "display/drawing-item.h"
#include "display/rendermode.h"
-
+#include "nr-filter-colormatrix.h"
typedef struct _SPCanvasArena SPCanvasArena;
@@ -65,6 +65,8 @@ public:
OutlineColors const &colors() const { return _colors; }
+ void setGrayscaleMatrix(gdouble 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 &ct, Geom::IntRect const &area, unsigned flags = 0);
DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags);
@@ -97,6 +99,7 @@ private:
size_t _cache_budget; ///< maximum allowed size of cache
OutlineColors _colors;
+ Filters::FilterColorMatrix::ColorMatrixMatrix _grayscale_colormatrix;
SPCanvasArena *_canvasarena; // may be NULL is this arena is not the screen
// but used for export etc.
diff --git a/src/dom/prop-css2.cpp b/src/dom/prop-css2.cpp
index 9fe998552..192295d1c 100644
--- a/src/dom/prop-css2.cpp
+++ b/src/dom/prop-css2.cpp
@@ -1279,6 +1279,7 @@ bool parseProperty(char *name, char *value)
}
+/*
static bool printTable()
{
for (CssProp *prop=cssProps; prop->name ; prop++)
@@ -1294,7 +1295,7 @@ static bool printTable()
}
return true;
}
-
+*/
int main(int /*argc*/, char **/*argv*/)
{
diff --git a/src/doxygen-main.cpp b/src/doxygen-main.cpp
index d41675c56..71cd49dae 100644
--- a/src/doxygen-main.cpp
+++ b/src/doxygen-main.cpp
@@ -330,7 +330,7 @@ namespace XML {}
* [\ref geom.cpp] [\ref mod360.cpp]
*/
/** \page OtherServices Classes and Files From Other Services
- * [\ref inkview.cpp, \ref slideshow.cpp] [\ref sp-animation.cpp]
+ * [\ref inkview.cpp, \ref slideshow.cpp]
*
* Inkscape::GC
*
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 5996d600b..e62435004 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -50,8 +50,6 @@
using Inkscape::DocumentUndo;
-static void sp_draw_context_class_init(SPDrawContextClass *klass);
-static void sp_draw_context_init(SPDrawContext *dc);
static void sp_draw_context_dispose(GObject *object);
static void sp_draw_context_setup(SPEventContext *ec);
@@ -76,27 +74,7 @@ static void spdc_flush_white(SPDrawContext *dc, SPCurve *gc);
static void spdc_reset_white(SPDrawContext *dc);
static void spdc_free_colors(SPDrawContext *dc);
-
-static SPEventContextClass *draw_parent_class;
-
-GType sp_draw_context_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPDrawContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_draw_context_class_init,
- NULL, NULL,
- sizeof(SPDrawContext),
- 4,
- (GInstanceInitFunc) sp_draw_context_init,
- NULL, // value_table
- };
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPDrawContext", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPDrawContext, sp_draw_context, SP_TYPE_EVENT_CONTEXT);
static void sp_draw_context_class_init(SPDrawContextClass *klass)
{
@@ -106,8 +84,6 @@ static void sp_draw_context_class_init(SPDrawContextClass *klass)
object_class = (GObjectClass *)klass;
ec_class = SP_EVENT_CONTEXT_CLASS(klass);
- draw_parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent(klass));
-
object_class->dispose = sp_draw_context_dispose;
ec_class->setup = sp_draw_context_setup;
@@ -167,7 +143,7 @@ static void sp_draw_context_dispose(GObject *object)
spdc_free_colors(dc);
- G_OBJECT_CLASS(draw_parent_class)->dispose(object);
+ G_OBJECT_CLASS(sp_draw_context_parent_class)->dispose(object);
}
static void sp_draw_context_setup(SPEventContext *ec)
@@ -175,8 +151,8 @@ static void sp_draw_context_setup(SPEventContext *ec)
SPDrawContext *dc = SP_DRAW_CONTEXT(ec);
SPDesktop *dt = ec->desktop;
- if ((SP_EVENT_CONTEXT_CLASS(draw_parent_class))->setup) {
- (SP_EVENT_CONTEXT_CLASS(draw_parent_class))->setup(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->setup) {
+ (SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->setup(ec);
}
dc->selection = sp_desktop_selection(dt);
@@ -261,8 +237,8 @@ gint sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event)
}
if (!ret) {
- if ((SP_EVENT_CONTEXT_CLASS(draw_parent_class))->root_handler) {
- ret = (SP_EVENT_CONTEXT_CLASS(draw_parent_class))->root_handler(ec, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->root_handler) {
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->root_handler(ec, event);
}
}
diff --git a/src/draw-context.h b/src/draw-context.h
index 202dd85b2..98309c0cb 100644
--- a/src/draw-context.h
+++ b/src/draw-context.h
@@ -20,6 +20,7 @@
#include "event-context.h"
#include "live_effects/effect.h"
+G_BEGIN_DECLS
/* Freehand context */
#define SP_TYPE_DRAW_CONTEXT (sp_draw_context_get_type())
@@ -82,7 +83,7 @@ struct SPDrawContext : public SPEventContext{
struct SPDrawContextClass : public SPEventContextClass{};
-GType sp_draw_context_get_type(void);
+GType sp_draw_context_get_type(void) G_GNUC_CONST;
/**
* Returns FIRST active anchor (the activated one).
@@ -119,6 +120,7 @@ void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item);
*/
void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char const *tool, guint event_state);
+G_END_DECLS
#endif // SEEN_SP_DRAW_CONTEXT_H
/*
diff --git a/src/dropper-context.cpp b/src/dropper-context.cpp
index 38b981444..66dcf4ab9 100644
--- a/src/dropper-context.cpp
+++ b/src/dropper-context.cpp
@@ -50,6 +50,23 @@
using Inkscape::DocumentUndo;
+typedef struct
+{
+ double R;
+ double G;
+ double B;
+ double alpha;
+
+ unsigned int dragging : 1;
+
+ SPCanvasItem *grabbed;
+ SPCanvasItem *area;
+ Geom::Point centre;
+} SPDropperContextPrivate;
+
+#define SP_DROPPER_CONTEXT_GET_PRIVATE(dc) \
+ G_TYPE_INSTANCE_GET_PRIVATE(dc, SP_TYPE_DROPPER_CONTEXT, SPDropperContextPrivate)
+
static void sp_dropper_context_class_init(SPDropperContextClass *klass);
static void sp_dropper_context_init(SPDropperContext *dc);
@@ -63,34 +80,21 @@ static SPEventContextClass *parent_class;
static GdkCursor *cursor_dropper_fill = NULL;
static GdkCursor *cursor_dropper_stroke = NULL;
-GType sp_dropper_context_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPDropperContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_dropper_context_class_init,
- NULL, NULL,
- sizeof(SPDropperContext),
- 4,
- (GInstanceInitFunc) sp_dropper_context_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPDropperContext", &info, (GTypeFlags) 0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPDropperContext, sp_dropper_context, SP_TYPE_EVENT_CONTEXT);
-static void sp_dropper_context_class_init(SPDropperContextClass *klass)
+static void
+sp_dropper_context_class_init(SPDropperContextClass *klass)
{
- SPEventContextClass *ec_class = SP_EVENT_CONTEXT_CLASS(klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ SPEventContextClass *ec_class = SP_EVENT_CONTEXT_CLASS(klass);
parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent(klass));
ec_class->setup = sp_dropper_context_setup;
ec_class->finish = sp_dropper_context_finish;
ec_class->root_handler = sp_dropper_context_root_handler;
+
+ g_type_class_add_private(object_class, sizeof(SPDropperContext));
}
static void sp_dropper_context_init(SPDropperContext *dc)
@@ -105,9 +109,11 @@ static void sp_dropper_context_init(SPDropperContext *dc)
}
-static void sp_dropper_context_setup(SPEventContext *ec)
+static void
+sp_dropper_context_setup(SPEventContext *ec)
{
- SPDropperContext *dc = SP_DROPPER_CONTEXT(ec);
+ SPDropperContext *dc = SP_DROPPER_CONTEXT(ec);
+ SPDropperContextPrivate *priv = SP_DROPPER_CONTEXT_GET_PRIVATE(dc);
if ((SP_EVENT_CONTEXT_CLASS(parent_class))->setup) {
(SP_EVENT_CONTEXT_CLASS(parent_class))->setup(ec);
@@ -122,11 +128,11 @@ static void sp_dropper_context_setup(SPEventContext *ec)
c->curveto(1, -C1, C1, -1, 0, -1 );
c->curveto(-C1, -1, -1, -C1, -1, 0 );
c->closepath();
- dc->area = sp_canvas_bpath_new(sp_desktop_controls(ec->desktop), c);
+ priv->area = sp_canvas_bpath_new(sp_desktop_controls(ec->desktop), c);
c->unref();
- sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(dc->area), 0x00000000,(SPWindRule)0);
- sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->area), 0x0000007f, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
- sp_canvas_item_hide(dc->area);
+ sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(priv->area), 0x00000000,(SPWindRule)0);
+ sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(priv->area), 0x0000007f, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
+ sp_canvas_item_hide(priv->area);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/tools/dropper/selcue")) {
@@ -138,20 +144,22 @@ static void sp_dropper_context_setup(SPEventContext *ec)
}
}
-static void sp_dropper_context_finish(SPEventContext *ec)
+static void
+sp_dropper_context_finish(SPEventContext *ec)
{
- SPDropperContext *dc = SP_DROPPER_CONTEXT(ec);
+ SPDropperContext *dc = SP_DROPPER_CONTEXT(ec);
+ SPDropperContextPrivate *priv = SP_DROPPER_CONTEXT_GET_PRIVATE(dc);
ec->enableGrDrag(false);
- if (dc->grabbed) {
- sp_canvas_item_ungrab(dc->grabbed, GDK_CURRENT_TIME);
- dc->grabbed = NULL;
+ if (priv->grabbed) {
+ sp_canvas_item_ungrab(priv->grabbed, GDK_CURRENT_TIME);
+ priv->grabbed = NULL;
}
- if (dc->area) {
- sp_canvas_item_destroy(dc->area);
- dc->area = NULL;
+ if (priv->area) {
+ sp_canvas_item_destroy(priv->area);
+ priv->area = NULL;
}
if (cursor_dropper_fill) {
@@ -176,40 +184,38 @@ static void sp_dropper_context_finish(SPEventContext *ec)
}
-
-/**
- * Returns the current dropper context icc-color.
- */
-static SPColor* sp_dropper_context_get_icc_color(SPEventContext */*ec*/)
-{
- //TODO: implement-me!
-
- return 0; // At least we will cause a clean crash, instead of random corruption.
-}
-
/**
* Returns the current dropper context color.
*/
-guint32 sp_dropper_context_get_color(SPEventContext *ec)
+guint32
+sp_dropper_context_get_color(SPEventContext *ec)
{
- SPDropperContext *dc = SP_DROPPER_CONTEXT(ec);
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ SPDropperContext *dc = SP_DROPPER_CONTEXT(ec);
+ SPDropperContextPrivate *priv = SP_DROPPER_CONTEXT_GET_PRIVATE(dc);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int pick = prefs->getInt("/tools/dropper/pick",
- SP_DROPPER_PICK_VISIBLE);
+ SP_DROPPER_PICK_VISIBLE);
+
bool setalpha = prefs->getBool("/tools/dropper/setalpha", true);
- return SP_RGBA32_F_COMPOSE(dc->R, dc->G, dc->B,
- (pick == SP_DROPPER_PICK_ACTUAL && setalpha) ? dc->alpha : 1.0);
+ return SP_RGBA32_F_COMPOSE(priv->R,
+ priv->G,
+ priv->B,
+ (pick == SP_DROPPER_PICK_ACTUAL && setalpha) ? priv->alpha
+ : 1.0);
}
-
-static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEvent *event)
+static gint
+sp_dropper_context_root_handler(SPEventContext *event_context,
+ GdkEvent *event)
{
- SPDropperContext *dc = SP_DROPPER_CONTEXT(event_context);
+ SPDropperContext *dc = SP_DROPPER_CONTEXT(event_context);
+ SPDropperContextPrivate *priv = SP_DROPPER_CONTEXT_GET_PRIVATE(dc);
+ SPDesktop *desktop = event_context->desktop;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
int ret = FALSE;
- SPDesktop *desktop = event_context->desktop;
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int pick = prefs->getInt("/tools/dropper/pick", SP_DROPPER_PICK_VISIBLE);
bool setalpha = prefs->getBool("/tools/dropper/setalpha", true);
@@ -217,15 +223,15 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv
switch (event->type) {
case GDK_BUTTON_PRESS:
if (event->button.button == 1 && !event_context->space_panning) {
- dc->centre = Geom::Point(event->button.x, event->button.y);
- dc->dragging = TRUE;
+ priv->centre = Geom::Point(event->button.x, event->button.y);
+ priv->dragging = TRUE;
ret = TRUE;
}
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK,
NULL, event->button.time);
- dc->grabbed = SP_CANVAS_ITEM(desktop->acetate);
+ priv->grabbed = SP_CANVAS_ITEM(desktop->acetate);
break;
case GDK_MOTION_NOTIFY:
@@ -246,25 +252,25 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv
double rw = 0.0;
double R(0), G(0), B(0), A(0);
- if (dc->dragging) {
+ if (priv->dragging) {
// calculate average
// radius
- rw = std::min(Geom::L2(Geom::Point(event->button.x, event->button.y) - dc->centre), 400.0);
+ rw = std::min(Geom::L2(Geom::Point(event->button.x, event->button.y) - priv->centre), 400.0);
if (rw == 0) { // happens sometimes, little idea why...
break;
}
- Geom::Point const cd = desktop->w2d(dc->centre);
+ Geom::Point const cd = desktop->w2d(priv->centre);
Geom::Affine const w2dt = desktop->w2d();
const double scale = rw * w2dt.descrim();
Geom::Affine const sm( Geom::Scale(scale, scale) * Geom::Translate(cd) );
- sp_canvas_item_affine_absolute(dc->area, sm);
- sp_canvas_item_show(dc->area);
+ sp_canvas_item_affine_absolute(priv->area, sm);
+ sp_canvas_item_show(priv->area);
/* Get buffer */
- Geom::Rect r(dc->centre, dc->centre);
+ Geom::Rect r(priv->centre, priv->centre);
r.expandBy(rw);
if (!r.hasZeroArea()) {
Geom::IntRect area = r.roundOutwards();
@@ -303,13 +309,13 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv
}
// remember color
- dc->R = R;
- dc->G = G;
- dc->B = B;
- dc->alpha = A;
+ priv->R = R;
+ priv->G = G;
+ priv->B = B;
+ priv->alpha = A;
// status message
- double alpha_to_set = setalpha? dc->alpha : 1.0;
+ double alpha_to_set = setalpha? priv->alpha : 1.0;
guint32 c32 = SP_RGBA32_F_COMPOSE(R, G, B, alpha_to_set);
gchar c[64];
@@ -319,9 +325,9 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv
// locale-sensitive printf is OK, since this goes to the UI, not into SVG
gchar *alpha = g_strdup_printf(_(" alpha %.3g"), alpha_to_set);
// where the color is picked, to show in the statusbar
- gchar *where = dc->dragging ? g_strdup_printf(_(", averaged with radius %d"), (int) rw) : g_strdup_printf(_(" under cursor"));
+ gchar *where = priv->dragging ? g_strdup_printf(_(", averaged with radius %d"), (int) rw) : g_strdup_printf(_(" under cursor"));
// message, to show in the statusbar
- const gchar *message = dc->dragging ? _("<b>Release mouse</b> to set color.") : _("<b>Click</b> to set fill, <b>Shift+click</b> to set stroke; <b>drag</b> to average color in area; with <b>Alt</b> to pick inverse color; <b>Ctrl+C</b> to copy the color under mouse to clipboard");
+ const gchar *message = priv->dragging ? _("<b>Release mouse</b> to set color.") : _("<b>Click</b> to set fill, <b>Shift+click</b> to set stroke; <b>drag</b> to average color in area; with <b>Alt</b> to pick inverse color; <b>Ctrl+C</b> to copy the color under mouse to clipboard");
event_context->defaultMessageContext()->setF(
Inkscape::NORMAL_MESSAGE,
"<b>%s%s</b>%s. %s", c,
@@ -338,15 +344,15 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv
case GDK_BUTTON_RELEASE:
if (event->button.button == 1 && !event_context->space_panning)
{
- sp_canvas_item_hide(dc->area);
- dc->dragging = FALSE;
+ sp_canvas_item_hide(priv->area);
+ priv->dragging = FALSE;
- if (dc->grabbed) {
- sp_canvas_item_ungrab(dc->grabbed, event->button.time);
- dc->grabbed = NULL;
+ if (priv->grabbed) {
+ sp_canvas_item_ungrab(priv->grabbed, event->button.time);
+ priv->grabbed = NULL;
}
- double alpha_to_set = setalpha? dc->alpha : 1.0;
+ double alpha_to_set = setalpha? priv->alpha : 1.0;
bool fill = !(event->button.state & GDK_SHIFT_MASK); // Stroke if Shift key held
if (prefs->getBool("/tools/dropper/onetimepick", false)) {
@@ -357,7 +363,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv
// do the actual color setting
sp_desktop_set_color(desktop,
(event->button.state & GDK_MOD1_MASK)?
- ColorRGBA(1 - dc->R, 1 - dc->G, 1 - dc->B, alpha_to_set) : ColorRGBA(dc->R, dc->G, dc->B, alpha_to_set),
+ ColorRGBA(1 - priv->R, 1 - priv->G, 1 - priv->B, alpha_to_set) : ColorRGBA(priv->R, priv->G, priv->B, alpha_to_set),
false, fill);
// REJON: set aux. toolbar input to hex color!
diff --git a/src/dropper-context.h b/src/dropper-context.h
index 22c6a1cf3..68ae3df07 100644
--- a/src/dropper-context.h
+++ b/src/dropper-context.h
@@ -14,6 +14,8 @@
#include "event-context.h"
+G_BEGIN_DECLS
+
#define SP_TYPE_DROPPER_CONTEXT (sp_dropper_context_get_type ())
#define SP_DROPPER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_DROPPER_CONTEXT, SPDropperContext))
#define SP_IS_DROPPER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_DROPPER_CONTEXT))
@@ -28,17 +30,6 @@ enum {
struct SPDropperContext {
SPEventContext event_context;
-
- unsigned int dragging : 1;
-
- SPCanvasItem *grabbed;
- SPCanvasItem *area;
- Geom::Point centre;
-
- double R;
- double G;
- double B;
- double alpha;
};
struct SPDropperContextClass {
@@ -49,6 +40,8 @@ GType sp_dropper_context_get_type (void);
guint32 sp_dropper_context_get_color(SPEventContext *ec);
+G_END_DECLS
+
#endif
/*
diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp
index 78f3f48d6..8253818d2 100644
--- a/src/ege-adjustment-action.cpp
+++ b/src/ege-adjustment-action.cpp
@@ -810,12 +810,6 @@ static gboolean event_cb( EgeAdjustmentAction* act, GdkEvent* evt )
return handled;
}
-static gchar *slider_format_falue( GtkScale* scale, gdouble value, gchar *label )
-{
- (void)scale;
- return g_strdup_printf("%s %d", label, (int) round(value));
-}
-
static GtkWidget* create_tool_item( GtkAction* action )
{
GtkWidget* item = 0;
diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp
index a0c91d09e..a5d92e809 100644
--- a/src/ege-select-one-action.cpp
+++ b/src/ege-select-one-action.cpp
@@ -785,15 +785,8 @@ GtkWidget* create_tool_item( GtkAction* action )
GtkWidget *normal;
if (act->private_data->selectionMode == SELECTION_OPEN) {
-
-// Backward-compatibility: GtkComboBoxEntry is deprecated in GTK+ >= 2.24
-// and gtk_combo_box_set_entry_text_column is unavailable in earlier versions.
-#if GTK_CHECK_VERSION (2, 24, 0)
normal = gtk_combo_box_new_with_model_and_entry (act->private_data->model);
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (normal), act->private_data->labelColumn);
-#else
- normal = gtk_combo_box_entry_new_with_model (act->private_data->model, act->private_data->labelColumn);
-#endif
GtkWidget *child = gtk_bin_get_child( GTK_BIN(normal) );
if (GTK_IS_ENTRY(child)) {
@@ -897,13 +890,7 @@ void resync_active( EgeSelectOneAction* act, gint active, gboolean override )
}
if ( GTK_IS_COMBO_BOX(combodata) ) {
GtkComboBox* combo = GTK_COMBO_BOX(combodata);
-// Backward-compatibility: GtkComboBoxEntry is deprecated in GTK+ >= 2.24
-// gtk_combo_box_get_has_entry is unavailable in earlier versions
-#if GTK_CHECK_VERSION (2, 24, 0)
if ((active == -1) && (gtk_combo_box_get_has_entry(combo))) {
-#else
- if ((active == -1) && (GTK_IS_COMBO_BOX_ENTRY(combo))) {
-#endif
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo))), act->private_data->activeText);
} else if ( gtk_combo_box_get_active(combo) != active ) {
gtk_combo_box_set_active( combo, active );
@@ -1019,10 +1006,6 @@ void combo_changed_cb( GtkComboBox* widget, gpointer user_data )
GtkComboBox *cb = GTK_COMBO_BOX (widget);
gint newActive = gtk_combo_box_get_active(widget);
-// Backward-compatibility: gtk_combo_box_get_active_text is deprecated in
-// GTK+ >= 2.24. gtk_combo_box_get_has_entry is unavailable in earlier
-// versions.
-#if GTK_CHECK_VERSION (2, 24, 0)
if (gtk_combo_box_get_has_entry (cb)) {
GtkBin *bin = GTK_BIN (cb);
GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (bin));
@@ -1038,9 +1021,6 @@ void combo_changed_cb( GtkComboBox* widget, gpointer user_data )
gtk_tree_model_get (model, &iter, 0, &text, -1);
}
}
-#else
- text = gtk_combo_box_get_active_text (cb);
-#endif
if (!text) {
/* User probably deleted the data in the model */
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index c4560d462..cd0b1dc3b 100644
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
@@ -83,9 +83,6 @@ using Inkscape::DocumentUndo;
#define DRAG_DEFAULT 1.0
#define DRAG_MAX 1.0
-
-static void sp_eraser_context_class_init(SPEraserContextClass *klass);
-static void sp_eraser_context_init(SPEraserContext *erc);
static void sp_eraser_context_dispose(GObject *object);
static void sp_eraser_context_setup(SPEventContext *ec);
@@ -104,29 +101,7 @@ static Geom::Point sp_eraser_get_npoint(SPEraserContext const *erc, Geom::Point
static Geom::Point sp_eraser_get_vpoint(SPEraserContext const *erc, Geom::Point n);
static void draw_temporary_box(SPEraserContext *dc);
-
-static SPEventContextClass *eraser_parent_class = 0;
-
-GType sp_eraser_context_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPEraserContextClass),
- 0, // base_init
- 0, // base_finalize
- (GClassInitFunc)sp_eraser_context_class_init,
- 0, // class_finalize
- 0, // class_data
- sizeof(SPEraserContext),
- 0, // n_preallocs
- (GInstanceInitFunc)sp_eraser_context_init,
- 0 // value_table
- };
- type = g_type_register_static(SP_TYPE_COMMON_CONTEXT, "SPEraserContext", &info, static_cast<GTypeFlags>(0));
- }
- return type;
-}
+G_DEFINE_TYPE(SPEraserContext, sp_eraser_context, SP_TYPE_COMMON_CONTEXT);
static void
sp_eraser_context_class_init(SPEraserContextClass *klass)
@@ -134,8 +109,6 @@ sp_eraser_context_class_init(SPEraserContextClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS(klass);
SPEventContextClass *event_context_class = SP_EVENT_CONTEXT_CLASS(klass);
- eraser_parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent(klass));
-
object_class->dispose = sp_eraser_context_dispose;
event_context_class->setup = sp_eraser_context_setup;
@@ -154,9 +127,7 @@ sp_eraser_context_init(SPEraserContext *erc)
static void
sp_eraser_context_dispose(GObject *object)
{
- //SPEraserContext *erc = SP_ERASER_CONTEXT(object);
-
- G_OBJECT_CLASS(eraser_parent_class)->dispose(object);
+ G_OBJECT_CLASS(sp_eraser_context_parent_class)->dispose(object);
}
static void
@@ -165,8 +136,8 @@ sp_eraser_context_setup(SPEventContext *ec)
SPEraserContext *erc = SP_ERASER_CONTEXT(ec);
SPDesktop *desktop = ec->desktop;
- if ((SP_EVENT_CONTEXT_CLASS(eraser_parent_class))->setup)
- (SP_EVENT_CONTEXT_CLASS(eraser_parent_class))->setup(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_eraser_context_parent_class))->setup)
+ (SP_EVENT_CONTEXT_CLASS(sp_eraser_context_parent_class))->setup(ec);
erc->accumulated = new SPCurve();
erc->currentcurve = new SPCurve();
@@ -222,8 +193,8 @@ static void
sp_eraser_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val)
{
//pass on up to parent class to handle common attributes.
- if ( eraser_parent_class->set ) {
- eraser_parent_class->set(ec, val);
+ if (SP_EVENT_CONTEXT_CLASS(sp_eraser_context_parent_class)->set ) {
+ SP_EVENT_CONTEXT_CLASS(sp_eraser_context_parent_class)->set(ec, val);
}
}
@@ -689,8 +660,8 @@ sp_eraser_context_root_handler(SPEventContext *event_context,
}
if (!ret) {
- if ((SP_EVENT_CONTEXT_CLASS(eraser_parent_class))->root_handler) {
- ret = (SP_EVENT_CONTEXT_CLASS(eraser_parent_class))->root_handler(event_context, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_eraser_context_parent_class))->root_handler) {
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_eraser_context_parent_class))->root_handler(event_context, event);
}
}
diff --git a/src/eraser-context.h b/src/eraser-context.h
index 68ed04ad5..7c147c32f 100644
--- a/src/eraser-context.h
+++ b/src/eraser-context.h
@@ -21,6 +21,8 @@
#include "common-context.h"
+G_BEGIN_DECLS
+
#define SP_TYPE_ERASER_CONTEXT (sp_eraser_context_get_type())
#define SP_ERASER_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_ERASER_CONTEXT, SPEraserContext))
#define SP_ERASER_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_ERASER_CONTEXT, SPEraserContextClass))
@@ -45,6 +47,8 @@ struct SPEraserContextClass : public SPEventContextClass{};
GType sp_eraser_context_get_type(void);
+G_END_DECLS
+
#endif // SP_ERASER_CONTEXT_H_SEEN
/*
diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h
index 785059cca..5c1cb673e 100644
--- a/src/extension/internal/filter/color.h
+++ b/src/extension/internal/filter/color.h
@@ -211,7 +211,7 @@ ChannelPaint::get_filter_text (Inkscape::Extension::Extension * ext)
}
_filter = g_strdup_printf(
- "<filter inkscape:label=\"Channel Painting\" style=\"color-interpolation-filters:sRGB;\" >\n"
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Channel Painting\">\n"
"<feColorMatrix values=\"%s\" type=\"saturate\" result=\"colormatrix1\" />\n"
"<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 %s %s %s %s 0 \" in=\"SourceGraphic\" result=\"colormatrix2\" />\n"
"<feFlood flood-color=\"rgb(%s,%s,%s)\" flood-opacity=\"%s\" result=\"flood\" />\n"
diff --git a/src/filters/flood.cpp b/src/filters/flood.cpp
index 170bed767..51b139b34 100644
--- a/src/filters/flood.cpp
+++ b/src/filters/flood.cpp
@@ -29,9 +29,6 @@
/* FeFlood base class */
-static void sp_feFlood_class_init(SPFeFloodClass *klass);
-static void sp_feFlood_init(SPFeFlood *feFlood);
-
static void sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_feFlood_release(SPObject *object);
static void sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value);
@@ -39,35 +36,13 @@ static void sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags);
static Inkscape::XML::Node *sp_feFlood_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter);
-static SPFilterPrimitiveClass *feFlood_parent_class;
-
-GType sp_feFlood_get_type()
-{
- static GType feFlood_type = 0;
-
- if (!feFlood_type) {
- GTypeInfo feFlood_info = {
- sizeof(SPFeFloodClass),
- NULL, NULL,
- (GClassInitFunc) sp_feFlood_class_init,
- NULL, NULL,
- sizeof(SPFeFlood),
- 16,
- (GInstanceInitFunc) sp_feFlood_init,
- NULL, /* value_table */
- };
- feFlood_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeFlood", &feFlood_info, (GTypeFlags)0);
- }
- return feFlood_type;
-}
+G_DEFINE_TYPE(SPFeFlood, sp_feFlood, SP_TYPE_FILTER_PRIMITIVE);
static void sp_feFlood_class_init(SPFeFloodClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *)klass;
SPFilterPrimitiveClass *sp_primitive_class = (SPFilterPrimitiveClass *)klass;
- feFlood_parent_class = (SPFilterPrimitiveClass*)g_type_class_peek_parent(klass);
-
sp_object_class->build = sp_feFlood_build;
sp_object_class->release = sp_feFlood_release;
sp_object_class->write = sp_feFlood_write;
@@ -90,8 +65,8 @@ static void sp_feFlood_init(SPFeFlood *feFlood)
static void
sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) feFlood_parent_class)->build) {
- ((SPObjectClass *) feFlood_parent_class)->build(object, document, repr);
+ if ((SP_OBJECT_CLASS(sp_feFlood_parent_class))->build) {
+ (SP_OBJECT_CLASS(sp_feFlood_parent_class))->build(object, document, repr);
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
@@ -104,8 +79,8 @@ sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *re
*/
static void sp_feFlood_release(SPObject *object)
{
- if (((SPObjectClass *) feFlood_parent_class)->release)
- ((SPObjectClass *) feFlood_parent_class)->release(object);
+ if ((SP_OBJECT_CLASS(sp_feFlood_parent_class))->release)
+ (SP_OBJECT_CLASS(sp_feFlood_parent_class))->release(object);
}
/**
@@ -170,8 +145,8 @@ sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value)
}
break;
default:
- if (((SPObjectClass *) feFlood_parent_class)->set)
- ((SPObjectClass *) feFlood_parent_class)->set(object, key, value);
+ if ((SP_OBJECT_CLASS(sp_feFlood_parent_class))->set)
+ (SP_OBJECT_CLASS(sp_feFlood_parent_class))->set(object, key, value);
break;
}
@@ -190,8 +165,8 @@ sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags)
}
- if (((SPObjectClass *) feFlood_parent_class)->update) {
- ((SPObjectClass *) feFlood_parent_class)->update(object, ctx, flags);
+ if ((SP_OBJECT_CLASS(sp_feFlood_parent_class))->update) {
+ (SP_OBJECT_CLASS(sp_feFlood_parent_class))->update(object, ctx, flags);
}
}
@@ -207,8 +182,8 @@ sp_feFlood_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::
repr = object->getRepr()->duplicate(doc);
}
- if (((SPObjectClass *) feFlood_parent_class)->write) {
- ((SPObjectClass *) feFlood_parent_class)->write(object, doc, repr, flags);
+ if ((SP_OBJECT_CLASS(sp_feFlood_parent_class))->write) {
+ (SP_OBJECT_CLASS(sp_feFlood_parent_class))->write(object, doc, repr, flags);
}
return repr;
diff --git a/src/filters/flood.h b/src/filters/flood.h
index 0083def70..d60321689 100644
--- a/src/filters/flood.h
+++ b/src/filters/flood.h
@@ -15,10 +15,12 @@
#include "sp-filter-primitive.h"
#include "svg/svg-icc-color.h"
-#define SP_TYPE_FEFLOOD (sp_feFlood_get_type())
-#define SP_FEFLOOD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_FEFLOOD, SPFeFlood))
-#define SP_FEFLOOD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_FEFLOOD, SPFeFloodClass))
-#define SP_IS_FEFLOOD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_FEFLOOD))
+G_BEGIN_DECLS
+
+#define SP_TYPE_FEFLOOD (sp_feFlood_get_type())
+#define SP_FEFLOOD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_FEFLOOD, SPFeFlood))
+#define SP_FEFLOOD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_FEFLOOD, SPFeFloodClass))
+#define SP_IS_FEFLOOD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_FEFLOOD))
#define SP_IS_FEFLOOD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_FEFLOOD))
class SPFeFloodClass;
@@ -33,9 +35,9 @@ struct SPFeFloodClass {
SPFilterPrimitiveClass parent_class;
};
-GType sp_feFlood_get_type();
-
+GType sp_feFlood_get_type() G_GNUC_CONST;
+G_END_DECLS
#endif /* !SP_FEFLOOD_H_SEEN */
/*
diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp
index 14f8f83a6..d9b1b0965 100644
--- a/src/ink-comboboxentry-action.cpp
+++ b/src/ink-comboboxentry-action.cpp
@@ -361,16 +361,8 @@ GtkWidget* create_tool_item( GtkAction* action )
item = GTK_WIDGET( gtk_tool_item_new() );
- GtkWidget* comboBoxEntry;
-
-// Backward-compatibility: GtkComboBoxEntry is deprecated in GTK+ >= 2.24
-// gtk_combo_box_set_entry_text_column is unavailable in earlier versions
-#if GTK_CHECK_VERSION (2, 24, 0)
- comboBoxEntry = gtk_combo_box_new_with_model_and_entry (ink_comboboxentry_action->model);
+ GtkWidget* comboBoxEntry = gtk_combo_box_new_with_model_and_entry (ink_comboboxentry_action->model);
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (comboBoxEntry), 0);
-#else
- comboBoxEntry = gtk_combo_box_entry_new_with_model( ink_comboboxentry_action->model, 0 );
-#endif
// Name it so we can muck with it using an RC file
gtk_widget_set_name( comboBoxEntry, combobox_name );
@@ -796,7 +788,7 @@ static void ink_comboboxentry_action_defocus( Ink_ComboBoxEntry_Action* action )
}
}
-gboolean keypress_cb( GtkWidget *widget, GdkEventKey *event, gpointer data )
+gboolean keypress_cb( GtkWidget * /*widget*/, GdkEventKey *event, gpointer data )
{
gboolean wasConsumed = FALSE; /* default to report event not consumed */
guint key = 0;
diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp
index 75732f805..043685460 100644
--- a/src/knot-holder-entity.cpp
+++ b/src/knot-holder-entity.cpp
@@ -133,13 +133,13 @@ KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape:
/* TODO: this pattern manipulation is not able to handle general transformation matrices. Only matrices that are the result of a pure scale times a pure rotation. */
-static gdouble sp_pattern_extract_theta(SPPattern *pat)
+static gdouble sp_pattern_extract_theta(SPPattern const *pat)
{
Geom::Affine transf = pat->patternTransform;
return Geom::atan2(transf.xAxis());
}
-static Geom::Point sp_pattern_extract_scale(SPPattern *pat)
+static Geom::Point sp_pattern_extract_scale(SPPattern const *pat)
{
Geom::Affine transf = pat->patternTransform;
return Geom::Point( transf.expansionX(), transf.expansionY() );
@@ -175,18 +175,18 @@ PatternKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &ori
}
Geom::Point
-PatternKnotHolderEntityXY::knot_get()
+PatternKnotHolderEntityXY::knot_get() const
{
SPPattern const *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
return sp_pattern_extract_trans(pat);
}
Geom::Point
-PatternKnotHolderEntityAngle::knot_get()
+PatternKnotHolderEntityAngle::knot_get() const
{
- SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
+ SPPattern const *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
- gdouble x = (pattern_width(pat));
+ gdouble x = pattern_width(pat);
gdouble y = 0;
Geom::Point delta = Geom::Point(x,y);
Geom::Point scale = sp_pattern_extract_scale(pat);
@@ -258,9 +258,9 @@ PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &
Geom::Point
-PatternKnotHolderEntityScale::knot_get()
+PatternKnotHolderEntityScale::knot_get() const
{
- SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
+ SPPattern const *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
gdouble x = pattern_width(pat);
gdouble y = pattern_height(pat);
diff --git a/src/knot-holder-entity.h b/src/knot-holder-entity.h
index 09d70f8c9..a4e6528cf 100644
--- a/src/knot-holder-entity.h
+++ b/src/knot-holder-entity.h
@@ -59,7 +59,7 @@ public:
/* 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 Geom::Point knot_get() = 0;
+ virtual Geom::Point knot_get() const = 0;
virtual void knot_click(guint /*state*/) {}
void update_knot();
@@ -101,19 +101,19 @@ protected:
class PatternKnotHolderEntityXY : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class PatternKnotHolderEntityAngle : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class PatternKnotHolderEntityScale : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
diff --git a/src/knot.cpp b/src/knot.cpp
index afcd70eb5..890abd0a1 100644
--- a/src/knot.cpp
+++ b/src/knot.cpp
@@ -184,6 +184,7 @@ static void sp_knot_init(SPKnot *knot)
{
knot->desktop = NULL;
knot->item = NULL;
+ knot->owner = NULL;
knot->flags = 0;
knot->size = 8;
diff --git a/src/knot.h b/src/knot.h
index c0d2f68e4..ec640df3a 100644
--- a/src/knot.h
+++ b/src/knot.h
@@ -21,6 +21,7 @@
#include <sigc++/sigc++.h>
#include "enums.h"
#include <gtk/gtk.h>
+#include "sp-item.h"
class SPDesktop;
class SPKnot;
@@ -43,6 +44,7 @@ struct SPCanvasItem;
struct SPKnot : GObject {
SPDesktop *desktop; /**< Desktop we are on. */
SPCanvasItem *item; /**< Our CanvasItem. */
+ SPItem *owner; /**< Optional Owner Item */
guint flags;
guint size; /**< Always square. */
diff --git a/src/libavoid/orthogonal.cpp b/src/libavoid/orthogonal.cpp
index 772fc9668..d0a899252 100644
--- a/src/libavoid/orthogonal.cpp
+++ b/src/libavoid/orthogonal.cpp
@@ -204,12 +204,6 @@ class ShiftSegment
};
typedef std::list<ShiftSegment> ShiftSegmentList;
-static bool cmpShiftSegment(const ShiftSegment& u, const ShiftSegment& v)
-{
- return u < v;
-}
-
-
struct Node;
struct CmpNodePos { bool operator()(const Node* u, const Node* v) const; };
diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp
index ed1e1dc5c..98904a47a 100644
--- a/src/libnrtype/FontFactory.cpp
+++ b/src/libnrtype/FontFactory.cpp
@@ -315,9 +315,15 @@ font_factory::font_factory(void) :
{
#ifdef USE_PANGO_WIN32
#else
- pango_ft2_font_map_set_resolution((PangoFT2FontMap*)fontServer, 72, 72);
- fontContext = pango_ft2_font_map_create_context((PangoFT2FontMap*)fontServer);
- pango_ft2_font_map_set_default_substitute((PangoFT2FontMap*)fontServer,FactorySubstituteFunc,this,NULL);
+ pango_ft2_font_map_set_resolution(PANGO_FT2_FONT_MAP(fontServer),
+ 72, 72);
+
+ fontContext = pango_font_map_create_context(fontServer);
+
+ pango_ft2_font_map_set_default_substitute(PANGO_FT2_FONT_MAP(fontServer),
+ FactorySubstituteFunc,
+ this,
+ NULL);
#endif
}
diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp
index 4ca8bf2a0..f26b157da 100644
--- a/src/libnrtype/FontInstance.cpp
+++ b/src/libnrtype/FontInstance.cpp
@@ -399,7 +399,7 @@ void font_instance::InitTheFace()
SetGraphicsMode(daddy->hScreenDC, GM_COMPATIBLE);
SelectObject(daddy->hScreenDC,theFace);
#else
- theFace=pango_ft2_font_get_face(pFont); // Deprecated, use pango_fc_font_lock_face() instead
+ theFace=pango_fc_font_lock_face(PANGO_FC_FONT(pFont));
if ( theFace ) {
FT_Select_Charmap(theFace,ft_encoding_unicode) && FT_Select_Charmap(theFace,ft_encoding_symbol);
}
@@ -411,6 +411,8 @@ void font_instance::FreeTheFace()
#ifdef USE_PANGO_WIN32
SelectObject(daddy->hScreenDC,GetStockObject(SYSTEM_FONT));
pango_win32_font_cache_unload(daddy->pangoFontCache,theFace);
+#else
+ pango_fc_font_unlock_face(PANGO_FC_FONT(pFont));
#endif
theFace=NULL;
}
@@ -454,12 +456,13 @@ int font_instance::MapUnicodeChar(gunichar c)
#ifdef USE_PANGO_WIN32
res = pango_win32_font_get_glyph_index(pFont, c);
#else
- theFace = pango_ft2_font_get_face(pFont);
+ theFace = pango_fc_font_lock_face(PANGO_FC_FONT(pFont));
if ( c > 0xf0000 ) {
res = CLAMP(c, 0xf0000, 0x1fffff) - 0xf0000;
} else {
res = FT_Get_Char_Index(theFace, c);
}
+ pango_fc_font_unlock_face(PANGO_FC_FONT(pFont));
#endif
}
return res;
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 3b57de25c..b0be02b95 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -300,7 +300,7 @@ Effect::~Effect()
}
Glib::ustring
-Effect::getName()
+Effect::getName() const
{
if (lpeobj->effecttype_set && LPETypeConverter.is_valid_id(lpeobj->effecttype) )
return Glib::ustring( _(LPETypeConverter.get_label(lpeobj->effecttype).c_str()) );
@@ -309,7 +309,7 @@ Effect::getName()
}
EffectType
-Effect::effectType() {
+Effect::effectType() const {
return lpeobj->effecttype;
}
@@ -317,7 +317,7 @@ Effect::effectType() {
* Is performed a single time when the effect is freshly applied to a path
*/
void
-Effect::doOnApply (SPLPEItem */*lpeitem*/)
+Effect::doOnApply (SPLPEItem const*/*lpeitem*/)
{
}
@@ -325,7 +325,7 @@ Effect::doOnApply (SPLPEItem */*lpeitem*/)
* Is performed each time before the effect is updated.
*/
void
-Effect::doBeforeEffect (SPLPEItem */*lpeitem*/)
+Effect::doBeforeEffect (SPLPEItem const*/*lpeitem*/)
{
//Do nothing for simple effects
}
@@ -370,7 +370,7 @@ Effect::writeParamsToSVG() {
* your LPE. But don't forget to call the parent method so that is_ready is set to true!
*/
void
-Effect::acceptParamPath (SPPath */*param_path*/) {
+Effect::acceptParamPath (SPPath const*/*param_path*/) {
setReady();
}
@@ -424,7 +424,7 @@ Effect::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
}
void
-Effect::readallParameters(Inkscape::XML::Node * repr)
+Effect::readallParameters(Inkscape::XML::Node const* repr)
{
std::vector<Parameter *>::iterator it = param_vector.begin();
while (it != param_vector.end()) {
@@ -491,7 +491,7 @@ Effect::addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
* This is the function called by external code like SPLPEItem.
*/
std::vector<Geom::PathVector>
-Effect::getHelperPaths(SPLPEItem *lpeitem)
+Effect::getHelperPaths(SPLPEItem const* lpeitem)
{
std::vector<Geom::PathVector> hp_vec;
@@ -524,7 +524,7 @@ Effect::getHelperPaths(SPLPEItem *lpeitem)
* This function should be overwritten by derived effects if they want to provide their own helperpaths.
*/
void
-Effect::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector<Geom::PathVector> &/*hp_vec*/)
+Effect::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector<Geom::PathVector> &/*hp_vec*/)
{
}
@@ -643,7 +643,7 @@ Effect::editNextParamOncanvas(SPItem * item, SPDesktop * desktop)
* The nice thing about this is that this function can use knowledge of the original path and set things accordingly for example to the size or origin of the original path!
*/
void
-Effect::resetDefaults(SPItem * /*item*/)
+Effect::resetDefaults(SPItem const* /*item*/)
{
std::vector<Inkscape::LivePathEffect::Parameter *>::iterator p;
for (p = param_vector.begin(); p != param_vector.end(); ++p) {
@@ -663,7 +663,7 @@ Effect::transform_multiply(Geom::Affine const& postmul, bool set)
}
bool
-Effect::providesKnotholder()
+Effect::providesKnotholder() const
{
// does the effect actively provide any knotholder entities of its own?
if (_provides_knotholder_entities) {
@@ -671,7 +671,7 @@ Effect::providesKnotholder()
}
// otherwise: are there any parameters that have knotholderentities?
- for (std::vector<Parameter *>::iterator p = param_vector.begin(); p != param_vector.end(); ++p) {
+ for (std::vector<Parameter *>::const_iterator p = param_vector.begin(); p != param_vector.end(); ++p) {
if ((*p)->providesKnotHolderEntities()) {
return true;
}
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index 008de5ea8..f7a7155b0 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -51,16 +51,16 @@ public:
virtual ~Effect();
- EffectType effectType ();
+ EffectType effectType() const;
- virtual void doOnApply (SPLPEItem *lpeitem);
- virtual void doBeforeEffect (SPLPEItem *lpeitem);
+ virtual void doOnApply (SPLPEItem const* lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
void writeParamsToSVG();
- virtual void acceptParamPath (SPPath *param_path);
+ virtual void acceptParamPath (SPPath const* param_path);
static int acceptsNumClicks(EffectType type);
- int acceptsNumClicks() { return acceptsNumClicks(effectType()); }
+ int acceptsNumClicks() const { return acceptsNumClicks(effectType()); }
void doAcceptPathPreparations(SPLPEItem *lpeitem);
/*
@@ -68,7 +68,7 @@ public:
* e.g., waiting for a parameter path either before the effect is created or when it needs a
* path as argument. This is set in sp_lpe_item_add_path_effect().
*/
- inline bool isReady() { return is_ready; }
+ inline bool isReady() const { return is_ready; }
inline void setReady(bool ready = true) { is_ready = ready; }
virtual void doEffect (SPCurve * curve);
@@ -78,35 +78,35 @@ public:
/**
* Sets all parameters to their default values and writes them to SVG.
*/
- virtual void resetDefaults(SPItem * item);
+ virtual void resetDefaults(SPItem const* item);
/// /todo: is this method really necessary? it causes UI inconsistensies... (johan)
virtual void transform_multiply(Geom::Affine const& postmul, bool set);
// /TODO: providesKnotholder() is currently used as an indicator of whether a nodepath is
// created for an item or not. When we allow both at the same time, this needs rethinking!
- bool providesKnotholder();
+ bool providesKnotholder() const;
// /TODO: in view of providesOwnFlashPaths() below, this is somewhat redundant
// (but spiro lpe still needs it!)
- virtual LPEPathFlashType pathFlashType() { return DEFAULT; }
+ virtual LPEPathFlashType pathFlashType() const { return DEFAULT; }
void addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
- std::vector<Geom::PathVector> getHelperPaths(SPLPEItem *lpeitem);
+ std::vector<Geom::PathVector> getHelperPaths(SPLPEItem const* lpeitem);
- inline bool providesOwnFlashPaths() {
+ inline bool providesOwnFlashPaths() const {
return provides_own_flash_paths || show_orig_path;
}
- inline bool showOrigPath() { return show_orig_path; }
+ inline bool showOrigPath() const { return show_orig_path; }
- Glib::ustring getName();
+ Glib::ustring getName() const;
Inkscape::XML::Node * getRepr();
SPDocument * getSPDoc();
LivePathEffectObject * getLPEObj() {return lpeobj;};
Parameter * getParameter(const char * key);
- void readallParameters(Inkscape::XML::Node * repr);
+ void readallParameters(Inkscape::XML::Node const* repr);
void setParameter(const gchar * key, const gchar * new_value);
- inline bool isVisible() { return is_visible; }
+ inline bool isVisible() const { return is_visible; }
void editNextParamOncanvas(SPItem * item, SPDesktop * desktop);
@@ -128,7 +128,7 @@ protected:
virtual void addKnotHolderEntities(KnotHolder * /*knotholder*/, SPDesktop * /*desktop*/, SPItem * /*item*/) {};
- virtual void addCanvasIndicators(SPLPEItem *lpeitem, std::vector<Geom::PathVector> &hp_vec);
+ virtual void addCanvasIndicators(SPLPEItem const* lpeitem, std::vector<Geom::PathVector> &hp_vec);
std::vector<Parameter *> param_vector;
bool _provides_knotholder_entities;
diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp
index 8aa88f1f0..91f779ef3 100644
--- a/src/live_effects/lpe-angle_bisector.cpp
+++ b/src/live_effects/lpe-angle_bisector.cpp
@@ -28,14 +28,14 @@ class KnotHolderEntityLeftEnd : public LPEKnotHolderEntity {
public:
KnotHolderEntityLeftEnd(LPEAngleBisector* effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
class KnotHolderEntityRightEnd : public LPEKnotHolderEntity {
public:
KnotHolderEntityRightEnd(LPEAngleBisector* effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
} // namespace TtC
@@ -125,16 +125,16 @@ KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*or
}
Geom::Point
-KnotHolderEntityLeftEnd::knot_get()
+KnotHolderEntityLeftEnd::knot_get() const
{
- LPEAngleBisector *lpe = dynamic_cast<LPEAngleBisector *>(_effect);
+ LPEAngleBisector const* lpe = dynamic_cast<LPEAngleBisector const*>(_effect);
return lpe->ptA - lpe->dir * lpe->length_left;
}
Geom::Point
-KnotHolderEntityRightEnd::knot_get()
+KnotHolderEntityRightEnd::knot_get() const
{
- LPEAngleBisector *lpe = dynamic_cast<LPEAngleBisector *>(_effect);
+ LPEAngleBisector const* lpe = dynamic_cast<LPEAngleBisector const*>(_effect);
return lpe->ptA + lpe->dir * lpe->length_right;
}
diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp
index 3732ae3ef..49660c91b 100644
--- a/src/live_effects/lpe-bendpath.cpp
+++ b/src/live_effects/lpe-bendpath.cpp
@@ -72,7 +72,7 @@ LPEBendPath::~LPEBendPath()
}
void
-LPEBendPath::doBeforeEffect (SPLPEItem *lpeitem)
+LPEBendPath::doBeforeEffect (SPLPEItem const* lpeitem)
{
// get the item bounding box
original_bbox(lpeitem);
@@ -123,7 +123,7 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
}
void
-LPEBendPath::resetDefaults(SPItem * item)
+LPEBendPath::resetDefaults(SPItem const* item)
{
Effect::resetDefaults(item);
diff --git a/src/live_effects/lpe-bendpath.h b/src/live_effects/lpe-bendpath.h
index 98421df88..3d336e2e7 100644
--- a/src/live_effects/lpe-bendpath.h
+++ b/src/live_effects/lpe-bendpath.h
@@ -33,11 +33,11 @@ public:
LPEBendPath(LivePathEffectObject *lpeobject);
virtual ~LPEBendPath();
- virtual void doBeforeEffect (SPLPEItem *lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
- virtual void resetDefaults(SPItem * item);
+ virtual void resetDefaults(SPItem const* item);
private:
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index 9ac553ed5..c1b72c3c7 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -34,14 +34,14 @@ class KnotHolderEntityStartingAngle : public LPEKnotHolderEntity {
public:
KnotHolderEntityStartingAngle(LPECopyRotate *effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
class KnotHolderEntityRotationAngle : public LPEKnotHolderEntity {
public:
KnotHolderEntityRotationAngle(LPECopyRotate *effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
} // namespace CR
@@ -73,9 +73,9 @@ LPECopyRotate::~LPECopyRotate()
}
void
-LPECopyRotate::doOnApply(SPLPEItem *lpeitem)
+LPECopyRotate::doOnApply(SPLPEItem const* lpeitem)
{
- SPCurve *curve = SP_SHAPE(lpeitem)->_curve;
+ SPCurve const *curve = SP_SHAPE(lpeitem)->_curve;
A = *(curve->first_point());
B = *(curve->last_point());
@@ -188,16 +188,16 @@ KnotHolderEntityRotationAngle::knot_set(Geom::Point const &p, Geom::Point const
}
Geom::Point
-KnotHolderEntityStartingAngle::knot_get()
+KnotHolderEntityStartingAngle::knot_get() const
{
- LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
+ LPECopyRotate const *lpe = dynamic_cast<LPECopyRotate const*>(_effect);
return lpe->start_pos;
}
Geom::Point
-KnotHolderEntityRotationAngle::knot_get()
+KnotHolderEntityRotationAngle::knot_get() const
{
- LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
+ LPECopyRotate const *lpe = dynamic_cast<LPECopyRotate const*>(_effect);
return lpe->rot_pos;
}
diff --git a/src/live_effects/lpe-copy_rotate.h b/src/live_effects/lpe-copy_rotate.h
index b14bc4128..1354b980a 100644
--- a/src/live_effects/lpe-copy_rotate.h
+++ b/src/live_effects/lpe-copy_rotate.h
@@ -31,7 +31,7 @@ public:
LPECopyRotate(LivePathEffectObject *lpeobject);
virtual ~LPECopyRotate();
- virtual void doOnApply (SPLPEItem *lpeitem);
+ virtual void doOnApply (SPLPEItem const* lpeitem);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp
index edf8ab55e..af928fff8 100644
--- a/src/live_effects/lpe-curvestitch.cpp
+++ b/src/live_effects/lpe-curvestitch.cpp
@@ -151,7 +151,7 @@ LPECurveStitch::doEffect_path (std::vector<Geom::Path> const & path_in)
}
void
-LPECurveStitch::resetDefaults(SPItem * item)
+LPECurveStitch::resetDefaults(SPItem const* item)
{
Effect::resetDefaults(item);
diff --git a/src/live_effects/lpe-curvestitch.h b/src/live_effects/lpe-curvestitch.h
index f46f2a5d2..38a11b4af 100644
--- a/src/live_effects/lpe-curvestitch.h
+++ b/src/live_effects/lpe-curvestitch.h
@@ -30,7 +30,7 @@ public:
virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
- virtual void resetDefaults(SPItem * item);
+ virtual void resetDefaults(SPItem const* item);
virtual void transform_multiply(Geom::Affine const& postmul, bool set);
diff --git a/src/live_effects/lpe-envelope.cpp b/src/live_effects/lpe-envelope.cpp
index 9fd299ee8..4f5623fba 100644
--- a/src/live_effects/lpe-envelope.cpp
+++ b/src/live_effects/lpe-envelope.cpp
@@ -50,7 +50,7 @@ LPEEnvelope::~LPEEnvelope()
}
void
-LPEEnvelope::doBeforeEffect (SPLPEItem *lpeitem)
+LPEEnvelope::doBeforeEffect (SPLPEItem const* lpeitem)
{
// get the item bounding box
original_bbox(lpeitem);
@@ -225,7 +225,7 @@ LPEEnvelope::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
}
void
-LPEEnvelope::resetDefaults(SPItem * item)
+LPEEnvelope::resetDefaults(SPItem const* item)
{
Effect::resetDefaults(item);
diff --git a/src/live_effects/lpe-envelope.h b/src/live_effects/lpe-envelope.h
index fe1d9561d..b5d6ceb50 100644
--- a/src/live_effects/lpe-envelope.h
+++ b/src/live_effects/lpe-envelope.h
@@ -31,11 +31,11 @@ public:
LPEEnvelope(LivePathEffectObject *lpeobject);
virtual ~LPEEnvelope();
- virtual void doBeforeEffect (SPLPEItem *lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
- virtual void resetDefaults(SPItem * item);
+ virtual void resetDefaults(SPItem const* item);
private:
PathParam bend_path1;
diff --git a/src/live_effects/lpe-extrude.cpp b/src/live_effects/lpe-extrude.cpp
index 4351f3aa0..7f5a00cf8 100644
--- a/src/live_effects/lpe-extrude.cpp
+++ b/src/live_effects/lpe-extrude.cpp
@@ -170,7 +170,7 @@ LPEExtrude::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2
}
void
-LPEExtrude::resetDefaults(SPItem * item)
+LPEExtrude::resetDefaults(SPItem const* item)
{
Effect::resetDefaults(item);
diff --git a/src/live_effects/lpe-extrude.h b/src/live_effects/lpe-extrude.h
index 0c9f11444..491fe4959 100644
--- a/src/live_effects/lpe-extrude.h
+++ b/src/live_effects/lpe-extrude.h
@@ -26,7 +26,7 @@ public:
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
- virtual void resetDefaults(SPItem * item);
+ virtual void resetDefaults(SPItem const* item);
private:
VectorParam extrude_vector;
diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp
index 227185f91..e41bc6f0e 100644
--- a/src/live_effects/lpe-interpolate.cpp
+++ b/src/live_effects/lpe-interpolate.cpp
@@ -99,7 +99,7 @@ LPEInterpolate::doEffect_path (Geom::PathVector const & path_in)
}
void
-LPEInterpolate::resetDefaults(SPItem * item)
+LPEInterpolate::resetDefaults(SPItem const* item)
{
Effect::resetDefaults(item);
diff --git a/src/live_effects/lpe-interpolate.h b/src/live_effects/lpe-interpolate.h
index 3091537f3..679001a81 100644
--- a/src/live_effects/lpe-interpolate.h
+++ b/src/live_effects/lpe-interpolate.h
@@ -29,7 +29,7 @@ public:
virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
- virtual void resetDefaults(SPItem * item);
+ virtual void resetDefaults(SPItem const* item);
private:
PathParam trajectory_path;
ScalarParam number_of_steps;
diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp
index 61e457d35..27652bf0c 100644
--- a/src/live_effects/lpe-knot.cpp
+++ b/src/live_effects/lpe-knot.cpp
@@ -46,7 +46,7 @@ class KnotHolderEntityCrossingSwitcher : public LPEKnotHolderEntity {
public:
KnotHolderEntityCrossingSwitcher(LPEKnot *effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_click(guint state);
};
@@ -531,7 +531,7 @@ collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector<Geom::Path> &paths,
void
-LPEKnot::doBeforeEffect (SPLPEItem *lpeitem)
+LPEKnot::doBeforeEffect (SPLPEItem const* lpeitem)
{
using namespace Geom;
original_bbox(lpeitem);
@@ -631,9 +631,9 @@ KnotHolderEntityCrossingSwitcher::knot_set(Geom::Point const &p, Geom::Point con
}
Geom::Point
-KnotHolderEntityCrossingSwitcher::knot_get()
+KnotHolderEntityCrossingSwitcher::knot_get() const
{
- LPEKnot* lpe = dynamic_cast<LPEKnot *>(_effect);
+ LPEKnot const *lpe = dynamic_cast<LPEKnot const*>(_effect);
return lpe->switcher;
}
diff --git a/src/live_effects/lpe-knot.h b/src/live_effects/lpe-knot.h
index 14c61a4e5..a25607981 100644
--- a/src/live_effects/lpe-knot.h
+++ b/src/live_effects/lpe-knot.h
@@ -56,7 +56,7 @@ public:
LPEKnot(LivePathEffectObject *lpeobject);
virtual ~LPEKnot();
- virtual void doBeforeEffect (SPLPEItem *lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & input_path);
/* the knotholder entity classes must be declared friends */
diff --git a/src/live_effects/lpe-lattice.cpp b/src/live_effects/lpe-lattice.cpp
index 2d04c4d41..8136569e8 100644
--- a/src/live_effects/lpe-lattice.cpp
+++ b/src/live_effects/lpe-lattice.cpp
@@ -173,13 +173,13 @@ LPELattice::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2
}
void
-LPELattice::doBeforeEffect (SPLPEItem *lpeitem)
+LPELattice::doBeforeEffect (SPLPEItem const* lpeitem)
{
original_bbox(lpeitem);
}
void
-LPELattice::resetDefaults(SPItem * item)
+LPELattice::resetDefaults(SPItem const* item)
{
Effect::resetDefaults(item);
diff --git a/src/live_effects/lpe-lattice.h b/src/live_effects/lpe-lattice.h
index f95e33b0b..a44dda3fd 100644
--- a/src/live_effects/lpe-lattice.h
+++ b/src/live_effects/lpe-lattice.h
@@ -31,11 +31,11 @@ public:
LPELattice(LivePathEffectObject *lpeobject);
virtual ~LPELattice();
- virtual void doBeforeEffect (SPLPEItem *lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
- virtual void resetDefaults(SPItem * item);
+ virtual void resetDefaults(SPItem const* item);
protected:
//virtual void addHelperPathsImpl(SPLPEItem *lpeitem, SPDesktop *desktop);
diff --git a/src/live_effects/lpe-line_segment.cpp b/src/live_effects/lpe-line_segment.cpp
index 6619b85ce..2e7240e25 100644
--- a/src/live_effects/lpe-line_segment.cpp
+++ b/src/live_effects/lpe-line_segment.cpp
@@ -43,7 +43,7 @@ LPELineSegment::~LPELineSegment()
}
void
-LPELineSegment::doBeforeEffect (SPLPEItem *lpeitem)
+LPELineSegment::doBeforeEffect (SPLPEItem const* lpeitem)
{
lpetool_get_limiting_bbox_corners(lpeitem->document, bboxA, bboxB);
}
diff --git a/src/live_effects/lpe-line_segment.h b/src/live_effects/lpe-line_segment.h
index b2bb0994f..1a57688b6 100644
--- a/src/live_effects/lpe-line_segment.h
+++ b/src/live_effects/lpe-line_segment.h
@@ -32,7 +32,7 @@ public:
LPELineSegment(LivePathEffectObject *lpeobject);
virtual ~LPELineSegment();
- virtual void doBeforeEffect (SPLPEItem *lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index a56909338..4d4837d8d 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -43,7 +43,7 @@ LPEMirrorSymmetry::~LPEMirrorSymmetry()
}
void
-LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem)
+LPEMirrorSymmetry::doOnApply (SPLPEItem const* lpeitem)
{
using namespace Geom;
diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h
index a37e0d45c..c01d1bf6f 100644
--- a/src/live_effects/lpe-mirror_symmetry.h
+++ b/src/live_effects/lpe-mirror_symmetry.h
@@ -28,7 +28,7 @@ public:
LPEMirrorSymmetry(LivePathEffectObject *lpeobject);
virtual ~LPEMirrorSymmetry();
- virtual void doOnApply (SPLPEItem *lpeitem);
+ virtual void doOnApply (SPLPEItem const* lpeitem);
virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp
index 26d42a94f..192bd17ca 100644
--- a/src/live_effects/lpe-offset.cpp
+++ b/src/live_effects/lpe-offset.cpp
@@ -40,7 +40,7 @@ LPEOffset::~LPEOffset()
}
void
-LPEOffset::doOnApply(SPLPEItem *lpeitem)
+LPEOffset::doOnApply(SPLPEItem const* lpeitem)
{
offset_pt.param_set_and_write_new_value(*(SP_SHAPE(lpeitem)->_curve->first_point()));
}
diff --git a/src/live_effects/lpe-offset.h b/src/live_effects/lpe-offset.h
index f57d41a14..9966fd45d 100644
--- a/src/live_effects/lpe-offset.h
+++ b/src/live_effects/lpe-offset.h
@@ -26,7 +26,7 @@ public:
LPEOffset(LivePathEffectObject *lpeobject);
virtual ~LPEOffset();
- virtual void doOnApply (SPLPEItem *lpeitem);
+ virtual void doOnApply (SPLPEItem const* lpeitem);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp
index 4d4b0c17d..bb37fd42c 100644
--- a/src/live_effects/lpe-parallel.cpp
+++ b/src/live_effects/lpe-parallel.cpp
@@ -32,14 +32,14 @@ class KnotHolderEntityLeftEnd : public LPEKnotHolderEntity {
public:
KnotHolderEntityLeftEnd(LPEParallel *effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
class KnotHolderEntityRightEnd : public LPEKnotHolderEntity {
public:
KnotHolderEntityRightEnd(LPEParallel *effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
} // namespace Pl
@@ -65,7 +65,7 @@ LPEParallel::~LPEParallel()
}
void
-LPEParallel::doOnApply (SPLPEItem *lpeitem)
+LPEParallel::doOnApply (SPLPEItem const* lpeitem)
{
SPCurve const *curve = SP_SHAPE(lpeitem)->_curve;
@@ -143,16 +143,16 @@ KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*or
}
Geom::Point
-KnotHolderEntityLeftEnd::knot_get()
+KnotHolderEntityLeftEnd::knot_get() const
{
- LPEParallel *lpe = dynamic_cast<LPEParallel *>(_effect);
+ LPEParallel const *lpe = dynamic_cast<LPEParallel const*>(_effect);
return lpe->C;
}
Geom::Point
-KnotHolderEntityRightEnd::knot_get()
+KnotHolderEntityRightEnd::knot_get() const
{
- LPEParallel *lpe = dynamic_cast<LPEParallel *>(_effect);
+ LPEParallel const *lpe = dynamic_cast<LPEParallel const*>(_effect);
return lpe->D;
}
diff --git a/src/live_effects/lpe-parallel.h b/src/live_effects/lpe-parallel.h
index e23361675..ff19d690e 100644
--- a/src/live_effects/lpe-parallel.h
+++ b/src/live_effects/lpe-parallel.h
@@ -32,7 +32,7 @@ public:
LPEParallel(LivePathEffectObject *lpeobject);
virtual ~LPEParallel();
- virtual void doOnApply (SPLPEItem *lpeitem);
+ virtual void doOnApply (SPLPEItem const* lpeitem);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
diff --git a/src/live_effects/lpe-perp_bisector.cpp b/src/live_effects/lpe-perp_bisector.cpp
index c528ef692..c2a25a187 100644
--- a/src/live_effects/lpe-perp_bisector.cpp
+++ b/src/live_effects/lpe-perp_bisector.cpp
@@ -38,25 +38,25 @@ class KnotHolderEntityLeftEnd : public KnotHolderEntityEnd {
public:
KnotHolderEntityLeftEnd(LPEPerpBisector *effect) : KnotHolderEntityEnd(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
class KnotHolderEntityRightEnd : public KnotHolderEntityEnd {
public:
KnotHolderEntityRightEnd(LPEPerpBisector *effect) : KnotHolderEntityEnd(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
Geom::Point
-KnotHolderEntityLeftEnd::knot_get() {
- LPEPerpBisector *lpe = dynamic_cast<LPEPerpBisector *>(_effect);
+KnotHolderEntityLeftEnd::knot_get() const {
+ LPEPerpBisector const* lpe = dynamic_cast<LPEPerpBisector const*>(_effect);
return Geom::Point(lpe->C);
}
Geom::Point
-KnotHolderEntityRightEnd::knot_get() {
- LPEPerpBisector *lpe = dynamic_cast<LPEPerpBisector *>(_effect);
+KnotHolderEntityRightEnd::knot_get() const {
+ LPEPerpBisector const* lpe = dynamic_cast<LPEPerpBisector const*>(_effect);
return Geom::Point(lpe->D);
}
@@ -111,7 +111,7 @@ LPEPerpBisector::~LPEPerpBisector()
}
void
-LPEPerpBisector::doOnApply (SPLPEItem */*lpeitem*/)
+LPEPerpBisector::doOnApply (SPLPEItem const*/*lpeitem*/)
{
/* make the path a straight line */
/**
diff --git a/src/live_effects/lpe-perp_bisector.h b/src/live_effects/lpe-perp_bisector.h
index f5a918028..4ff9909a4 100644
--- a/src/live_effects/lpe-perp_bisector.h
+++ b/src/live_effects/lpe-perp_bisector.h
@@ -37,7 +37,7 @@ public:
virtual EffectType effectType () { return PERP_BISECTOR; }
- void doOnApply (SPLPEItem *lpeitem);
+ void doOnApply (SPLPEItem const* lpeitem);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> >
doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp
index aeee77482..c255f8665 100644
--- a/src/live_effects/lpe-perspective_path.cpp
+++ b/src/live_effects/lpe-perspective_path.cpp
@@ -36,7 +36,7 @@ class KnotHolderEntityOffset : public LPEKnotHolderEntity
public:
KnotHolderEntityOffset(LPEPerspectivePath *effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
} // namespace PP
@@ -71,7 +71,7 @@ LPEPerspectivePath::~LPEPerspectivePath()
}
void
-LPEPerspectivePath::doBeforeEffect (SPLPEItem *lpeitem)
+LPEPerspectivePath::doBeforeEffect (SPLPEItem const* lpeitem)
{
original_bbox(lpeitem, true);
}
@@ -165,9 +165,9 @@ KnotHolderEntityOffset::knot_set(Geom::Point const &p, Geom::Point const &origin
}
Geom::Point
-KnotHolderEntityOffset::knot_get()
+KnotHolderEntityOffset::knot_get() const
{
- LPEPerspectivePath* lpe = dynamic_cast<LPEPerspectivePath *>(_effect);
+ LPEPerspectivePath const *lpe = dynamic_cast<LPEPerspectivePath const*>(_effect);
return lpe->orig + Geom::Point(lpe->offsetx, -lpe->offsety);
}
diff --git a/src/live_effects/lpe-perspective_path.h b/src/live_effects/lpe-perspective_path.h
index 14321f52e..a9ee004f9 100644
--- a/src/live_effects/lpe-perspective_path.h
+++ b/src/live_effects/lpe-perspective_path.h
@@ -34,7 +34,7 @@ public:
LPEPerspectivePath(LivePathEffectObject *lpeobject);
virtual ~LPEPerspectivePath();
- virtual void doBeforeEffect (SPLPEItem *lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index b042f8d41..0533c1ed6 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -263,7 +263,7 @@ LPEPowerStroke::~LPEPowerStroke()
void
-LPEPowerStroke::doOnApply(SPLPEItem *lpeitem)
+LPEPowerStroke::doOnApply(SPLPEItem const* lpeitem)
{
if (SP_IS_SHAPE(lpeitem)) {
std::vector<Geom::Point> points;
diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h
index e6c915234..7bc736820 100644
--- a/src/live_effects/lpe-powerstroke.h
+++ b/src/live_effects/lpe-powerstroke.h
@@ -27,7 +27,7 @@ public:
virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
- virtual void doOnApply(SPLPEItem *lpeitem);
+ virtual void doOnApply(SPLPEItem const* lpeitem);
// methods called by path-manipulator upon edits
void adjustForNewPath(std::vector<Geom::Path> const & path_in);
diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp
index f52977fcb..96b0bb0ae 100644
--- a/src/live_effects/lpe-rough-hatches.cpp
+++ b/src/live_effects/lpe-rough-hatches.cpp
@@ -539,7 +539,7 @@ LPERoughHatches::smoothSnake(std::vector<std::vector<Point> > const &linearSnake
}
void
-LPERoughHatches::doBeforeEffect (SPLPEItem */*lpeitem*/)
+LPERoughHatches::doBeforeEffect (SPLPEItem const*/*lpeitem*/)
{
using namespace Geom;
top_edge_variation.resetRandomizer();
@@ -555,7 +555,7 @@ LPERoughHatches::doBeforeEffect (SPLPEItem */*lpeitem*/)
void
-LPERoughHatches::resetDefaults(SPItem * item)
+LPERoughHatches::resetDefaults(SPItem const* item)
{
Effect::resetDefaults(item);
diff --git a/src/live_effects/lpe-rough-hatches.h b/src/live_effects/lpe-rough-hatches.h
index 5051b313a..f8454e1ea 100644
--- a/src/live_effects/lpe-rough-hatches.h
+++ b/src/live_effects/lpe-rough-hatches.h
@@ -31,9 +31,9 @@ public:
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> >
doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
- virtual void resetDefaults(SPItem * item);
+ virtual void resetDefaults(SPItem const* item);
- virtual void doBeforeEffect(SPLPEItem * item);
+ virtual void doBeforeEffect(SPLPEItem const* item);
std::vector<double>
generateLevels(Geom::Interval const &domain, double x_org);
diff --git a/src/live_effects/lpe-skeleton.cpp b/src/live_effects/lpe-skeleton.cpp
index 65faef216..c61e9773f 100644
--- a/src/live_effects/lpe-skeleton.cpp
+++ b/src/live_effects/lpe-skeleton.cpp
@@ -95,7 +95,7 @@ class KnotHolderEntityMyHandle : public LPEKnotHolderEntity
public:
// the set() and get() methods must be implemented, click() is optional
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
//virtual void knot_click(guint state);
};
diff --git a/src/live_effects/lpe-sketch.cpp b/src/live_effects/lpe-sketch.cpp
index ccc508144..8ad0e616f 100644
--- a/src/live_effects/lpe-sketch.cpp
+++ b/src/live_effects/lpe-sketch.cpp
@@ -362,7 +362,7 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_
}
void
-LPESketch::doBeforeEffect (SPLPEItem */*lpeitem*/)
+LPESketch::doBeforeEffect (SPLPEItem const*/*lpeitem*/)
{
//init random parameters.
parallel_offset.resetRandomizer();
diff --git a/src/live_effects/lpe-sketch.h b/src/live_effects/lpe-sketch.h
index b95f57682..3bef0cf5e 100644
--- a/src/live_effects/lpe-sketch.h
+++ b/src/live_effects/lpe-sketch.h
@@ -31,7 +31,7 @@ public:
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
- virtual void doBeforeEffect (SPLPEItem *lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
private:
// add the parameters for your effect here:
diff --git a/src/live_effects/lpe-spiro.h b/src/live_effects/lpe-spiro.h
index f3cdbda79..edce42280 100644
--- a/src/live_effects/lpe-spiro.h
+++ b/src/live_effects/lpe-spiro.h
@@ -18,7 +18,7 @@ public:
LPESpiro(LivePathEffectObject *lpeobject);
virtual ~LPESpiro();
- virtual LPEPathFlashType pathFlashType() { return SUPPRESS_FLASH; }
+ virtual LPEPathFlashType pathFlashType() const { return SUPPRESS_FLASH; }
virtual void doEffect(SPCurve * curve);
diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp
index b40d404ae..dbebdf7fb 100644
--- a/src/live_effects/lpe-tangent_to_curve.cpp
+++ b/src/live_effects/lpe-tangent_to_curve.cpp
@@ -36,14 +36,14 @@ class KnotHolderEntityAttachPt : public LPEKnotHolderEntity {
public:
KnotHolderEntityAttachPt(LPETangentToCurve *effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
class KnotHolderEntityLeftEnd : public LPEKnotHolderEntity {
public:
KnotHolderEntityLeftEnd(LPETangentToCurve *effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
class KnotHolderEntityRightEnd : public LPEKnotHolderEntity
@@ -51,7 +51,7 @@ class KnotHolderEntityRightEnd : public LPEKnotHolderEntity
public:
KnotHolderEntityRightEnd(LPETangentToCurve *effect) : LPEKnotHolderEntity(effect) {};
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
};
} // namespace TtC
@@ -172,23 +172,23 @@ KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*or
}
Geom::Point
-KnotHolderEntityAttachPt::knot_get()
+KnotHolderEntityAttachPt::knot_get() const
{
- LPETangentToCurve* lpe = dynamic_cast<LPETangentToCurve *>(_effect);
+ LPETangentToCurve const *lpe = dynamic_cast<LPETangentToCurve const*>(_effect);
return lpe->ptA;
}
Geom::Point
-KnotHolderEntityLeftEnd::knot_get()
+KnotHolderEntityLeftEnd::knot_get() const
{
- LPETangentToCurve *lpe = dynamic_cast<LPETangentToCurve *>(_effect);
+ LPETangentToCurve const *lpe = dynamic_cast<LPETangentToCurve const*>(_effect);
return lpe->C;
}
Geom::Point
-KnotHolderEntityRightEnd::knot_get()
+KnotHolderEntityRightEnd::knot_get() const
{
- LPETangentToCurve *lpe = dynamic_cast<LPETangentToCurve *>(_effect);
+ LPETangentToCurve const *lpe = dynamic_cast<LPETangentToCurve const*>(_effect);
return lpe->D;
}
diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp
index 7e4b5f5fe..f7b2beeba 100644
--- a/src/live_effects/lpe-vonkoch.cpp
+++ b/src/live_effects/lpe-vonkoch.cpp
@@ -241,7 +241,7 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
*/
void
-LPEVonKoch::doBeforeEffect (SPLPEItem *lpeitem)
+LPEVonKoch::doBeforeEffect (SPLPEItem const* lpeitem)
{
using namespace Geom;
original_bbox(lpeitem);
@@ -269,7 +269,7 @@ LPEVonKoch::doBeforeEffect (SPLPEItem *lpeitem)
void
-LPEVonKoch::resetDefaults(SPItem * item)
+LPEVonKoch::resetDefaults(SPItem const* item)
{
Effect::resetDefaults(item);
diff --git a/src/live_effects/lpe-vonkoch.h b/src/live_effects/lpe-vonkoch.h
index 7862cdbb5..2ea7c8169 100644
--- a/src/live_effects/lpe-vonkoch.h
+++ b/src/live_effects/lpe-vonkoch.h
@@ -51,9 +51,9 @@ public:
virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
- virtual void resetDefaults(SPItem * item);
+ virtual void resetDefaults(SPItem const* item);
- virtual void doBeforeEffect(SPLPEItem * item);
+ virtual void doBeforeEffect(SPLPEItem const* item);
//Usefull??
// protected:
diff --git a/src/live_effects/lpegroupbbox.cpp b/src/live_effects/lpegroupbbox.cpp
index e2378265a..2a1b70a6a 100644
--- a/src/live_effects/lpegroupbbox.cpp
+++ b/src/live_effects/lpegroupbbox.cpp
@@ -22,7 +22,7 @@ namespace LivePathEffect {
* or of the transformed lpeitem (\c absolute = \c true) using sp_item_i2doc_affine.
* @post Updated values of boundingbox_X and boundingbox_Y. These intervals are set to empty intervals when the precondition is not met.
*/
-void GroupBBoxEffect::original_bbox(SPLPEItem *lpeitem, bool absolute)
+void GroupBBoxEffect::original_bbox(SPLPEItem const* lpeitem, bool absolute)
{
// Get item bounding box
Geom::Affine transform;
diff --git a/src/live_effects/lpegroupbbox.h b/src/live_effects/lpegroupbbox.h
index 57577d20f..cc14203d1 100644
--- a/src/live_effects/lpegroupbbox.h
+++ b/src/live_effects/lpegroupbbox.h
@@ -22,7 +22,7 @@ protected:
Geom::Interval boundingbox_Y;
//This sets boundingbox_X and boundingbox_Y
- void original_bbox(SPLPEItem *lpeitem, bool absolute = false);
+ void original_bbox(SPLPEItem const* lpeitem, bool absolute = false);
};
}; //namespace LivePathEffect
diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h
index d7aa299aa..fafb1beca 100644
--- a/src/live_effects/parameter/bool.h
+++ b/src/live_effects/parameter/bool.h
@@ -36,10 +36,9 @@ public:
void param_setValue(bool newvalue);
virtual void param_set_default();
- bool get_value() { return value; };
+ bool get_value() const { return value; };
- inline operator bool()
- { return value; };
+ inline operator bool() const { return value; };
private:
BoolParam(const BoolParam&);
diff --git a/src/live_effects/parameter/enum.h b/src/live_effects/parameter/enum.h
index 2a1b07b47..2340663c3 100644
--- a/src/live_effects/parameter/enum.h
+++ b/src/live_effects/parameter/enum.h
@@ -68,8 +68,9 @@ public:
return value;
}
- inline operator E()
- { return value; };
+ inline operator E() const {
+ return value;
+ };
void param_set_default() {
param_set_value(defvalue);
diff --git a/src/live_effects/parameter/originalpath.h b/src/live_effects/parameter/originalpath.h
index 7dd17edb0..b3feec41f 100644
--- a/src/live_effects/parameter/originalpath.h
+++ b/src/live_effects/parameter/originalpath.h
@@ -31,7 +31,7 @@ public:
/** Disable the canvas indicators of parent class by overriding this method */
virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {};
/** Disable the canvas indicators of parent class by overriding this method */
- virtual void addCanvasIndicators(SPLPEItem * /*lpeitem*/, std::vector<Geom::PathVector> & /*hp_vec*/) {};
+ virtual void addCanvasIndicators(SPLPEItem const* /*lpeitem*/, std::vector<Geom::PathVector> & /*hp_vec*/) {};
protected:
virtual void linked_modified_callback(SPObject *linked_obj, guint flags);
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index 4785d5455..785ada92e 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -59,9 +59,9 @@ public:
virtual Glib::ustring * param_getTooltip() { return &param_tooltip; };
// overload these for your particular parameter to make it provide knotholder handles or canvas helperpaths
- virtual bool providesKnotHolderEntities() { return false; }
+ virtual bool providesKnotHolderEntities() const { return false; }
virtual void addKnotHolderEntities(KnotHolder */*knotholder*/, SPDesktop */*desktop*/, SPItem */*item*/) {};
- virtual void addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector<Geom::PathVector> &/*hp_vec*/) {};
+ virtual void addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector<Geom::PathVector> &/*hp_vec*/) {};
virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {};
virtual void param_setup_nodepath(Inkscape::NodePath::Path */*np*/) {};
@@ -112,8 +112,7 @@ public:
virtual Gtk::Widget * param_newWidget();
- inline operator gdouble()
- { return value; };
+ inline operator gdouble() const { return value; };
protected:
gdouble value;
diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp
index 1b3d7417d..eca0d7a22 100644
--- a/src/live_effects/parameter/path.cpp
+++ b/src/live_effects/parameter/path.cpp
@@ -77,7 +77,7 @@ PathParam::~PathParam()
}
std::vector<Geom::Path> const &
-PathParam::get_pathvector()
+PathParam::get_pathvector() const
{
return _pathvector;
}
@@ -231,7 +231,7 @@ PathParam::param_setup_nodepath(Inkscape::NodePath::Path *)
}
void
-PathParam::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec)
+PathParam::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector<Geom::PathVector> &hp_vec)
{
hp_vec.push_back(_pathvector);
}
diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h
index a4f46f11f..112a1ea13 100644
--- a/src/live_effects/parameter/path.h
+++ b/src/live_effects/parameter/path.h
@@ -31,7 +31,7 @@ public:
const gchar * default_value = "M0,0 L1,1");
virtual ~PathParam();
- std::vector<Geom::Path> const & get_pathvector();
+ std::vector<Geom::Path> const & get_pathvector() const;
Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2();
virtual Gtk::Widget * param_newWidget();
@@ -46,7 +46,7 @@ public:
virtual void param_editOncanvas(SPItem * item, SPDesktop * dt);
virtual void param_setup_nodepath(Inkscape::NodePath::Path *np);
- virtual void addCanvasIndicators(SPLPEItem *lpeitem, std::vector<Geom::PathVector> &hp_vec);
+ virtual void addCanvasIndicators(SPLPEItem const* lpeitem, std::vector<Geom::PathVector> &hp_vec);
virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/);
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index 2be87e048..53866f278 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -133,7 +133,7 @@ public:
virtual ~PointParamKnotHolderEntity() {}
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_click(guint state);
private:
@@ -149,7 +149,7 @@ PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*
}
Geom::Point
-PointParamKnotHolderEntity::knot_get()
+PointParamKnotHolderEntity::knot_get() const
{
return *pparam;
}
diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h
index f2397753e..319835bb3 100644
--- a/src/live_effects/parameter/point.h
+++ b/src/live_effects/parameter/point.h
@@ -47,7 +47,7 @@ public:
void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
- virtual bool providesKnotHolderEntities() { return true; }
+ virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
private:
diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp
index 93161ec0d..fecdfeda8 100644
--- a/src/live_effects/parameter/powerstrokepointarray.cpp
+++ b/src/live_effects/parameter/powerstrokepointarray.cpp
@@ -124,11 +124,11 @@ public:
virtual ~PowerStrokePointArrayParamKnotHolderEntity() {}
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_click(guint state);
/** Checks whether the index falls within the size of the parameter's vector */
- bool valid_index(unsigned int index) {
+ bool valid_index(unsigned int index) const {
return (_pparam->_vector.size() > index);
};
@@ -164,7 +164,7 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom:
}
Geom::Point
-PowerStrokePointArrayParamKnotHolderEntity::knot_get()
+PowerStrokePointArrayParamKnotHolderEntity::knot_get() const
{
using namespace Geom;
diff --git a/src/live_effects/parameter/powerstrokepointarray.h b/src/live_effects/parameter/powerstrokepointarray.h
index 0e08d78fe..e1fa440f2 100644
--- a/src/live_effects/parameter/powerstrokepointarray.h
+++ b/src/live_effects/parameter/powerstrokepointarray.h
@@ -37,12 +37,12 @@ public:
void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
- virtual bool providesKnotHolderEntities() { return true; }
+ virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
void set_pwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in, Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_normal_in);
- Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2() { return last_pwd2; }
- Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2_normal() { return last_pwd2_normal; }
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2() const { return last_pwd2; }
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2_normal() const { return last_pwd2_normal; }
void recalculate_controlpoints_for_new_pwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
diff --git a/src/live_effects/parameter/random.h b/src/live_effects/parameter/random.h
index b72f6f976..ca4440336 100644
--- a/src/live_effects/parameter/random.h
+++ b/src/live_effects/parameter/random.h
@@ -42,8 +42,7 @@ public:
void resetRandomizer();
operator gdouble();
- inline gdouble get_value()
- { return value; } ;
+ inline gdouble get_value() { return value; } ;
protected:
long startseed;
diff --git a/src/live_effects/parameter/text.h b/src/live_effects/parameter/text.h
index 85833885e..62de70eec 100644
--- a/src/live_effects/parameter/text.h
+++ b/src/live_effects/parameter/text.h
@@ -46,7 +46,7 @@ public:
const double t, const double length, bool use_curvature = false);
void setAnchor(double x_value, double y_value);
- const Glib::ustring get_value() { return defvalue; };
+ const Glib::ustring get_value() const { return defvalue; };
private:
TextParam(const TextParam&);
diff --git a/src/live_effects/parameter/unit.cpp b/src/live_effects/parameter/unit.cpp
index 36b6efacc..7a2ce6f65 100644
--- a/src/live_effects/parameter/unit.cpp
+++ b/src/live_effects/parameter/unit.cpp
@@ -59,7 +59,7 @@ UnitParam::param_set_value(SPUnit const *val)
}
const gchar *
-UnitParam::get_abbreviation()
+UnitParam::get_abbreviation() const
{
return sp_unit_get_abbreviation(unit);
}
diff --git a/src/live_effects/parameter/unit.h b/src/live_effects/parameter/unit.h
index 3d417fcd6..ea7a0112a 100644
--- a/src/live_effects/parameter/unit.h
+++ b/src/live_effects/parameter/unit.h
@@ -30,11 +30,11 @@ public:
virtual gchar * param_getSVGValue() const;
virtual void param_set_default();
void param_set_value(SPUnit const *val);
- const gchar *get_abbreviation();
+ const gchar *get_abbreviation() const;
virtual Gtk::Widget * param_newWidget();
- operator SPUnit const *() { return unit; }
+ operator SPUnit const *() const { return unit; }
private:
SPUnit const *unit;
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index a20c46042..edd6b863f 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -154,7 +154,7 @@ public:
param->setOrigin(s);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
};
- virtual Geom::Point knot_get(){
+ virtual Geom::Point knot_get() const {
return param->origin;
};
virtual void knot_click(guint /*state*/){
@@ -176,7 +176,7 @@ public:
param->setVector(s);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
};
- virtual Geom::Point knot_get(){
+ virtual Geom::Point knot_get() const {
return param->origin + param->vector;
};
virtual void knot_click(guint /*state*/){
diff --git a/src/live_effects/parameter/vector.h b/src/live_effects/parameter/vector.h
index f82affe16..35ca04437 100644
--- a/src/live_effects/parameter/vector.h
+++ b/src/live_effects/parameter/vector.h
@@ -52,7 +52,7 @@ public:
void set_origin_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
void set_oncanvas_color(guint32 color);
- virtual bool providesKnotHolderEntities() { return true; }
+ virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
private:
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 1c7f76a7f..54aef2b71 100644
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -95,7 +95,7 @@ KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop)
/* handle for horizontal rounding radius */
class RectKnotHolderEntityRX : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ 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);
};
@@ -103,7 +103,7 @@ public:
/* handle for vertical rounding radius */
class RectKnotHolderEntityRY : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ 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);
};
@@ -111,7 +111,7 @@ public:
/* handle for width/height adjustment */
class RectKnotHolderEntityWH : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
protected:
@@ -121,12 +121,12 @@ protected:
/* handle for x/y adjustment */
class RectKnotHolderEntityXY : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
Geom::Point
-RectKnotHolderEntityRX::knot_get()
+RectKnotHolderEntityRX::knot_get() const
{
SPRect *rect = SP_RECT(item);
@@ -175,7 +175,7 @@ RectKnotHolderEntityRX::knot_click(guint state)
}
Geom::Point
-RectKnotHolderEntityRY::knot_get()
+RectKnotHolderEntityRY::knot_get() const
{
SPRect *rect = SP_RECT(item);
@@ -247,7 +247,7 @@ static void sp_rect_clamp_radii(SPRect *rect)
}
Geom::Point
-RectKnotHolderEntityWH::knot_get()
+RectKnotHolderEntityWH::knot_get() const
{
SPRect *rect = SP_RECT(item);
@@ -334,7 +334,7 @@ RectKnotHolderEntityWH::knot_set(Geom::Point const &p, Geom::Point const &origin
}
Geom::Point
-RectKnotHolderEntityXY::knot_get()
+RectKnotHolderEntityXY::knot_get() const
{
SPRect *rect = SP_RECT(item);
@@ -467,15 +467,15 @@ RectKnotHolder::RectKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel
class Box3DKnotHolderEntity : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get() = 0;
+ virtual Geom::Point knot_get() const = 0;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) = 0;
- Geom::Point knot_get_generic(SPItem *item, unsigned int knot_id);
+ 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);
};
Geom::Point
-Box3DKnotHolderEntity::knot_get_generic(SPItem *item, unsigned int knot_id)
+Box3DKnotHolderEntity::knot_get_generic(SPItem *item, unsigned int knot_id) const
{
return box3d_get_corner_screen(SP_BOX3D(item), knot_id);
}
@@ -503,108 +503,108 @@ Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom
class Box3DKnotHolderEntity0 : public Box3DKnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class Box3DKnotHolderEntity1 : public Box3DKnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class Box3DKnotHolderEntity2 : public Box3DKnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class Box3DKnotHolderEntity3 : public Box3DKnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class Box3DKnotHolderEntity4 : public Box3DKnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class Box3DKnotHolderEntity5 : public Box3DKnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class Box3DKnotHolderEntity6 : public Box3DKnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class Box3DKnotHolderEntity7 : public Box3DKnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
class Box3DKnotHolderEntityCenter : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
Geom::Point
-Box3DKnotHolderEntity0::knot_get()
+Box3DKnotHolderEntity0::knot_get() const
{
return knot_get_generic(item, 0);
}
Geom::Point
-Box3DKnotHolderEntity1::knot_get()
+Box3DKnotHolderEntity1::knot_get() const
{
return knot_get_generic(item, 1);
}
Geom::Point
-Box3DKnotHolderEntity2::knot_get()
+Box3DKnotHolderEntity2::knot_get() const
{
return knot_get_generic(item, 2);
}
Geom::Point
-Box3DKnotHolderEntity3::knot_get()
+Box3DKnotHolderEntity3::knot_get() const
{
return knot_get_generic(item, 3);
}
Geom::Point
-Box3DKnotHolderEntity4::knot_get()
+Box3DKnotHolderEntity4::knot_get() const
{
return knot_get_generic(item, 4);
}
Geom::Point
-Box3DKnotHolderEntity5::knot_get()
+Box3DKnotHolderEntity5::knot_get() const
{
return knot_get_generic(item, 5);
}
Geom::Point
-Box3DKnotHolderEntity6::knot_get()
+Box3DKnotHolderEntity6::knot_get() const
{
return knot_get_generic(item, 6);
}
Geom::Point
-Box3DKnotHolderEntity7::knot_get()
+Box3DKnotHolderEntity7::knot_get() const
{
return knot_get_generic(item, 7);
}
Geom::Point
-Box3DKnotHolderEntityCenter::knot_get()
+Box3DKnotHolderEntityCenter::knot_get() const
{
return box3d_get_center_screen(SP_BOX3D(item));
}
@@ -738,28 +738,28 @@ Box3DKnotHolder::Box3DKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderR
class ArcKnotHolderEntityStart : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ 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);
};
class ArcKnotHolderEntityEnd : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ 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);
};
class ArcKnotHolderEntityRX : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ 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);
};
class ArcKnotHolderEntityRY : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ 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);
};
@@ -806,9 +806,9 @@ ArcKnotHolderEntityStart::knot_set(Geom::Point const &p, Geom::Point const &/*or
}
Geom::Point
-ArcKnotHolderEntityStart::knot_get()
+ArcKnotHolderEntityStart::knot_get() const
{
- SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
+ SPGenericEllipse const *ge = SP_GENERICELLIPSE(item);
SPArc *arc = SP_ARC(item);
return sp_arc_get_xy(arc, ge->start);
@@ -849,9 +849,9 @@ ArcKnotHolderEntityEnd::knot_set(Geom::Point const &p, Geom::Point const &/*orig
}
Geom::Point
-ArcKnotHolderEntityEnd::knot_get()
+ArcKnotHolderEntityEnd::knot_get() const
{
- SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
+ SPGenericEllipse const *ge = SP_GENERICELLIPSE(item);
SPArc *arc = SP_ARC(item);
return sp_arc_get_xy(arc, ge->end);
@@ -887,9 +887,9 @@ ArcKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origi
}
Geom::Point
-ArcKnotHolderEntityRX::knot_get()
+ArcKnotHolderEntityRX::knot_get() const
{
- SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
+ SPGenericEllipse const *ge = SP_GENERICELLIPSE(item);
return (Geom::Point(ge->cx.computed, ge->cy.computed) - Geom::Point(ge->rx.computed, 0));
}
@@ -922,9 +922,9 @@ ArcKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origi
}
Geom::Point
-ArcKnotHolderEntityRY::knot_get()
+ArcKnotHolderEntityRY::knot_get() const
{
- SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
+ SPGenericEllipse const *ge = SP_GENERICELLIPSE(item);
return (Geom::Point(ge->cx.computed, ge->cy.computed) - Geom::Point(0, ge->ry.computed));
}
@@ -978,14 +978,14 @@ ArcKnotHolder::ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRelea
class StarKnotHolderEntity1 : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ 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);
};
class StarKnotHolderEntity2 : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ 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);
};
@@ -1046,22 +1046,22 @@ StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origi
}
Geom::Point
-StarKnotHolderEntity1::knot_get()
+StarKnotHolderEntity1::knot_get() const
{
g_assert(item != NULL);
- SPStar *star = SP_STAR(item);
+ SPStar const *star = SP_STAR(item);
return sp_star_get_xy(star, SP_STAR_POINT_KNOT1, 0);
}
Geom::Point
-StarKnotHolderEntity2::knot_get()
+StarKnotHolderEntity2::knot_get() const
{
g_assert(item != NULL);
- SPStar *star = SP_STAR(item);
+ SPStar const *star = SP_STAR(item);
return sp_star_get_xy(star, SP_STAR_POINT_KNOT2, 0);
}
@@ -1122,14 +1122,14 @@ StarKnotHolder::StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel
class SpiralKnotHolderEntityInner : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ 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);
};
class SpiralKnotHolderEntityOuter : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
@@ -1264,17 +1264,17 @@ SpiralKnotHolderEntityOuter::knot_set(Geom::Point const &p, Geom::Point const &/
}
Geom::Point
-SpiralKnotHolderEntityInner::knot_get()
+SpiralKnotHolderEntityInner::knot_get() const
{
- SPSpiral *spiral = SP_SPIRAL(item);
+ SPSpiral const *spiral = SP_SPIRAL(item);
return sp_spiral_get_xy(spiral, spiral->t0);
}
Geom::Point
-SpiralKnotHolderEntityOuter::knot_get()
+SpiralKnotHolderEntityOuter::knot_get() const
{
- SPSpiral *spiral = SP_SPIRAL(item);
+ SPSpiral const *spiral = SP_SPIRAL(item);
return sp_spiral_get_xy(spiral, 1.0);
}
@@ -1317,7 +1317,7 @@ SpiralKnotHolder::SpiralKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolde
class OffsetKnotHolderEntity : public KnotHolderEntity {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
@@ -1335,9 +1335,9 @@ OffsetKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*orig
Geom::Point
-OffsetKnotHolderEntity::knot_get()
+OffsetKnotHolderEntity::knot_get() const
{
- SPOffset *offset = SP_OFFSET(item);
+ SPOffset const *offset = SP_OFFSET(item);
Geom::Point np;
sp_offset_top_point(offset,&np);
@@ -1360,14 +1360,14 @@ OffsetKnotHolder::OffsetKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolde
// sense logically.
class FlowtextKnotHolderEntity : public RectKnotHolderEntityWH {
public:
- virtual Geom::Point knot_get();
+ virtual Geom::Point knot_get() const;
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
};
Geom::Point
-FlowtextKnotHolderEntity::knot_get()
+FlowtextKnotHolderEntity::knot_get() const
{
- SPRect *rect = SP_RECT(item);
+ SPRect const *rect = SP_RECT(item);
return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed);
}
diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h
index 77ffe429a..c5d972966 100644
--- a/src/preferences-skeleton.h
+++ b/src/preferences-skeleton.h
@@ -369,7 +369,6 @@ static char const preferences_skeleton[] =
" </group>\n"
" <group id=\"workarounds\"\n"
" colorsontop=\"0\"\n"
-" floatallowed=\"0\"\n"
" partialdynamic=\"0\"/>\n"
" </group>\n"
"\n"
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 3b1028ab8..946858ec4 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -2892,7 +2892,7 @@ void sp_selection_to_guides(SPDesktop *desktop)
/*
* Convert <g> to <symbol>, leaving all <use> elements referencing group unchanged.
*/
-void sp_selection_symbol(SPDesktop *desktop, bool apply )
+void sp_selection_symbol(SPDesktop *desktop, bool /*apply*/ )
{
if (desktop == NULL) {
diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp
index 9ececbb3b..5af75a9a5 100644
--- a/src/shortcuts.cpp
+++ b/src/shortcuts.cpp
@@ -420,7 +420,7 @@ void sp_shortcut_file_export_do(char const *exportname) {
* Element (b) is used in shortcut lookup and contains an uppercase version of the gdk_keyval_name,
* or a gdk_keyval_name name and the "Shift" modifier for Shift altered hardware code keys (see get_group0_keyval() for explanation)
*/
-void sp_shortcut_delete_from_file(char const *action, unsigned int const shortcut) {
+void sp_shortcut_delete_from_file(char const * /*action*/, unsigned int const shortcut) {
char const *filename = get_path(USER, KEYS, "default.xml");
diff --git a/src/sp-animation.cpp b/src/sp-animation.cpp
deleted file mode 100644
index 2951a76fd..000000000
--- a/src/sp-animation.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/** \file
- * SVG <animate> implementation.
- *
- * N.B. This file is currently just a stub file with no meaningful implementation.
- */
-/*
- * Authors:
- * Lauris Kaplinski <lauris@kaplinski.com>
- * Abhishek Sharma
- *
- * Copyright (C) 2002 Lauris Kaplinski
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "sp-animation.h"
-
-#if 0
-/* Feel free to remove this function and its calls. */
-static void log_set_attr(char const *const classname, unsigned int const key, char const *const value)
-{
- unsigned char const *const attr_name = sp_attribute_name(key);
- if (value) {
- g_print("%s: Set %s=%s\n", classname, attr_name, value);
- } else {
- g_print("%s: unset %s.\n", classname, attr_name);
- }
-}
-#else
-# define log_set_attr(_classname, _key, _value) static_cast<void>(0)
-#endif
-
-/* Animation base class */
-
-static void sp_animation_class_init(SPAnimationClass *klass);
-static void sp_animation_init(SPAnimation *animation);
-
-static void sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
-static void sp_animation_release(SPObject *object);
-static void sp_animation_set(SPObject *object, unsigned int key, gchar const *value);
-
-static SPObjectClass *animation_parent_class;
-
-GType sp_animation_get_type(void)
-{
- static GType animation_type = 0;
-
- if (!animation_type) {
- GTypeInfo animation_info = {
- sizeof(SPAnimationClass),
- NULL, NULL,
- (GClassInitFunc) sp_animation_class_init,
- NULL, NULL,
- sizeof(SPAnimation),
- 16,
- (GInstanceInitFunc) sp_animation_init,
- NULL, /* value_table */
- };
- animation_type = g_type_register_static(SP_TYPE_OBJECT, "SPAnimation", &animation_info, (GTypeFlags)0);
- }
- return animation_type;
-}
-
-static void sp_animation_class_init(SPAnimationClass *klass)
-{
- //GObjectClass *gobject_class = (GObjectClass *) klass;
- SPObjectClass *sp_object_class = (SPObjectClass *) klass;
-
- animation_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass);
-
- sp_object_class->build = sp_animation_build;
- sp_object_class->release = sp_animation_release;
- sp_object_class->set = sp_animation_set;
-}
-
-static void sp_animation_init(SPAnimation */*animation*/)
-{
-}
-
-
-static void sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
-{
- if (((SPObjectClass *) animation_parent_class)->build)
- ((SPObjectClass *) animation_parent_class)->build(object, document, repr);
-
- object->readAttr( "xlink:href" );
- object->readAttr( "attributeName" );
- object->readAttr( "attributeType" );
- object->readAttr( "begin" );
- object->readAttr( "dur" );
- object->readAttr( "end" );
- object->readAttr( "min" );
- object->readAttr( "max" );
- object->readAttr( "restart" );
- object->readAttr( "repeatCount" );
- object->readAttr( "repeatDur" );
- object->readAttr( "fill" );
-}
-
-static void sp_animation_release(SPObject */*object*/)
-{
-}
-
-static void sp_animation_set(SPObject *object, unsigned int key, gchar const *value)
-{
- //SPAnimation *animation = SP_ANIMATION(object);
-
- log_set_attr("SPAnimation", key, value);
-
- if (((SPObjectClass *) animation_parent_class)->set)
- ((SPObjectClass *) animation_parent_class)->set(object, key, value);
-}
-
-/* Interpolated animation base class */
-
-static void sp_ianimation_class_init(SPIAnimationClass *klass);
-static void sp_ianimation_init(SPIAnimation *animation);
-
-static void sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
-static void sp_ianimation_release(SPObject *object);
-static void sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value);
-
-static SPObjectClass *ianimation_parent_class;
-
-GType sp_ianimation_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof(SPIAnimationClass),
- NULL, NULL,
- (GClassInitFunc) sp_ianimation_class_init,
- NULL, NULL,
- sizeof(SPIAnimation),
- 16,
- (GInstanceInitFunc) sp_ianimation_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_OBJECT, "SPIAnimation", &info, (GTypeFlags)0);
- }
- return type;
-}
-
-static void sp_ianimation_class_init(SPIAnimationClass *klass)
-{
- //GObjectClass *gobject_class = (GObjectClass *) klass;
- SPObjectClass *sp_object_class = (SPObjectClass *) klass;
-
- ianimation_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass);
-
- sp_object_class->build = sp_ianimation_build;
- sp_object_class->release = sp_ianimation_release;
- sp_object_class->set = sp_ianimation_set;
-}
-
-static void sp_ianimation_init(SPIAnimation */*animation*/)
-{
-}
-
-
-static void sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
-{
- if (((SPObjectClass *) ianimation_parent_class)->build)
- ((SPObjectClass *) ianimation_parent_class)->build(object, document, repr);
-
- object->readAttr( "calcMode" );
- object->readAttr( "values" );
- object->readAttr( "keyTimes" );
- object->readAttr( "keySplines" );
- object->readAttr( "from" );
- object->readAttr( "to" );
- object->readAttr( "by" );
- object->readAttr( "additive" );
- object->readAttr( "accumulate" );
-}
-
-static void sp_ianimation_release(SPObject */*object*/)
-{
-}
-
-static void sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value)
-{
- //SPIAnimation *ianimation = SP_IANIMATION(object);
-
- log_set_attr("SPIAnimation", key, value);
-
- if (((SPObjectClass *) ianimation_parent_class)->set)
- ((SPObjectClass *) ianimation_parent_class)->set(object, key, value);
-}
-
-/* SVG <animate> */
-
-static void sp_animate_class_init(SPAnimateClass *klass);
-static void sp_animate_init(SPAnimate *animate);
-
-static void sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
-static void sp_animate_release(SPObject *object);
-static void sp_animate_set(SPObject *object, unsigned int key, gchar const *value);
-
-static SPIAnimationClass *animate_parent_class;
-
-GType sp_animate_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof(SPAnimateClass),
- NULL, NULL,
- (GClassInitFunc) sp_animate_class_init,
- NULL, NULL,
- sizeof(SPAnimate),
- 16,
- (GInstanceInitFunc) sp_animate_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_IANIMATION, "SPAnimate", &info, (GTypeFlags)0);
- }
- return type;
-}
-
-static void sp_animate_class_init(SPAnimateClass *klass)
-{
- //GObjectClass *gobject_class = (GObjectClass *) klass;
- SPObjectClass *sp_object_class = (SPObjectClass *) klass;
-
- animate_parent_class = (SPIAnimationClass*)g_type_class_peek_parent(klass);
-
- sp_object_class->build = sp_animate_build;
- sp_object_class->release = sp_animate_release;
- sp_object_class->set = sp_animate_set;
-}
-
-static void sp_animate_init(SPAnimate */*animate*/)
-{
-}
-
-
-static void sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
-{
- if (((SPObjectClass *) animate_parent_class)->build)
- ((SPObjectClass *) animate_parent_class)->build(object, document, repr);
-}
-
-static void sp_animate_release(SPObject */*object*/)
-{
-}
-
-static void sp_animate_set(SPObject *object, unsigned int key, gchar const *value)
-{
- //SPAnimate *animate = SP_ANIMATE(object);
-
- log_set_attr("SPAnimate", key, value);
-
- if (((SPObjectClass *) animate_parent_class)->set)
- ((SPObjectClass *) animate_parent_class)->set(object, key, value);
-}
-
-
-/*
- 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/sp-animation.h b/src/sp-animation.h
deleted file mode 100644
index 407419f5b..000000000
--- a/src/sp-animation.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef __SP_ANIMATION_H__
-#define __SP_ANIMATION_H__
-
-/*
- * SVG <animate> implementation
- *
- * Authors:
- * Lauris Kaplinski <lauris@kaplinski.com>
- *
- * Copyright (C) 2002 Lauris Kaplinski
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "sp-object.h"
-
-
-
-/* Animation base class */
-
-#define SP_TYPE_ANIMATION (sp_animation_get_type ())
-#define SP_ANIMATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_ANIMATION, SPAnimation))
-#define SP_IS_ANIMATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_ANIMATION))
-
-class SPAnimation;
-class SPAnimationClass;
-
-struct SPAnimation : public SPObject {
-};
-
-struct SPAnimationClass {
- SPObjectClass parent_class;
-};
-
-GType sp_animation_get_type (void);
-
-/* Interpolated animation base class */
-
-#define SP_TYPE_IANIMATION (sp_ianimation_get_type ())
-#define SP_IANIMATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_IANIMATION, SPIAnimation))
-#define SP_IS_IANIMATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_IANIMATION))
-
-class SPIAnimation;
-class SPIAnimationClass;
-
-struct SPIAnimation : public SPAnimation {
-};
-
-struct SPIAnimationClass {
- SPAnimationClass parent_class;
-};
-
-GType sp_ianimation_get_type (void);
-
-/* SVG <animate> */
-
-#define SP_TYPE_ANIMATE (sp_animate_get_type ())
-#define SP_ANIMATE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_ANIMATE, SPAnimate))
-#define SP_IS_ANIMATE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_ANIMATE))
-
-class SPAnimate;
-class SPAnimateClass;
-
-struct SPAnimate : public SPIAnimation {
-};
-
-struct SPAnimateClass {
- SPIAnimationClass parent_class;
-};
-
-GType sp_animate_get_type (void);
-
-
-
-#endif
diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index 2213443a5..47d9be2c1 100644
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
@@ -64,9 +64,8 @@ SPClipPath::sp_clippath_get_type(void)
void SPClipPathClass::sp_clippath_class_init(SPClipPathClass *klass)
{
- SPObjectClass *sp_object_class = (SPObjectClass *) klass;
-
- static_parent_class = (SPObjectGroupClass*)g_type_class_ref(SP_TYPE_OBJECTGROUP);
+ SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass);
+ static_parent_class = SP_OBJECTGROUP_CLASS(g_type_class_ref(SP_TYPE_OBJECTGROUP));
sp_object_class->build = SPClipPath::build;
sp_object_class->release = SPClipPath::release;
diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp
index 17e9e7397..8e89b28fb 100644
--- a/src/sp-conn-end-pair.cpp
+++ b/src/sp-conn-end-pair.cpp
@@ -82,9 +82,7 @@ sp_conn_end_pair_build(SPObject *object)
{
object->readAttr( "inkscape:connector-type" );
object->readAttr( "inkscape:connection-start" );
- object->readAttr( "inkscape:connection-start-point" );
object->readAttr( "inkscape:connection-end" );
- object->readAttr( "inkscape:connection-end-point" );
object->readAttr( "inkscape:connector-curvature" );
}
@@ -164,10 +162,6 @@ SPConnEndPair::setAttr(unsigned const key, gchar const *const value)
case SP_ATTR_CONNECTION_END:
this->_connEnd[(key == SP_ATTR_CONNECTION_START ? 0 : 1)]->setAttacherHref(value, _path);
break;
- case SP_ATTR_CONNECTION_START_POINT:
- case SP_ATTR_CONNECTION_END_POINT:
- this->_connEnd[(key == SP_ATTR_CONNECTION_START_POINT ? 0 : 1)]->setAttacherEndpoint(value, _path);
- break;
}
}
@@ -175,15 +169,10 @@ SPConnEndPair::setAttr(unsigned const key, gchar const *const value)
void
SPConnEndPair::writeRepr(Inkscape::XML::Node *const repr) const
{
- char const * const attr_strs[] = {"inkscape:connection-start", "inkscape:connection-start-point",
- "inkscape:connection-end", "inkscape:connection-end-point"};
+ char const * const attr_strs[] = {"inkscape:connection-start", "inkscape:connection-end"};
for (unsigned handle_ix = 0; handle_ix < 2; ++handle_ix) {
if (this->_connEnd[handle_ix]->ref.getURI()) {
- repr->setAttribute(attr_strs[2*handle_ix], this->_connEnd[handle_ix]->ref.getURI()->toString());
- std::ostringstream ostr;
- ostr<<(this->_connEnd[handle_ix]->type == ConnPointDefault ? "d":"u") <<
- this->_connEnd[handle_ix]->id;
- repr->setAttribute(attr_strs[2*handle_ix+1], ostr.str().c_str());
+ repr->setAttribute(attr_strs[handle_ix], this->_connEnd[handle_ix]->ref.getURI()->toString());
}
}
repr->setAttribute("inkscape:connector-curvature", Glib::Ascii::dtostr(_connCurvature).c_str());
@@ -222,7 +211,7 @@ void SPConnEndPair::getEndpoints(Geom::Point endPts[]) const
for (unsigned h = 0; h < 2; ++h) {
if ( h2attItem[h] ) {
g_assert(h2attItem[h]->avoidRef);
- endPts[h] = h2attItem[h]->avoidRef->getConnectionPointPos(_connEnd[h]->type, _connEnd[h]->id);
+ endPts[h] = h2attItem[h]->avoidRef->getConnectionPointPos();
}
else if (!curve->is_empty())
{
diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp
index cabda82d3..c136cea66 100644
--- a/src/sp-conn-end.cpp
+++ b/src/sp-conn-end.cpp
@@ -21,11 +21,10 @@ SPConnEnd::SPConnEnd(SPObject *const owner) :
ref(owner),
href(NULL),
// Default to center connection endpoint
- type(ConnPointDefault),
- id(4),
_changed_connection(),
_delete_connection(),
- _transformed_connection()
+ _transformed_connection(),
+ _group_connection()
{
}
@@ -154,9 +153,9 @@ sp_conn_get_route_and_redraw(SPPath *const path,
Geom::PathVector conn_pv = path->_curve->get_pathvector();
double endPos[2] = { 0.0, static_cast<double>(conn_pv[0].size()) };
- SPConnEnd** _connEnd = path->connEndPair.getConnEnds();
for (unsigned h = 0; h < 2; ++h) {
- if (h2attItem[h] && _connEnd[h]->type == ConnPointDefault && _connEnd[h]->id == ConnPointPosCC) {
+ // Assume center point for all
+ if (h2attItem[h]) {
Geom::Affine h2i2anc = i2anc_affine(h2attItem[h], ancestor);
try_get_intersect_point_with_item(path, h2attItem[h], h2i2anc, path2anc,
(h == 0), endPos[h]);
@@ -228,13 +227,9 @@ change_endpts(SPCurve *const curve, double const endPos[2])
static void
sp_conn_end_deleted(SPObject *, SPObject *const owner, unsigned const handle_ix)
{
- // todo: The first argument is the deleted object, or just NULL if
- // called by sp_conn_end_detach.
- g_return_if_fail(handle_ix < 2);
- char const * const attr_strs[] = {"inkscape:connection-start", "inkscape:connection-start-point",
- "inkscape:connection-end", "inkscape:connection-end-point"};
- owner->getRepr()->setAttribute(attr_strs[2*handle_ix], NULL);
- owner->getRepr()->setAttribute(attr_strs[2*handle_ix+1], NULL);
+ char const * const attrs[] = {
+ "inkscape:connection-start", "inkscape:connection-end"};
+ owner->getRepr()->setAttribute(attrs[handle_ix], NULL);
/* I believe this will trigger sp_conn_end_href_changed. */
}
@@ -283,84 +278,6 @@ SPConnEnd::setAttacherHref(gchar const *value, SPPath* /*path*/)
}
}
-void
-SPConnEnd::setAttacherEndpoint(gchar const *value, SPPath* /*path*/)
-{
-
- /* References to the connection points have the following format
- <t><id>, where t is the type of the point, which
- can be either "d" for default or "u" for user-defined, and
- id is the local (inside the item) id of the connection point.
- In the case of default points id represents the position on the
- item (i.e. Top-Left, Center-Center, etc.).
- */
-
- bool changed = false;
- ConnPointType newtype = type;
-
- if (!value)
- {
- // Default to center endpoint
- type = ConnPointDefault;
- id = 4;
- }
- else
- {
- switch (value[0])
- {
- case 'd':
- if ( newtype != ConnPointDefault )
- {
- newtype = ConnPointDefault;
- changed = true;
- }
- break;
- case 'u':
- if ( newtype != ConnPointUserDefined)
- {
- newtype = ConnPointUserDefined;
- changed = true;
- }
- break;
- default:
- g_warning("Bad reference to a connection point.");
- }
-
- int newid = (int) g_ascii_strtod( value+1, 0 );
- if ( id != newid )
- {
- id = newid;
- changed = true;
- }
-
- // We have to verify that the reference to the
- // connection point is a valid one.
-
- if ( changed )
- {
-
- // Get the item the connector is attached to
- SPItem* item = ref.getObject();
- if ( item )
- {
- if (!item->avoidRef->isValidConnPointId( newtype, newid ) )
- {
- g_warning("Bad reference to a connection point.");
- }
- else
- {
- type = newtype;
- id = newid;
- }
- /* // Update the connector
- if (path->connEndPair.isAutoRoutingConn()) {
- path->connEndPair.tellLibavoidNewEndpoints();
- }
- */
- }
- }
- }
-}
void
sp_conn_end_href_changed(SPObject */*old_ref*/, SPObject */*ref*/,
@@ -370,6 +287,7 @@ sp_conn_end_href_changed(SPObject */*old_ref*/, SPObject */*ref*/,
SPConnEnd &connEnd = *connEndPtr;
connEnd._delete_connection.disconnect();
connEnd._transformed_connection.disconnect();
+ connEnd._group_connection.disconnect();
if (connEnd.href) {
SPObject *refobj = connEnd.ref.getObject();
@@ -377,6 +295,14 @@ sp_conn_end_href_changed(SPObject */*old_ref*/, SPObject */*ref*/,
connEnd._delete_connection
= refobj->connectDelete(sigc::bind(sigc::ptr_fun(&sp_conn_end_deleted),
path, handle_ix));
+ // This allows the connector tool to dive into a group's children
+ // And connect to their children's centers.
+ SPObject *parent = refobj->parent;
+ if (SP_IS_GROUP(parent) and ! SP_IS_LAYER(parent)) {
+ connEnd._group_connection
+ = SP_ITEM(parent)->connectTransformed(sigc::bind(sigc::ptr_fun(&sp_conn_end_shape_move),
+ path));
+ }
connEnd._transformed_connection
= SP_ITEM(refobj)->connectTransformed(sigc::bind(sigc::ptr_fun(&sp_conn_end_shape_move),
path));
diff --git a/src/sp-conn-end.h b/src/sp-conn-end.h
index de0d2c0b7..a0b1ba5df 100644
--- a/src/sp-conn-end.h
+++ b/src/sp-conn-end.h
@@ -6,7 +6,6 @@
#include <sigc++/connection.h>
#include "sp-use-reference.h"
-#include "connection-points.h"
#include "conn-avoid-ref.h"
class SPPath;
@@ -18,15 +17,6 @@ public:
SPUseReference ref;
gchar *href;
- /* In the following, type refers to connection point type,
- i.e. default (one of the 9 combinations of right, centre,
- left, top, bottom) or user-defined. The id serves to identify
- the connection point in a list of connection points.
- */
-
- ConnPointType type;
- int id;
-
/** Change of href string (not a modification of the attributes of the referrent). */
sigc::connection _changed_connection;
@@ -36,6 +26,9 @@ public:
/** A sigc connection for transformed signal, used to do move compensation. */
sigc::connection _transformed_connection;
+ /** 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 *);
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index 6a71cf4f0..7445b0b75 100644
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
@@ -53,8 +53,6 @@ enum {
PROP_HICOLOR
};
-static void sp_guide_class_init(SPGuideClass *gc);
-static void sp_guide_init(SPGuide *guide);
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);
@@ -62,36 +60,13 @@ static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML
static void sp_guide_release(SPObject *object);
static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value);
-static SPObjectClass *parent_class;
-
-GType sp_guide_get_type(void)
-{
- static GType guide_type = 0;
-
- if (!guide_type) {
- GTypeInfo guide_info = {
- sizeof(SPGuideClass),
- NULL, NULL,
- (GClassInitFunc) sp_guide_class_init,
- NULL, NULL,
- sizeof(SPGuide),
- 16,
- (GInstanceInitFunc) sp_guide_init,
- NULL, /* value_table */
- };
- guide_type = g_type_register_static(SP_TYPE_OBJECT, "SPGuide", &guide_info, (GTypeFlags) 0);
- }
-
- return guide_type;
-}
+G_DEFINE_TYPE(SPGuide, sp_guide, SP_TYPE_OBJECT);
static void sp_guide_class_init(SPGuideClass *gc)
{
GObjectClass *gobject_class = (GObjectClass *) gc;
SPObjectClass *sp_object_class = (SPObjectClass *) gc;
- parent_class = (SPObjectClass*) g_type_class_ref(SP_TYPE_OBJECT);
-
gobject_class->set_property = sp_guide_set_property;
gobject_class->get_property = sp_guide_get_property;
@@ -158,8 +133,8 @@ static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value,
static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) (parent_class))->build) {
- (* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
+ if ((SP_OBJECT_CLASS(sp_guide_parent_class))->build) {
+ (* (SP_OBJECT_CLASS(sp_guide_parent_class))->build)(object, document, repr);
}
object->readAttr( "inkscape:label" );
@@ -184,8 +159,8 @@ static void sp_guide_release(SPObject *object)
object->document->removeResource("guide", object);
}
- if (((SPObjectClass *) parent_class)->release) {
- ((SPObjectClass *) parent_class)->release(object);
+ if ((SP_OBJECT_CLASS(sp_guide_parent_class))->release) {
+ (SP_OBJECT_CLASS(sp_guide_parent_class))->release(object);
}
}
@@ -260,8 +235,8 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value)
}
break;
default:
- if (((SPObjectClass *) (parent_class))->set) {
- ((SPObjectClass *) (parent_class))->set(object, key, value);
+ if ((SP_OBJECT_CLASS(sp_guide_parent_class))->set) {
+ (SP_OBJECT_CLASS(sp_guide_parent_class))->set(object, key, value);
}
break;
}
diff --git a/src/sp-guide.h b/src/sp-guide.h
index 319e12305..c39252066 100644
--- a/src/sp-guide.h
+++ b/src/sp-guide.h
@@ -22,6 +22,8 @@
struct SPCanvas;
struct SPCanvasGroup;
+G_BEGIN_DECLS
+
#define SP_TYPE_GUIDE (sp_guide_get_type())
#define SP_GUIDE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_GUIDE, SPGuide))
#define SP_GUIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_GUIDE, SPGuideClass))
@@ -70,6 +72,7 @@ void sp_guide_remove(SPGuide *guide);
char *sp_guide_description(SPGuide const *guide, const bool verbose = true);
+G_END_DECLS
#endif // SEEN_SP_GUIDE_H
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 7293c49fa..7b5d56638 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -108,8 +108,6 @@ static SPItemClass *parent_class;
extern "C"
{
void user_read_data( png_structp png_ptr, png_bytep data, png_size_t length );
- void user_write_data( png_structp png_ptr, png_bytep data, png_size_t length );
- void user_flush_data( png_structp png_ptr );
}
@@ -255,16 +253,6 @@ static void user_read_data( png_structp png_ptr, png_bytep data, png_size_t leng
// g_message("things out");
}
-static void user_write_data( png_structp /*png_ptr*/, png_bytep /*data*/, png_size_t /*length*/ )
-{
- //g_message( "user_write_data(%d)", length );
-}
-
-static void user_flush_data( png_structp /*png_ptr*/ )
-{
- //g_message( "user_flush_data" );
-}
-
static bool readPngAndHeaders( PushPull &youme, gint & dpiX, gint & dpiY )
{
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index a8e525bd5..559ff80ac 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -511,9 +511,6 @@ void SPItem::sp_item_set(SPObject *object, unsigned key, gchar const *value)
case SP_ATTR_CONNECTOR_AVOID:
item->avoidRef->setAvoid(value);
break;
- case SP_ATTR_CONNECTION_POINTS:
- item->avoidRef->setConnectionPoints(value);
- break;
case SP_ATTR_TRANSFORM_CENTER_X:
if (value) {
item->transform_center_x = g_strtod(value, NULL);
diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp
index f955e5428..785a626f8 100644
--- a/src/sp-mask.cpp
+++ b/src/sp-mask.cpp
@@ -73,7 +73,7 @@ sp_mask_get_type (void)
static void
sp_mask_class_init (SPMaskClass *klass)
{
- parent_class = (SPObjectGroupClass*) g_type_class_ref (SP_TYPE_OBJECTGROUP);
+ parent_class = SP_OBJECTGROUP_CLASS(g_type_class_ref(SP_TYPE_OBJECTGROUP));
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
sp_object_class->build = sp_mask_build;
diff --git a/src/sp-mesh-array.cpp b/src/sp-mesh-array.cpp
index 3b2d33bbd..249f9562e 100644
--- a/src/sp-mesh-array.cpp
+++ b/src/sp-mesh-array.cpp
@@ -72,12 +72,6 @@
enum { ROW, COL };
-static void swap_p( Geom::Point *p1, Geom::Point *p2 ) {
- Geom::Point temp = *p1;
- *p1 = *p2;
- *p2 = temp;
-};
-
SPMeshPatchI::SPMeshPatchI( std::vector<std::vector< SPMeshNode* > > * n, int r, int c ) {
nodes = n;
diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp
index 65fbc0295..5158ec70a 100644
--- a/src/sp-object-group.cpp
+++ b/src/sp-object-group.cpp
@@ -16,74 +16,82 @@
#include "xml/repr.h"
#include "document.h"
-SPObjectClass * SPObjectGroupClass::static_parent_class = 0;
+static void sp_objectgroup_child_added(SPObject *object,
+ Inkscape::XML::Node *child,
+ Inkscape::XML::Node *ref);
-GType SPObjectGroup::sp_objectgroup_get_type(void)
-{
- static GType objectgroup_type = 0;
- if (!objectgroup_type) {
- GTypeInfo objectgroup_info = {
- sizeof(SPObjectGroupClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) SPObjectGroupClass::sp_objectgroup_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPObjectGroup),
- 16, /* n_preallocs */
- (GInstanceInitFunc) init,
- NULL, /* value_table */
- };
- objectgroup_type = g_type_register_static(SP_TYPE_OBJECT, "SPObjectGroup", &objectgroup_info, (GTypeFlags)0);
- }
- return objectgroup_type;
-}
+static void sp_objectgroup_remove_child(SPObject *object,
+ Inkscape::XML::Node *child);
-void SPObjectGroupClass::sp_objectgroup_class_init(SPObjectGroupClass *klass)
-{
- //GObjectClass * object_class = (GObjectClass *) klass;
- SPObjectClass * sp_object_class = (SPObjectClass *) klass;
+static void sp_objectgroup_order_changed(SPObject *object,
+ Inkscape::XML::Node *child,
+ Inkscape::XML::Node *old_ref,
+ Inkscape::XML::Node *new_ref);
- static_parent_class = (SPObjectClass *)g_type_class_ref(SP_TYPE_OBJECT);
+static Inkscape::XML::Node* sp_objectgroup_write(SPObject *object,
+ Inkscape::XML::Document *doc,
+ Inkscape::XML::Node *repr,
+ guint flags);
+
+G_DEFINE_TYPE(SPObjectGroup, sp_objectgroup, SP_TYPE_OBJECT);
+
+static void
+sp_objectgroup_class_init(SPObjectGroupClass *klass)
+{
+ SPObjectClass * sp_object_class = SP_OBJECT_CLASS(klass);
- sp_object_class->child_added = SPObjectGroup::childAdded;
- sp_object_class->remove_child = SPObjectGroup::removeChild;
- sp_object_class->order_changed = SPObjectGroup::orderChanged;
- sp_object_class->write = SPObjectGroup::write;
+ sp_object_class->child_added = sp_objectgroup_child_added;
+ sp_object_class->remove_child = sp_objectgroup_remove_child;
+ sp_object_class->order_changed = sp_objectgroup_order_changed;
+ sp_object_class->write = sp_objectgroup_write;
}
-void SPObjectGroup::init(SPObjectGroup * /*objectgroup*/)
+static void
+sp_objectgroup_init(SPObjectGroup * /*objectgroup*/)
{
}
-void SPObjectGroup::childAdded(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
+static void
+sp_objectgroup_child_added(SPObject *object,
+ Inkscape::XML::Node *child,
+ Inkscape::XML::Node *ref)
{
- if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added) {
- (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added)(object, child, ref);
+ if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->child_added) {
+ (* (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->child_added)(object, child, ref);
}
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
-void SPObjectGroup::removeChild(SPObject *object, Inkscape::XML::Node *child)
+static void
+sp_objectgroup_remove_child(SPObject *object,
+ Inkscape::XML::Node *child)
{
- if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child) {
- (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child)(object, child);
+ if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->remove_child) {
+ (* (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->remove_child)(object, child);
}
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
-void SPObjectGroup::orderChanged(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref)
+static void
+sp_objectgroup_order_changed(SPObject *object,
+ Inkscape::XML::Node *child,
+ Inkscape::XML::Node *old_ref,
+ Inkscape::XML::Node *new_ref)
{
- if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed) {
- (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed)(object, child, old_ref, new_ref);
+ if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->order_changed) {
+ (* (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->order_changed)(object, child, old_ref, new_ref);
}
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
-Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node*
+sp_objectgroup_write(SPObject *object,
+ Inkscape::XML::Document *xml_doc,
+ Inkscape::XML::Node *repr,
+ guint flags)
{
SP_OBJECTGROUP(object); // Ensure we have the right type of SPObject
@@ -99,8 +107,8 @@ Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Docum
}
}
while (l) {
- repr->addChild((Inkscape::XML::Node *) l->data, NULL);
- Inkscape::GC::release((Inkscape::XML::Node *) l->data);
+ repr->addChild(static_cast<Inkscape::XML::Node *>(l->data), NULL);
+ Inkscape::GC::release(static_cast<Inkscape::XML::Node *>(l->data));
l = g_slist_remove(l, l->data);
}
} else {
@@ -109,8 +117,8 @@ Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Docum
}
}
- if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write) {
- ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write(object, xml_doc, repr, flags);
+ if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->write) {
+ (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-object-group.h b/src/sp-object-group.h
index a666a316a..88e0e0f4e 100644
--- a/src/sp-object-group.h
+++ b/src/sp-object-group.h
@@ -16,25 +16,17 @@
#include "sp-object.h"
-#define SP_TYPE_OBJECTGROUP (SPObjectGroup::sp_objectgroup_get_type ())
-#define SP_OBJECTGROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_OBJECTGROUP, SPObjectGroup))
-#define SP_OBJECTGROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_OBJECTGROUP, SPObjectGroupClass))
-#define SP_IS_OBJECTGROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_OBJECTGROUP))
+#define SP_TYPE_OBJECTGROUP (sp_objectgroup_get_type ())
+#define SP_OBJECTGROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_OBJECTGROUP, SPObjectGroup))
+#define SP_OBJECTGROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_OBJECTGROUP, SPObjectGroupClass))
+#define SP_IS_OBJECTGROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_OBJECTGROUP))
#define SP_IS_OBJECTGROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_OBJECTGROUP))
-class SPObjectGroup : public SPObject {
-public:
- static GType sp_objectgroup_get_type(void);
+GType sp_objectgroup_get_type() G_GNUC_CONST;
+class SPObjectGroup : public SPObject {
private:
- static void init(SPObjectGroup *objectgroup);
-
- static void childAdded(SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * ref);
- static void removeChild(SPObject * object, Inkscape::XML::Node * child);
- static void orderChanged(SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * old_ref, Inkscape::XML::Node * new_ref);
- static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
- friend class SPObjectGroupClass;
+ friend class SPObjectGroupClass;
};
class SPObjectGroupClass {
@@ -42,9 +34,6 @@ public:
SPObjectClass parent_class;
private:
- static void sp_objectgroup_class_init(SPObjectGroupClass *klass);
- static SPObjectClass *static_parent_class;
-
friend class SPObjectGroup;
};
diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp
index 992001f99..cd332cd34 100644
--- a/src/sp-object-repr.cpp
+++ b/src/sp-object-repr.cpp
@@ -42,7 +42,6 @@
#include "sp-clippath.h"
#include "sp-mask.h"
#include "sp-anchor.h"
-//#include "sp-animation.h"
#include "sp-flowdiv.h"
#include "sp-flowregion.h"
#include "sp-flowtext.h"
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 2cf28137a..4d2a5a709 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -101,48 +101,63 @@ public:
}
};
+static void sp_object_child_added(SPObject *object,
+ Inkscape::XML::Node *child,
+ Inkscape::XML::Node *ref);
-GObjectClass * SPObjectClass::static_parent_class = 0;
+static void sp_object_finalize(GObject *object);
-GType SPObject::get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPObjectClass),
- NULL, NULL,
- (GClassInitFunc) SPObjectClass::init,
- NULL, NULL,
- sizeof(SPObject),
- 16,
- (GInstanceInitFunc)init,
- NULL
- };
- type = g_type_register_static(G_TYPE_OBJECT, "SPObject", &info, (GTypeFlags)0);
- }
- return type;
-}
-
-void SPObjectClass::init(SPObjectClass *klass)
-{
- GObjectClass *object_class;
+static void sp_object_remove_child(SPObject *object,
+ Inkscape::XML::Node *child);
+
+static void sp_object_order_changed(SPObject *object,
+ Inkscape::XML::Node *child,
+ Inkscape::XML::Node *old_ref,
+ Inkscape::XML::Node *new_ref);
- object_class = (GObjectClass *) klass;
+static void sp_object_release(SPObject *object);
+static void sp_object_build(SPObject *object,
+ SPDocument *document,
+ Inkscape::XML::Node *repr);
- static_parent_class = (GObjectClass *) g_type_class_ref(G_TYPE_OBJECT);
+static void sp_object_private_set(SPObject *object,
+ unsigned int key,
+ gchar const *value);
- object_class->finalize = SPObject::finalize;
+static Inkscape::XML::Node *sp_object_private_write(SPObject *object,
+ Inkscape::XML::Document *doc,
+ Inkscape::XML::Node *repr,
+ guint flags);
+
+static gchar *sp_object_get_unique_id(SPObject *object,
+ gchar const *defid);
+
+G_DEFINE_TYPE(SPObject, sp_object, G_TYPE_OBJECT);
+
+/**
+ * Initializes the SPObject vtable.
+ */
+static void
+sp_object_class_init(SPObjectClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+
+ object_class->finalize = sp_object_finalize;
- klass->child_added = SPObject::child_added;
- klass->remove_child = SPObject::remove_child;
- klass->order_changed = SPObject::order_changed;
- klass->release = SPObject::release;
- klass->build = SPObject::build;
- klass->set = SPObject::private_set;
- klass->write = SPObject::private_write;
+ klass->child_added = sp_object_child_added;
+ klass->remove_child = sp_object_remove_child;
+ klass->order_changed = sp_object_order_changed;
+ klass->release = sp_object_release;
+ klass->build = sp_object_build;
+ klass->set = sp_object_private_set;
+ klass->write = sp_object_private_write;
}
-void SPObject::init(SPObject *object)
+/**
+ * Callback to initialize the SPObject object.
+ */
+static void
+sp_object_init(SPObject *object)
{
debug("id=%x, typename=%s",object, g_type_name_from_instance((GTypeInstance*)object));
@@ -175,7 +190,11 @@ void SPObject::init(SPObject *object)
object->_default_label = NULL;
}
-void SPObject::finalize(GObject *object)
+/**
+ * Callback to destroy all members and connections of object and itself.
+ */
+static void
+sp_object_finalize(GObject *object)
{
SPObject *spobject = (SPObject *)object;
@@ -194,8 +213,8 @@ void SPObject::finalize(GObject *object)
spobject->_delete_signal.~signal();
spobject->_position_changed_signal.~signal();
- if (((GObjectClass *) (SPObjectClass::static_parent_class))->finalize) {
- (* ((GObjectClass *) (SPObjectClass::static_parent_class))->finalize)(object);
+ if (((GObjectClass *) (sp_object_parent_class))->finalize) {
+ (* ((GObjectClass *) (sp_object_parent_class))->finalize)(object);
}
}
@@ -613,7 +632,14 @@ SPObject *SPObject::get_child_by_repr(Inkscape::XML::Node *repr)
return result;
}
-void SPObject::child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
+/**
+ * Callback for child_added event.
+ * Invoked whenever the given mutation event happens in the XML tree.
+ */
+static void
+sp_object_child_added(SPObject *object,
+ Inkscape::XML::Node *child,
+ Inkscape::XML::Node *ref)
{
GType type = sp_repr_type_lookup(child);
if (!type) {
@@ -627,7 +653,19 @@ void SPObject::child_added(SPObject *object, Inkscape::XML::Node *child, Inkscap
ochild->invoke_build(object->document, child, object->cloned);
}
-void SPObject::release(SPObject *object)
+/**
+ * Removes, releases and unrefs all children of object.
+ *
+ * This is the opposite of build. It has to be invoked as soon as the
+ * object is removed from the tree, even if it is still alive according
+ * to reference count. The frontend unregisters the object from the
+ * document and releases the SPRepr bindings; implementations should free
+ * state data and release all child objects. Invoking release on
+ * SPRoot destroys the whole document tree.
+ * @see sp_object_build()
+ */
+static void
+sp_object_release(SPObject *object)
{
debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object));
while (object->children) {
@@ -635,7 +673,17 @@ void SPObject::release(SPObject *object)
}
}
-void SPObject::remove_child(SPObject *object, Inkscape::XML::Node *child)
+/**
+ * Remove object's child whose node equals repr, release and
+ * unref it.
+ *
+ * Invoked whenever the given mutation event happens in the XML
+ * tree, BEFORE removal from the XML tree happens, so grouping
+ * objects can safely release the child data.
+ */
+static void
+sp_object_remove_child(SPObject *object,
+ Inkscape::XML::Node *child)
{
debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object));
SPObject *ochild = object->get_child_by_repr(child);
@@ -645,8 +693,17 @@ void SPObject::remove_child(SPObject *object, Inkscape::XML::Node *child)
}
}
-void SPObject::order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node * /*old_ref*/,
- Inkscape::XML::Node *new_ref)
+/**
+ * Move object corresponding to child after sibling object corresponding
+ * to new_ref.
+ * Invoked whenever the given mutation event happens in the XML tree.
+ * @param old_ref Ignored
+ */
+static void
+sp_object_order_changed(SPObject *object,
+ Inkscape::XML::Node *child,
+ Inkscape::XML::Node * /*old_ref*/,
+ Inkscape::XML::Node *new_ref)
{
SPObject *ochild = object->get_child_by_repr(child);
g_return_if_fail(ochild != NULL);
@@ -655,7 +712,21 @@ void SPObject::order_changed(SPObject *object, Inkscape::XML::Node *child, Inksc
ochild->_position_changed_signal.emit(ochild);
}
-void SPObject::build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
+/**
+ * Virtual build callback.
+ *
+ * This has to be invoked immediately after creation of an SPObject. The
+ * frontend method ensures that the new object is properly attached to
+ * the document and repr; implementation then will parse all of the attributes,
+ * generate the children objects and so on. Invoking build on the SPRoot
+ * object results in creation of the whole document tree (this is, what
+ * SPDocument does after the creation of the XML tree).
+ * @see release()
+ */
+static void
+sp_object_build(SPObject *object,
+ SPDocument *document,
+ Inkscape::XML::Node *repr)
{
/* Nothing specific here */
debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object));
@@ -706,7 +777,7 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns
gchar const *id = this->repr->attribute("id");
if (!document->isSeeking()) {
{
- gchar *realid = get_unique_id(this, id);
+ gchar *realid = sp_object_get_unique_id(this, id);
g_assert(realid != NULL);
this->document->bindObjectToId(realid, this);
@@ -844,7 +915,12 @@ void SPObject::repr_order_changed(Inkscape::XML::Node * /*repr*/, Inkscape::XML:
}
}
-void SPObject::private_set(SPObject *object, unsigned int key, gchar const *value)
+/**
+ * Callback for set event.
+ */
+static void sp_object_private_set(SPObject *object,
+ unsigned int key,
+ gchar const *value)
{
g_assert(key != SP_ATTR_INVALID);
@@ -866,7 +942,7 @@ void SPObject::private_set(SPObject *object, unsigned int key, gchar const *valu
if (!document->isSeeking()) {
sp_object_ref(conflict, NULL);
// give the conflicting object a new ID
- gchar *new_conflict_id = get_unique_id(conflict, NULL);
+ gchar *new_conflict_id = sp_object_get_unique_id(conflict, NULL);
conflict->getRepr()->setAttribute("id", new_conflict_id);
g_free(new_conflict_id);
sp_object_unref(conflict, NULL);
@@ -994,7 +1070,14 @@ static gchar const *sp_xml_get_space_string(unsigned int space)
}
}
-Inkscape::XML::Node * SPObject::private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
+/**
+ * Callback for write event.
+ */
+static Inkscape::XML::Node*
+sp_object_private_write(SPObject *object,
+ Inkscape::XML::Document *doc,
+ Inkscape::XML::Node *repr,
+ guint flags)
{
if (!repr && (flags & SP_OBJECT_WRITE_BUILD)) {
repr = object->getRepr()->duplicate(doc);
@@ -1297,9 +1380,10 @@ bool SPObject::storeAsDouble( gchar const *key, double *val ) const
return sp_repr_get_double(((Inkscape::XML::Node *)(this->getRepr())),key,val);
}
-/* Helper */
-
-gchar * SPObject::get_unique_id(SPObject *object, gchar const *id)
+/** Helper */
+static gchar*
+sp_object_get_unique_id(SPObject *object,
+ gchar const *id)
{
static unsigned long count = 0;
diff --git a/src/sp-object.h b/src/sp-object.h
index 0c4429a74..b3f3e6c2f 100644
--- a/src/sp-object.h
+++ b/src/sp-object.h
@@ -18,7 +18,7 @@
class SPObject;
class SPObjectClass;
-#define SP_TYPE_OBJECT (SPObject::get_type ())
+#define SP_TYPE_OBJECT (sp_object_get_type())
#define SP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_OBJECT, SPObject))
#define SP_OBJECT_CLASS(clazz) (G_TYPE_CHECK_CLASS_CAST((clazz), SP_TYPE_OBJECT, SPObjectClass))
#define SP_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_OBJECT))
@@ -122,6 +122,7 @@ struct SPIXmlSpace {
guint value : 1;
};
+GType sp_object_get_type() G_GNUC_CONST;
/*
* Refcounting
@@ -226,7 +227,6 @@ public:
/**
* Returns the XML representation of tree
*/
- //Inkscape::XML::Node const* getRepr() const;
//protected:
Inkscape::XML::Node * getRepr();
@@ -796,78 +796,6 @@ private:
*/
GString * textualContent() const;
- /**
- * Callback to initialize the SPObject object.
- */
- static void init(SPObject *object);
-
- /**
- * Callback to destroy all members and connections of object and itself.
- */
- static void finalize(GObject *object);
-
- /**
- * Callback for child_added event.
- * Invoked whenever the given mutation event happens in the XML tree.
- */
- static void child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
-
- /**
- * Remove object's child whose node equals repr, release and
- * unref it.
- *
- * Invoked whenever the given mutation event happens in the XML
- * tree, BEFORE removal from the XML tree happens, so grouping
- * objects can safely release the child data.
- */
- static void remove_child(SPObject *object, Inkscape::XML::Node *child);
-
- /**
- * Move object corresponding to child after sibling object corresponding
- * to new_ref.
- * Invoked whenever the given mutation event happens in the XML tree.
- * @param old_ref Ignored
- */
- static void order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref);
-
- /**
- * Removes, releases and unrefs all children of object.
- *
- * This is the opposite of build. It has to be invoked as soon as the
- * object is removed from the tree, even if it is still alive according
- * to reference count. The frontend unregisters the object from the
- * document and releases the SPRepr bindings; implementations should free
- * state data and release all child objects. Invoking release on
- * SPRoot destroys the whole document tree.
- * @see build()
- */
- static void release(SPObject *object);
-
- /**
- * Virtual build callback.
- *
- * This has to be invoked immediately after creation of an SPObject. The
- * frontend method ensures that the new object is properly attached to
- * the document and repr; implementation then will parse all of the attributes,
- * generate the children objects and so on. Invoking build on the SPRoot
- * object results in creation of the whole document tree (this is, what
- * SPDocument does after the creation of the XML tree).
- * @see release()
- */
- static void build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
-
- /**
- * Callback for set event.
- */
- static void private_set(SPObject *object, unsigned int key, gchar const *value);
-
- /**
- * Callback for write event.
- */
- static Inkscape::XML::Node *private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
- static gchar *get_unique_id(SPObject *object, gchar const *defid);
-
/* Real handlers of repr signals */
public:
@@ -935,13 +863,6 @@ public:
Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags);
private:
- static GObjectClass *static_parent_class;
-
- /**
- * Initializes the SPObject vtable.
- */
- static void init(SPObjectClass *klass);
-
friend class SPObject;
};
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index b98399171..bc8a46252 100644
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
@@ -941,7 +941,7 @@ sp_offset_distance_to_original (SPOffset * offset, Geom::Point px)
* \return the topmost point on the offset.
*/
void
-sp_offset_top_point (SPOffset * offset, Geom::Point *px)
+sp_offset_top_point (SPOffset const * offset, Geom::Point *px)
{
(*px) = Geom::Point(0, 0);
if (offset == NULL)
diff --git a/src/sp-offset.h b/src/sp-offset.h
index ec8c2cf29..4e245f952 100644
--- a/src/sp-offset.h
+++ b/src/sp-offset.h
@@ -88,7 +88,7 @@ struct SPOffsetClass
GType sp_offset_get_type (void);
double sp_offset_distance_to_original (SPOffset * offset, Geom::Point px);
-void sp_offset_top_point (SPOffset * offset, Geom::Point *px);
+void sp_offset_top_point (SPOffset const *offset, Geom::Point *px);
SPItem *sp_offset_get_source (SPOffset *offset);
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index 137864101..f18199e96 100644
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
@@ -515,73 +515,73 @@ SPPattern *pattern_getroot(SPPattern *pat)
// Access functions that look up fields up the chain of referenced patterns and return the first one which is set
// FIXME: all of them must use chase_hrefs the same as in SPGradient, to avoid lockup on circular refs
-guint pattern_patternUnits (SPPattern *pat)
+guint pattern_patternUnits (SPPattern const *pat)
{
- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
- if (pat_i->patternUnits_set)
- return pat_i->patternUnits;
- }
- return pat->patternUnits;
+ for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
+ if (pat_i->patternUnits_set)
+ return pat_i->patternUnits;
+ }
+ return pat->patternUnits;
}
-guint pattern_patternContentUnits (SPPattern *pat)
+guint pattern_patternContentUnits (SPPattern const *pat)
{
- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
- if (pat_i->patternContentUnits_set)
- return pat_i->patternContentUnits;
- }
- return pat->patternContentUnits;
+ for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
+ if (pat_i->patternContentUnits_set)
+ return pat_i->patternContentUnits;
+ }
+ return pat->patternContentUnits;
}
Geom::Affine const &pattern_patternTransform(SPPattern const *pat)
{
- for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
- if (pat_i->patternTransform_set)
- return pat_i->patternTransform;
- }
- return pat->patternTransform;
+ for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
+ if (pat_i->patternTransform_set)
+ return pat_i->patternTransform;
+ }
+ return pat->patternTransform;
}
-gdouble pattern_x (SPPattern *pat)
+gdouble pattern_x (SPPattern const *pat)
{
- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
- if (pat_i->x._set)
- return pat_i->x.computed;
- }
- return 0;
+ for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
+ if (pat_i->x._set)
+ return pat_i->x.computed;
+ }
+ return 0;
}
-gdouble pattern_y (SPPattern *pat)
+gdouble pattern_y (SPPattern const *pat)
{
- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
- if (pat_i->y._set)
- return pat_i->y.computed;
- }
- return 0;
+ for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
+ if (pat_i->y._set)
+ return pat_i->y.computed;
+ }
+ return 0;
}
-gdouble pattern_width (SPPattern *pat)
+gdouble pattern_width (SPPattern const* pat)
{
- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
- if (pat_i->width._set)
- return pat_i->width.computed;
- }
- return 0;
+ for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
+ if (pat_i->width._set)
+ return pat_i->width.computed;
+ }
+ return 0;
}
-gdouble pattern_height (SPPattern *pat)
+gdouble pattern_height (SPPattern const *pat)
{
- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
- if (pat_i->height._set)
- return pat_i->height.computed;
- }
- return 0;
+ for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
+ if (pat_i->height._set)
+ return pat_i->height.computed;
+ }
+ return 0;
}
-Geom::OptRect pattern_viewBox (SPPattern *pat)
+Geom::OptRect pattern_viewBox (SPPattern const *pat)
{
Geom::OptRect viewbox;
- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
+ for (SPPattern const *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
if (pat_i->viewBox_set) {
viewbox = pat_i->viewBox;
break;
@@ -590,10 +590,10 @@ Geom::OptRect pattern_viewBox (SPPattern *pat)
return viewbox;
}
-static bool pattern_hasItemChildren (SPPattern *pat)
+static bool pattern_hasItemChildren (SPPattern const *pat)
{
bool hasChildren = false;
- for (SPObject *child = pat->firstChild() ; child && !hasChildren ; child = child->getNext() ) {
+ for (SPObject const *child = pat->firstChild() ; child && !hasChildren ; child = child->getNext() ) {
if (SP_IS_ITEM(child)) {
hasChildren = true;
}
diff --git a/src/sp-pattern.h b/src/sp-pattern.h
index debce86fb..e0a7dce54 100644
--- a/src/sp-pattern.h
+++ b/src/sp-pattern.h
@@ -91,14 +91,14 @@ const gchar *pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *documen
SPPattern *pattern_getroot (SPPattern *pat);
-guint pattern_patternUnits (SPPattern *pat);
-guint pattern_patternContentUnits (SPPattern *pat);
+guint pattern_patternUnits (SPPattern const *pat);
+guint pattern_patternContentUnits (SPPattern const *pat);
Geom::Affine const &pattern_patternTransform(SPPattern const *pat);
-gdouble pattern_x (SPPattern *pat);
-gdouble pattern_y (SPPattern *pat);
-gdouble pattern_width (SPPattern *pat);
-gdouble pattern_height (SPPattern *pat);
-Geom::OptRect pattern_viewBox (SPPattern *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);
+Geom::OptRect pattern_viewBox (SPPattern const *pat);
#endif // SEEN_SP_PATTERN_H
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index f33d234ee..e7e1432c2 100644
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
@@ -31,9 +31,6 @@
#define noRECT_VERBOSE
-static void sp_rect_class_init(SPRectClass *klass);
-static void sp_rect_init(SPRect *rect);
-
static void sp_rect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_rect_set(SPObject *object, unsigned key, gchar const *value);
static void sp_rect_update(SPObject *object, SPCtx *ctx, guint flags);
@@ -46,30 +43,7 @@ static void sp_rect_convert_to_guides(SPItem *item);
static void sp_rect_set_shape(SPShape *shape);
static void sp_rect_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
-static SPShapeClass *parent_class;
-
-GType
-sp_rect_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof(SPRectClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_rect_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPRect),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_rect_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_SHAPE, "SPRect", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPRect, sp_rect, SP_TYPE_SHAPE);
static void
sp_rect_class_init(SPRectClass *klass)
@@ -78,8 +52,6 @@ sp_rect_class_init(SPRectClass *klass)
SPItemClass *item_class = (SPItemClass *) klass;
SPShapeClass *shape_class = (SPShapeClass *) klass;
- parent_class = (SPShapeClass *)g_type_class_ref(SP_TYPE_SHAPE);
-
sp_object_class->build = sp_rect_build;
sp_object_class->write = sp_rect_write;
sp_object_class->set = sp_rect_set;
@@ -108,8 +80,8 @@ sp_rect_init(SPRect */*rect*/)
static void
sp_rect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) parent_class)->build)
- ((SPObjectClass *) parent_class)->build(object, document, repr);
+ if ((SP_OBJECT_CLASS(sp_rect_parent_class))->build)
+ (SP_OBJECT_CLASS(sp_rect_parent_class))->build(object, document, repr);
object->readAttr( "x" );
object->readAttr( "y" );
@@ -160,8 +132,8 @@ sp_rect_set(SPObject *object, unsigned key, gchar const *value)
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) parent_class)->set)
- ((SPObjectClass *) parent_class)->set(object, key, value);
+ if ((SP_OBJECT_CLASS(sp_rect_parent_class))->set)
+ (SP_OBJECT_CLASS(sp_rect_parent_class))->set(object, key, value);
break;
}
}
@@ -187,8 +159,8 @@ sp_rect_update(SPObject *object, SPCtx *ctx, guint flags)
flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // since we change the description, it's not a "just translation" anymore
}
- if (((SPObjectClass *) parent_class)->update)
- ((SPObjectClass *) parent_class)->update(object, ctx, flags);
+ if ((SP_OBJECT_CLASS(sp_rect_parent_class))->update)
+ (SP_OBJECT_CLASS(sp_rect_parent_class))->update(object, ctx, flags);
}
static Inkscape::XML::Node *
@@ -209,8 +181,8 @@ sp_rect_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML:
sp_rect_set_shape ((SPShape *) rect); // evaluate SPCurve
- if (((SPObjectClass *) parent_class)->write)
- ((SPObjectClass *) parent_class)->write(object, xml_doc, repr, flags);
+ if ((SP_OBJECT_CLASS(sp_rect_parent_class))->write)
+ (SP_OBJECT_CLASS(sp_rect_parent_class))->write(object, xml_doc, repr, flags);
return repr;
}
diff --git a/src/sp-rect.h b/src/sp-rect.h
index 7bc85dd8a..5e518dcd7 100644
--- a/src/sp-rect.h
+++ b/src/sp-rect.h
@@ -18,7 +18,7 @@
#include "sp-shape.h"
#include <2geom/forward.h>
-
+G_BEGIN_DECLS
#define SP_TYPE_RECT (sp_rect_get_type ())
#define SP_RECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_RECT, SPRect))
@@ -44,7 +44,7 @@ struct SPRectClass {
/* Standard GType function */
-GType sp_rect_get_type (void);
+GType sp_rect_get_type (void) G_GNUC_CONST;
void sp_rect_position_set (SPRect * rect, gdouble x, gdouble y, gdouble width, gdouble height);
@@ -65,6 +65,8 @@ gdouble sp_rect_get_visible_height (SPRect *rect);
void sp_rect_compensate_rxry (SPRect *rect, Geom::Affine xform);
+G_END_DECLS
+
#endif // SEEN_SP_RECT_H
/*
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index e0f05d0f4..08de1732b 100644
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
@@ -566,7 +566,7 @@ static void sp_star_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan
*/
Geom::Point
-sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized)
+sp_star_get_xy (SPStar const *star, SPStarPoint point, gint index, bool randomized)
{
gdouble darg = 2.0 * M_PI / (double) star->sides;
diff --git a/src/sp-star.h b/src/sp-star.h
index 82197d13d..bd271ccc0 100644
--- a/src/sp-star.h
+++ b/src/sp-star.h
@@ -52,7 +52,7 @@ GType sp_star_get_type (void);
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);
-Geom::Point sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized = false);
+Geom::Point sp_star_get_xy (SPStar const *star, SPStarPoint point, gint index, bool randomized = false);
diff --git a/src/sp-switch.cpp b/src/sp-switch.cpp
index 500e43c9c..be9866e16 100644
--- a/src/sp-switch.cpp
+++ b/src/sp-switch.cpp
@@ -25,35 +25,11 @@
#include <sigc++/functors/ptr_fun.h>
#include <sigc++/adaptors/bind.h>
-static void sp_switch_class_init (SPSwitchClass *klass);
-static void sp_switch_init (SPSwitch *group);
-
-static SPGroupClass * parent_class;
-
-GType CSwitch::getType (void)
-{
- static GType switch_type = 0;
- if (!switch_type) {
- GTypeInfo switch_info = {
- sizeof (SPSwitchClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_switch_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPSwitch),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_switch_init,
- NULL, /* value_table */
- };
- switch_type = g_type_register_static (SP_TYPE_GROUP, "SPSwitch", &switch_info, (GTypeFlags)0);
- }
- return switch_type;
-}
+G_DEFINE_TYPE(SPSwitch, sp_switch, SP_TYPE_GROUP);
static void
-sp_switch_class_init (SPSwitchClass *) {
- parent_class = (SPGroupClass *)g_type_class_ref (SP_TYPE_GROUP);
+sp_switch_class_init (SPSwitchClass *)
+{
}
static void sp_switch_init (SPSwitch *group)
diff --git a/src/sp-switch.h b/src/sp-switch.h
index c2c98e3b3..f0442f27b 100644
--- a/src/sp-switch.h
+++ b/src/sp-switch.h
@@ -17,12 +17,16 @@
#include <stddef.h>
#include <sigc++/connection.h>
-#define SP_TYPE_SWITCH (CSwitch::getType())
+G_BEGIN_DECLS
+
+#define SP_TYPE_SWITCH (sp_switch_get_type())
#define SP_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SWITCH, SPSwitch))
#define SP_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SWITCH, SPSwitchClass))
#define SP_IS_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SWITCH))
#define SP_IS_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SWITCH))
+GType sp_switch_get_type() G_GNUC_CONST;
+
/*
* Virtual methods of SPSwitch
*/
@@ -32,8 +36,6 @@ public:
virtual ~CSwitch();
friend class SPSwitch;
-
- static GType getType();
virtual void onChildAdded(Inkscape::XML::Node *child);
virtual void onChildRemoved(Inkscape::XML::Node *child);
@@ -61,4 +63,6 @@ struct SPSwitch : public SPGroup {
struct SPSwitchClass : public SPGroupClass {
};
+G_END_DECLS
+
#endif
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 0b60c1960..1b4246483 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -62,8 +62,6 @@
# SPTEXT
#####################################################*/
-static void sp_text_class_init (SPTextClass *classname);
-static void sp_text_init (SPText *text);
static void sp_text_release (SPObject *object);
static void sp_text_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
@@ -82,29 +80,7 @@ static void sp_text_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan
static Geom::Affine sp_text_set_transform(SPItem *item, Geom::Affine const &xform);
static void sp_text_print (SPItem *item, SPPrintContext *gpc);
-static SPItemClass *text_parent_class;
-
-GType
-sp_text_get_type ()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof (SPTextClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_text_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPText),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_text_init,
- NULL, /* value_table */
- };
- type = g_type_register_static (SP_TYPE_ITEM, "SPText", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPText, sp_text, SP_TYPE_ITEM);
static void
sp_text_class_init (SPTextClass *classname)
@@ -112,8 +88,6 @@ sp_text_class_init (SPTextClass *classname)
SPObjectClass *sp_object_class = (SPObjectClass *) classname;
SPItemClass *item_class = (SPItemClass *) classname;
- text_parent_class = (SPItemClass*)g_type_class_ref (SP_TYPE_ITEM);
-
sp_object_class->release = sp_text_release;
sp_object_class->build = sp_text_build;
sp_object_class->set = sp_text_set;
@@ -146,8 +120,8 @@ sp_text_release (SPObject *object)
text->attributes.~TextTagAttributes();
text->layout.~Layout();
- if (((SPObjectClass *) text_parent_class)->release)
- ((SPObjectClass *) text_parent_class)->release(object);
+ if ((SP_OBJECT_CLASS(sp_text_parent_class))->release)
+ (SP_OBJECT_CLASS(sp_text_parent_class))->release(object);
}
static void
@@ -159,8 +133,8 @@ sp_text_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
object->readAttr( "dy" );
object->readAttr( "rotate" );
- if (((SPObjectClass *) text_parent_class)->build)
- ((SPObjectClass *) text_parent_class)->build(object, doc, repr);
+ if ((SP_OBJECT_CLASS(sp_text_parent_class))->build)
+ (SP_OBJECT_CLASS(sp_text_parent_class))->build(object, doc, repr);
object->readAttr( "sodipodi:linespacing" ); // has to happen after the styles are read
}
@@ -186,8 +160,8 @@ sp_text_set(SPObject *object, unsigned key, gchar const *value)
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) text_parent_class)->set)
- ((SPObjectClass *) text_parent_class)->set (object, key, value);
+ if ((SP_OBJECT_CLASS(sp_text_parent_class))->set)
+ (SP_OBJECT_CLASS(sp_text_parent_class))->set (object, key, value);
break;
}
}
@@ -198,8 +172,8 @@ sp_text_child_added (SPObject *object, Inkscape::XML::Node *rch, Inkscape::XML::
{
SPText *text = SP_TEXT (object);
- if (((SPObjectClass *) text_parent_class)->child_added)
- ((SPObjectClass *) text_parent_class)->child_added (object, rch, ref);
+ if ((SP_OBJECT_CLASS(sp_text_parent_class))->child_added)
+ (SP_OBJECT_CLASS(sp_text_parent_class))->child_added (object, rch, ref);
text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_CONTENT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
}
@@ -209,8 +183,8 @@ sp_text_remove_child (SPObject *object, Inkscape::XML::Node *rch)
{
SPText *text = SP_TEXT (object);
- if (((SPObjectClass *) text_parent_class)->remove_child)
- ((SPObjectClass *) text_parent_class)->remove_child (object, rch);
+ if ((SP_OBJECT_CLASS(sp_text_parent_class))->remove_child)
+ (SP_OBJECT_CLASS(sp_text_parent_class))->remove_child (object, rch);
text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_CONTENT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
}
@@ -219,8 +193,8 @@ static void sp_text_update(SPObject *object, SPCtx *ctx, guint flags)
{
SPText *text = SP_TEXT (object);
- if (((SPObjectClass *) text_parent_class)->update)
- ((SPObjectClass *) text_parent_class)->update (object, ctx, flags);
+ if ((SP_OBJECT_CLASS(sp_text_parent_class))->update)
+ (SP_OBJECT_CLASS(sp_text_parent_class))->update (object, ctx, flags);
guint cflags = (flags & SP_OBJECT_MODIFIED_CASCADE);
if (flags & SP_OBJECT_MODIFIED_FLAG) cflags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
@@ -264,8 +238,8 @@ static void sp_text_update(SPObject *object, SPCtx *ctx, guint flags)
static void sp_text_modified(SPObject *object, guint flags)
{
- if (((SPObjectClass *) text_parent_class)->modified) {
- ((SPObjectClass *) text_parent_class)->modified (object, flags);
+ if ((SP_OBJECT_CLASS(sp_text_parent_class))->modified) {
+ (SP_OBJECT_CLASS(sp_text_parent_class))->modified (object, flags);
}
guint cflags = (flags & SP_OBJECT_MODIFIED_CASCADE);
@@ -357,8 +331,8 @@ static Inkscape::XML::Node *sp_text_write(SPObject *object, Inkscape::XML::Docum
text->getRepr()->setAttribute("sodipodi:linespacing", NULL);
}
- if (((SPObjectClass *) (text_parent_class))->write) {
- ((SPObjectClass *) (text_parent_class))->write (object, xml_doc, repr, flags);
+ if ((SP_OBJECT_CLASS(sp_text_parent_class))->write) {
+ (SP_OBJECT_CLASS(sp_text_parent_class))->write (object, xml_doc, repr, flags);
}
return repr;
@@ -396,8 +370,8 @@ sp_text_show(SPItem *item, Inkscape::Drawing &drawing, unsigned /* key*/, unsign
static void
sp_text_hide(SPItem *item, unsigned key)
{
- if (((SPItemClass *) text_parent_class)->hide)
- ((SPItemClass *) text_parent_class)->hide (item, key);
+ if ((SP_ITEM_CLASS(sp_text_parent_class))->hide)
+ (SP_ITEM_CLASS(sp_text_parent_class))->hide (item, key);
}
static char * sp_text_description(SPItem *item)
diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp
index 1b1ae3d52..09429df6f 100644
--- a/src/sp-tspan.cpp
+++ b/src/sp-tspan.cpp
@@ -48,9 +48,6 @@
# SPTSPAN
#####################################################*/
-static void sp_tspan_class_init(SPTSpanClass *classname);
-static void sp_tspan_init(SPTSpan *tspan);
-
static void sp_tspan_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
static void sp_tspan_release(SPObject *object);
static void sp_tspan_set(SPObject *object, unsigned key, gchar const *value);
@@ -60,43 +57,13 @@ static Geom::OptRect sp_tspan_bbox(SPItem const *item, Geom::Affine const &trans
static Inkscape::XML::Node *sp_tspan_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static char *sp_tspan_description (SPItem *item);
-static SPItemClass *tspan_parent_class;
-
-/**
- *
- */
-GType
-sp_tspan_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPTSpanClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_tspan_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPTSpan),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_tspan_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_ITEM, "SPTSpan", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPTSpan, sp_tspan, SP_TYPE_ITEM);
static void
sp_tspan_class_init(SPTSpanClass *classname)
{
- SPObjectClass * sp_object_class;
- SPItemClass * item_class;
-
- sp_object_class = (SPObjectClass *) classname;
- item_class = (SPItemClass *) classname;
-
- tspan_parent_class = (SPItemClass*)g_type_class_ref(SP_TYPE_ITEM);
+ SPObjectClass *sp_object_class = SP_OBJECT_CLASS(classname);
+ SPItemClass *item_class = SP_ITEM_CLASS(classname);
sp_object_class->build = sp_tspan_build;
sp_object_class->release = sp_tspan_release;
@@ -123,15 +90,13 @@ sp_tspan_release(SPObject *object)
tspan->attributes.~TextTagAttributes();
- if (((SPObjectClass *) tspan_parent_class)->release)
- ((SPObjectClass *) tspan_parent_class)->release(object);
+ if ((SP_OBJECT_CLASS(sp_tspan_parent_class))->release)
+ (SP_OBJECT_CLASS(sp_tspan_parent_class))->release(object);
}
static void
sp_tspan_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
{
- //SPTSpan *tspan = SP_TSPAN(object);
-
object->readAttr( "x" );
object->readAttr( "y" );
object->readAttr( "dx" );
@@ -139,8 +104,8 @@ sp_tspan_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
object->readAttr( "rotate" );
object->readAttr( "sodipodi:role" );
- if (((SPObjectClass *) tspan_parent_class)->build)
- ((SPObjectClass *) tspan_parent_class)->build(object, doc, repr);
+ if ((SP_OBJECT_CLASS(sp_tspan_parent_class))->build)
+ (SP_OBJECT_CLASS(sp_tspan_parent_class))->build(object, doc, repr);
}
static void
@@ -160,8 +125,8 @@ sp_tspan_set(SPObject *object, unsigned key, gchar const *value)
}
break;
default:
- if (((SPObjectClass *) tspan_parent_class)->set)
- (((SPObjectClass *) tspan_parent_class)->set)(object, key, value);
+ if ((SP_OBJECT_CLASS(sp_tspan_parent_class))->set)
+ (SP_OBJECT_CLASS(sp_tspan_parent_class))->set(object, key, value);
break;
}
}
@@ -169,8 +134,8 @@ sp_tspan_set(SPObject *object, unsigned key, gchar const *value)
static void sp_tspan_update(SPObject *object, SPCtx *ctx, guint flags)
{
- if (((SPObjectClass *) tspan_parent_class)->update) {
- ((SPObjectClass *) tspan_parent_class)->update(object, ctx, flags);
+ if ((SP_OBJECT_CLASS(sp_tspan_parent_class))->update) {
+ (SP_OBJECT_CLASS(sp_tspan_parent_class))->update(object, ctx, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -187,8 +152,8 @@ static void sp_tspan_update(SPObject *object, SPCtx *ctx, guint flags)
static void sp_tspan_modified(SPObject *object, unsigned flags)
{
- if (((SPObjectClass *) tspan_parent_class)->modified) {
- ((SPObjectClass *) tspan_parent_class)->modified(object, flags);
+ if ((SP_OBJECT_CLASS(sp_tspan_parent_class))->modified) {
+ (SP_OBJECT_CLASS(sp_tspan_parent_class))->modified(object, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -272,8 +237,8 @@ sp_tspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML
}
}
- if (((SPObjectClass *) tspan_parent_class)->write) {
- ((SPObjectClass *) tspan_parent_class)->write(object, xml_doc, repr, flags);
+ if ((SP_OBJECT_CLASS(sp_tspan_parent_class))->write) {
+ (SP_OBJECT_CLASS(sp_tspan_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
@@ -292,8 +257,6 @@ sp_tspan_description(SPItem *item)
# SPTEXTPATH
#####################################################*/
-static void sp_textpath_class_init(SPTextPathClass *classname);
-static void sp_textpath_init(SPTextPath *textpath);
static void sp_textpath_finalize(GObject *obj);
static void sp_textpath_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
@@ -303,42 +266,15 @@ static void sp_textpath_update(SPObject *object, SPCtx *ctx, guint flags);
static void sp_textpath_modified(SPObject *object, unsigned flags);
static Inkscape::XML::Node *sp_textpath_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static SPItemClass *textpath_parent_class;
-
void refresh_textpath_source(SPTextPath* offset);
+G_DEFINE_TYPE(SPTextPath, sp_textpath, SP_TYPE_ITEM);
-/**
- *
- */
-GType
-sp_textpath_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPTextPathClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_textpath_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPTextPath),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_textpath_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_ITEM, "SPTextPath", &info, (GTypeFlags)0);
- }
- return type;
-}
-
-static void sp_textpath_class_init(SPTextPathClass *classname)
+static void
+sp_textpath_class_init(SPTextPathClass *classname)
{
- GObjectClass *gobject_class = reinterpret_cast<GObjectClass *>(classname);
- SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(classname);
-
- textpath_parent_class = reinterpret_cast<SPItemClass*>(g_type_class_ref(SP_TYPE_ITEM));
+ GObjectClass *gobject_class = G_OBJECT_CLASS(classname);
+ SPObjectClass *sp_object_class = SP_OBJECT_CLASS(classname);
gobject_class->finalize = sp_textpath_finalize;
@@ -381,11 +317,12 @@ sp_textpath_release(SPObject *object)
if (textpath->originalPath) delete textpath->originalPath;
textpath->originalPath = NULL;
- if (((SPObjectClass *) textpath_parent_class)->release)
- ((SPObjectClass *) textpath_parent_class)->release(object);
+ if ((SP_OBJECT_CLASS(sp_textpath_parent_class))->release)
+ (SP_OBJECT_CLASS(sp_textpath_parent_class))->release(object);
}
-static void sp_textpath_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
+static void
+sp_textpath_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
{
object->readAttr( "x" );
object->readAttr( "y" );
@@ -410,8 +347,8 @@ static void sp_textpath_build(SPObject *object, SPDocument *doc, Inkscape::XML::
repr->addChild(rch, NULL);
}
- if (((SPObjectClass *) textpath_parent_class)->build) {
- ((SPObjectClass *) textpath_parent_class)->build(object, doc, repr);
+ if ((SP_OBJECT_CLASS(sp_textpath_parent_class))->build) {
+ (SP_OBJECT_CLASS(sp_textpath_parent_class))->build(object, doc, repr);
}
}
@@ -432,8 +369,8 @@ sp_textpath_set(SPObject *object, unsigned key, gchar const *value)
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) textpath_parent_class)->set)
- (((SPObjectClass *) textpath_parent_class)->set)(object, key, value);
+ if ((SP_OBJECT_CLASS(sp_textpath_parent_class))->set)
+ (SP_OBJECT_CLASS(sp_textpath_parent_class))->set(object, key, value);
break;
}
}
@@ -449,8 +386,8 @@ static void sp_textpath_update(SPObject *object, SPCtx *ctx, guint flags)
}
textpath->isUpdating = false;
- if (((SPObjectClass *) textpath_parent_class)->update) {
- ((SPObjectClass *) textpath_parent_class)->update(object, ctx, flags);
+ if ((SP_OBJECT_CLASS(sp_textpath_parent_class))->update) {
+ (SP_OBJECT_CLASS(sp_textpath_parent_class))->update(object, ctx, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -486,10 +423,11 @@ void refresh_textpath_source(SPTextPath* tp)
}
}
-static void sp_textpath_modified(SPObject *object, unsigned flags)
+static void
+sp_textpath_modified(SPObject *object, unsigned flags)
{
- if (((SPObjectClass *) textpath_parent_class)->modified) {
- ((SPObjectClass *) textpath_parent_class)->modified(object, flags);
+ if ((SP_OBJECT_CLASS(sp_textpath_parent_class))->modified) {
+ (SP_OBJECT_CLASS(sp_textpath_parent_class))->modified(object, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -503,6 +441,7 @@ static void sp_textpath_modified(SPObject *object, unsigned flags)
}
}
}
+
static Inkscape::XML::Node *
sp_textpath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
@@ -559,8 +498,8 @@ sp_textpath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::
}
}
- if (((SPObjectClass *) textpath_parent_class)->write) {
- ((SPObjectClass *) textpath_parent_class)->write(object, xml_doc, repr, flags);
+ if ((SP_OBJECT_CLASS(sp_textpath_parent_class))->write) {
+ (SP_OBJECT_CLASS(sp_textpath_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-tspan.h b/src/sp-tspan.h
index 3672fd3b5..794e71039 100644
--- a/src/sp-tspan.h
+++ b/src/sp-tspan.h
@@ -9,6 +9,7 @@
#include "sp-item.h"
#include "text-tag-attributes.h"
+G_BEGIN_DECLS
#define SP_TYPE_TSPAN (sp_tspan_get_type())
#define SP_TSPAN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_TSPAN, SPTSpan))
@@ -16,7 +17,6 @@
#define SP_IS_TSPAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_TSPAN))
#define SP_IS_TSPAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_TSPAN))
-
enum {
SP_TSPAN_ROLE_UNSPECIFIED,
SP_TSPAN_ROLE_PARAGRAPH,
@@ -32,8 +32,9 @@ struct SPTSpanClass {
SPItemClass parent_class;
};
-GType sp_tspan_get_type();
+GType sp_tspan_get_type() G_GNUC_CONST;
+G_END_DECLS
#endif /* !INKSCAPE_SP_TSPAN_H */
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index b2ab3d9e6..f4e4ff4e8 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -915,8 +915,8 @@ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only)
ButtType o_butt;
{
o_width = i_style->stroke_width.computed;
- if (o_width < 0.1) {
- o_width = 0.1;
+ if (o_width < 0.01) {
+ o_width = 0.01;
}
o_miter = i_style->stroke_miterlimit.value * o_width;
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index 2046784f1..8a3fede0f 100644
--- a/src/text-chemistry.cpp
+++ b/src/text-chemistry.cpp
@@ -41,18 +41,6 @@
using Inkscape::DocumentUndo;
static SPItem *
-text_in_selection(Inkscape::Selection *selection)
-{
- for (GSList *items = (GSList *) selection->itemList();
- items != NULL;
- items = items->next) {
- if (SP_IS_TEXT(items->data))
- return ((SPItem *) items->data);
- }
- return NULL;
-}
-
-static SPItem *
flowtext_in_selection(Inkscape::Selection *selection)
{
for (GSList *items = (GSList *) selection->itemList();
diff --git a/src/trace/imagemap.cpp b/src/trace/imagemap.cpp
index c5a6bc2b5..a8d8a8c8f 100644
--- a/src/trace/imagemap.cpp
+++ b/src/trace/imagemap.cpp
@@ -192,16 +192,18 @@ PackedPixelMap *PackedPixelMapCreate(int width, int height)
/** fields **/
me->width = width;
me->height = height;
- me->pixels = (unsigned long *)
- malloc(sizeof(unsigned long) * width * height);
- me->rows = (unsigned long **)
- malloc(sizeof(unsigned long *) * height);
- if (!me->pixels)
- {
+ me->pixels = (unsigned long *) malloc(sizeof(unsigned long) * width * height);
+ if (!me->pixels){
free(me);
return NULL;
- }
-
+ }
+ me->rows = (unsigned long **) malloc(sizeof(unsigned long *) * height);
+ if (!me->rows){
+ free(me->pixels); //allocated as me->pixels is not NULL here: see previous check
+ free(me);
+ return NULL;
+ }
+
unsigned long *row = me->pixels;
for (int i=0 ; i<height ; i++)
{
@@ -270,10 +272,12 @@ static int rWritePPM(RgbMap *me, char *fileName)
static void rDestroy(RgbMap *me)
{
- if (me->pixels)
+ if (me->pixels){
free(me->pixels);
- if (me->rows)
+ }
+ if (me->rows){
free(me->rows);
+ }
free(me);
}
@@ -283,9 +287,10 @@ RgbMap *RgbMapCreate(int width, int height)
{
RgbMap *me = (RgbMap *)malloc(sizeof(RgbMap));
- if (!me)
+ if (!me){
return NULL;
-
+ }
+
/** methods **/
me->setPixel = rSetPixel;
me->setPixelRGB = rSetPixelRGB;
@@ -297,22 +302,23 @@ RgbMap *RgbMapCreate(int width, int height)
/** fields **/
me->width = width;
me->height = height;
- me->pixels = (RGB *)
- malloc(sizeof(RGB) * width * height);
- me->rows = (RGB **)
- malloc(sizeof(RGB *) * height);
- if (!me->pixels)
- {
+ me->pixels = (RGB *) malloc(sizeof(RGB) * width * height);
+ if (!me->pixels){
free(me);
return NULL;
- }
+ }
+ me->rows = (RGB **) malloc(sizeof(RGB *) * height);
+ if (!me->rows){
+ free(me->pixels); //allocated as me->pixels is not NULL here: see previous check
+ free(me);
+ return NULL;
+ }
RGB *row = me->pixels;
- for (int i=0 ; i<height ; i++)
- {
+ for (int i=0 ; i<height ; i++){
me->rows[i] = row;
row += width;
- }
+ }
return me;
}
@@ -376,10 +382,12 @@ static int iWritePPM(IndexedMap *me, char *fileName)
static void iDestroy(IndexedMap *me)
{
- if (me->pixels)
+ if (me->pixels){
free(me->pixels);
- if (me->rows)
+ }
+ if (me->rows){
free(me->rows);
+ }
free(me);
}
@@ -403,31 +411,31 @@ IndexedMap *IndexedMapCreate(int width, int height)
/** fields **/
me->width = width;
me->height = height;
- me->pixels = (unsigned int *)
- malloc(sizeof(unsigned int) * width * height);
- me->rows = (unsigned int **)
- malloc(sizeof(unsigned int *) * height);
- if (!me->pixels)
- {
+ me->pixels = (unsigned int *) malloc(sizeof(unsigned int) * width * height);
+ if (!me->pixels){
free(me);
return NULL;
- }
+ }
+ me->rows = (unsigned int **) malloc(sizeof(unsigned int *) * height);
+ if (!me->rows){
+ free(me->pixels); //allocated as me->pixels is not NULL here: see previous check
+ free(me);
+ return NULL;
+ }
unsigned int *row = me->pixels;
- for (int i=0 ; i<height ; i++)
- {
+ for (int i=0 ; i<height ; i++){
me->rows[i] = row;
row += width;
- }
+ }
me->nrColors = 0;
RGB rgb;
rgb.r = rgb.g = rgb.b = 0;
- for (int i=0; i<256 ; i++)
- {
+ for (int i=0; i<256 ; i++){
me->clut[i] = rgb;
- }
+ }
return me;
}
diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp
index e370a0342..2ff4ed657 100644
--- a/src/ui/dialog/color-item.cpp
+++ b/src/ui/dialog/color-item.cpp
@@ -573,46 +573,21 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewS
lbl->set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
widget = lbl;
} else {
-// Glib::ustring blank(" ");
-// if ( size == Inkscape::ICON_SIZE_MENU || size == Inkscape::ICON_SIZE_DECORATION ) {
-// blank = " ";
-// }
-
GtkWidget* eekWidget = eek_preview_new();
EekPreview * preview = EEK_PREVIEW(eekWidget);
Gtk::Widget* newBlot = Glib::wrap(eekWidget);
-
_regenPreview(preview);
- eek_preview_set_details( preview, (::PreviewStyle)style, (::ViewType)view, (::PreviewSize)size, ratio, border );
+ eek_preview_set_details( preview,
+ (::ViewType)view,
+ (::PreviewSize)size,
+ ratio,
+ border );
def.addCallback( _colorDefChanged, this );
-
- GValue val = {0, {{0}, {0}}};
- g_value_init( &val, G_TYPE_BOOLEAN );
- g_value_set_boolean( &val, FALSE );
- g_object_set_property( G_OBJECT(preview), "focus-on-click", &val );
-
-/*
- Gtk::Button *btn = new Gtk::Button(blank);
- Gdk::Color color;
- color.set_rgb((_r << 8)|_r, (_g << 8)|_g, (_b << 8)|_b);
- btn->modify_bg(Gtk::STATE_NORMAL, color);
- btn->modify_bg(Gtk::STATE_ACTIVE, color);
- btn->modify_bg(Gtk::STATE_PRELIGHT, color);
- btn->modify_bg(Gtk::STATE_SELECTED, color);
-
- Gtk::Widget* newBlot = btn;
-*/
-
+ eek_preview_set_focus_on_click(preview, FALSE);
newBlot->set_tooltip_text(def.descr);
-/*
- newBlot->signal_clicked().connect( sigc::mem_fun(*this, &ColorItem::buttonClicked) );
-
- sigc::signal<void> type_signal_something;
-*/
-
g_signal_connect( G_OBJECT(newBlot->gobj()),
"clicked",
G_CALLBACK(handleClick),
@@ -674,26 +649,6 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewS
G_CALLBACK(handleLeaveNotify),
this);
-// g_signal_connect( G_OBJECT(newBlot->gobj()),
-// "drag-drop",
-// G_CALLBACK(dragDropColorData),
-// this);
-
- if ( def.isEditable() )
- {
-// gtk_drag_dest_set( GTK_WIDGET(newBlot->gobj()),
-// GTK_DEST_DEFAULT_ALL,
-// destColorTargets,
-// G_N_ELEMENTS(destColorTargets),
-// GdkDragAction(GDK_ACTION_COPY | GDK_ACTION_MOVE) );
-
-
-// g_signal_connect( G_OBJECT(newBlot->gobj()),
-// "drag-data-received",
-// G_CALLBACK(_dropDataIn),
-// this );
- }
-
g_signal_connect( G_OBJECT(newBlot->gobj()),
"destroy",
G_CALLBACK(dieDieDie),
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 7574b9266..418132abb 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -1186,7 +1186,7 @@ void FilterEffectsDialog::FilterModifier::setTargetDesktop(SPDesktop *desktop)
}
// When the document changes, update connection to resources
-void FilterEffectsDialog::FilterModifier::on_document_replaced(SPDesktop *desktop, SPDocument *document)
+void FilterEffectsDialog::FilterModifier::on_document_replaced(SPDesktop * /*desktop*/, SPDocument *document)
{
if (_resource_changed) {
_resource_changed.disconnect();
@@ -1201,6 +1201,7 @@ void FilterEffectsDialog::FilterModifier::on_change_selection()
{
Inkscape::Selection *selection = sp_desktop_selection (SP_ACTIVE_DESKTOP);
update_selection(selection);
+ update_filters();
}
void FilterEffectsDialog::FilterModifier::on_modified_selection( guint flags )
@@ -1685,7 +1686,7 @@ void FilterEffectsDialog::PrimitiveList::remove_selected()
}
#if !WITH_GTKMM_3_0
-bool FilterEffectsDialog::PrimitiveList::on_expose_signal(GdkEventExpose *e)
+bool FilterEffectsDialog::PrimitiveList::on_expose_signal(GdkEventExpose * /*evt*/)
{
bool result = false;
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index 1f02002ca..d8bbb5539 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -45,8 +45,8 @@ namespace Dialogs {
GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop *desktop)
: _desktop(desktop), _guide(guide),
_relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")),
- _spin_button_x(_("_X:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu),
- _spin_button_y(_("_Y:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu),
+ _spin_button_x(C_("Guides", "_X:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu),
+ _spin_button_y(C_("Guides", "_Y:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu),
_label_entry(_("_Label:"), _("Optionally give this guideline a name")),
_spin_angle(_("_Angle:"), "", UNIT_TYPE_RADIAL),
_mode(true), _oldpos(0.,0.), _oldangle(0.0)
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 20e5d3ca6..d963e0c7f 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -320,6 +320,7 @@ void InkscapePreferences::initPageTools()
AddSelcueCheckbox(_page_selector, "/tools/select", false);
+ AddGradientCheckbox(_page_selector, "/tools/select", false);
_page_selector.add_group_header( _("When transforming, show"));
_t_sel_trans_obj.init ( _("Objects"), "/tools/select/show", "content", true, 0);
_page_selector.add_line( true, "", _t_sel_trans_obj, "",
@@ -811,7 +812,7 @@ void InkscapePreferences::initPageIO()
// Input devices options
_mouse_sens.init ( "/options/cursortolerance/value", 0.0, 30.0, 1.0, 1.0, 8.0, true, false);
- _page_mouse.add_line( false, _("_Grab sensitivity:"), _mouse_sens, _("pixels"),
+ _page_mouse.add_line( false, _("_Grab sensitivity:"), _mouse_sens, _("pixels (requires restart)"),
_("How close on the screen you need to be to an object to be able to grab it with mouse (in screen pixels)"), false);
_mouse_thres.init ( "/options/dragtolerance/value", 0.0, 20.0, 1.0, 1.0, 4.0, true, false);
_page_mouse.add_line( false, _("_Click/drag threshold:"), _mouse_thres, _("pixels"),
@@ -1096,6 +1097,9 @@ void InkscapePreferences::initPageBehavior()
_sel_locked.init ( _("Ignore locked objects and layers"), "/options/kbselection/onlysensitive", true);
_sel_layer_deselects.init ( _("Deselect upon layer change"), "/options/selection/layerdeselect", true);
+ _page_select.add_line( false, "", _sel_layer_deselects, "",
+ _("Uncheck this to be able to keep the current objects selected when the current layer changes"));
+
_page_select.add_group_header( _("Ctrl+A, Tab, Shift+Tab"));
_page_select.add_line( true, "", _sel_all, "",
_("Make keyboard selection commands work on objects in all layers"));
@@ -1108,10 +1112,6 @@ void InkscapePreferences::initPageBehavior()
_page_select.add_line( true, "", _sel_locked, "",
_("Uncheck this to be able to select objects that are locked (either by themselves or by being in a locked layer)"));
- _page_select.add_line( false, "", _sel_layer_deselects, "",
- _("Uncheck this to be able to keep the current objects selected when the current layer changes"));
-
-
_sel_cycle.init ( _("Wrap when cycling objects in z-order"), "/options/selection/cycleWrap", true);
_page_select.add_group_header( _("Alt+Scroll Wheel"));
@@ -1526,7 +1526,7 @@ void InkscapePreferences::onKBExport()
sp_shortcut_file_export();
}
-bool InkscapePreferences::onKBSearchKeyEvent(GdkEventKey *event)
+bool InkscapePreferences::onKBSearchKeyEvent(GdkEventKey * /*event*/)
{
_kb_filter->refilter();
return FALSE;
@@ -1651,7 +1651,7 @@ void InkscapePreferences::onKBListKeyboardShortcuts()
}
// Find this group in the tree
- Glib::ustring group = verb->get_group() ? verb->get_group() : "Misc";
+ Glib::ustring group = verb->get_group() ? _(verb->get_group()) : _("Misc");
Gtk::TreeStore::iterator iter_group;
bool found = false;
while (path) {
@@ -1679,7 +1679,7 @@ void InkscapePreferences::onKBListKeyboardShortcuts()
}
// Remove the key accelerators from the verb name
- Glib::ustring name = verb->get_name();
+ Glib::ustring name = _(verb->get_name());
std::string::size_type k = 0;
while((k=name.find('_',k))!=name.npos) {
name.erase(k, 1);
@@ -1698,9 +1698,9 @@ void InkscapePreferences::onKBListKeyboardShortcuts()
}
// Add the verb to the group
Gtk::TreeStore::iterator row = _kb_store->append(iter_group->children());
- (*row)[_kb_columns.name] = name;
+ (*row)[_kb_columns.name] = name;
(*row)[_kb_columns.shortcut] = shortcut_label;
- (*row)[_kb_columns.description] = verb->get_short_tip() ? verb->get_short_tip() : "";
+ (*row)[_kb_columns.description] = verb->get_short_tip() ? _(verb->get_short_tip()) : "";
(*row)[_kb_columns.shortcutid] = shortcut_id;
(*row)[_kb_columns.id] = verb->get_id();
(*row)[_kb_columns.user_set] = sp_shortcut_is_user_set(verb);
diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp
index 6aff67f69..1df0d606e 100644
--- a/src/ui/dialog/input.cpp
+++ b/src/ui/dialog/input.cpp
@@ -999,7 +999,7 @@ InputDialogImpl::ConfPanel::ConfPanel() :
titleLabel(""),
axisFrame(_("Axes")),
keysFrame(_("Keys")),
- modeLabel(_("Mode")),
+ modeLabel(_("Mode:")),
modeBox(false, 4)
{
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index 4f7b8f27c..fdc33b2a6 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -655,7 +655,7 @@ bool LayersPanel::_handleButtonEvent(GdkEventButton* event)
* Drap and drop within the tree
* Save the drag source and drop target SPObjects and if its a drag between layers or into (sublayer) a layer
*/
-bool LayersPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time)
+bool LayersPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& /*context*/, int x, int y, guint /*time*/)
{
int cell_x = 0, cell_y = 0;
Gtk::TreeModel::Path target_path;
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp
index f0801734a..0800346f7 100644
--- a/src/ui/dialog/object-properties.cpp
+++ b/src/ui/dialog/object-properties.cpp
@@ -69,15 +69,25 @@ ObjectProperties::ObjectProperties (void) :
subselChangedConn()
{
//initialize labels for the table at the bottom of the dialog
- int_labels.push_back("onclick");
- int_labels.push_back("onmouseover");
- int_labels.push_back("onmouseout");
- int_labels.push_back("onmousedown");
- int_labels.push_back("onmouseup");
- int_labels.push_back("onmousemove");
- int_labels.push_back("onfocusin");
- int_labels.push_back("onfocusout");
- int_labels.push_back("onload");
+ int_attrs.push_back("onclick");
+ int_attrs.push_back("onmouseover");
+ int_attrs.push_back("onmouseout");
+ int_attrs.push_back("onmousedown");
+ int_attrs.push_back("onmouseup");
+ int_attrs.push_back("onmousemove");
+ int_attrs.push_back("onfocusin");
+ int_attrs.push_back("onfocusout");
+ int_attrs.push_back("onload");
+
+ int_labels.push_back("onclick:");
+ int_labels.push_back("onmouseover:");
+ int_labels.push_back("onmouseout:");
+ int_labels.push_back("onmousedown:");
+ int_labels.push_back("onmouseup:");
+ int_labels.push_back("onmousemove:");
+ int_labels.push_back("onfocusin:");
+ int_labels.push_back("onfocusout:");
+ int_labels.push_back("onload:");
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &ObjectProperties::setTargetDesktop) );
deskTrack.connect(GTK_WIDGET(gobj()));
@@ -291,7 +301,7 @@ void ObjectProperties::widget_setup(void)
if (CurrentItem == NULL)
{
- attrTable.set_object(obj, int_labels, int_labels, (GtkWidget*)EInteractivity.gobj());
+ attrTable.set_object(obj, int_labels, int_attrs, (GtkWidget*)EInteractivity.gobj());
}
else
{
diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h
index 0bf622ce4..a04c62bec 100644
--- a/src/ui/dialog/object-properties.h
+++ b/src/ui/dialog/object-properties.h
@@ -67,6 +67,7 @@ public:
private:
bool blocked;
SPItem *CurrentItem; //to store the current item, for not wasting resources
+ std::vector<Glib::ustring> int_attrs;
std::vector<Glib::ustring> int_labels;
Gtk::Table TopTable; //the table with the object properties
diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp
index 82bc85099..09ce59e9c 100644
--- a/src/ui/dialog/ocaldialogs.cpp
+++ b/src/ui/dialog/ocaldialogs.cpp
@@ -324,7 +324,11 @@ bool LoadingBox::_on_expose_event(GdkEventExpose* /*event*/)
}
#endif
-bool LoadingBox::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
+bool LoadingBox::_on_draw(const Cairo::RefPtr<Cairo::Context> &
+#if WITH_GTKMM_3_0
+cr
+#endif
+)
{
// Draw shadow
int x = get_allocation().get_x();
@@ -561,6 +565,7 @@ void StatusWidget::end_process()
clear();
}
+#if !GTK_CHECK_VERSION(3,6,0)
SearchEntry::SearchEntry() : Gtk::Entry()
{
signal_changed().connect(sigc::mem_fun(*this, &SearchEntry::_on_changed));
@@ -589,6 +594,8 @@ void SearchEntry::_on_changed()
set_icon_from_stock(Gtk::Stock::CLEAR, Gtk::ENTRY_ICON_SECONDARY);
}
}
+#endif
+
BaseBox::BaseBox() : Gtk::EventBox()
{
@@ -1208,7 +1215,13 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types
BaseBox *basebox_no_search_results = new BaseBox();
label_not_found = new Gtk::Label();
label_description = new Gtk::Label();
+
+#if GTK_CHECK_VERSION(3,6,0)
+ entry_search = new Gtk::SearchEntry();
+#else
entry_search = new SearchEntry();
+#endif
+
button_search = new Gtk::Button(_("Search"));
#if WITH_GTKMM_3_0
diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h
index 1cdfa15bb..326542579 100644
--- a/src/ui/dialog/ocaldialogs.h
+++ b/src/ui/dialog/ocaldialogs.h
@@ -21,6 +21,11 @@
#include <gtkmm/listviewtext.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/window.h>
+
+#if GTK_CHECK_VERSION(3,6,0)
+# include <gtkmm/searchentry.h>
+#endif
+
#include <giomm/file.h>
//Inkscape includes
@@ -328,6 +333,7 @@ public:
Gtk::Label* label;
};
+#if !GTK_CHECK_VERSION(3,6,0)
/**
* A Gtk::Entry with search & clear icons
*/
@@ -340,6 +346,7 @@ private:
void _on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* event);
void _on_changed();
};
+#endif
/**
* A box which paints an overlay of the OCAL logo
@@ -449,7 +456,13 @@ protected:
private:
Glib::ustring filename_image;
Glib::ustring filename_thumbnail;
+
+#if GTK_CHECK_VERSION(3,6,0)
+ Gtk::SearchEntry *entry_search;
+#else
SearchEntry *entry_search;
+#endif
+
LogoArea *drawingarea_logo;
SearchResultList *list_results;
PreviewWidget *preview_files;
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 3188f1681..71674368b 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -231,8 +231,8 @@ void SymbolsDialog::rebuild() {
draw_symbols( symbolDocument );
}
-void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& data, guint info, guint time) {
-
+void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& /*context*/, Gtk::SelectionData& data, guint /*info*/, guint /*time*/)
+{
#if WITH_GTKMM_3_0
std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items();
#else
diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert
index bbda64648..2de954674 100644
--- a/src/ui/widget/Makefile_insert
+++ b/src/ui/widget/Makefile_insert
@@ -21,6 +21,8 @@ ink_common_sources += \
ui/widget/filter-effect-chooser.cpp \
ui/widget/gimpspinscale.c \
ui/widget/gimpspinscale.h \
+ ui/widget/gimpcolorwheel.c \
+ ui/widget/gimpcolorwheel.h \
ui/widget/frame.cpp \
ui/widget/frame.h \
ui/widget/imageicon.cpp \
diff --git a/src/ui/widget/gimpcolorwheel.c b/src/ui/widget/gimpcolorwheel.c
new file mode 100644
index 000000000..f632331d8
--- /dev/null
+++ b/src/ui/widget/gimpcolorwheel.c
@@ -0,0 +1,1598 @@
+/* HSV color selector for GTK+
+ *
+ * Copyright (C) 1999 The Free Software Foundation
+ *
+ * Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code)
+ * Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+)
+ * Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+)
+ * Michael Natterer <mitch@gimp.org> (ported back to GIMP)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * This widget was adopted by Inkscape by Alex Valavanis <valavanisalex@gmail.com>
+ * on 2013-01-08. Last merges with GIMP code were applied using the following
+ * commits from the GIMP git repository at
+ * http://git.gnome.org/browse/gimp/tree/modules/gimpcolorwheel.c
+ *
+ * Gtk+ 2 code merge: commit 632c5 (2013-01-06)
+ * Gtk+ 3 code merge: commit bcfc6, gtk3-port branch (2013-01-06)
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "gimpcolorwheel.h"
+#include <math.h>
+
+
+/* Default ring fraction */
+#define DEFAULT_FRACTION 0.1
+
+/* Default width/height */
+#define DEFAULT_SIZE 100
+
+/* Default ring width */
+#define DEFAULT_RING_WIDTH 10
+
+
+/* Dragging modes */
+typedef enum
+{
+ DRAG_NONE,
+ DRAG_H,
+ DRAG_SV
+} DragMode;
+
+/* Private part of the GimpColorWheel structure */
+typedef struct
+{
+ /* Color value */
+ gdouble h;
+ gdouble s;
+ gdouble v;
+
+ /* ring_width is this fraction of size */
+ gdouble ring_fraction;
+
+ /* Size and ring width */
+ gint size;
+ gint ring_width;
+
+ /* Window for capturing events */
+ GdkWindow *window;
+
+ /* Dragging mode */
+ DragMode mode;
+
+ guint focus_on_ring : 1;
+} GimpColorWheelPrivate;
+
+enum
+{
+ CHANGED,
+ MOVE,
+ LAST_SIGNAL
+};
+
+static void gimp_color_wheel_map (GtkWidget *widget);
+static void gimp_color_wheel_unmap (GtkWidget *widget);
+static void gimp_color_wheel_realize (GtkWidget *widget);
+static void gimp_color_wheel_unrealize (GtkWidget *widget);
+static void gimp_color_wheel_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
+static gboolean gimp_color_wheel_button_press (GtkWidget *widget,
+ GdkEventButton *event);
+static gboolean gimp_color_wheel_button_release (GtkWidget *widget,
+ GdkEventButton *event);
+static gboolean gimp_color_wheel_motion (GtkWidget *widget,
+ GdkEventMotion *event);
+#if GTK_CHECK_VERSION(3,0,0)
+static gboolean gimp_color_wheel_draw (GtkWidget *widget,
+ cairo_t *cr);
+static void gimp_color_wheel_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width);
+static void gimp_color_wheel_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height);
+#else
+static gboolean gimp_color_wheel_expose (GtkWidget *widget,
+ GdkEventExpose *event);
+static void gimp_color_wheel_size_request (GtkWidget *widget,
+ GtkRequisition *requisition);
+#endif
+
+static gboolean gimp_color_wheel_grab_broken (GtkWidget *widget,
+ GdkEventGrabBroken *event);
+static gboolean gimp_color_wheel_focus (GtkWidget *widget,
+ GtkDirectionType direction);
+static void gimp_color_wheel_move (GimpColorWheel *wheel,
+ GtkDirectionType dir);
+
+
+static guint wheel_signals[LAST_SIGNAL];
+
+G_DEFINE_TYPE (GimpColorWheel, gimp_color_wheel, GTK_TYPE_WIDGET)
+
+#define parent_class gimp_color_wheel_parent_class
+
+
+static void
+gimp_color_wheel_class_init (GimpColorWheelClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+ GimpColorWheelClass *wheel_class = GIMP_COLOR_WHEEL_CLASS (class);
+ GtkBindingSet *binding_set;
+
+ widget_class->map = gimp_color_wheel_map;
+ widget_class->unmap = gimp_color_wheel_unmap;
+ widget_class->realize = gimp_color_wheel_realize;
+ widget_class->unrealize = gimp_color_wheel_unrealize;
+ widget_class->size_allocate = gimp_color_wheel_size_allocate;
+ widget_class->button_press_event = gimp_color_wheel_button_press;
+ widget_class->button_release_event = gimp_color_wheel_button_release;
+ widget_class->motion_notify_event = gimp_color_wheel_motion;
+
+#if GTK_CHECK_VERSION(3,0,0)
+ widget_class->get_preferred_width = gimp_color_wheel_get_preferred_width;
+ widget_class->get_preferred_height = gimp_color_wheel_get_preferred_height;
+ widget_class->draw = gimp_color_wheel_draw;
+#else
+ widget_class->size_request = gimp_color_wheel_size_request;
+ widget_class->expose_event = gimp_color_wheel_expose;
+#endif
+
+ widget_class->focus = gimp_color_wheel_focus;
+ widget_class->grab_broken_event = gimp_color_wheel_grab_broken;
+
+ wheel_class->move = gimp_color_wheel_move;
+
+ wheel_signals[CHANGED] =
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpColorWheelClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ wheel_signals[MOVE] =
+ g_signal_new ("move",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GimpColorWheelClass, move),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__ENUM,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_DIRECTION_TYPE);
+
+ binding_set = gtk_binding_set_by_class (class);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, 0,
+ "move", 1,
+ G_TYPE_ENUM, GTK_DIR_UP);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, 0,
+ "move", 1,
+ G_TYPE_ENUM, GTK_DIR_UP);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, 0,
+ "move", 1,
+ G_TYPE_ENUM, GTK_DIR_DOWN);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, 0,
+ "move", 1,
+ G_TYPE_ENUM, GTK_DIR_DOWN);
+
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Right, 0,
+ "move", 1,
+ G_TYPE_ENUM, GTK_DIR_RIGHT);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Right, 0,
+ "move", 1,
+ G_TYPE_ENUM, GTK_DIR_RIGHT);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Left, 0,
+ "move", 1,
+ G_TYPE_ENUM, GTK_DIR_LEFT);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Left, 0,
+ "move", 1,
+ G_TYPE_ENUM, GTK_DIR_LEFT);
+
+ g_type_class_add_private (object_class, sizeof (GimpColorWheelPrivate));
+}
+
+static void
+gimp_color_wheel_init (GimpColorWheel *wheel)
+{
+ GimpColorWheelPrivate *priv;
+
+ priv = G_TYPE_INSTANCE_GET_PRIVATE (wheel, GIMP_TYPE_COLOR_WHEEL,
+ GimpColorWheelPrivate);
+
+ wheel->priv = priv;
+
+ gtk_widget_set_has_window (GTK_WIDGET (wheel), FALSE);
+ gtk_widget_set_can_focus (GTK_WIDGET (wheel), TRUE);
+
+ priv->ring_fraction = DEFAULT_FRACTION;
+ priv->size = DEFAULT_SIZE;
+ priv->ring_width = DEFAULT_RING_WIDTH;
+}
+
+static void
+gimp_color_wheel_map (GtkWidget *widget)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+
+ GTK_WIDGET_CLASS (parent_class)->map (widget);
+
+ gdk_window_show (priv->window);
+}
+
+static void
+gimp_color_wheel_unmap (GtkWidget *widget)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+
+ gdk_window_hide (priv->window);
+
+ GTK_WIDGET_CLASS (parent_class)->unmap (widget);
+}
+
+static void
+gimp_color_wheel_realize (GtkWidget *widget)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+ GtkAllocation allocation;
+ GdkWindowAttr attr;
+ gint attr_mask;
+ GdkWindow *parent_window;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ gtk_widget_set_realized (widget, TRUE);
+
+ attr.window_type = GDK_WINDOW_CHILD;
+ attr.x = allocation.x;
+ attr.y = allocation.y;
+ attr.width = allocation.width;
+ attr.height = allocation.height;
+ attr.wclass = GDK_INPUT_ONLY;
+ attr.event_mask = (gtk_widget_get_events (widget) |
+ GDK_KEY_PRESS_MASK |
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_POINTER_MOTION_MASK |
+ GDK_ENTER_NOTIFY_MASK |
+ GDK_LEAVE_NOTIFY_MASK);
+
+ attr_mask = GDK_WA_X | GDK_WA_Y;
+
+ parent_window = gtk_widget_get_parent_window (widget);
+
+ gtk_widget_set_window (widget, parent_window);
+ g_object_ref (parent_window);
+
+ priv->window = gdk_window_new (parent_window, &attr, attr_mask);
+ gdk_window_set_user_data (priv->window, wheel);
+
+ gtk_widget_style_attach (widget);
+}
+
+static void
+gimp_color_wheel_unrealize (GtkWidget *widget)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+
+ gdk_window_set_user_data (priv->window, NULL);
+ gdk_window_destroy (priv->window);
+ priv->window = NULL;
+
+ GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
+}
+
+#if GTK_CHECK_VERSION(3,0,0)
+static void
+gimp_color_wheel_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width)
+{
+ gint focus_width;
+ gint focus_pad;
+
+ gtk_widget_style_get (widget,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+
+ *minimum_width = *natural_width = DEFAULT_SIZE + 2 * (focus_width + focus_pad);
+}
+
+static void
+gimp_color_wheel_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ gint focus_width;
+ gint focus_pad;
+
+ gtk_widget_style_get (widget,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+
+ *minimum_height = *natural_height = DEFAULT_SIZE + 2 * (focus_width + focus_pad);
+}
+#else
+static void
+gimp_color_wheel_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ gint focus_width;
+ gint focus_pad;
+
+ gtk_widget_style_get (widget,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+
+ requisition->width = DEFAULT_SIZE + 2 * (focus_width + focus_pad);
+ requisition->height = DEFAULT_SIZE + 2 * (focus_width + focus_pad);
+}
+#endif
+
+static void
+gimp_color_wheel_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+ gint focus_width;
+ gint focus_pad;
+
+ gtk_widget_set_allocation (widget, allocation);
+
+ gtk_widget_style_get (widget,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+
+ priv->size = MIN (allocation->width - 2 * (focus_width + focus_pad),
+ allocation->height - 2 * (focus_width + focus_pad));
+
+ priv->ring_width = priv->size * priv->ring_fraction;
+
+ if (gtk_widget_get_realized (widget))
+ gdk_window_move_resize (priv->window,
+ allocation->x,
+ allocation->y,
+ allocation->width,
+ allocation->height);
+}
+
+
+/* Utility functions */
+
+#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
+
+/* Converts from HSV to RGB */
+static void
+hsv_to_rgb (gdouble *h,
+ gdouble *s,
+ gdouble *v)
+{
+ gdouble hue, saturation, value;
+ gdouble f, p, q, t;
+
+ if (*s == 0.0)
+ {
+ *h = *v;
+ *s = *v;
+ *v = *v; /* heh */
+ }
+ else
+ {
+ hue = *h * 6.0;
+ saturation = *s;
+ value = *v;
+
+ if (hue == 6.0)
+ hue = 0.0;
+
+ f = hue - (int) hue;
+ p = value * (1.0 - saturation);
+ q = value * (1.0 - saturation * f);
+ t = value * (1.0 - saturation * (1.0 - f));
+
+ switch ((int) hue)
+ {
+ case 0:
+ *h = value;
+ *s = t;
+ *v = p;
+ break;
+
+ case 1:
+ *h = q;
+ *s = value;
+ *v = p;
+ break;
+
+ case 2:
+ *h = p;
+ *s = value;
+ *v = t;
+ break;
+
+ case 3:
+ *h = p;
+ *s = q;
+ *v = value;
+ break;
+
+ case 4:
+ *h = t;
+ *s = p;
+ *v = value;
+ break;
+
+ case 5:
+ *h = value;
+ *s = p;
+ *v = q;
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+ }
+}
+
+/* Computes the vertices of the saturation/value triangle */
+static void
+compute_triangle (GimpColorWheel *wheel,
+ gint *hx,
+ gint *hy,
+ gint *sx,
+ gint *sy,
+ gint *vx,
+ gint *vy)
+{
+ GimpColorWheelPrivate *priv = wheel->priv;
+ GtkAllocation allocation;
+ gdouble center_x;
+ gdouble center_y;
+ gdouble inner, outer;
+ gdouble angle;
+
+ gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation);
+
+ center_x = allocation.width / 2.0;
+ center_y = allocation.height / 2.0;
+
+ outer = priv->size / 2.0;
+ inner = outer - priv->ring_width;
+ angle = priv->h * 2.0 * G_PI;
+
+ *hx = floor (center_x + cos (angle) * inner + 0.5);
+ *hy = floor (center_y - sin (angle) * inner + 0.5);
+ *sx = floor (center_x + cos (angle + 2.0 * G_PI / 3.0) * inner + 0.5);
+ *sy = floor (center_y - sin (angle + 2.0 * G_PI / 3.0) * inner + 0.5);
+ *vx = floor (center_x + cos (angle + 4.0 * G_PI / 3.0) * inner + 0.5);
+ *vy = floor (center_y - sin (angle + 4.0 * G_PI / 3.0) * inner + 0.5);
+}
+
+/* Computes whether a point is inside the hue ring */
+static gboolean
+is_in_ring (GimpColorWheel *wheel,
+ gdouble x,
+ gdouble y)
+{
+ GimpColorWheelPrivate *priv = wheel->priv;
+ GtkAllocation allocation;
+ gdouble dx, dy, dist;
+ gdouble center_x;
+ gdouble center_y;
+ gdouble inner, outer;
+
+ gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation);
+
+ center_x = allocation.width / 2.0;
+ center_y = allocation.height / 2.0;
+
+ outer = priv->size / 2.0;
+ inner = outer - priv->ring_width;
+
+ dx = x - center_x;
+ dy = center_y - y;
+ dist = dx * dx + dy * dy;
+
+ return (dist >= inner * inner && dist <= outer * outer);
+}
+
+/* Computes a saturation/value pair based on the mouse coordinates */
+static void
+compute_sv (GimpColorWheel *wheel,
+ gdouble x,
+ gdouble y,
+ gdouble *s,
+ gdouble *v)
+{
+ GtkAllocation allocation;
+ gint ihx, ihy, isx, isy, ivx, ivy;
+ gdouble hx, hy, sx, sy, vx, vy;
+ gdouble center_x;
+ gdouble center_y;
+
+ gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation);
+
+ compute_triangle (wheel, &ihx, &ihy, &isx, &isy, &ivx, &ivy);
+
+ center_x = allocation.width / 2.0;
+ center_y = allocation.height / 2.0;
+
+ hx = ihx - center_x;
+ hy = center_y - ihy;
+ sx = isx - center_x;
+ sy = center_y - isy;
+ vx = ivx - center_x;
+ vy = center_y - ivy;
+ x -= center_x;
+ y = center_y - y;
+
+ if (vx * (x - sx) + vy * (y - sy) < 0.0)
+ {
+ *s = 1.0;
+ *v = (((x - sx) * (hx - sx) + (y - sy) * (hy-sy))
+ / ((hx - sx) * (hx - sx) + (hy - sy) * (hy - sy)));
+
+ if (*v < 0.0)
+ *v = 0.0;
+ else if (*v > 1.0)
+ *v = 1.0;
+ }
+ else if (hx * (x - sx) + hy * (y - sy) < 0.0)
+ {
+ *s = 0.0;
+ *v = (((x - sx) * (vx - sx) + (y - sy) * (vy - sy))
+ / ((vx - sx) * (vx - sx) + (vy - sy) * (vy - sy)));
+
+ if (*v < 0.0)
+ *v = 0.0;
+ else if (*v > 1.0)
+ *v = 1.0;
+ }
+ else if (sx * (x - hx) + sy * (y - hy) < 0.0)
+ {
+ *v = 1.0;
+ *s = (((x - vx) * (hx - vx) + (y - vy) * (hy - vy)) /
+ ((hx - vx) * (hx - vx) + (hy - vy) * (hy - vy)));
+
+ if (*s < 0.0)
+ *s = 0.0;
+ else if (*s > 1.0)
+ *s = 1.0;
+ }
+ else
+ {
+ *v = (((x - sx) * (hy - vy) - (y - sy) * (hx - vx))
+ / ((vx - sx) * (hy - vy) - (vy - sy) * (hx - vx)));
+
+ if (*v<= 0.0)
+ {
+ *v = 0.0;
+ *s = 0.0;
+ }
+ else
+ {
+ if (*v > 1.0)
+ *v = 1.0;
+
+ if (fabs (hy - vy) < fabs (hx - vx))
+ *s = (x - sx - *v * (vx - sx)) / (*v * (hx - vx));
+ else
+ *s = (y - sy - *v * (vy - sy)) / (*v * (hy - vy));
+
+ if (*s < 0.0)
+ *s = 0.0;
+ else if (*s > 1.0)
+ *s = 1.0;
+ }
+ }
+}
+
+/* Computes whether a point is inside the saturation/value triangle */
+static gboolean
+is_in_triangle (GimpColorWheel *wheel,
+ gdouble x,
+ gdouble y)
+{
+ gint hx, hy, sx, sy, vx, vy;
+ gdouble det, s, v;
+
+ compute_triangle (wheel, &hx, &hy, &sx, &sy, &vx, &vy);
+
+ det = (vx - sx) * (hy - sy) - (vy - sy) * (hx - sx);
+
+ s = ((x - sx) * (hy - sy) - (y - sy) * (hx - sx)) / det;
+ v = ((vx - sx) * (y - sy) - (vy - sy) * (x - sx)) / det;
+
+ return (s >= 0.0 && v >= 0.0 && s + v <= 1.0);
+}
+
+/* Computes a value based on the mouse coordinates */
+static double
+compute_v (GimpColorWheel *wheel,
+ gdouble x,
+ gdouble y)
+{
+ GtkAllocation allocation;
+ gdouble center_x;
+ gdouble center_y;
+ gdouble dx, dy;
+ gdouble angle;
+
+ gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation);
+
+ center_x = allocation.width / 2.0;
+ center_y = allocation.height / 2.0;
+
+ dx = x - center_x;
+ dy = center_y - y;
+
+ angle = atan2 (dy, dx);
+ if (angle < 0.0)
+ angle += 2.0 * G_PI;
+
+ return angle / (2.0 * G_PI);
+}
+
+static void
+set_cross_grab (GimpColorWheel *wheel,
+ guint32 time)
+{
+ GimpColorWheelPrivate *priv = wheel->priv;
+ GdkCursor *cursor;
+
+ cursor =
+ gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (wheel)),
+ GDK_CROSSHAIR);
+
+#if GTK_CHECK_VERSION(3,0,0)
+ gdk_device_grab (gtk_get_current_event_device(),
+ priv->window,
+ GDK_OWNERSHIP_NONE,
+ FALSE,
+ GDK_POINTER_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ cursor, time);
+ g_object_unref (cursor);
+#else
+ gdk_pointer_grab (priv->window, FALSE,
+ GDK_POINTER_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ NULL, cursor, time);
+ gdk_cursor_unref (cursor);
+#endif
+}
+
+static gboolean gimp_color_wheel_grab_broken(GtkWidget *widget, GdkEventGrabBroken *event)
+{
+ (void)event;
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+
+ priv->mode = DRAG_NONE;
+
+ return TRUE;
+}
+
+static gboolean
+gimp_color_wheel_button_press (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+ gdouble x, y;
+
+ if (priv->mode != DRAG_NONE || event->button != 1)
+ return FALSE;
+
+ x = event->x;
+ y = event->y;
+
+ if (is_in_ring (wheel, x, y))
+ {
+ priv->mode = DRAG_H;
+ set_cross_grab (wheel, event->time);
+
+ gimp_color_wheel_set_color (wheel,
+ compute_v (wheel, x, y),
+ priv->s,
+ priv->v);
+
+ gtk_widget_grab_focus (widget);
+ priv->focus_on_ring = TRUE;
+
+ return TRUE;
+ }
+
+ if (is_in_triangle (wheel, x, y))
+ {
+ gdouble s, v;
+
+ priv->mode = DRAG_SV;
+ set_cross_grab (wheel, event->time);
+
+ compute_sv (wheel, x, y, &s, &v);
+ gimp_color_wheel_set_color (wheel, priv->h, s, v);
+
+ gtk_widget_grab_focus (widget);
+ priv->focus_on_ring = FALSE;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+gimp_color_wheel_button_release (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+ DragMode mode;
+ gdouble x, y;
+
+ if (priv->mode == DRAG_NONE || event->button != 1)
+ return FALSE;
+
+ /* Set the drag mode to DRAG_NONE so that signal handlers for "catched"
+ * can see that this is the final color state.
+ */
+
+ mode = priv->mode;
+ priv->mode = DRAG_NONE;
+
+ x = event->x;
+ y = event->y;
+
+ if (mode == DRAG_H)
+ {
+ gimp_color_wheel_set_color (wheel,
+ compute_v (wheel, x, y), priv->s, priv->v);
+ }
+ else if (mode == DRAG_SV)
+ {
+ gdouble s, v;
+
+ compute_sv (wheel, x, y, &s, &v);
+ gimp_color_wheel_set_color (wheel, priv->h, s, v);
+ }
+ else
+ g_assert_not_reached ();
+
+#if GTK_CHECK_VERSION(3,0,0)
+ gdk_device_ungrab (gtk_get_current_event_device(),
+ event->time);
+#else
+ gdk_display_pointer_ungrab (gdk_window_get_display (event->window),
+ event->time);
+#endif
+
+ return TRUE;
+}
+
+static gboolean
+gimp_color_wheel_motion (GtkWidget *widget,
+ GdkEventMotion *event)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+ gdouble x, y;
+
+ if (priv->mode == DRAG_NONE)
+ return FALSE;
+
+ gdk_event_request_motions (event);
+ x = event->x;
+ y = event->y;
+
+ if (priv->mode == DRAG_H)
+ {
+ gimp_color_wheel_set_color (wheel,
+ compute_v (wheel, x, y), priv->s, priv->v);
+ return TRUE;
+ }
+ else if (priv->mode == DRAG_SV)
+ {
+ gdouble s, v;
+
+ compute_sv (wheel, x, y, &s, &v);
+ gimp_color_wheel_set_color (wheel, priv->h, s, v);
+ return TRUE;
+ }
+
+ g_assert_not_reached ();
+
+ return FALSE;
+}
+
+
+/* Redrawing */
+
+/* Paints the hue ring */
+static void
+paint_ring (GimpColorWheel *wheel,
+ cairo_t *cr)
+{
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkWidget *widget = GTK_WIDGET (wheel);
+#else
+ GtkAllocation allocation;
+#endif
+ GimpColorWheelPrivate *priv = wheel->priv;
+ gint width, height;
+ gint xx, yy;
+ gdouble dx, dy, dist;
+ gdouble center_x;
+ gdouble center_y;
+ gdouble inner, outer;
+ guint32 *buf, *p;
+ gdouble angle;
+ gdouble hue;
+ gdouble r, g, b;
+ cairo_surface_t *source;
+ cairo_t *source_cr;
+ gint stride;
+
+#if GTK_CHECK_VERSION(3,0,0)
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
+#else
+ gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation);
+ width = allocation.width;
+ height = allocation.height;
+#endif
+
+ center_x = width / 2.0;
+ center_y = height / 2.0;
+
+ outer = priv->size / 2.0;
+ inner = outer - priv->ring_width;
+
+ /* Create an image initialized with the ring colors */
+
+ stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width);
+ buf = g_new (guint32, height * stride / 4);
+
+ for (yy = 0; yy < height; yy++)
+ {
+ p = buf + yy * width;
+ dy = -(yy - center_y);
+
+ for (xx = 0; xx < width; xx++)
+ {
+ dx = xx - center_x;
+
+ dist = dx * dx + dy * dy;
+ if (dist < ((inner-1) * (inner-1)) || dist > ((outer+1) * (outer+1)))
+ {
+ *p++ = 0;
+ continue;
+ }
+
+ angle = atan2 (dy, dx);
+ if (angle < 0.0)
+ angle += 2.0 * G_PI;
+
+ hue = angle / (2.0 * G_PI);
+
+ r = hue;
+ g = 1.0;
+ b = 1.0;
+ hsv_to_rgb (&r, &g, &b);
+
+ *p++ = (((int)floor (r * 255 + 0.5) << 16) |
+ ((int)floor (g * 255 + 0.5) << 8) |
+ (int)floor (b * 255 + 0.5));
+ }
+ }
+
+ source = cairo_image_surface_create_for_data ((unsigned char *)buf,
+ CAIRO_FORMAT_RGB24,
+ width, height, stride);
+
+ /* Now draw the value marker onto the source image, so that it
+ * will get properly clipped at the edges of the ring
+ */
+ source_cr = cairo_create (source);
+
+ r = priv->h;
+ g = 1.0;
+ b = 1.0;
+ hsv_to_rgb (&r, &g, &b);
+
+ if (INTENSITY (r, g, b) > 0.5)
+ cairo_set_source_rgb (source_cr, 0.0, 0.0, 0.0);
+ else
+ cairo_set_source_rgb (source_cr, 1.0, 1.0, 1.0);
+
+ cairo_move_to (source_cr, center_x, center_y);
+ cairo_line_to (source_cr,
+ center_x + cos (priv->h * 2.0 * G_PI) * priv->size / 2,
+ center_y - sin (priv->h * 2.0 * G_PI) * priv->size / 2);
+ cairo_stroke (source_cr);
+ cairo_destroy (source_cr);
+
+ /* Draw the ring using the source image */
+
+ cairo_save (cr);
+
+ cairo_set_source_surface (cr, source, 0, 0);
+ cairo_surface_destroy (source);
+
+ cairo_set_line_width (cr, priv->ring_width);
+ cairo_new_path (cr);
+ cairo_arc (cr,
+ center_x, center_y,
+ priv->size / 2.0 - priv->ring_width / 2.0,
+ 0, 2 * G_PI);
+ cairo_stroke (cr);
+
+ cairo_restore (cr);
+
+ g_free (buf);
+}
+
+/* Converts an HSV triplet to an integer RGB triplet */
+static void
+get_color (gdouble h,
+ gdouble s,
+ gdouble v,
+ gint *r,
+ gint *g,
+ gint *b)
+{
+ hsv_to_rgb (&h, &s, &v);
+
+ *r = floor (h * 255 + 0.5);
+ *g = floor (s * 255 + 0.5);
+ *b = floor (v * 255 + 0.5);
+}
+
+#define SWAP(a, b, t) ((t) = (a), (a) = (b), (b) = (t))
+
+#define LERP(a, b, v1, v2, i) (((v2) - (v1) != 0) \
+ ? ((a) + ((b) - (a)) * ((i) - (v1)) / ((v2) - (v1))) \
+ : (a))
+
+/* Number of pixels we extend out from the edges when creating
+ * color source to avoid artifacts
+ */
+#define PAD 3
+
+/* Paints the HSV triangle */
+static void
+paint_triangle (GimpColorWheel *wheel,
+ cairo_t *cr,
+ gboolean draw_focus)
+{
+ GtkWidget *widget = GTK_WIDGET (wheel);
+ GimpColorWheelPrivate *priv = wheel->priv;
+ gint hx, hy, sx, sy, vx, vy; /* HSV vertices */
+ gint x1, y1, r1, g1, b1; /* First vertex in scanline order */
+ gint x2, y2, r2, g2, b2; /* Second vertex */
+ gint x3, y3, r3, g3, b3; /* Third vertex */
+ gint t;
+ guint32 *buf, *p, c;
+ gint xl, xr, rl, rr, gl, gr, bl, br; /* Scanline data */
+ gint xx, yy;
+ gint x_interp, y_interp;
+ gint x_start, x_end;
+ cairo_surface_t *source;
+ gdouble r, g, b;
+ gint stride;
+ gint width, height;
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkStyleContext *context;
+
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
+#else
+ gchar *detail;
+
+ GtkAllocation allocation;
+ gtk_widget_get_allocation (widget, &allocation);
+ width = allocation.width;
+ height = allocation.height;
+#endif
+
+ /* Compute triangle's vertices */
+
+ compute_triangle (wheel, &hx, &hy, &sx, &sy, &vx, &vy);
+
+ x1 = hx;
+ y1 = hy;
+ get_color (priv->h, 1.0, 1.0, &r1, &g1, &b1);
+
+ x2 = sx;
+ y2 = sy;
+ get_color (priv->h, 1.0, 0.0, &r2, &g2, &b2);
+
+ x3 = vx;
+ y3 = vy;
+ get_color (priv->h, 0.0, 1.0, &r3, &g3, &b3);
+
+ if (y2 > y3)
+ {
+ SWAP (x2, x3, t);
+ SWAP (y2, y3, t);
+ SWAP (r2, r3, t);
+ SWAP (g2, g3, t);
+ SWAP (b2, b3, t);
+ }
+
+ if (y1 > y3)
+ {
+ SWAP (x1, x3, t);
+ SWAP (y1, y3, t);
+ SWAP (r1, r3, t);
+ SWAP (g1, g3, t);
+ SWAP (b1, b3, t);
+ }
+
+ if (y1 > y2)
+ {
+ SWAP (x1, x2, t);
+ SWAP (y1, y2, t);
+ SWAP (r1, r2, t);
+ SWAP (g1, g2, t);
+ SWAP (b1, b2, t);
+ }
+
+ /* Shade the triangle */
+
+ stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width);
+ buf = g_new (guint32, height * stride / 4);
+
+ for (yy = 0; yy < height; yy++)
+ {
+ p = buf + yy * width;
+
+ if (yy >= y1 - PAD && yy < y3 + PAD)
+ {
+ y_interp = CLAMP (yy, y1, y3);
+
+ if (y_interp < y2)
+ {
+ xl = LERP (x1, x2, y1, y2, y_interp);
+
+ rl = LERP (r1, r2, y1, y2, y_interp);
+ gl = LERP (g1, g2, y1, y2, y_interp);
+ bl = LERP (b1, b2, y1, y2, y_interp);
+ }
+ else
+ {
+ xl = LERP (x2, x3, y2, y3, y_interp);
+
+ rl = LERP (r2, r3, y2, y3, y_interp);
+ gl = LERP (g2, g3, y2, y3, y_interp);
+ bl = LERP (b2, b3, y2, y3, y_interp);
+ }
+
+ xr = LERP (x1, x3, y1, y3, y_interp);
+
+ rr = LERP (r1, r3, y1, y3, y_interp);
+ gr = LERP (g1, g3, y1, y3, y_interp);
+ br = LERP (b1, b3, y1, y3, y_interp);
+
+ if (xl > xr)
+ {
+ SWAP (xl, xr, t);
+ SWAP (rl, rr, t);
+ SWAP (gl, gr, t);
+ SWAP (bl, br, t);
+ }
+
+ x_start = MAX (xl - PAD, 0);
+ x_end = MIN (xr + PAD, width);
+ x_start = MIN (x_start, x_end);
+
+ c = (rl << 16) | (gl << 8) | bl;
+
+ for (xx = 0; xx < x_start; xx++)
+ *p++ = c;
+
+ for (; xx < x_end; xx++)
+ {
+ x_interp = CLAMP (xx, xl, xr);
+
+ *p++ = ((LERP (rl, rr, xl, xr, x_interp) << 16) |
+ (LERP (gl, gr, xl, xr, x_interp) << 8) |
+ LERP (bl, br, xl, xr, x_interp));
+ }
+
+ c = (rr << 16) | (gr << 8) | br;
+
+ for (; xx < width; xx++)
+ *p++ = c;
+ }
+ }
+
+ source = cairo_image_surface_create_for_data ((unsigned char *)buf,
+ CAIRO_FORMAT_RGB24,
+ width, height, stride);
+
+ /* Draw a triangle with the image as a source */
+
+ cairo_set_source_surface (cr, source, 0, 0);
+ cairo_surface_destroy (source);
+
+ cairo_move_to (cr, x1, y1);
+ cairo_line_to (cr, x2, y2);
+ cairo_line_to (cr, x3, y3);
+ cairo_close_path (cr);
+ cairo_fill (cr);
+
+ g_free (buf);
+
+ /* Draw value marker */
+
+ xx = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5);
+ yy = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5);
+
+ r = priv->h;
+ g = priv->s;
+ b = priv->v;
+ hsv_to_rgb (&r, &g, &b);
+
+#if GTK_CHECK_VERSION(3,0,0)
+ context = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (context);
+#endif
+
+ if (INTENSITY (r, g, b) > 0.5)
+ {
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_style_context_add_class (context, "light-area-focus");
+#else
+ detail = "colorwheel_light";
+#endif
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+ }
+ else
+ {
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_style_context_add_class (context, "dark-area-focus");
+#else
+ detail = "colorwheel_dark";
+#endif
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ }
+
+#define RADIUS 4
+#define FOCUS_RADIUS 6
+
+ cairo_new_path (cr);
+ cairo_arc (cr, xx, yy, RADIUS, 0, 2 * G_PI);
+ cairo_stroke (cr);
+
+ /* Draw focus outline */
+
+ if (draw_focus && ! priv->focus_on_ring)
+ {
+ gint focus_width;
+ gint focus_pad;
+
+ gtk_widget_style_get (widget,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_render_focus (context, cr,
+ xx - FOCUS_RADIUS - focus_width - focus_pad,
+ yy - FOCUS_RADIUS - focus_width - focus_pad,
+ 2 * (FOCUS_RADIUS + focus_width + focus_pad),
+ 2 * (FOCUS_RADIUS + focus_width + focus_pad));
+#else
+ gtk_widget_get_allocation (widget, &allocation);
+ gtk_paint_focus (gtk_widget_get_style (widget),
+ gtk_widget_get_window (widget),
+ gtk_widget_get_state (widget),
+ NULL, widget, detail,
+ allocation.x + xx - FOCUS_RADIUS - focus_width - focus_pad,
+ allocation.y + yy - FOCUS_RADIUS - focus_width - focus_pad,
+ 2 * (FOCUS_RADIUS + focus_width + focus_pad),
+ 2 * (FOCUS_RADIUS + focus_width + focus_pad));
+#endif
+ }
+
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_style_context_restore (context);
+#endif
+}
+
+#if GTK_CHECK_VERSION(3,2,0)
+static gboolean
+gimp_color_wheel_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+ gboolean draw_focus;
+
+ draw_focus = gtk_widget_has_visible_focus (widget);
+
+ paint_ring (wheel, cr);
+ paint_triangle (wheel, cr, draw_focus);
+
+ if (draw_focus && priv->focus_on_ring)
+ {
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
+
+ gtk_render_focus (context, cr, 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
+ }
+
+ return FALSE;
+}
+#else
+static gint
+gimp_color_wheel_expose (GtkWidget *widget,
+ GdkEventExpose *event)
+{
+ cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
+
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+ gboolean draw_focus;
+ GtkAllocation allocation;
+
+ if (! (event->window == gtk_widget_get_window (widget) &&
+ gtk_widget_is_drawable (widget)))
+ return FALSE;
+
+ gdk_cairo_region (cr, event->region);
+ cairo_clip (cr);
+
+ gtk_widget_get_allocation (widget, &allocation);
+ cairo_translate (cr, allocation.x, allocation.y);
+
+ draw_focus = gtk_widget_has_focus (widget);
+
+ paint_ring (wheel, cr);
+ paint_triangle (wheel, cr, draw_focus);
+
+ cairo_destroy (cr);
+
+ if (draw_focus && priv->focus_on_ring)
+ gtk_paint_focus (gtk_widget_get_style (widget),
+ gtk_widget_get_window (widget),
+ gtk_widget_get_state (widget),
+ &event->area, widget, NULL,
+ allocation.x,
+ allocation.y,
+ allocation.width,
+ allocation.height);
+
+ return FALSE;
+}
+#endif
+
+static gboolean
+gimp_color_wheel_focus (GtkWidget *widget,
+ GtkDirectionType dir)
+{
+ GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget);
+ GimpColorWheelPrivate *priv = wheel->priv;
+
+ if (!gtk_widget_has_focus (widget))
+ {
+ if (dir == GTK_DIR_TAB_BACKWARD)
+ priv->focus_on_ring = FALSE;
+ else
+ priv->focus_on_ring = TRUE;
+
+ gtk_widget_grab_focus (widget);
+ return TRUE;
+ }
+
+ switch (dir)
+ {
+ case GTK_DIR_UP:
+ if (priv->focus_on_ring)
+ return FALSE;
+ else
+ priv->focus_on_ring = TRUE;
+ break;
+
+ case GTK_DIR_DOWN:
+ if (priv->focus_on_ring)
+ priv->focus_on_ring = FALSE;
+ else
+ return FALSE;
+ break;
+
+ case GTK_DIR_LEFT:
+ case GTK_DIR_TAB_BACKWARD:
+ if (priv->focus_on_ring)
+ return FALSE;
+ else
+ priv->focus_on_ring = TRUE;
+ break;
+
+ case GTK_DIR_RIGHT:
+ case GTK_DIR_TAB_FORWARD:
+ if (priv->focus_on_ring)
+ priv->focus_on_ring = FALSE;
+ else
+ return FALSE;
+ break;
+ }
+
+ gtk_widget_queue_draw (widget);
+
+ return TRUE;
+}
+
+/**
+ * gimp_color_wheel_new:
+ *
+ * Creates a new HSV color selector.
+ *
+ * Return value: A newly-created HSV color selector.
+ *
+ * Since: 2.14
+ */
+GtkWidget*
+gimp_color_wheel_new (void)
+{
+ return g_object_new (GIMP_TYPE_COLOR_WHEEL, NULL);
+}
+
+/**
+ * gimp_color_wheel_set_color:
+ * @hsv: An HSV color selector
+ * @h: Hue
+ * @s: Saturation
+ * @v: Value
+ *
+ * Sets the current color in an HSV color selector.
+ * Color component values must be in the [0.0, 1.0] range.
+ *
+ * Since: 2.14
+ */
+void
+gimp_color_wheel_set_color (GimpColorWheel *wheel,
+ gdouble h,
+ gdouble s,
+ gdouble v)
+{
+ GimpColorWheelPrivate *priv;
+
+ g_return_if_fail (GIMP_IS_COLOR_WHEEL (wheel));
+ g_return_if_fail (h >= 0.0 && h <= 1.0);
+ g_return_if_fail (s >= 0.0 && s <= 1.0);
+ g_return_if_fail (v >= 0.0 && v <= 1.0);
+
+ priv = wheel->priv;
+
+ priv->h = h;
+ priv->s = s;
+ priv->v = v;
+
+ g_signal_emit (wheel, wheel_signals[CHANGED], 0);
+
+ gtk_widget_queue_draw (GTK_WIDGET (wheel));
+}
+
+/**
+ * gimp_color_wheel_get_color:
+ * @hsv: An HSV color selector
+ * @h: (out): Return value for the hue
+ * @s: (out): Return value for the saturation
+ * @v: (out): Return value for the value
+ *
+ * Queries the current color in an HSV color selector.
+ * Returned values will be in the [0.0, 1.0] range.
+ *
+ * Since: 2.14
+ */
+void
+gimp_color_wheel_get_color (GimpColorWheel *wheel,
+ gdouble *h,
+ gdouble *s,
+ gdouble *v)
+{
+ GimpColorWheelPrivate *priv;
+
+ g_return_if_fail (GIMP_IS_COLOR_WHEEL (wheel));
+
+ priv = wheel->priv;
+
+ if (h) *h = priv->h;
+ if (s) *s = priv->s;
+ if (v) *v = priv->v;
+}
+
+/**
+ * gimp_color_wheel_set_ring_fraction:
+ * @ring: A wheel color selector
+ * @fraction: Ring fraction
+ *
+ * Sets the ring fraction of a wheel color selector.
+ *
+ * Since: GIMP 2.10
+ */
+void
+gimp_color_wheel_set_ring_fraction (GimpColorWheel *hsv,
+ gdouble fraction)
+{
+ GimpColorWheelPrivate *priv;
+
+ g_return_if_fail (GIMP_IS_COLOR_WHEEL (hsv));
+
+ priv = hsv->priv;
+
+ priv->ring_fraction = CLAMP (fraction, 0.01, 0.99);
+
+ gtk_widget_queue_draw (GTK_WIDGET (hsv));
+}
+
+/**
+ * gimp_color_wheel_get_ring_fraction:
+ * @ring: A wheel color selector
+ *
+ * Returns value: The ring fraction of the wheel color selector.
+ *
+ * Since: GIMP 2.10
+ */
+gdouble
+gimp_color_wheel_get_ring_fraction (GimpColorWheel *wheel)
+{
+ GimpColorWheelPrivate *priv;
+
+ g_return_val_if_fail (GIMP_IS_COLOR_WHEEL (wheel), DEFAULT_FRACTION);
+
+ priv = wheel->priv;
+
+ return priv->ring_fraction;
+}
+
+/**
+ * gimp_color_wheel_is_adjusting:
+ * @hsv: A #GimpColorWheel
+ *
+ * An HSV color selector can be said to be adjusting if multiple rapid
+ * changes are being made to its value, for example, when the user is
+ * adjusting the value with the mouse. This function queries whether
+ * the HSV color selector is being adjusted or not.
+ *
+ * Return value: %TRUE if clients can ignore changes to the color value,
+ * since they may be transitory, or %FALSE if they should consider
+ * the color value status to be final.
+ *
+ * Since: 2.14
+ */
+gboolean
+gimp_color_wheel_is_adjusting (GimpColorWheel *wheel)
+{
+ GimpColorWheelPrivate *priv;
+
+ g_return_val_if_fail (GIMP_IS_COLOR_WHEEL (wheel), FALSE);
+
+ priv = wheel->priv;
+
+ return priv->mode != DRAG_NONE;
+}
+
+static void
+gimp_color_wheel_move (GimpColorWheel *wheel,
+ GtkDirectionType dir)
+{
+ GimpColorWheelPrivate *priv = wheel->priv;
+ gdouble hue, sat, val;
+ gint hx, hy, sx, sy, vx, vy; /* HSV vertices */
+ gint x, y; /* position in triangle */
+
+ hue = priv->h;
+ sat = priv->s;
+ val = priv->v;
+
+ compute_triangle (wheel, &hx, &hy, &sx, &sy, &vx, &vy);
+
+ x = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5);
+ y = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5);
+
+#define HUE_DELTA 0.002
+ switch (dir)
+ {
+ case GTK_DIR_UP:
+ if (priv->focus_on_ring)
+ hue += HUE_DELTA;
+ else
+ {
+ y -= 1;
+ compute_sv (wheel, x, y, &sat, &val);
+ }
+ break;
+
+ case GTK_DIR_DOWN:
+ if (priv->focus_on_ring)
+ hue -= HUE_DELTA;
+ else
+ {
+ y += 1;
+ compute_sv (wheel, x, y, &sat, &val);
+ }
+ break;
+
+ case GTK_DIR_LEFT:
+ if (priv->focus_on_ring)
+ hue += HUE_DELTA;
+ else
+ {
+ x -= 1;
+ compute_sv (wheel, x, y, &sat, &val);
+ }
+ break;
+
+ case GTK_DIR_RIGHT:
+ if (priv->focus_on_ring)
+ hue -= HUE_DELTA
+ ;
+ else
+ {
+ x += 1;
+ compute_sv (wheel, x, y, &sat, &val);
+ }
+ break;
+
+ default:
+ /* we don't care about the tab directions */
+ break;
+ }
+
+ /* Wrap */
+ if (hue < 0.0)
+ hue = 1.0;
+ else if (hue > 1.0)
+ hue = 0.0;
+
+ gimp_color_wheel_set_color (wheel, hue, sat, val);
+}
diff --git a/src/ui/widget/gimpcolorwheel.h b/src/ui/widget/gimpcolorwheel.h
new file mode 100644
index 000000000..016fb593f
--- /dev/null
+++ b/src/ui/widget/gimpcolorwheel.h
@@ -0,0 +1,95 @@
+/* HSV color selector for GTK+
+ *
+ * Copyright (C) 1999 The Free Software Foundation
+ *
+ * Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code)
+ * Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+)
+ * Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GIMP_COLOR_WHEEL_H__
+#define __GIMP_COLOR_WHEEL_H__
+
+G_BEGIN_DECLS
+
+#define GIMP_TYPE_COLOR_WHEEL (gimp_color_wheel_get_type ())
+#define GIMP_COLOR_WHEEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_WHEEL, GimpColorWheel))
+#define GIMP_COLOR_WHEEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_WHEEL, GimpColorWheelClass))
+#define GIMP_IS_COLOR_WHEEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_WHEEL))
+#define GIMP_IS_COLOR_WHEEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_WHEEL))
+#define GIMP_COLOR_WHEEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_WHEEL, GimpColorWheelClass))
+
+
+typedef struct _GimpColorWheel GimpColorWheel;
+typedef struct _GimpColorWheelClass GimpColorWheelClass;
+
+struct _GimpColorWheel
+{
+ GtkWidget parent_instance;
+
+ /* Private data */
+ gpointer priv;
+};
+
+struct _GimpColorWheelClass
+{
+ GtkWidgetClass parent_class;
+
+ /* Notification signals */
+ void (* changed) (GimpColorWheel *wheel);
+
+ /* Keybindings */
+ void (* move) (GimpColorWheel *wheel,
+ GtkDirectionType type);
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+};
+
+
+GType gimp_color_wheel_get_type (void) G_GNUC_CONST;
+GtkWidget * gimp_color_wheel_new (void);
+
+void gimp_color_wheel_set_color (GimpColorWheel *wheel,
+ double h,
+ double s,
+ double v);
+void gimp_color_wheel_get_color (GimpColorWheel *wheel,
+ gdouble *h,
+ gdouble *s,
+ gdouble *v);
+
+void gimp_color_wheel_set_ring_fraction (GimpColorWheel *wheel,
+ gdouble fraction);
+gdouble gimp_color_wheel_get_ring_fraction (GimpColorWheel *wheel);
+
+gboolean gimp_color_wheel_is_adjusting (GimpColorWheel *wheel);
+
+G_END_DECLS
+
+#endif /* __GIMP_COLOR_WHEEL_H__ */
diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp
index 00c575568..8aab57a34 100644
--- a/src/ui/widget/spin-scale.cpp
+++ b/src/ui/widget/spin-scale.cpp
@@ -19,10 +19,9 @@ namespace UI {
namespace Widget {
SpinScale::SpinScale(const char* label, double value, double lower, double upper, double step_inc,
- double climb_rate, int digits, const SPAttributeEnum a, const char* tip_text)
+ double /*climb_rate*/, int digits, const SPAttributeEnum a, const char* tip_text)
: AttrWidget(a, value)
{
-
#if WITH_GTKMM_3_0
_adjustment = Gtk::Adjustment::create(value, lower, upper, step_inc);
_spinscale = gimp_spin_scale_new (_adjustment->gobj(), label, digits);
diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp
index 87deffc71..7c72f8e0c 100644
--- a/src/widgets/connector-toolbar.cpp
+++ b/src/widgets/connector-toolbar.cpp
@@ -78,13 +78,6 @@ using Inkscape::UI::PrefPusher;
//## Connector ##
//#########################
-static void sp_connector_mode_toggled( GtkToggleAction* act, GObject * /*tbl*/ )
-{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool("/tools/connector/mode",
- gtk_toggle_action_get_active( act ));
-}
-
static void sp_connector_path_set_avoid(void)
{
cc_selection_set_avoid(true);
@@ -303,26 +296,6 @@ static void connector_tb_event_attr_changed(Inkscape::XML::Node *repr,
}
}
-static void sp_connector_new_connection_point(GtkWidget *, GObject *tbl)
-{
- SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" ));
- SPConnectorContext* cc = SP_CONNECTOR_CONTEXT(desktop->event_context);
-
- if (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE) {
- cc_create_connection_point(cc);
- }
-}
-
-static void sp_connector_remove_connection_point(GtkWidget *, GObject *tbl)
-{
- SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" ));
- SPConnectorContext* cc = SP_CONNECTOR_CONTEXT(desktop->event_context);
-
- if (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE) {
- cc_remove_connection_point(cc);
- }
-}
-
static Inkscape::XML::NodeEventVector connector_tb_repr_events = {
NULL, /* child_added */
NULL, /* child_removed */
@@ -351,22 +324,6 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions,
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
- // Editing mode toggle button
- {
- InkToggleAction* act = ink_toggle_action_new( "ConnectorEditModeAction",
- _("EditMode"),
- _("Switch between connection point editing and connector drawing mode"),
- INKSCAPE_ICON("connector-edit"),
- Inkscape::ICON_SIZE_DECORATION );
- gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
-
- bool tbuttonstate = prefs->getBool("/tools/connector/mode");
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act), ( tbuttonstate ? TRUE : FALSE ));
- g_object_set_data( holder, "mode", act );
- g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_connector_mode_toggled), holder );
- }
-
-
{
InkAction* inky = ink_action_new( "ConnectorAvoidAction",
_("Avoid"),
@@ -480,30 +437,6 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions,
}
- // New connection point button
- {
- InkAction* inky = ink_action_new( "ConnectorNewConnPointAction",
- _("New connection point"),
- _("Add a new connection point to the currently selected item"),
- INKSCAPE_ICON("connector-new-connpoint"),
- secondarySize );
- g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_new_connection_point), holder );
- gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
- }
-
- // Remove selected connection point button
-
- {
- InkAction* inky = ink_action_new( "ConnectorRemoveConnPointAction",
- _("Remove connection point"),
- _("Remove the currently selected connection point"),
- INKSCAPE_ICON("connector-remove-connpoint"),
- secondarySize );
- g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_remove_connection_point), holder );
- gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
- }
-
-
// Code to watch for changes to the connector-spacing attribute in
// the XML.
Inkscape::XML::Node *repr = desktop->namedview->getRepr();
diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp
index 535a5d101..988aa2453 100644
--- a/src/widgets/eek-preview.cpp
+++ b/src/widgets/eek-preview.cpp
@@ -46,68 +46,79 @@ using std::min;
#define PRIME_BUTTON_MAGIC_NUMBER 1
-#define FOCUS_PROP_ID 1
-
-/* Keep in sycn with last value in eek-preview.h */
+/* Keep in sync with last value in eek-preview.h */
#define PREVIEW_SIZE_LAST PREVIEW_SIZE_HUGE
#define PREVIEW_SIZE_NEXTFREE (PREVIEW_SIZE_HUGE + 1)
#define PREVIEW_MAX_RATIO 500
-static void eek_preview_class_init( EekPreviewClass *klass );
-static void eek_preview_init( EekPreview *preview );
+enum {
+ PROP_0,
+ PROP_FOCUS
+};
+
+typedef struct
+{
+ int scaledW;
+ int scaledH;
+
+ int r;
+ int g;
+ int b;
+
+ gboolean hot;
+ gboolean within;
+ gboolean takesFocus;
+ ViewType view;
+ PreviewSize size;
+ guint ratio;
+ guint linked;
+ guint border;
+ GdkPixbuf *previewPixbuf;
+ GdkPixbuf *scaled;
+} EekPreviewPrivate;
+
+#define EEK_PREVIEW_GET_PRIVATE(preview) \
+ G_TYPE_INSTANCE_GET_PRIVATE(preview, EEK_PREVIEW_TYPE, EekPreviewPrivate)
+
+static void eek_preview_class_init( EekPreviewClass *klass );
+static void eek_preview_init( EekPreview *preview );
static gboolean eek_preview_draw(GtkWidget* widget, cairo_t* cr);
+G_DEFINE_TYPE(EekPreview, eek_preview, GTK_TYPE_DRAWING_AREA);
+
static GtkWidgetClass* parent_class = 0;
void eek_preview_set_color( EekPreview* preview, int r, int g, int b )
{
- preview->_r = r;
- preview->_g = g;
- preview->_b = b;
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ priv->r = r;
+ priv->g = g;
+ priv->b = b;
gtk_widget_queue_draw(GTK_WIDGET(preview));
}
-void eek_preview_set_pixbuf( EekPreview* preview, GdkPixbuf* pixbuf )
+void
+eek_preview_set_pixbuf(EekPreview *preview,
+ GdkPixbuf *pixbuf)
{
- preview->_previewPixbuf = pixbuf;
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
- gtk_widget_queue_draw(GTK_WIDGET(preview));
-
- if (preview->_scaled) {
- g_object_unref(preview->_scaled);
- preview->_scaled = 0;
- }
- preview->_scaledW = gdk_pixbuf_get_width(preview->_previewPixbuf);
- preview->_scaledH = gdk_pixbuf_get_height(preview->_previewPixbuf);
-}
+ priv->previewPixbuf = pixbuf;
+ gtk_widget_queue_draw(GTK_WIDGET(preview));
-GType eek_preview_get_type(void)
-{
- static GType preview_type = 0;
-
- if (!preview_type) {
- static const GTypeInfo preview_info = {
- sizeof( EekPreviewClass ),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)eek_preview_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof( EekPreview ),
- 0, /* n_preallocs */
- (GInstanceInitFunc)eek_preview_init,
- NULL /* value_table */
- };
-
-
- preview_type = g_type_register_static( GTK_TYPE_DRAWING_AREA, "EekPreview", &preview_info, (GTypeFlags)0 );
+ if (priv->scaled)
+ {
+ g_object_unref(priv->scaled);
+ priv->scaled = NULL;
}
- return preview_type;
+ priv->scaledW = gdk_pixbuf_get_width(priv->previewPixbuf);
+ priv->scaledH = gdk_pixbuf_get_height(priv->previewPixbuf);
}
static gboolean setupDone = FALSE;
@@ -149,9 +160,10 @@ void eek_preview_set_size_mappings( guint count, GtkIconSize const* sizes )
static void eek_preview_size_request( GtkWidget* widget, GtkRequisition* req )
{
- gint width = 0;
- gint height = 0;
- EekPreview* preview = EEK_PREVIEW(widget);
+ gint width = 0;
+ gint height = 0;
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
if ( !setupDone ) {
GtkIconSize sizes[] = {
@@ -164,15 +176,15 @@ static void eek_preview_size_request( GtkWidget* widget, GtkRequisition* req )
eek_preview_set_size_mappings( G_N_ELEMENTS(sizes), sizes );
}
- width = sizeThings[preview->_size].width;
- height = sizeThings[preview->_size].height;
+ width = sizeThings[priv->size].width;
+ height = sizeThings[priv->size].height;
- if ( preview->_view == VIEW_TYPE_LIST ) {
+ if ( priv->view == VIEW_TYPE_LIST ) {
width *= 3;
}
- if ( preview->_ratio != 100 ) {
- width = (width * preview->_ratio) / 100;
+ if ( priv->ratio != 100 ) {
+ width = (width * priv->ratio) / 100;
if ( width < 0 ) {
width = 1;
}
@@ -223,49 +235,54 @@ static gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* /*
}
#endif
-static gboolean eek_preview_draw(GtkWidget* widget, cairo_t* cr)
+static
+gboolean eek_preview_draw(GtkWidget *widget,
+ cairo_t *cr)
{
- GtkStyle* style = gtk_widget_get_style(widget);
+ GtkStyle *style = gtk_widget_get_style(widget);
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
- EekPreview* preview = EEK_PREVIEW(widget);
GdkColor fg = { 0,
- static_cast<guint16>(preview->_r),
- static_cast<guint16>(preview->_g),
- static_cast<guint16>(preview->_b)};
+ static_cast<guint16>(priv->r),
+ static_cast<guint16>(priv->g),
+ static_cast<guint16>(priv->b)
+ };
gint insetTop = 0, insetBottom = 0;
gint insetLeft = 0, insetRight = 0;
- if (preview->_border == BORDER_SOLID) {
+ if (priv->border == BORDER_SOLID) {
insetTop = 1;
insetLeft = 1;
}
- if (preview->_border == BORDER_SOLID_LAST_ROW) {
+ if (priv->border == BORDER_SOLID_LAST_ROW) {
insetTop = insetBottom = 1;
insetLeft = 1;
}
- if (preview->_border == BORDER_WIDE) {
+ if (priv->border == BORDER_WIDE) {
insetTop = insetBottom = 1;
insetLeft = insetRight = 1;
}
#if GTK_CHECK_VERSION(3,0,0)
- GtkStyleContext *context = gtk_widget_get_style_context(widget);
+ GtkStyleContext *context = gtk_widget_get_style_context(widget);
- gtk_render_frame(context,
- cr,
- 0, 0,
- allocation.width, allocation.height);
+ gtk_render_frame(context,
+ cr,
+ 0, 0,
+ allocation.width, allocation.height);
- gtk_render_background(context,
- cr,
- 0, 0,
- allocation.width, allocation.height);
+ gtk_render_background(context,
+ cr,
+ 0, 0,
+ allocation.width, allocation.height);
#else
- GdkWindow* window = gtk_widget_get_window(widget);
+ GdkWindow* window = gtk_widget_get_window(widget);
gtk_paint_flat_box( style,
window,
@@ -277,227 +294,247 @@ static gboolean eek_preview_draw(GtkWidget* widget, cairo_t* cr)
0, 0,
allocation.width, allocation.height);
- gdk_colormap_alloc_color( gdk_colormap_get_system(), &fg, FALSE, TRUE );
+ gdk_colormap_alloc_color( gdk_colormap_get_system(), &fg, FALSE, TRUE );
#endif
- // Border
- if (preview->_border != BORDER_NONE) {
+ // Border
+ if (priv->border != BORDER_NONE) {
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
cairo_fill(cr);
- }
+ }
- cairo_set_source_rgb(cr, preview->_r/65535.0, preview->_g/65535.0, preview->_b/65535.0 );
+ cairo_set_source_rgb(cr, priv->r/65535.0, priv->g/65535.0, priv->b/65535.0 );
cairo_rectangle(cr, insetLeft, insetTop, allocation.width - (insetLeft + insetRight), allocation.height - (insetTop + insetBottom));
cairo_fill(cr);
- if ( preview->_previewPixbuf ) {
+ if (priv->previewPixbuf )
+ {
GtkDrawingArea *da = &(preview->drawing);
- GdkWindow *da_window = gtk_widget_get_window(GTK_WIDGET(da));
- cairo_t *cr = gdk_cairo_create(da_window);
+ GdkWindow *da_window = gtk_widget_get_window(GTK_WIDGET(da));
+ cairo_t *cr = gdk_cairo_create(da_window);
- gint w = gdk_window_get_width(da_window);
- gint h = gdk_window_get_height(da_window);
+ gint w = gdk_window_get_width(da_window);
+ gint h = gdk_window_get_height(da_window);
- if ((w != preview->_scaledW) || (h != preview->_scaledH)) {
- if (preview->_scaled) {
- g_object_unref(preview->_scaled);
+ if ((w != priv->scaledW) || (h != priv->scaledH)) {
+ if (priv->scaled)
+ {
+ g_object_unref(priv->scaled);
}
- preview->_scaled = gdk_pixbuf_scale_simple(preview->_previewPixbuf, w - (insetLeft + insetRight), h - (insetTop + insetBottom), GDK_INTERP_BILINEAR);
- preview->_scaledW = w - (insetLeft + insetRight);
- preview->_scaledH = h - (insetTop + insetBottom);
+
+ priv->scaled = gdk_pixbuf_scale_simple(priv->previewPixbuf,
+ w - (insetLeft + insetRight),
+ h - (insetTop + insetBottom),
+ GDK_INTERP_BILINEAR);
+
+ priv->scaledW = w - (insetLeft + insetRight);
+ priv->scaledH = h - (insetTop + insetBottom);
}
- GdkPixbuf *pix = (preview->_scaled) ? preview->_scaled : preview->_previewPixbuf;
+ GdkPixbuf *pix = (priv->scaled) ? priv->scaled : priv->previewPixbuf;
// Border
- if (preview->_border != BORDER_NONE) {
+ if (priv->border != BORDER_NONE) {
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
cairo_fill(cr);
}
- gdk_cairo_set_source_pixbuf(cr, pix, insetLeft, insetTop);
- cairo_paint(cr);
- cairo_destroy(cr);
+ gdk_cairo_set_source_pixbuf(cr, pix, insetLeft, insetTop);
+ cairo_paint(cr);
+ cairo_destroy(cr);
}
- if ( preview->_linked ) {
- /* Draw arrow */
- GdkRectangle possible = {insetLeft, insetTop, (allocation.width - (insetLeft + insetRight)), (allocation.height - (insetTop + insetBottom)) };
- GdkRectangle area = {possible.x, possible.y, possible.width / 2, possible.height / 2 };
-
- /* Make it square */
- if ( area.width > area.height )
- area.width = area.height;
- if ( area.height > area.width )
- area.height = area.width;
-
- /* Center it horizontally */
- if ( area.width < possible.width ) {
- int diff = (possible.width - area.width) / 2;
- area.x += diff;
- }
-
+ if (priv->linked)
+ {
+ /* Draw arrow */
+ GdkRectangle possible = {insetLeft,
+ insetTop,
+ (allocation.width - (insetLeft + insetRight)),
+ (allocation.height - (insetTop + insetBottom))
+ };
+
+ GdkRectangle area = {possible.x,
+ possible.y,
+ possible.width / 2,
+ possible.height / 2 };
+
+ /* Make it square */
+ if ( area.width > area.height )
+ area.width = area.height;
+ if ( area.height > area.width )
+ area.height = area.width;
+
+ /* Center it horizontally */
+ if ( area.width < possible.width ) {
+ int diff = (possible.width - area.width) / 2;
+ area.x += diff;
+ }
- if ( preview->_linked & PREVIEW_LINK_IN ) {
+ if (priv->linked & PREVIEW_LINK_IN)
+ {
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_arrow(context,
- cr,
- G_PI, // Down-pointing arrow
- area.x, area.y,
- min(area.width, area.height)
- );
+ gtk_render_arrow(context,
+ cr,
+ G_PI, // Down-pointing arrow
+ area.x, area.y,
+ min(area.width, area.height)
+ );
#else
- gtk_paint_arrow( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_IN,
- NULL, /* clip area. &area, */
- widget, /* may be NULL */
- NULL, /* detail */
- GTK_ARROW_DOWN,
- FALSE,
- area.x, area.y,
- area.width, area.height
- );
+ gtk_paint_arrow( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_IN,
+ NULL, /* clip area. &area, */
+ widget, /* may be NULL */
+ NULL, /* detail */
+ GTK_ARROW_DOWN,
+ FALSE,
+ area.x, area.y,
+ area.width, area.height
+ );
#endif
- }
+ }
- if ( preview->_linked & PREVIEW_LINK_OUT ) {
- GdkRectangle otherArea = {area.x, area.y, area.width, area.height};
- if ( otherArea.height < possible.height ) {
- otherArea.y = possible.y + (possible.height - otherArea.height);
- }
+ if (priv->linked & PREVIEW_LINK_OUT)
+ {
+ GdkRectangle otherArea = {area.x, area.y, area.width, area.height};
+ if ( otherArea.height < possible.height ) {
+ otherArea.y = possible.y + (possible.height - otherArea.height);
+ }
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_arrow(context,
- cr,
- G_PI, // Down-pointing arrow
- otherArea.x, otherArea.y,
- min(otherArea.width, otherArea.height)
- );
+ gtk_render_arrow(context,
+ cr,
+ G_PI, // Down-pointing arrow
+ otherArea.x, otherArea.y,
+ min(otherArea.width, otherArea.height)
+ );
#else
- gtk_paint_arrow( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL, /* clip area. &area, */
- widget, /* may be NULL */
- NULL, /* detail */
- GTK_ARROW_DOWN,
- FALSE,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height
- );
+ gtk_paint_arrow( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ NULL, /* clip area. &area, */
+ widget, /* may be NULL */
+ NULL, /* detail */
+ GTK_ARROW_DOWN,
+ FALSE,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height
+ );
#endif
- }
+ }
- if ( preview->_linked & PREVIEW_LINK_OTHER ) {
- GdkRectangle otherArea = {insetLeft, area.y, area.width, area.height};
- if ( otherArea.height < possible.height ) {
- otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
- }
+ if (priv->linked & PREVIEW_LINK_OTHER)
+ {
+ GdkRectangle otherArea = {insetLeft, area.y, area.width, area.height};
+ if ( otherArea.height < possible.height ) {
+ otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
+ }
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_arrow(context,
- cr,
- 1.5*G_PI, // Left-pointing arrow
- otherArea.x, otherArea.y,
- min(otherArea.width, otherArea.height)
- );
+ gtk_render_arrow(context,
+ cr,
+ 1.5*G_PI, // Left-pointing arrow
+ otherArea.x, otherArea.y,
+ min(otherArea.width, otherArea.height)
+ );
#else
- gtk_paint_arrow( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL, /* clip area. &area, */
- widget, /* may be NULL */
- NULL, /* detail */
- GTK_ARROW_LEFT,
- FALSE,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height
- );
+ gtk_paint_arrow( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ NULL, /* clip area. &area, */
+ widget, /* may be NULL */
+ NULL, /* detail */
+ GTK_ARROW_LEFT,
+ FALSE,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height
+ );
#endif
- }
+ }
- if ( preview->_linked & PREVIEW_FILL ) {
- GdkRectangle otherArea = {possible.x + ((possible.width / 4) - (area.width / 2)),
- area.y,
- area.width, area.height};
- if ( otherArea.height < possible.height ) {
- otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
- }
+ if (priv->linked & PREVIEW_FILL)
+ {
+ GdkRectangle otherArea = {possible.x + ((possible.width / 4) - (area.width / 2)),
+ area.y,
+ area.width, area.height};
+ if ( otherArea.height < possible.height ) {
+ otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
+ }
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_check(context,
- cr,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
+ gtk_render_check(context,
+ cr,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height );
#else
- gtk_paint_check( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL,
- widget,
- NULL,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
+ gtk_paint_check( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ NULL,
+ widget,
+ NULL,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height );
#endif
- }
+ }
- if ( preview->_linked & PREVIEW_STROKE ) {
- GdkRectangle otherArea = {possible.x + (((possible.width * 3) / 4) - (area.width / 2)),
- area.y,
- area.width, area.height};
- if ( otherArea.height < possible.height ) {
- otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
- }
+ if (priv->linked & PREVIEW_STROKE)
+ {
+ GdkRectangle otherArea = {possible.x + (((possible.width * 3) / 4) - (area.width / 2)),
+ area.y,
+ area.width, area.height};
+ if ( otherArea.height < possible.height ) {
+ otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
+ }
#if GTK_CHECK_VERSION(3,0,0)
- gtk_paint_diamond( style,
- cr,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- widget,
- NULL,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
+ gtk_paint_diamond( style,
+ cr,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ widget,
+ NULL,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height );
#else
- gtk_paint_diamond( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL,
- widget,
- NULL,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
+ gtk_paint_diamond( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ NULL,
+ widget,
+ NULL,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height );
#endif
- }
}
+ }
- if ( gtk_widget_has_focus(widget) ) {
- gtk_widget_get_allocation (widget, &allocation);
+ if ( gtk_widget_has_focus(widget) ) {
+ gtk_widget_get_allocation (widget, &allocation);
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_focus(context,
- cr,
- 0 + 1, 0 + 1,
- allocation.width - 2, allocation.height - 2 );
+ gtk_render_focus(context,
+ cr,
+ 0 + 1, 0 + 1,
+ allocation.width - 2, allocation.height - 2 );
#else
- gtk_paint_focus( style,
- window,
- GTK_STATE_NORMAL,
- NULL, /* GdkRectangle *area, */
- widget,
- NULL,
- 0 + 1, 0 + 1,
- allocation.width - 2, allocation.height - 2 );
+ gtk_paint_focus( style,
+ window,
+ GTK_STATE_NORMAL,
+ NULL, /* GdkRectangle *area, */
+ widget,
+ NULL,
+ 0 + 1, 0 + 1,
+ allocation.width - 2, allocation.height - 2 );
#endif
- }
+ }
return FALSE;
}
@@ -506,52 +543,48 @@ static gboolean eek_preview_draw(GtkWidget* widget, cairo_t* cr)
static gboolean eek_preview_enter_cb( GtkWidget* widget, GdkEventCrossing* event )
{
if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) {
- EekPreview* preview = EEK_PREVIEW(widget);
- preview->_within = TRUE;
- gtk_widget_set_state( widget, preview->_hot ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT );
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ priv->within = TRUE;
+ gtk_widget_set_state( widget, priv->hot ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT );
}
+
return FALSE;
}
static gboolean eek_preview_leave_cb( GtkWidget* widget, GdkEventCrossing* event )
{
if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) {
- EekPreview* preview = EEK_PREVIEW(widget);
- preview->_within = FALSE;
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ priv->within = FALSE;
gtk_widget_set_state( widget, GTK_STATE_NORMAL );
}
- return FALSE;
-}
-/*
-static gboolean eek_preview_focus_in_event( GtkWidget* widget, GdkEventFocus* event )
-{
- g_message("focus IN");
- gboolean blip = parent_class->focus_in_event ? parent_class->focus_in_event(widget, event) : FALSE;
- return blip;
-}
-
-static gboolean eek_preview_focus_out_event( GtkWidget* widget, GdkEventFocus* event )
-{
- g_message("focus OUT");
- gboolean blip = parent_class->focus_out_event ? parent_class->focus_out_event(widget, event) : FALSE;
- return blip;
+ return FALSE;
}
-*/
static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton* event )
{
- if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) {
- EekPreview* preview = EEK_PREVIEW(widget);
+ if ( gtk_get_event_widget( (GdkEvent*)event ) == widget )
+ {
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
- if ( preview->_takesFocus && !gtk_widget_has_focus(widget) ) {
+ if ( priv->takesFocus && !gtk_widget_has_focus(widget) )
+ {
gtk_widget_grab_focus(widget);
}
if ( event->button == PRIME_BUTTON_MAGIC_NUMBER ||
- event->button == 2 ) {
- preview->_hot = TRUE;
- if ( preview->_within ) {
+ event->button == 2 )
+ {
+ priv->hot = TRUE;
+
+ if ( priv->within )
+ {
gtk_widget_set_state( widget, GTK_STATE_ACTIVE );
}
}
@@ -563,91 +596,76 @@ static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton*
static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton* event )
{
if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) {
- EekPreview* preview = EEK_PREVIEW(widget);
- preview->_hot = FALSE;
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ priv->hot = FALSE;
gtk_widget_set_state( widget, GTK_STATE_NORMAL );
- if ( preview->_within &&
- (event->button == PRIME_BUTTON_MAGIC_NUMBER || event->button == 2)) {
+
+ if ( priv->within &&
+ (event->button == PRIME_BUTTON_MAGIC_NUMBER ||
+ event->button == 2))
+ {
gboolean isAlt = ( ((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) ||
(event->button == 2));
- if ( isAlt ) {
+ if ( isAlt )
+ {
g_signal_emit( widget, eek_preview_signals[ALTCLICKED_SIGNAL], 0, 2 );
- } else {
+ }
+ else
+ {
g_signal_emit( widget, eek_preview_signals[CLICKED_SIGNAL], 0 );
}
}
}
- return FALSE;
-}
-static gboolean eek_preview_key_press_event( GtkWidget* widget, GdkEventKey* event)
-{
- (void)widget;
- (void)event;
- g_message("TICK");
return FALSE;
}
-static gboolean eek_preview_key_release_event( GtkWidget* widget, GdkEventKey* event)
-{
- (void)widget;
- (void)event;
- g_message("tock");
- return FALSE;
-}
-
-static void eek_preview_get_property( GObject *object,
- guint property_id,
- GValue *value,
+static void eek_preview_get_property( GObject *object,
+ guint prop_id,
+ GValue *value,
GParamSpec *pspec)
{
- GObjectClass* gobjClass = G_OBJECT_CLASS(parent_class);
- switch ( property_id ) {
- case FOCUS_PROP_ID:
- {
- EekPreview* preview = EEK_PREVIEW( object );
- g_value_set_boolean( value, preview->_takesFocus );
- }
- break;
+ EekPreview *preview = EEK_PREVIEW( object );
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ switch (prop_id)
+ {
+ case PROP_FOCUS:
+ g_value_set_boolean( value, priv->takesFocus );
+ break;
+
default:
- {
- if ( gobjClass->get_property ) {
- gobjClass->get_property( object, property_id, value, pspec );
- }
- }
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
}
}
-static void eek_preview_set_property( GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+static void
+eek_preview_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GObjectClass* gobjClass = G_OBJECT_CLASS(parent_class);
- switch ( property_id ) {
- case FOCUS_PROP_ID:
- {
- EekPreview* preview = EEK_PREVIEW( object );
- gboolean val = g_value_get_boolean( value );
- if ( val != preview->_takesFocus ) {
- preview->_takesFocus = val;
- }
- }
- break;
+ EekPreview *preview = EEK_PREVIEW( object );
+
+ switch (prop_id)
+ {
+ case PROP_FOCUS:
+ eek_preview_set_focus_on_click(preview, g_value_get_boolean(value));
+ break;
+
default:
- {
- if ( gobjClass->set_property ) {
- gobjClass->set_property( object, property_id, value, pspec );
- }
- }
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
}
}
static gboolean eek_preview_popup_menu( GtkWidget* widget )
{
-/* g_message("Do the popup!"); */
gboolean blip = parent_class->popup_menu ? parent_class->popup_menu(widget) : FALSE;
return blip;
}
@@ -655,21 +673,14 @@ static gboolean eek_preview_popup_menu( GtkWidget* widget )
static void eek_preview_class_init( EekPreviewClass *klass )
{
- GObjectClass* gobjClass = G_OBJECT_CLASS(klass);
- /*GtkObjectClass* objectClass = (GtkObjectClass*)klass;*/
+ GObjectClass* gobjClass = G_OBJECT_CLASS(klass);
GtkWidgetClass* widgetClass = (GtkWidgetClass*)klass;
gobjClass->set_property = eek_preview_set_property;
gobjClass->get_property = eek_preview_get_property;
- /*objectClass->destroy = eek_preview_destroy;*/
-
parent_class = (GtkWidgetClass*)g_type_class_peek_parent( klass );
- /*widgetClass->map = ;*/
- /*widgetClass->unmap = ;*/
- /*widgetClass->realize = ;*/
- /*widgetClass->unrealize = ;*/
#if GTK_CHECK_VERSION(3,0,0)
widgetClass->get_preferred_width = eek_preview_get_preferred_width;
widgetClass->get_preferred_height = eek_preview_get_preferred_height;
@@ -678,49 +689,16 @@ static void eek_preview_class_init( EekPreviewClass *klass )
widgetClass->size_request = eek_preview_size_request;
widgetClass->expose_event = eek_preview_expose_event;
#endif
- /*widgetClass->size_allocate = ;*/
- /*widgetClass->state_changed = ;*/
- /*widgetClass->style_set = ;*/
- /*widgetClass->grab_notify = ;*/
widgetClass->button_press_event = eek_preview_button_press_cb;
widgetClass->button_release_event = eek_preview_button_release_cb;
- /*widgetClass->delete_event = ;*/
- /*widgetClass->destroy_event = ;*/
-/* widgetClass->key_press_event = eek_preview_key_press_event; */
-/* widgetClass->key_release_event = eek_preview_key_release_event; */
widgetClass->enter_notify_event = eek_preview_enter_cb;
widgetClass->leave_notify_event = eek_preview_leave_cb;
- /*widgetClass->configure_event = ;*/
- /*widgetClass->focus_in_event = eek_preview_focus_in_event;*/
- /*widgetClass->focus_out_event = eek_preview_focus_out_event;*/
-
- /* selection */
- /*widgetClass->selection_get = ;*/
- /*widgetClass->selection_received = ;*/
-
-
- /* drag source: */
- /*widgetClass->drag_begin = ;*/
- /*widgetClass->drag_end = ;*/
- /*widgetClass->drag_data_get = ;*/
- /*widgetClass->drag_data_delete = ;*/
-
- /* drag target: */
- /*widgetClass->drag_leave = ;*/
- /*widgetClass->drag_motion = ;*/
- /*widgetClass->drag_drop = ;*/
- /*widgetClass->drag_data_received = ;*/
/* For keybindings: */
widgetClass->popup_menu = eek_preview_popup_menu;
- /*widgetClass->show_help = ;*/
-
- /* Accessibility support: */
- /*widgetClass->get_accessible = ;*/
- /*widgetClass->screen_changed = ;*/
- /*widgetClass->can_activate_accel = ;*/
+ g_type_class_add_private(gobjClass, sizeof(EekPreviewPrivate));
eek_preview_signals[CLICKED_SIGNAL] =
g_signal_new( "clicked",
@@ -741,7 +719,7 @@ static void eek_preview_class_init( EekPreviewClass *klass )
g_object_class_install_property( gobjClass,
- FOCUS_PROP_ID,
+ PROP_FOCUS,
g_param_spec_boolean(
"focus-on-click",
NULL,
@@ -749,57 +727,94 @@ static void eek_preview_class_init( EekPreviewClass *klass )
TRUE,
(GParamFlags)(G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
)
- );
+ );
}
-void eek_preview_set_linked( EekPreview* splat, LinkType link )
+void
+eek_preview_set_linked(EekPreview *preview,
+ LinkType link)
{
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ g_return_if_fail(IS_EEK_PREVIEW(preview));
+
link = (LinkType)(link & PREVIEW_LINK_ALL);
- if ( link != (LinkType)splat->_linked ) {
- splat->_linked = link;
- gtk_widget_queue_draw( GTK_WIDGET(splat) );
+ if (link != (LinkType)priv->linked)
+ {
+ priv->linked = link;
+
+ gtk_widget_queue_draw(GTK_WIDGET(preview));
}
}
-LinkType eek_preview_get_linked( EekPreview* splat )
+LinkType
+eek_preview_get_linked(EekPreview *preview)
{
- return (LinkType)splat->_linked;
+ g_return_val_if_fail(IS_EEK_PREVIEW(preview), PREVIEW_LINK_NONE);
+
+ return (LinkType)EEK_PREVIEW_GET_PRIVATE(preview)->linked;
}
-gboolean eek_preview_get_focus_on_click( EekPreview* preview )
+gboolean
+eek_preview_get_focus_on_click(EekPreview* preview)
{
- return preview->_takesFocus;
+ g_return_val_if_fail(IS_EEK_PREVIEW(preview), FALSE);
+
+ return EEK_PREVIEW_GET_PRIVATE(preview)->takesFocus;
}
-void eek_preview_set_focus_on_click( EekPreview* preview, gboolean focus_on_click )
+void
+eek_preview_set_focus_on_click(EekPreview *preview,
+ gboolean focus_on_click)
{
- if ( focus_on_click != preview->_takesFocus ) {
- preview->_takesFocus = focus_on_click;
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ g_return_if_fail(IS_EEK_PREVIEW(preview));
+
+ if (focus_on_click != priv->takesFocus)
+ {
+ priv->takesFocus = focus_on_click;
}
}
-void eek_preview_set_details( EekPreview* preview, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio, guint border )
+void
+eek_preview_set_details(EekPreview *preview,
+ ViewType view,
+ PreviewSize size,
+ guint ratio,
+ guint border)
{
- preview->_prevstyle = prevstyle;
- preview->_view = view;
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ g_return_if_fail(IS_EEK_PREVIEW(preview));
+
+ priv->view = view;
- if ( size > PREVIEW_SIZE_LAST ) {
+ if ( size > PREVIEW_SIZE_LAST )
+ {
size = PREVIEW_SIZE_LAST;
}
- preview->_size = size;
- if ( ratio > PREVIEW_MAX_RATIO ) {
+ priv->size = size;
+
+ if ( ratio > PREVIEW_MAX_RATIO )
+ {
ratio = PREVIEW_MAX_RATIO;
}
- preview->_ratio = ratio;
- preview->_border = border;
+
+ priv->ratio = ratio;
+ priv->border = border;
+
gtk_widget_queue_draw(GTK_WIDGET(preview));
}
-static void eek_preview_init( EekPreview *preview )
+static void
+eek_preview_init(EekPreview *preview)
{
- GtkWidget* widg = GTK_WIDGET(preview);
+ GtkWidget *widg = GTK_WIDGET(preview);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
gtk_widget_set_can_focus( widg, TRUE );
gtk_widget_set_receives_default( widg, TRUE );
@@ -813,69 +828,22 @@ static void eek_preview_init( EekPreview *preview )
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK );
-/* gtk_widget_add_events( widg, GDK_ALL_EVENTS_MASK );*/
-
- preview->_r = 0x80;
- preview->_g = 0x80;
- preview->_b = 0xcc;
- preview->_scaledW = 0;
- preview->_scaledH = 0;
-
- preview->_hot = FALSE;
- preview->_within = FALSE;
- preview->_takesFocus = FALSE;
-
- preview->_prevstyle = PREVIEW_STYLE_ICON;
- preview->_view = VIEW_TYPE_LIST;
- preview->_size = PREVIEW_SIZE_SMALL;
- preview->_ratio = 100;
- preview->_border = BORDER_NONE;
- preview->_previewPixbuf = 0;
- preview->_scaled = 0;
-
-/*
- GdkColor color = {0};
- color.red = (255 << 8) | 255;
-
- GdkColor whack = {0};
- whack.green = (255 << 8) | 255;
-
- gtk_widget_modify_bg( widg, GTK_STATE_NORMAL, &color );
- gtk_widget_modify_bg( widg, GTK_STATE_PRELIGHT, &whack );
-*/
-
-/* GTK_STATE_ACTIVE, */
-/* GTK_STATE_PRELIGHT, */
-/* GTK_STATE_SELECTED, */
-/* GTK_STATE_INSENSITIVE */
-
- if ( 0 ) {
- GdkColor color = {0,0,0,0};
-
- color.red = 0xffff;
- color.green = 0;
- color.blue = 0xffff;
-#if !GTK_CHECK_VERSION(3,0,0)
- gdk_colormap_alloc_color( gdk_colormap_get_system(), &color, FALSE, TRUE );
-#endif
- gtk_widget_modify_bg(widg, GTK_STATE_ACTIVE, &color);
-
- color.red = 0;
- color.green = 0xffff;
- color.blue = 0;
-#if !GTK_CHECK_VERSION(3,0,0)
- gdk_colormap_alloc_color( gdk_colormap_get_system(), &color, FALSE, TRUE );
-#endif
- gtk_widget_modify_bg(widg, GTK_STATE_SELECTED, &color);
-
- color.red = 0xffff;
- color.green = 0;
- color.blue = 0;
-#if !GTK_CHECK_VERSION(3,0,0)
- gdk_colormap_alloc_color( gdk_colormap_get_system(), &color, FALSE, TRUE );
-#endif
- gtk_widget_modify_bg( widg, GTK_STATE_PRELIGHT, &color );
- }
+ priv->r = 0x80;
+ priv->g = 0x80;
+ priv->b = 0xcc;
+ priv->scaledW = 0;
+ priv->scaledH = 0;
+
+ priv->hot = FALSE;
+ priv->within = FALSE;
+ priv->takesFocus = FALSE;
+
+ priv->view = VIEW_TYPE_LIST;
+ priv->size = PREVIEW_SIZE_SMALL;
+ priv->ratio = 100;
+ priv->border = BORDER_NONE;
+ priv->previewPixbuf = 0;
+ priv->scaled = 0;
}
diff --git a/src/widgets/eek-preview.h b/src/widgets/eek-preview.h
index 42e89a161..e4c724cc5 100644
--- a/src/widgets/eek-preview.h
+++ b/src/widgets/eek-preview.h
@@ -42,12 +42,11 @@
/**
* @file
- * Generic implementation of a object that can be shown by a preview.
+ * Generic implementation of an object that can be shown by a preview.
*/
G_BEGIN_DECLS
-
#define EEK_PREVIEW_TYPE (eek_preview_get_type())
#define EEK_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST( (obj), EEK_PREVIEW_TYPE, EekPreview))
#define EEK_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST( (klass), EEK_PREVIEW_TYPE, EekPreviewClass))
@@ -90,7 +89,6 @@ typedef enum {
PREVIEW_LINK_ALL = 31
} LinkType;
-
typedef enum {
BORDER_NONE = 0,
BORDER_SOLID,
@@ -101,29 +99,9 @@ typedef enum {
typedef struct _EekPreview EekPreview;
typedef struct _EekPreviewClass EekPreviewClass;
-
struct _EekPreview
{
GtkDrawingArea drawing;
-
- int _r;
- int _g;
- int _b;
- int _scaledW;
- int _scaledH;
-
- gboolean _hot;
- gboolean _within;
- gboolean _takesFocus;
-
- PreviewStyle _prevstyle;
- ViewType _view;
- PreviewSize _size;
- guint _ratio;
- guint _linked;
- guint _border;
- GdkPixbuf* _previewPixbuf;
- GdkPixbuf* _scaled;
};
struct _EekPreviewClass
@@ -133,11 +111,14 @@ struct _EekPreviewClass
void (*clicked) (EekPreview* splat);
};
-
GType eek_preview_get_type(void) G_GNUC_CONST;
GtkWidget* eek_preview_new(void);
-void eek_preview_set_details( EekPreview* splat, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio, guint);
+void eek_preview_set_details(EekPreview *preview,
+ ViewType view,
+ PreviewSize size,
+ guint ratio,
+ guint border);
void eek_preview_set_color( EekPreview* splat, int r, int g, int b );
void eek_preview_set_pixbuf( EekPreview* splat, GdkPixbuf* pixbuf );
diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp
index 32619de1f..d4186cd93 100644
--- a/src/widgets/fill-style.cpp
+++ b/src/widgets/fill-style.cpp
@@ -220,7 +220,7 @@ void FillNStroke::setDesktop(SPDesktop *desktop)
* Listen to this "change in tool" event, in case a subselection tool (such as Gradient or Node) selection
* is changed back to a selection tool - especially needed for selected gradient stops.
*/
-void FillNStroke::eventContextCB(SPDesktop *desktop, SPEventContext *eventcontext)
+void FillNStroke::eventContextCB(SPDesktop * /*desktop*/, SPEventContext * /*eventcontext*/)
{
performUpdate();
}
diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp
index 2c6774fe9..972155ea9 100644
--- a/src/widgets/gradient-selector.cpp
+++ b/src/widgets/gradient-selector.cpp
@@ -487,8 +487,7 @@ SPGradient *SPGradientSelector::getVector()
}
-static void
-sp_gradient_selector_vector_set (SPGradientVectorSelector *gvs, SPGradient *gr, SPGradientSelector *sel)
+static void sp_gradient_selector_vector_set(SPGradientVectorSelector * /*gvs*/, SPGradient *gr, SPGradientSelector *sel)
{
if (!sel->blocked) {
@@ -497,7 +496,6 @@ sp_gradient_selector_vector_set (SPGradientVectorSelector *gvs, SPGradient *gr,
sel->setVector((gr) ? gr->document : 0, gr);
g_signal_emit (G_OBJECT (sel), signals[CHANGED], 0, gr);
sel->blocked = FALSE;
-
}
}
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index ff443504d..7866989b1 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -309,7 +309,7 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr)
}
#if !GTK_CHECK_VERSION(3,0,0)
-gboolean IconImpl::expose(GtkWidget *widget, GdkEventExpose *event)
+gboolean IconImpl::expose(GtkWidget *widget, GdkEventExpose * /*event*/)
{
gboolean result = TRUE;
diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp
index fa586ce5f..07cafc391 100644
--- a/src/widgets/sp-color-notebook.cpp
+++ b/src/widgets/sp-color-notebook.cpp
@@ -539,7 +539,7 @@ void ColorNotebook::_colorChanged()
_updateRgbaEntry( _color, _alpha );
}
-void ColorNotebook::_picker_clicked(GtkWidget *widget, SPColorNotebook *colorbook)
+void ColorNotebook::_picker_clicked(GtkWidget * /*widget*/, SPColorNotebook * /*colorbook*/)
{
// Set the dropper into a "one click" mode, so it reverts to the previous tool after a click
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp
index 3e91274d2..7c8bb1df7 100644
--- a/src/widgets/sp-color-wheel-selector.cpp
+++ b/src/widgets/sp-color-wheel-selector.cpp
@@ -9,6 +9,7 @@
#include "sp-color-scales.h"
#include "sp-color-icc-selector.h"
#include "../svg/svg-icc-color.h"
+#include "ui/widget/gimpcolorwheel.h"
G_BEGIN_DECLS
@@ -101,46 +102,6 @@ void sp_color_wheel_selector_init (SPColorWheelSelector *cs)
}
}
-static void resizeHSVWheel( GtkHSV *hsv, GtkAllocation *allocation )
-{
- gint diam = std::min(allocation->width, allocation->height);
-
- // drop a little for resizing
- // This magic number stops the dialog expanding in width when resizing height
- diam -= 16;
-
- GtkStyle *style = gtk_widget_get_style( GTK_WIDGET(hsv) );
- if ( style ) {
- gint thick = std::max(style->xthickness, style->ythickness);
- if (thick > 0) {
- diam -= thick * 2;
- }
- }
- gint padding = -1;
- gtk_widget_style_get( GTK_WIDGET(hsv),
- "focus-padding", &padding,
- NULL );
- if (padding > 0) {
- diam -= padding * 2;
- }
-
- diam = std::max(20, diam);
- gint ring = static_cast<gint>( static_cast<gdouble>(diam) / (4.0 * 1.618) );
- gtk_hsv_set_metrics( hsv, diam, ring );
-}
-
-static void handleWheelStyleSet(GtkHSV *hsv, GtkStyle* /*previous*/, gpointer /*userData*/)
-{
- GtkAllocation allocation = {0, 0, 0, 0};
- gtk_widget_get_allocation( GTK_WIDGET(hsv), &allocation );
- resizeHSVWheel( hsv, &allocation );
-}
-
-static void handleWheelAllocation(GtkHSV *hsv, GtkAllocation *allocation, gpointer /*userData*/)
-{
- resizeHSVWheel( hsv, allocation );
-}
-
void ColorWheelSelector::init()
{
gint row = 0;
@@ -160,8 +121,7 @@ void ColorWheelSelector::init()
/* Create components */
row = 0;
- _wheel = gtk_hsv_new();
- gtk_hsv_set_metrics( GTK_HSV(_wheel), 48, 8 );
+ _wheel = gimp_color_wheel_new();
gtk_widget_show( _wheel );
#if GTK_CHECK_VERSION(3,0,0)
@@ -252,13 +212,6 @@ void ColorWheelSelector::init()
g_signal_connect( G_OBJECT(_wheel), "changed",
G_CALLBACK (_wheelChanged), _csel );
-
-
- // GTK does not automatically scale the color wheel, so we have to add that in:
- g_signal_connect( G_OBJECT (_wheel), "size-allocate",
- G_CALLBACK (handleWheelAllocation), _csel );
- g_signal_connect( G_OBJECT (_wheel), "style-set",
- G_CALLBACK (handleWheelStyleSet), _csel );
}
static void sp_color_wheel_selector_dispose(GObject *object)
@@ -299,11 +252,9 @@ void ColorWheelSelector::_colorChanged()
#endif
_updating = TRUE;
{
- gdouble h = 0;
- gdouble s = 0;
- gdouble v = 0;
- gtk_rgb_to_hsv( _color.v.c[0], _color.v.c[1], _color.v.c[2], &h, &s, &v );
- gtk_hsv_set_color( GTK_HSV(_wheel), h, s, v );
+ float hsv[3] = {0,0,0};
+ sp_color_rgb_to_hsv_floatv(hsv, _color.v.c[0], _color.v.c[1], _color.v.c[2]);
+ gimp_color_wheel_set_color( GIMP_COLOR_WHEEL(_wheel), hsv[0], hsv[1], hsv[2] );
}
guint32 start = _color.toRGBA32( 0x00 );
@@ -374,21 +325,19 @@ void ColorWheelSelector::_sliderChanged( SPColorSlider *slider, SPColorWheelSele
wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
}
-void ColorWheelSelector::_wheelChanged( GtkHSV *hsv, SPColorWheelSelector *cs )
+void ColorWheelSelector::_wheelChanged( GimpColorWheel *wheel, SPColorWheelSelector *cs )
{
ColorWheelSelector* wheelSelector = static_cast<ColorWheelSelector*>(SP_COLOR_SELECTOR(cs)->base);
gdouble h = 0;
gdouble s = 0;
gdouble v = 0;
- gtk_hsv_get_color( hsv, &h, &s, &v );
+ gimp_color_wheel_get_color( wheel, &h, &s, &v );
- gdouble r = 0;
- gdouble g = 0;
- gdouble b = 0;
- gtk_hsv_to_rgb(h, s, v, &r, &g, &b);
+ float rgb[3] = {0,0,0};
+ sp_color_hsv_to_rgb_floatv (rgb, h, s, v);
- SPColor color(r, g, b);
+ SPColor color(rgb[0], rgb[1], rgb[2]);
guint32 start = color.toRGBA32( 0x00 );
guint32 mid = color.toRGBA32( 0x7f );
@@ -397,7 +346,7 @@ void ColorWheelSelector::_wheelChanged( GtkHSV *hsv, SPColorWheelSelector *cs )
sp_color_slider_set_colors (SP_COLOR_SLIDER(wheelSelector->_slider), start, mid, end);
preserve_icc(&color, cs);
- wheelSelector->_updateInternals( color, wheelSelector->_alpha, gtk_hsv_is_adjusting( hsv ) );
+ wheelSelector->_updateInternals( color, wheelSelector->_alpha, gimp_color_wheel_is_adjusting(wheel) );
}
diff --git a/src/widgets/sp-color-wheel-selector.h b/src/widgets/sp-color-wheel-selector.h
index 4d8f79976..8e0dc6cea 100644
--- a/src/widgets/sp-color-wheel-selector.h
+++ b/src/widgets/sp-color-wheel-selector.h
@@ -10,7 +10,7 @@
-typedef struct _GtkHSV GtkHSV;
+typedef struct _GimpColorWheel GimpColorWheel;
struct SPColorWheelSelector;
struct SPColorWheelSelectorClass;
@@ -30,7 +30,7 @@ protected:
static void _sliderGrabbed( SPColorSlider *slider, SPColorWheelSelector *cs );
static void _sliderReleased( SPColorSlider *slider, SPColorWheelSelector *cs );
static void _sliderChanged( SPColorSlider *slider, SPColorWheelSelector *cs );
- static void _wheelChanged( GtkHSV *hsv, SPColorWheelSelector *cs );
+ static void _wheelChanged( GimpColorWheel *wheel, SPColorWheelSelector *cs );
static void _fooChanged( GtkWidget foo, SPColorWheelSelector *cs );
diff --git a/src/widgets/sp-xmlview-tree.cpp b/src/widgets/sp-xmlview-tree.cpp
index bc6031c1e..43b7dc289 100644
--- a/src/widgets/sp-xmlview-tree.cpp
+++ b/src/widgets/sp-xmlview-tree.cpp
@@ -35,7 +35,6 @@ static void sp_xmlview_tree_destroy(GtkObject * object);
#endif
static NodeData * node_data_new (SPXMLViewTree * tree, GtkTreeIter * node, GtkTreeRowReference *rowref, Inkscape::XML::Node * repr);
-static void node_data_free (gpointer data);
static GtkTreeRowReference * add_node (SPXMLViewTree * tree, GtkTreeIter * parent, GtkTreeIter * before, Inkscape::XML::Node * repr);
@@ -261,15 +260,6 @@ NodeData *node_data_new(SPXMLViewTree * tree, GtkTreeIter * /*node*/, GtkTreeRow
return data;
}
-void node_data_free(gpointer ptr)
-{
- NodeData *data = static_cast<NodeData *>(ptr);
- sp_repr_remove_listener_by_data (data->repr, data);
- g_assert (data->repr != NULL);
- Inkscape::GC::release(data->repr);
- g_free (data);
-}
-
void element_child_added (Inkscape::XML::Node * /*repr*/, Inkscape::XML::Node * child, Inkscape::XML::Node * ref, gpointer ptr)
{
NodeData *data = static_cast<NodeData *>(ptr);
diff --git a/src/widgets/spinbutton-events.cpp b/src/widgets/spinbutton-events.cpp
index 96d746468..7a481aea8 100644
--- a/src/widgets/spinbutton-events.cpp
+++ b/src/widgets/spinbutton-events.cpp
@@ -3,7 +3,9 @@
*
* Authors:
* bulia byak <bulia@users.sourceforge.net>
+ * Jon A. Cruz <jon@joncruz.org>
*
+ * Copyright (C) 2013 authors
* Copyright (C) 2003 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
@@ -22,122 +24,136 @@
#include "widget-sizes.h"
#include "spinbutton-events.h"
-gboolean
-spinbutton_focus_in (GtkWidget *w, GdkEventKey * /*event*/, gpointer /*data*/)
+gboolean spinbutton_focus_in(GtkWidget *w, GdkEventKey * /*event*/, gpointer /*data*/)
{
- gdouble *ini = static_cast<gdouble *>(g_object_get_data(G_OBJECT(w), "ini"));
- if (ini) g_free (ini); // free the old value if any
+ gdouble *ini = static_cast<gdouble *>(g_object_get_data(G_OBJECT(w), "ini"));
+ if (ini) {
+ g_free(ini); // free the old value if any
+ }
- // retrieve the value
- ini = g_new (gdouble, 1);
- *ini = gtk_spin_button_get_value (GTK_SPIN_BUTTON(w));
+ // retrieve the value
+ ini = g_new(gdouble, 1);
+ *ini = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- // remember it
- g_object_set_data (G_OBJECT (w), "ini", ini);
+ // remember it
+ g_object_set_data(G_OBJECT(w), "ini", ini);
- return FALSE; // I didn't consume the event
+ return FALSE; // I didn't consume the event
}
-void
-spinbutton_undo (GtkWidget *w)
+void spinbutton_undo(GtkWidget *w)
{
- gdouble *ini = static_cast<gdouble *>(g_object_get_data(G_OBJECT (w), "ini"));
- if (ini) {
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), *ini);
- }
+ gdouble *ini = static_cast<gdouble *>(g_object_get_data(G_OBJECT(w), "ini"));
+ if (ini) {
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), *ini);
+ }
}
-void
-spinbutton_defocus (GtkWidget *container)
+void spinbutton_defocus(GtkWidget *container)
{
- // defocus spinbuttons by moving focus to the canvas, unless "stay" is on
- gboolean stay = GPOINTER_TO_INT(g_object_get_data(G_OBJECT (container), "stay"));
- if (stay) {
- g_object_set_data (G_OBJECT (container), "stay", GINT_TO_POINTER (FALSE));
- } else {
- GtkWidget *canvas = GTK_WIDGET(g_object_get_data(G_OBJECT (container), "dtw"));
- if (canvas) {
- gtk_widget_grab_focus (GTK_WIDGET(canvas));
- }
- }
+ // defocus spinbuttons by moving focus to the canvas, unless "stay" is on
+ gboolean stay = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(container), "stay"));
+ if (stay) {
+ g_object_set_data(G_OBJECT(container), "stay", GINT_TO_POINTER(FALSE));
+ } else {
+ GtkWidget *canvas = GTK_WIDGET(g_object_get_data(G_OBJECT(container), "dtw"));
+ if (canvas) {
+ gtk_widget_grab_focus(GTK_WIDGET(canvas));
+ }
+ }
}
-gboolean spinbutton_keypress(GtkWidget *w, GdkEventKey *event, gpointer data)
+gboolean spinbutton_keypress(GtkWidget *w, GdkEventKey *event, gpointer /*data*/)
{
- gdouble v;
- gdouble step;
- gdouble page;
+ gboolean result = FALSE; // I didn't consume the event
- switch (get_group0_keyval (event)) {
+ switch (get_group0_keyval(event)) {
case GDK_KEY_Escape: // defocus
- spinbutton_undo(w);
- spinbutton_defocus(w);
- return TRUE; // I consumed the event
- break;
+ spinbutton_undo(w);
+ spinbutton_defocus(w);
+ result = TRUE; // I consumed the event
+ break;
case GDK_KEY_Return: // defocus
case GDK_KEY_KP_Enter:
- spinbutton_defocus(w);
- return TRUE; // I consumed the event
- break;
+ spinbutton_defocus(w);
+ result = TRUE; // I consumed the event
+ break;
case GDK_KEY_Tab:
case GDK_KEY_ISO_Left_Tab:
- // set the flag meaning "do not leave toolbar when changing value"
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- return FALSE; // I didn't consume the event
- break;
+ // set the flag meaning "do not leave toolbar when changing value"
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ result = FALSE; // I didn't consume the event
+ break;
- // The following keys are processed manually because GTK implements them in strange ways
- // (increments start with double step value and seem to grow as you press the key continuously)
+ // The following keys are processed manually because GTK implements them in strange ways
+ // (increments start with double step value and seem to grow as you press the key continuously)
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
- v += step;
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
- return TRUE; // I consumed the event
- break;
+ {
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ gdouble v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
+ gdouble step = 0;
+ gdouble page = 0;
+ gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
+ v += step;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
+ result = TRUE; // I consumed the event
+ break;
+ }
case GDK_KEY_Down:
case GDK_KEY_KP_Down:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
- v -= step;
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
- return TRUE; // I consumed the event
- break;
+ {
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ gdouble v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
+ gdouble step = 0;
+ gdouble page = 0;
+ gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
+ v -= step;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
+ result = TRUE; // I consumed the event
+ break;
+ }
case GDK_KEY_Page_Up:
case GDK_KEY_KP_Page_Up:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
- v += page;
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
- return TRUE; // I consumed the event
- break;
+ {
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ gdouble v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
+ gdouble step = 0;
+ gdouble page = 0;
+ gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
+ v += page;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
+ result = TRUE; // I consumed the event
+ break;
+ }
case GDK_KEY_Page_Down:
case GDK_KEY_KP_Page_Down:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
- v -= page;
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
- return TRUE; // I consumed the event
- break;
+ {
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ gdouble v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
+ gdouble step = 0;
+ gdouble page = 0;
+ gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
+ v -= page;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
+ result = TRUE; // I consumed the event
+ break;
+ }
case GDK_KEY_z:
case GDK_KEY_Z:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- if (event->state & GDK_CONTROL_MASK) {
- spinbutton_undo(w);
- return TRUE; // I consumed the event
- }
- break;
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ if (event->state & GDK_CONTROL_MASK) {
+ spinbutton_undo(w);
+ result = TRUE; // I consumed the event
+ }
+ break;
default:
- return FALSE;
- break;
- }
- return FALSE; // I didn't consume the event
+ result = FALSE;
+ break;
+ }
+
+ return result;
}
/*
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 7912b654a..0f79a609b 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -434,8 +434,7 @@ StrokeStyle::makeRadioButton(Gtk::RadioButton *tb, char const *icon,
* Gets the marker uri string and applies it to all selected
* items in the current desktop.
*/
-void
-StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, SPMarkerLoc const which)
+void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, SPMarkerLoc const /*which*/)
{
if (spw->update) {
return;
@@ -485,12 +484,10 @@ StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, SPMa
css = 0;
spw->update = false;
-
};
-void
-StrokeStyle::updateMarkerHist(SPMarkerLoc const which) {
-
+void StrokeStyle::updateMarkerHist(SPMarkerLoc const which)
+{
switch (which) {
case SP_MARKER_LOC_START:
startMarkerConn.block();
@@ -552,8 +549,9 @@ gboolean StrokeStyle::setStrokeWidthUnit(SPUnitSelector *,
gdouble average = stroke_average_width (objects);
- if (average == Geom::infinity() || average == 0)
+ if ((average == Geom::infinity()) || (average < 1e-8)){ //less than 1e-8: to campare against zero, while taking numeric accuracy into account
return FALSE;
+ }
#if WITH_GTKMM_3_0
(*spw->widthAdj)->set_value(100.0 * w / average);
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index a5e929c7d..3a7eb6b9c 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -527,7 +527,6 @@ static gchar const * ui_descr =
" </toolbar>"
" <toolbar name='ConnectorToolbar'>"
-// " <toolitem action='ConnectorEditModeAction' />"
" <toolitem action='ConnectorAvoidAction' />"
" <toolitem action='ConnectorIgnoreAction' />"
" <toolitem action='ConnectorOrthogonalAction' />"
@@ -537,8 +536,6 @@ static gchar const * ui_descr =
" <toolitem action='ConnectorLengthAction' />"
" <toolitem action='ConnectorDirectedAction' />"
" <toolitem action='ConnectorOverlapAction' />"
-// " <toolitem action='ConnectorNewConnPointAction' />"
-// " <toolitem action='ConnectorRemoveConnPointAction' />"
" </toolbar>"
"</ui>"
@@ -939,36 +936,13 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto
}
-static void handlebox_detached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
-{
- GtkAllocation alloc;
- gtk_widget_get_allocation(widget, &alloc);
- gtk_widget_set_size_request( widget,
- alloc.width,
- alloc.height );
-}
-
-static void handlebox_attached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
-{
- gtk_widget_set_size_request( widget, -1, -1 );
-}
-
static GtkWidget* toolboxNewCommon( GtkWidget* tb, BarId id, GtkPositionType handlePos )
{
g_object_set_data(G_OBJECT(tb), "desktop", NULL);
gtk_widget_set_sensitive(tb, FALSE);
- GtkWidget *hb = 0;
- gboolean forceFloatAllowed = Inkscape::Preferences::get()->getBool("/options/workarounds/floatallowed", false);
- if ( UXManager::getInstance()->isFloatWindowProblem() && !forceFloatAllowed ) {
- hb = gtk_event_box_new(); // A simple, neutral container.
- } else {
- hb = gtk_handle_box_new();
- gtk_handle_box_set_handle_position(GTK_HANDLE_BOX(hb), handlePos);
- gtk_handle_box_set_shadow_type(GTK_HANDLE_BOX(hb), GTK_SHADOW_OUT);
- gtk_handle_box_set_snap_edge(GTK_HANDLE_BOX(hb), GTK_POS_LEFT);
- }
+ GtkWidget *hb = gtk_event_box_new(); // A simple, neutral container.
gtk_container_add(GTK_CONTAINER(hb), tb);
gtk_widget_show(GTK_WIDGET(tb));
@@ -976,11 +950,6 @@ static GtkWidget* toolboxNewCommon( GtkWidget* tb, BarId id, GtkPositionType han
sigc::connection* conn = new sigc::connection;
g_object_set_data(G_OBJECT(hb), "event_context_connection", conn);
- if ( GTK_IS_HANDLE_BOX(hb) ) {
- g_signal_connect(G_OBJECT(hb), "child_detached", G_CALLBACK(handlebox_detached), static_cast<gpointer>(0));
- g_signal_connect(G_OBJECT(hb), "child_attached", G_CALLBACK(handlebox_attached), static_cast<gpointer>(0));
- }
-
gpointer val = GINT_TO_POINTER(id);
g_object_set_data(G_OBJECT(hb), BAR_ID_KEY, val);
@@ -1196,14 +1165,8 @@ static void setupToolboxCommon( GtkWidget *toolbox,
Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize(sizePref);
gtk_toolbar_set_icon_size( GTK_TOOLBAR(toolBar), static_cast<GtkIconSize>(toolboxSize) );
- if (GTK_IS_HANDLE_BOX(toolbox)) {
- // g_message("GRABBING ORIENTATION [%s]", toolbarName);
- GtkPositionType pos = gtk_handle_box_get_handle_position(GTK_HANDLE_BOX(toolbox));
- orientation = ((pos == GTK_POS_LEFT) || (pos == GTK_POS_RIGHT)) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
- } else {
- GtkPositionType pos = static_cast<GtkPositionType>(GPOINTER_TO_INT(g_object_get_data( G_OBJECT(toolbox), HANDLE_POS_MARK )));
- orientation = ((pos == GTK_POS_LEFT) || (pos == GTK_POS_RIGHT)) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
- }
+ GtkPositionType pos = static_cast<GtkPositionType>(GPOINTER_TO_INT(g_object_get_data( G_OBJECT(toolbox), HANDLE_POS_MARK )));
+ orientation = ((pos == GTK_POS_LEFT) || (pos == GTK_POS_RIGHT)) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
gtk_orientable_set_orientation (GTK_ORIENTABLE(toolBar), orientation);
gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolBar), TRUE);
@@ -1229,7 +1192,6 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati
#endif
GtkPositionType pos = (orientation == GTK_ORIENTATION_HORIZONTAL) ? GTK_POS_LEFT : GTK_POS_TOP;
- GtkHandleBox* handleBox = 0;
if (GTK_IS_BIN(toolbox)) {
#if DUMP_DETAILS
@@ -1278,9 +1240,6 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati
if (GTK_IS_TOOLBAR(child2)) {
GtkToolbar* childBar = GTK_TOOLBAR(child2);
gtk_orientable_set_orientation(GTK_ORIENTABLE(childBar), orientation);
- if (GTK_IS_HANDLE_BOX(toolbox)) {
- handleBox = GTK_HANDLE_BOX(toolbox);
- }
} else {
g_message("need to add dynamic switch");
}
@@ -1288,25 +1247,14 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati
g_list_free(children);
} else {
// The call is being made before the toolbox proper has been setup.
- if (GTK_IS_HANDLE_BOX(toolbox)) {
- handleBox = GTK_HANDLE_BOX(toolbox);
- } else {
- g_object_set_data(G_OBJECT(toolbox), HANDLE_POS_MARK, GINT_TO_POINTER(pos));
- }
+ g_object_set_data(G_OBJECT(toolbox), HANDLE_POS_MARK, GINT_TO_POINTER(pos));
}
} else if (GTK_IS_TOOLBAR(child)) {
GtkToolbar* toolbar = GTK_TOOLBAR(child);
gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), orientation );
- if (GTK_IS_HANDLE_BOX(toolbox)) {
- handleBox = GTK_HANDLE_BOX(toolbox);
- }
}
}
}
-
- if (handleBox) {
- gtk_handle_box_set_handle_position(handleBox, pos);
- }
}
void setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop)