[fondue-commits] [SCM] Fondue Font Editor branch, master, updated. 08b3bcdfd92d36098f89673d35f5eb6ff5f0559a
Eugeniy Meshcheryakov
eugen at debian.org
Thu May 15 13:28:09 UTC 2008
The following commit has been merged in the master branch:
commit 08b3bcdfd92d36098f89673d35f5eb6ff5f0559a
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date: Thu May 15 15:22:13 2008 +0200
fix point selection/movement
diff --git a/gui/glyphcell.cxx b/gui/glyphcell.cxx
index f0303a3..c945941 100644
--- a/gui/glyphcell.cxx
+++ b/gui/glyphcell.cxx
@@ -29,7 +29,7 @@
GlyphCell::GlyphCell(Glyph *glyph) : QGraphicsView(), m_glyph(glyph),
m_rubberBand(0), m_rubberActive(false), m_pointerMove(false),
- m_pointerMoved(false)
+ m_pointerMoved(false), m_altSelection(false)
{
Q_ASSERT(m_glyph);
@@ -195,6 +195,7 @@ void GlyphCell::mousePressEvent(QMouseEvent *event)
bool startSelection = false;
if (m_editMode == Pointer) {
+ m_altSelection = event->modifiers() & Qt::ShiftModifier;
// deside wheter to start selection or move selected points
// if there is control point under mouse, start moving points
// else - show a rubber band
@@ -210,11 +211,19 @@ void GlyphCell::mousePressEvent(QMouseEvent *event)
}
if (pt) {
// user clicked at a control point
+ // select/deselect it
+ if (m_altSelection)
+ pt->setSelected(!pt->isSelected());
+ else
+ pt->setSelected(true);
+ // selection may be reset is there was no movement...
+
// start moving, if there is selection...
- if (!scene()->selectedItems().isEmpty())
- m_actionOrigin = event->pos();
- m_pointerMove = true;
- m_pointerMoved = false;
+ if (!scene()->selectedItems().isEmpty()) {
+ m_actionOrigin = event->pos();
+ m_pointerMove = true;
+ m_pointerMoved = false;
+ }
}
else
startSelection = true;
@@ -276,14 +285,13 @@ void GlyphCell::mouseReleaseEvent(QMouseEvent *event)
if (!m_rubberBand->geometry().isEmpty()) {
if (m_editMode == Pointer) {
// select
- bool altSelection = event->modifiers() & Qt::ShiftModifier;
QList<QGraphicsItem *> selItems = items(m_rubberBand->geometry(),
rubberBandSelectionMode());
- if (!altSelection)
+ if (!m_altSelection)
scene()->clearSelection();
foreach (QGraphicsItem *i, selItems) {
- if (altSelection)
+ if (m_altSelection)
i->setSelected(!i->isSelected());
else
i->setSelected(true);
@@ -302,18 +310,15 @@ void GlyphCell::mouseReleaseEvent(QMouseEvent *event)
// handle just mouse click
if (m_editMode == Pointer) {
if (!m_pointerMove || !m_pointerMoved) {
- bool altSelection = event->modifiers() & Qt::ShiftModifier;
-
- if (!altSelection)
+ if (!m_altSelection)
scene()->clearSelection();
// TODO handle several items at this position
QGraphicsItem *i = itemAt(event->pos());
if (i) {
- if (altSelection)
- i->setSelected(!i->isSelected());
- else
+ if (!m_altSelection)
i->setSelected(true);
+ // the other case is already handled in press event
}
}
m_pointerMove = false;
diff --git a/gui/glyphcell.h b/gui/glyphcell.h
index 9a195ea..a4505e1 100644
--- a/gui/glyphcell.h
+++ b/gui/glyphcell.h
@@ -60,6 +60,7 @@ private:
bool m_rubberActive;
bool m_pointerMove;
bool m_pointerMoved;
+ bool m_altSelection;
EditMode m_editMode;
};
--
Fondue Font Editor
More information about the fondue-commits
mailing list