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.
This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-28 10:11:49 +02:00
parent 4b98d1cdf1
commit de96a7cdaa
3 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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);

View File

@ -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