[fondue-commits] [SCM] Fondue Font Editor branch, master, updated. b5056198e5469181556c59ce0c6911699b8fddcc
Eugeniy Meshcheryakov
eugen at debian.org
Wed Feb 6 20:23:36 UTC 2008
The following commit has been merged in the master branch:
commit 339079749be00f207ee30f3c20e98316cb8bb588
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date: Sat Jan 5 02:55:17 2008 +0100
do not allow to append empty contours to glyph
diff --git a/nongui/glyph.cxx b/nongui/glyph.cxx
index d5708d5..3573f90 100644
--- a/nongui/glyph.cxx
+++ b/nongui/glyph.cxx
@@ -55,6 +55,10 @@ void Glyph::appendContour(GlyphContour *contour)
Q_ASSERT(contour);
Q_ASSERT(!contour->parent());
+ if (contour->isEmpty()) {
+ contour->deleteLater();
+ return;
+ }
contour->setParent(this);
m_content << contour;
diff --git a/nongui/glyphcontour.cxx b/nongui/glyphcontour.cxx
index 5f34a7f..5b563a0 100644
--- a/nongui/glyphcontour.cxx
+++ b/nongui/glyphcontour.cxx
@@ -65,4 +65,12 @@ void GlyphContour::removePoints(int first, int count)
for (int i = 0; i < count; i++)
m_points.removeAt(first);
emit pointsRemoved(first, last);
+
+ if (m_points.empty())
+ emit contourBecomeEmpty(); // ... and should be destroyed (TODO)
+}
+
+bool GlyphContour::isEmpty() const
+{
+ return m_points.isEmpty();
}
diff --git a/nongui/glyphcontour.h b/nongui/glyphcontour.h
index 7e20058..c2ca5c6 100644
--- a/nongui/glyphcontour.h
+++ b/nongui/glyphcontour.h
@@ -23,6 +23,7 @@ class GlyphContour : public GlyphContentBase {
Q_OBJECT
Q_PROPERTY(bool open READ isOpen WRITE setOpen)
Q_PROPERTY(GlyphPointList points READ points)
+ Q_PROPERTY(bool empty READ isEmpty)
public:
GlyphContour(bool open = false);
ContentType type() const {return Contour;}
@@ -35,6 +36,7 @@ public:
Q_INVOKABLE void appendPoint(const GlyphPoint &point);
Q_INVOKABLE void removePoints(int first, int count);
Q_INVOKABLE void changePoint(int number, const GlyphPoint &newPoint);
+ bool isEmpty() const;
signals:
void pointChanged(int number);
void opennessChanged(); // FIXME any better name?
@@ -43,6 +45,8 @@ signals:
void pointsAdded(int start, int end);
void pointsAboutToBeRemoved(int start, int end);
void pointsRemoved(int start, int end);
+
+ void contourBecomeEmpty();
private:
bool m_open;
GlyphPointList m_points;
--
Fondue Font Editor
More information about the fondue-commits
mailing list