mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 23:36:36 +00:00
libgui/GuiCanvasWxBackend.py:resize(): set font size from cellSize[0] + 1 vs. hard-wired 8.
libroar/RoarCanvasWindow.py:{onMouseWheel,__init__}(): {de,in}crease cell size w/ <Ctrl> <Mouse Wheel>. assets/text/TODO: updated.
This commit is contained in:
parent
270a19ea40
commit
3b47af399a
@ -13,7 +13,6 @@ High-priority list:
|
|||||||
1) geometric primitives: arrow, circle, cloud/speech bubble, curve, heart, hexagon, line, pentagon, polygon, rhombus, triangle, square, star
|
1) geometric primitives: arrow, circle, cloud/speech bubble, curve, heart, hexagon, line, pentagon, polygon, rhombus, triangle, square, star
|
||||||
2) region filters: crop, duplicate, erase, fill, invert, measure, pick, rotate, scale, select, shift, slice, tile, translate
|
2) region filters: crop, duplicate, erase, fill, invert, measure, pick, rotate, scale, select, shift, slice, tile, translate
|
||||||
3) text tool: a) allow navigating w/ cursor keys b) Unicode set key & GUI w/ MRU
|
3) text tool: a) allow navigating w/ cursor keys b) Unicode set key & GUI w/ MRU
|
||||||
4) GUI: {de,in}crease cell size on <Ctrl> <Mouse Wheel>
|
4) cleanup & refactor
|
||||||
5) cleanup & refactor
|
|
||||||
|
|
||||||
vim:ff=dos tw=0
|
vim:ff=dos tw=0
|
||||||
|
@ -153,9 +153,9 @@ class GuiCanvasWxBackend():
|
|||||||
self.canvasBitmap.Destroy(); self.canvasBitmap = newBitmap;
|
self.canvasBitmap.Destroy(); self.canvasBitmap = newBitmap;
|
||||||
self.canvasSize, self.cellSize = canvasSize, cellSize
|
self.canvasSize, self.cellSize = canvasSize, cellSize
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
self._font = wx.TheFontList.FindOrCreateFont(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, self.fontName)
|
self._font = wx.TheFontList.FindOrCreateFont(cellSize[0] + 1, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, self.fontName)
|
||||||
else:
|
else:
|
||||||
self._font = wx.Font(8, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
|
self._font = wx.Font(cellSize[0] + 1, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ xlateEventPoint(self, event, eventDc, viewRect)
|
# {{{ xlateEventPoint(self, event, eventDc, viewRect)
|
||||||
def xlateEventPoint(self, event, eventDc, viewRect):
|
def xlateEventPoint(self, event, eventDc, viewRect):
|
||||||
|
@ -150,6 +150,22 @@ class RoarCanvasWindow(GuiWindow):
|
|||||||
if not self.applyTool(eventDc, True, None, None, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, self.commands.currentTool, viewRect):
|
if not self.applyTool(eventDc, True, None, None, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, self.commands.currentTool, viewRect):
|
||||||
event.Skip()
|
event.Skip()
|
||||||
# }}}
|
# }}}
|
||||||
|
# {{{ onMouseWheel(self, event)
|
||||||
|
def onMouseWheel(self, event):
|
||||||
|
if event.GetModifiers() == wx.MOD_CONTROL:
|
||||||
|
cd = +1 if event.GetWheelRotation() >= event.GetWheelDelta() else -1
|
||||||
|
newCellSize = [cs + cd for cs in self.backend.cellSize]
|
||||||
|
if (newCellSize[0] > 0) and (newCellSize[1] > 0):
|
||||||
|
self.backend.cellSize = newCellSize
|
||||||
|
super().resize([a * b for a, b in zip(self.canvas.size, self.backend.cellSize)])
|
||||||
|
self.backend.resize(self.canvas.size, self.backend.cellSize)
|
||||||
|
viewRect = self.GetViewStart(); eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, viewRect);
|
||||||
|
for numRow in range(self.canvas.size[1]):
|
||||||
|
for numCol in range(len(self.canvas.map[numRow])):
|
||||||
|
self._drawPatch(eventDc, False, [numCol, numRow, *self.canvas.map[numRow][numCol]], viewRect)
|
||||||
|
else:
|
||||||
|
event.Skip()
|
||||||
|
# }}}
|
||||||
# {{{ onPaint(self, event)
|
# {{{ onPaint(self, event)
|
||||||
def onPaint(self, event):
|
def onPaint(self, event):
|
||||||
self.backend.onPaint(self.GetClientSize(), self, self.GetViewStart())
|
self.backend.onPaint(self.GetClientSize(), self, self.GetViewStart())
|
||||||
@ -170,5 +186,6 @@ class RoarCanvasWindow(GuiWindow):
|
|||||||
self.brushColours, self.brushPos, self.brushSize, self.dirty, self.lastCellState = [4, 1], [0, 0], [1, 1], False, None
|
self.brushColours, self.brushPos, self.brushSize, self.dirty, self.lastCellState = [4, 1], [0, 0], [1, 1], False, None
|
||||||
self.dropTarget = RoarCanvasWindowDropTarget(self)
|
self.dropTarget = RoarCanvasWindowDropTarget(self)
|
||||||
self.SetDropTarget(self.dropTarget)
|
self.SetDropTarget(self.dropTarget)
|
||||||
|
self.Bind(wx.EVT_MOUSEWHEEL, self.onMouseWheel)
|
||||||
|
|
||||||
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
||||||
|
Loading…
Reference in New Issue
Block a user