mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 07:16:38 +00:00
Inhibit {drag & drop,{un,re}do} during object tool usage.
libroar/RoarCanvasCommands.py:update(): disable {re,un}do {menu,toolbar} items on lastPanelState["undoInhibit"]. libroar/RoarCanvasWindow.py:applyTool(): call commands.update(undoInhibit=True) after active object tool usage. libroar/RoarCanvasWindow.py:OnDropText(): inhibit during active object tool usage.
This commit is contained in:
parent
1487f2eb9a
commit
9f72bd5a4c
@ -66,7 +66,13 @@ class RoarCanvasCommands(RoarCanvasCommandsFile, RoarCanvasCommandsEdit, RoarCan
|
|||||||
and self.lastPanelState["dirty"]:
|
and self.lastPanelState["dirty"]:
|
||||||
textItems.append("*")
|
textItems.append("*")
|
||||||
self.parentFrame.statusBar.SetStatusText(" | ".join(textItems))
|
self.parentFrame.statusBar.SetStatusText(" | ".join(textItems))
|
||||||
if "undoLevel" in self.lastPanelState:
|
if ("undoInhibit" in self.lastPanelState) \
|
||||||
|
and (self.lastPanelState["undoInhibit"]):
|
||||||
|
for item in (self.canvasRedo, self.canvasUndo):
|
||||||
|
self.parentFrame.menuItemsById[item.attrDict["id"]].Enable(False)
|
||||||
|
toolBar = self.parentFrame.toolBarItemsById[item.attrDict["id"]].GetToolBar()
|
||||||
|
toolBar.EnableTool(item.attrDict["id"], False)
|
||||||
|
elif "undoLevel" in self.lastPanelState:
|
||||||
if (self.lastPanelState["undoLevel"] >= 0) \
|
if (self.lastPanelState["undoLevel"] >= 0) \
|
||||||
and (self.lastPanelState["undoLevel"] < (len(self.parentCanvas.canvas.journal.patchesUndo) - 1)):
|
and (self.lastPanelState["undoLevel"] < (len(self.parentCanvas.canvas.journal.patchesUndo) - 1)):
|
||||||
self.parentFrame.menuItemsById[self.canvasUndo.attrDict["id"]].Enable(True)
|
self.parentFrame.menuItemsById[self.canvasUndo.attrDict["id"]].Enable(True)
|
||||||
|
@ -17,7 +17,9 @@ class RoarCanvasWindowDropTarget(wx.TextDropTarget):
|
|||||||
# {{{ OnDropText(self, x, y, data)
|
# {{{ OnDropText(self, x, y, data)
|
||||||
def OnDropText(self, x, y, data):
|
def OnDropText(self, x, y, data):
|
||||||
rc = False
|
rc = False
|
||||||
if not self.inProgress:
|
if ((self.parent.commands.currentTool.__class__ != ToolObject) \
|
||||||
|
or (self.parent.commands.currentTool.toolState == self.parent.commands.currentTool.TS_NONE)) \
|
||||||
|
and (not self.inProgress):
|
||||||
try:
|
try:
|
||||||
dropMap, dropSize = json.loads(data)
|
dropMap, dropSize = json.loads(data)
|
||||||
viewRect = self.parent.GetViewStart()
|
viewRect = self.parent.GetViewStart()
|
||||||
@ -73,12 +75,16 @@ class RoarCanvasWindow(GuiWindow):
|
|||||||
else:
|
else:
|
||||||
self.commands.update(cellPos=mapPoint if mapPoint else self.brushPos)
|
self.commands.update(cellPos=mapPoint if mapPoint else self.brushPos)
|
||||||
self.canvas.journal.end()
|
self.canvas.journal.end()
|
||||||
if rc and (tool.__class__ == ToolObject) \
|
if rc and (tool.__class__ == ToolObject):
|
||||||
and (tool.toolState == tool.TS_NONE) \
|
if tool.toolState > tool.TS_NONE:
|
||||||
and tool.external:
|
self.commands.update(undoInhibit=True)
|
||||||
|
elif tool.toolState == tool.TS_NONE:
|
||||||
|
if tool.external:
|
||||||
self.commands.currentTool, self.commands.lastTool = self.commands.lastTool, self.commands.currentTool
|
self.commands.currentTool, self.commands.lastTool = self.commands.lastTool, self.commands.currentTool
|
||||||
self.commands.update(toolName=self.commands.currentTool.name)
|
self.commands.update(toolName=self.commands.currentTool.name, undoInhibit=False)
|
||||||
self.dropTarget.done()
|
self.dropTarget.done()
|
||||||
|
else:
|
||||||
|
self.commands.update(undoInhibit=False)
|
||||||
return rc
|
return rc
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ dispatchDeltaPatches(self, deltaPatches)
|
# {{{ dispatchDeltaPatches(self, deltaPatches)
|
||||||
|
Loading…
Reference in New Issue
Block a user