|
From: Tapio V. <aa...@us...> - 2011-01-17 09:19:25
|
Module: editor
Branch: master
Commit: 20947d8d172c5fd45677167f6688a586d8ab1043
Author: Tapio Vierros <tap...@gm...>
Date: Mon Jan 17 11:18:09 2011 +0200
Note floating status change through moving is now properly recorded.
---
notegraphwidget.cc | 12 ++++++++++--
notelabel.cc | 2 --
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index f27487b..882c813 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -258,11 +258,19 @@ void NoteGraphWidget::mouseReleaseEvent(QMouseEvent *event)
m_selectedNote->move(m_selectedNote->pos().x(), n2px(px2n(m_selectedNote->pos().y())));
if (m_actionHappened) {
// Operation for undo stack & saving
+ int notelabelid = getNoteLabelId(m_selectedNote);
Operation op("SETGEOM");
- op << getNoteLabelId(m_selectedNote)
+ op << notelabelid
<< m_selectedNote->x() << m_selectedNote->y()
<< m_selectedNote->width() << m_selectedNote->height();
doOperation(op, Operation::NO_EXEC);
+ // See if it needs to be unfloated
+ if (m_selectedNote->isFloating()) {
+ Operation fop("FLOATING"); fop << notelabelid << false;
+ Operation combiner("COMBINER"); combiner << 2;
+ doOperation(fop);
+ doOperation(combiner);
+ }
}
}
m_selectedAction = NONE;
@@ -366,7 +374,7 @@ void NoteGraphWidget::doOperation(const Operation& op, Operation::OperationFlags
{
if (!(flags & Operation::NO_EXEC)) {
std::string action = op.op().toStdString();
- if (action == "BLOCK") {
+ if (action == "BLOCK" || action == "COMBINER") {
; // No op
} else if (action == "NEW") {
NoteLabel *newLabel = new NoteLabel(
diff --git a/notelabel.cc b/notelabel.cc
index c2d08ce..7a7ff05 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -97,14 +97,12 @@ void NoteLabel::mouseMoveEvent(QMouseEvent *event)
else
resize(event->pos().x(), height());
if (ngw) ngw->updateNotes();
- setFloating(false);
} else if (!m_hotspot.isNull()) {
// Moving
QPoint newpos = pos() + event->pos() - m_hotspot;
move(newpos);
if (ngw) ngw->updateNotes();
- setFloating(false);
// Check if we need a new hotspot, because the note was constrained
if (pos().x() != newpos.x()) m_hotspot.rx() = event->x();
|