summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/muse/song.cpp4
-rw-r--r--muse2/muse/song.h1
-rw-r--r--muse2/muse/undo.cpp48
4 files changed, 54 insertions, 1 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 8c2a1751..a22ef487 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -4,6 +4,8 @@
not writable or is shared with another independent (non-clone) wave event.
TODO: Improve by asking even for writable waves outside the Project Directory
(add a 'copy' checkbox column to the dialog, settable only under certain conditions).
+ * Added: Informative text on Undo/Redo buttons/menu text/tooltips ("Undo AddTrack" etc). (Tim)
+ In cases of multiple items in one operation, the first is shown, with ", .." ("Undo AddTrack, ..").
16.09.2012:
- Fixed allocation error with drag&drop of plugins (rj)
- Fixed close menu alternative in Instrument editor (rj)
diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp
index 9781116f..026ec1a9 100644
--- a/muse2/muse/song.cpp
+++ b/muse2/muse/song.cpp
@@ -1778,6 +1778,7 @@ void Song::endMsgCmd()
redoList->clearDelete();
MusEGlobal::undoAction->setEnabled(true);
MusEGlobal::redoAction->setEnabled(false);
+ setUndoRedoText();
emit songChanged(updateFlags);
}
}
@@ -1795,6 +1796,7 @@ void Song::undo()
doUndo3();
MusEGlobal::redoAction->setEnabled(true);
MusEGlobal::undoAction->setEnabled(!undoList->empty());
+ setUndoRedoText();
if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED))
MusEGlobal::audio->msgUpdateSoloStates();
@@ -1815,6 +1817,7 @@ void Song::redo()
doRedo3();
MusEGlobal::undoAction->setEnabled(true);
MusEGlobal::redoAction->setEnabled(!redoList->empty());
+ setUndoRedoText();
if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED))
MusEGlobal::audio->msgUpdateSoloStates();
@@ -2102,6 +2105,7 @@ void Song::clear(bool signal, bool clear_all)
MusEGlobal::undoAction->setEnabled(false);
if(MusEGlobal::redoAction)
MusEGlobal::redoAction->setEnabled(false);
+ setUndoRedoText();
_markerList->clear();
pos[0].setTick(0);
diff --git a/muse2/muse/song.h b/muse2/muse/song.h
index 8777fb2c..9a314533 100644
--- a/muse2/muse/song.h
+++ b/muse2/muse/song.h
@@ -358,6 +358,7 @@ class Song : public QObject {
void doRedo3();
void addUndo(UndoOp i);
+ void setUndoRedoText();
//-----------------------------------------
// Configuration
diff --git a/muse2/muse/undo.cpp b/muse2/muse/undo.cpp
index 45642652..65ca04bf 100644
--- a/muse2/muse/undo.cpp
+++ b/muse2/muse/undo.cpp
@@ -214,6 +214,7 @@ void Song::startUndo()
{
redoList->clearDelete(); // redo must be invalidated when a new undo is started
MusEGlobal::redoAction->setEnabled(false);
+ setUndoRedoText();
undoList->push_back(Undo());
updateFlags = 0;
@@ -231,6 +232,49 @@ void Song::endUndo(SongChangedFlags_t flags)
undoMode = false;
}
+//---------------------------------------------------------
+// setUndoRedoText
+//---------------------------------------------------------
+
+void Song::setUndoRedoText()
+{
+ if(MusEGlobal::undoAction)
+ {
+ QString s = tr("Und&o");
+ if(MusEGlobal::undoAction->isEnabled())
+ {
+ if(!undoList->empty() && !undoList->back().empty())
+ {
+ int sz = undoList->back().size();
+ //if(sz >= 2)
+ // s += QString(" (%1)").arg(sz);
+ s += QString(" ") + undoList->back().front().typeName();
+ if(sz >= 2)
+ s += ", .."; // Hm, the tooltip will not show three dots "..."
+ }
+ }
+ MusEGlobal::undoAction->setText(s);
+ }
+
+ if(MusEGlobal::redoAction)
+ {
+ QString s = tr("Re&do");
+ if(MusEGlobal::redoAction->isEnabled())
+ {
+ if(!redoList->empty() && !redoList->back().empty())
+ {
+ int sz = redoList->back().size();
+ //if(sz >= 2)
+ // s += QString(" (%1)").arg(sz);
+ s += QString(" ") + redoList->back().front().typeName();
+ if(sz >= 2)
+ s += ", ..";
+ }
+ }
+ MusEGlobal::redoAction->setText(s);
+ }
+}
+
void cleanOperationGroup(Undo& group)
{
@@ -277,12 +321,14 @@ bool Song::applyOperationGroup(Undo& group, bool doUndo)
{
undoList->pop_back();
MusEGlobal::undoAction->setEnabled(!undoList->empty());
+ setUndoRedoText();
}
else
{
redoList->clearDelete(); // redo must be invalidated when a new undo is started
MusEGlobal::redoAction->setEnabled(false);
- }
+ setUndoRedoText();
+ }
return doUndo;
}