[fondue-commits] [SCM] Fondue Font Editor branch, master, updated. c190fbb61058a8c2f7e7a2c650bf0528d75324be

Eugeniy Meshcheryakov eugen at debian.org
Mon Feb 11 10:41:41 UTC 2008


The following commit has been merged in the master branch:
commit 88b844e7485a14beb4d25e621bf76c92a0bc5905
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Mon Feb 11 00:00:21 2008 +0100

    Cursor keys now move selected points in glyph editor

diff --git a/gui/glyphcell.cxx b/gui/glyphcell.cxx
index fdf3058..50fcead 100644
--- a/gui/glyphcell.cxx
+++ b/gui/glyphcell.cxx
@@ -140,4 +140,31 @@ void GlyphCell::keyPressEvent(QKeyEvent *e)
 			}
 		}
 	}
+	else if (e->key() == Qt::Key_Up && !e->modifiers()) {
+		moveSelection(QPointF(0, -1));
+	}
+	else if (e->key() == Qt::Key_Down && !e->modifiers()) {
+		moveSelection(QPointF(0, 1));
+	}
+	else if (e->key() == Qt::Key_Right && !e->modifiers()) {
+		moveSelection(QPointF(1, 0));
+	}
+	else if (e->key() == Qt::Key_Left && !e->modifiers()) {
+		moveSelection(QPointF(-1, 0));
+	}
+}
+
+void GlyphCell::moveSelection(const QPointF &offset)
+{
+	QList<QGraphicsItem *> items = scene()->selectedItems();
+
+	foreach (QGraphicsItem *item, items) {
+		// FIXME handle only points for now
+		if (item->type() == ControlPoint::Type) {
+			ControlPoint *cp = dynamic_cast<ControlPoint *>(item);
+			Q_ASSERT(cp);
+
+			cp->setPos(cp->pos() + offset);
+		}
+	}
 }
diff --git a/gui/glyphcell.h b/gui/glyphcell.h
index 4392ba7..f5f12cb 100644
--- a/gui/glyphcell.h
+++ b/gui/glyphcell.h
@@ -33,6 +33,7 @@ protected:
 	void drawForeground(QPainter *painter, const QRectF &rect);
 	void mouseDoubleClickEvent(QMouseEvent *e);
 	void keyPressEvent(QKeyEvent *e);
+	void moveSelection(const QPointF &offset);
 private:
 	GlyphGraphics *gg;
 	Glyph *m_glyph;

-- 
Fondue Font Editor



More information about the fondue-commits mailing list