diff base/CommandHistory.cpp @ 46:5364a9d338a2

* Add Insert Instant function in main window * Ensure selections and window geometry are saved in session file * Add wait cursor on session file save * Various improvements to display of texts in pane (clearer readability) * Use commands for setting properties on layers and panes (still need to batch up multiple sets on the same property) * Fix failure of spectrogram to refresh when initial part became visible * Some fixes & paint optimisations in View &c * Make curve mode for time value layers work properly when resolution == 1 * Some vague improvements for time value layer vertical scale
author Chris Cannam
date Thu, 16 Mar 2006 18:46:00 +0000
parents 701404725897
children bac8b14ab355
line wrap: on
line diff
--- a/base/CommandHistory.cpp	Wed Mar 15 18:11:23 2006 +0000
+++ b/base/CommandHistory.cpp	Thu Mar 16 18:46:00 2006 +0000
@@ -33,6 +33,7 @@
 CommandHistory::CommandHistory() :
     m_undoLimit(50),
     m_redoLimit(50),
+    m_menuLimit(15),
     m_savedAt(0),
     m_currentMacro(0),
     m_executeMacro(false)
@@ -112,7 +113,7 @@
 	return;
     }
 
-    std::cerr << "MVCH::addCommand: " << command->getName().toLocal8Bit().data() << std::endl;
+    std::cerr << "MVCH::addCommand: " << command->getName().toLocal8Bit().data() << " at " << command << std::endl;
 
     // We can't redo after adding a command
     clearStack(m_redoStack);
@@ -241,6 +242,13 @@
 }
 
 void
+CommandHistory::setMenuLimit(int limit)
+{
+    m_menuLimit = limit;
+    updateActions();
+}
+
+void
 CommandHistory::documentSaved()
 {
     m_savedAt = m_undoStack.size();
@@ -287,7 +295,8 @@
 {
     while (!stack.empty()) {
 	Command *command = stack.top();
-	std::cerr << "MVCH::clearStack: About to delete command: " << command->getName().toLocal8Bit().data() << " at " << command << std::endl;
+	// Not safe to call getName() on a command about to be deleted
+	std::cerr << "MVCH::clearStack: About to delete command " << command << std::endl;
 	delete command;
 	stack.pop();
     }
@@ -353,7 +362,7 @@
 	CommandStack tempStack;
 	int j = 0;
 
-	while (j < 10 && !stack.empty()) {
+	while (j < m_menuLimit && !stack.empty()) {
 
 	    Command *command = stack.top();
 	    tempStack.push(command);