Added: Undo Limit setting

This commit is contained in:
David Vierra 2013-03-13 23:25:09 -10:00
parent 7be7390018
commit c3158ccf7c
2 changed files with 11 additions and 0 deletions

View File

@ -114,6 +114,8 @@ Settings.vsync = Settings("vertical sync", 0)
Settings.visibilityCheck = Settings("visibility check", False)
Settings.viewMode = Settings("View Mode", "Camera")
Settings.undoLimit = Settings("Undo Limit", 20)
ControlSettings = config.Settings("Controls")
ControlSettings.mouseSpeed = ControlSettings("mouse speed", 5.0)
ControlSettings.cameraAccel = ControlSettings("camera acceleration", 125.0)
@ -1513,7 +1515,9 @@ class LevelEditor(GLViewport):
self.viewportContainer.top = row.bottom
self.viewportContainer.size = self.mainViewport.size
self.add(self.viewportContainer)
Settings.viewMode.addObserver(self)
Settings.undoLimit.addObserver(self)
self.reloadToolbar()
@ -3363,6 +3367,9 @@ class LevelEditor(GLViewport):
def addOperation(self, op):
if self.recordUndo:
self.undoStack.append(op)
if len(self.undoStack) > self.undoLimit:
self.undoStack.pop(0)
self.performWithRetry(op)
recordUndo = True

View File

@ -493,6 +493,9 @@ class OptionsPanel(Dialog):
mouseSpeedRow = mceutils.FloatInputRow("Mouse Speed: ",
ref=ControlSettings.mouseSpeed.propertyRef(), width=100, min=0.1, max=20.0)
undoLimitRow = mceutils.IntInputRow("Undo Limit: ",
ref=Settings.undoLimit.propertyRef(), width=100, min=0)
invertRow = mceutils.CheckBoxLabel("Invert Mouse",
ref=ControlSettings.invertMousePitch.propertyRef(),
tooltipText="Reverse the up and down motion of the mouse.")
@ -542,6 +545,7 @@ class OptionsPanel(Dialog):
cameraBrakeSpeedRow,
blockBufferRow,
mouseSpeedRow,
undoLimitRow,
)
options = (