From 09c0df13cf1dd93ac20f1464ee174469815ac01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Mon, 16 Sep 2019 17:31:17 +0200 Subject: [PATCH] libroar/RoarCanvasWindow.py:onKeyboardInput(): simulate LMB & advance to the right w/ space key except w/ Text tool. --- libroar/RoarCanvasWindow.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libroar/RoarCanvasWindow.py b/libroar/RoarCanvasWindow.py index 1e82c8e..b9b68e7 100644 --- a/libroar/RoarCanvasWindow.py +++ b/libroar/RoarCanvasWindow.py @@ -164,7 +164,7 @@ class RoarCanvasWindow(GuiWindow): def onKeyboardInput(self, event): keyCode, keyModifiers = event.GetKeyCode(), event.GetModifiers() viewRect = self.GetViewStart(); eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, viewRect); - if (keyCode == wx.WXK_PAUSE) \ + if (keyCode == wx.WXK_PAUSE) \ and (keyModifiers == wx.MOD_SHIFT): import pdb; pdb.set_trace() elif keyCode in (wx.WXK_DOWN, wx.WXK_LEFT, wx.WXK_RIGHT, wx.WXK_UP): @@ -190,6 +190,17 @@ class RoarCanvasWindow(GuiWindow): self.brushPos = [self.brushPos[0], self.canvas.size[1] - 1] self.commands.update(cellPos=self.brushPos) self.applyTool(eventDc, True, None, None, None, self.brushPos, False, False, False, self.commands.currentTool, viewRect) + elif (chr(event.GetUnicodeKey()) == " ") \ + and (self.commands.currentTool.__class__ != ToolText): + if not self.applyTool(eventDc, True, None, None, event.GetModifiers(), self.brushPos, False, True, False, self.commands.currentTool, viewRect): + event.Skip() + else: + if self.brushPos[0] < (self.canvas.size[0] - 1): + self.brushPos = [self.brushPos[0] + 1, self.brushPos[1]] + else: + self.brushPos = [0, self.brushPos[1]] + self.commands.update(cellPos=self.brushPos) + self.applyTool(eventDc, True, None, None, None, self.brushPos, False, False, False, self.commands.currentTool, viewRect) else: if not self.applyTool(eventDc, False, chr(event.GetUnicodeKey()), keyCode, keyModifiers, None, None, None, None, self.commands.currentTool, viewRect): event.Skip()