From c84ef3a47ec6beaf737c3438ef2c7d73dd9b1b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Sat, 28 Sep 2019 10:11:49 +0200 Subject: [PATCH] Various bugfixes. 1) Fix erroneous canvas repositioning on resize given no docked toolbars. 2) Correctly update scrollbar parameters when changing font (and hence cell) size. --- assets/text/TODO | 1 - libroar/RoarCanvasWindow.py | 2 +- libroar/RoarClient.py | 11 +++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/assets/text/TODO b/assets/text/TODO index 42e41ec..93b9c6a 100644 --- a/assets/text/TODO +++ b/assets/text/TODO @@ -23,6 +23,5 @@ Release roadmap: 3) operators: crop, scale, shift, slice 4) auto{load,save} & {backup,restore} 5) tools: unicode block elements -6) bugs: a) undock all toolbars & resize window b) increase cell size, scroll down vim:ff=dos tw=0 diff --git a/libroar/RoarCanvasWindow.py b/libroar/RoarCanvasWindow.py index 33cbd81..dd88e94 100644 --- a/libroar/RoarCanvasWindow.py +++ b/libroar/RoarCanvasWindow.py @@ -216,7 +216,7 @@ class RoarCanvasWindow(GuiWindow): newFontSize = self.backend.fontSize + fd if newFontSize > 0: self.backend.fontSize = newFontSize - self.backend.resize(self.canvas.size) + self.backend.resize(self.canvas.size); self.scrollStep = self.backend.cellSize; super().resize([a * b for a, b in zip(self.canvas.size, self.backend.cellSize)]) eventDc = self.backend.getDeviceContext(self.GetClientSize(), self) eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0); diff --git a/libroar/RoarClient.py b/libroar/RoarClient.py index a034150..55d2ad4 100644 --- a/libroar/RoarClient.py +++ b/libroar/RoarClient.py @@ -28,9 +28,6 @@ class RoarClient(GuiFrame): def onChar(self, event): self.canvasPanel.onKeyboardInput(event) - def onMouseWheel(self, event): - self.canvasPanel.GetEventHandler().ProcessEvent(event) - def onClose(self, event): if not self.canvasPanel.commands.exiting: closeFlag = self.canvasPanel.commands._promptSaveChanges() @@ -39,6 +36,12 @@ class RoarClient(GuiFrame): if closeFlag: event.Skip(); + def onMouseWheel(self, event): + self.canvasPanel.GetEventHandler().ProcessEvent(event) + + def onSize(self, event): + pass + def __init__(self, parent, defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), size=(840, 640), title=""): super().__init__(self._getIconPathName(), size, parent, title) self.canvas = Canvas(defaultCanvasSize) @@ -63,7 +66,7 @@ class RoarClient(GuiFrame): self.canvasPanel.commands.canvasClearRecent.attrDict["id"] = wx.NewId() menuItemWindow = self.canvasPanel.commands.canvasOpenRecent.attrDict["menu"].Append(self.canvasPanel.commands.canvasClearRecent.attrDict["id"], self.canvasPanel.commands.canvasClearRecent.attrDict["label"], self.canvasPanel.commands.canvasClearRecent.attrDict["caption"]) self.canvasPanel.commands.canvasOpenRecent.attrDict["menu"].Bind(wx.EVT_MENU, self.canvasPanel.commands.canvasClearRecent, menuItemWindow) - self.Bind(wx.EVT_CLOSE, self.onClose) + self.Bind(wx.EVT_CLOSE, self.onClose); self.Bind(wx.EVT_SIZE, self.onSize); self.toolBarPanes[0].BestSize(0, 0).Right(); self.toolBarPanes[1].BestSize(0, 0).Right(); self.auiManager.Update(); # vim:expandtab foldmethod=marker sw=4 ts=4 tw=120