[fondue-commits] [SCM] Fondue Font Editor branch, master, updated. bfebb8bd678db80c937a21dd2aaa09d9b8a44a17
Eugeniy Meshcheryakov
eugen at debian.org
Sun Nov 9 21:03:29 UTC 2008
The following commit has been merged in the master branch:
commit 3b170dba6d1560db87b1af7c0827666cad84d9e4
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date: Tue Sep 30 17:03:51 2008 +0200
handle removing of contours
diff --git a/gui/glyphgraphics.cxx b/gui/glyphgraphics.cxx
index d15f6a3..ac20af4 100644
--- a/gui/glyphgraphics.cxx
+++ b/gui/glyphgraphics.cxx
@@ -58,6 +58,7 @@ GlyphGraphics::GlyphGraphics(GlyphCell *parent, Glyph *glyph) :
}
p->scene()->addItem(item);
connect(m_glyph, SIGNAL(contourAdded(int)), this, SLOT(contourAdded(int)));
+ connect(m_glyph, SIGNAL(contentAboutToBeRemoved(int)), this, SLOT(contentAboutToBeRemoved(int)));
}
GlyphGraphics::GlyphGraphics(GlyphGraphics *parent, Glyph *glyph, const QPointF &pos) :
@@ -193,3 +194,17 @@ void GlyphGraphics::insertContour(GlyphContour *contour)
connect(contour, SIGNAL(pointsAdded(int, int)), this, SLOT(contourPointsAdded(int, int)));
connect(contour, SIGNAL(pointsAboutToBeRemoved(int, int)), this, SLOT(contourPointsAboutToBeRemoved(int, int)));
}
+
+void GlyphGraphics::contentAboutToBeRemoved(int id)
+{
+ GlyphContour *contour = qobject_cast<GlyphContour *>(m_glyph->content().at(id));
+ if (!contour)
+ return; // TODO handle references
+
+ foreach(ControlPoint *p, points) {
+ if (p->contour() == contour) {
+ points.removeAll(p); // FIXME is it safe?
+ p->deleteLater(); // and is this safe?
+ }
+ }
+}
diff --git a/gui/glyphgraphics.h b/gui/glyphgraphics.h
index b258dde..a93d146 100644
--- a/gui/glyphgraphics.h
+++ b/gui/glyphgraphics.h
@@ -38,6 +38,7 @@ public slots:
void contourPointsAdded(int start, int end);
void contourPointsAboutToBeRemoved(int start, int end);
void contourAdded(int id);
+ void contentAboutToBeRemoved(int id);
private:
GlyphGraphics(GlyphGraphics *parent, Glyph *glyph, const QPointF &pos);
void insertContour(GlyphContour *contour);
--
Fondue Font Editor
More information about the fondue-commits
mailing list