summaryrefslogtreecommitdiffstats
path: root/src/gradient-drag.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2012-05-04 09:35:59 +0000
committerJon A. Cruz <jon@joncruz.org>2012-05-04 09:35:59 +0000
commit3b72e337ab1a812319a9557adcd8fc40c2f36bb7 (patch)
treea64394c27307b434b03a1d09701df516b7150e97 /src/gradient-drag.cpp
parentSyntax of null pointer dereference checking (diff)
downloadinkscape-3b72e337ab1a812319a9557adcd8fc40c2f36bb7.tar.gz
inkscape-3b72e337ab1a812319a9557adcd8fc40c2f36bb7.zip
C++ification of SPCtrlLine in preparation of visibility improvements.
(bzr r11321)
Diffstat (limited to 'src/gradient-drag.cpp')
-rw-r--r--src/gradient-drag.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index c1f9251df..629659208 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -453,17 +453,16 @@ bool GrDrag::dropColor(SPItem */*item*/, gchar const *c, Geom::Point p)
// now see if we're over line and create a new stop
bool over_line = false;
- SPCtrlLine *line = NULL;
if (lines) {
for (GSList *l = lines; (l != NULL) && (!over_line); l = l->next) {
- line = (SPCtrlLine*) l->data;
+ SPCtrlLine *line = (SPCtrlLine*) l->data;
Geom::LineSegment ls(line->s, line->e);
Geom::Point nearest = ls.pointAt(ls.nearestPoint(p));
- double dist_screen = Geom::L2 (p - nearest) * desktop->current_zoom();
+ double dist_screen = Geom::L2(p - nearest) * desktop->current_zoom();
if (line->item && dist_screen < 5) {
- SPStop *stop = addStopNearPoint (line->item, p, 5/desktop->current_zoom());
+ SPStop *stop = addStopNearPoint(line->item, p, 5/desktop->current_zoom());
if (stop) {
- SPCSSAttr *css = sp_repr_css_attr_new ();
+ SPCSSAttr *css = sp_repr_css_attr_new();
sp_repr_css_set_property( css, "stop-color", stopIsNull ? 0 : toUse.c_str() );
sp_repr_css_set_property( css, "stop-opacity", "1" );
sp_repr_css_change(stop->getRepr(), css, "style");
@@ -1576,15 +1575,16 @@ void GrDrag::setDeselected(GrDragger *dragger)
*/
void GrDrag::addLine(SPItem *item, Geom::Point p1, Geom::Point p2, guint32 rgba)
{
- SPCanvasItem *line = sp_canvas_item_new(sp_desktop_controls(this->desktop),
- SP_TYPE_CTRLLINE, NULL);
+ SPCtrlLine *line = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_controls(this->desktop), SP_TYPE_CTRLLINE, NULL));
+
sp_canvas_item_move_to_z(line, 0);
- SP_CTRLLINE(line)->item = item;
- sp_ctrlline_set_coords(SP_CTRLLINE(line), p1, p2);
- if (rgba != GR_LINE_COLOR_FILL) // fill is the default, so don't set color for it to speed up redraw
- sp_ctrlline_set_rgba32 (SP_CTRLLINE(line), rgba);
- sp_canvas_item_show (line);
- this->lines = g_slist_append (this->lines, line);
+ line->item = item;
+ line->setCoords(p1, p2);
+ if (rgba != GR_LINE_COLOR_FILL) { // fill is the default, so don't set color for it to speed up redraw
+ line->setRgba32(rgba);
+ }
+ sp_canvas_item_show(line);
+ this->lines = g_slist_append(this->lines, line);
}
/**