2019-09-07 08:39:26 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
#
|
2019-09-10 08:14:12 +00:00
|
|
|
# RoarCanvasWindow.py
|
2019-09-07 08:39:26 +00:00
|
|
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
|
|
|
#
|
|
|
|
|
2019-09-10 08:14:12 +00:00
|
|
|
from GuiWindow import GuiWindow
|
2019-09-12 10:49:53 +00:00
|
|
|
from ToolObject import ToolObject
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
from ToolText import ToolText
|
2019-09-21 09:27:52 +00:00
|
|
|
import copy, json, wx, sys
|
2019-09-12 10:49:53 +00:00
|
|
|
|
|
|
|
class RoarCanvasWindowDropTarget(wx.TextDropTarget):
|
2019-09-15 11:57:41 +00:00
|
|
|
def done(self):
|
|
|
|
self.inProgress = False
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-12 10:49:53 +00:00
|
|
|
def OnDropText(self, x, y, data):
|
|
|
|
rc = False
|
2019-09-15 13:57:38 +00:00
|
|
|
if ((self.parent.commands.currentTool.__class__ != ToolObject) \
|
|
|
|
or (self.parent.commands.currentTool.toolState == self.parent.commands.currentTool.TS_NONE)) \
|
|
|
|
and (not self.inProgress):
|
2019-09-15 11:57:41 +00:00
|
|
|
try:
|
|
|
|
dropMap, dropSize = json.loads(data)
|
|
|
|
rectX, rectY = x - (x % self.parent.backend.cellSize[0]), y - (y % self.parent.backend.cellSize[1])
|
|
|
|
mapX, mapY = int(rectX / self.parent.backend.cellSize[0] if rectX else 0), int(rectY / self.parent.backend.cellSize[1] if rectY else 0)
|
2019-09-16 14:54:07 +00:00
|
|
|
viewRect = self.parent.GetViewStart(); mapPoint = [m + n for m, n in zip((mapX, mapY), viewRect)];
|
2019-09-15 11:57:41 +00:00
|
|
|
self.parent.commands.lastTool, self.parent.commands.currentTool = self.parent.commands.currentTool, ToolObject()
|
|
|
|
self.parent.commands.currentTool.setRegion(self.parent.canvas, mapPoint, dropMap, dropSize, external=True)
|
|
|
|
self.parent.commands.update(toolName=self.parent.commands.currentTool.name)
|
|
|
|
eventDc = self.parent.backend.getDeviceContext(self.parent.GetClientSize(), self.parent, viewRect)
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
self.parent.applyTool(eventDc, True, None, None, None, self.parent.brushPos, False, False, False, self.parent.commands.currentTool, viewRect)
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
2019-09-15 11:57:41 +00:00
|
|
|
rc = True; self.inProgress = True;
|
|
|
|
except:
|
|
|
|
with wx.MessageDialog(self.parent, "Error: {}".format(sys.exc_info()[1]), "", wx.OK | wx.OK_DEFAULT) as dialog:
|
|
|
|
dialogChoice = dialog.ShowModal()
|
2019-09-12 10:49:53 +00:00
|
|
|
return rc
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-12 10:49:53 +00:00
|
|
|
def __init__(self, parent):
|
2019-09-15 11:57:41 +00:00
|
|
|
super().__init__(); self.inProgress, self.parent = False, parent;
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-10 08:14:12 +00:00
|
|
|
class RoarCanvasWindow(GuiWindow):
|
2019-09-16 14:54:07 +00:00
|
|
|
def _drawPatch(self, eventDc, isCursor, patch):
|
2019-09-07 08:39:26 +00:00
|
|
|
if not self.canvas.dirtyCursor:
|
2019-09-16 14:54:07 +00:00
|
|
|
self.backend.drawCursorMaskWithJournal(self.canvas, self.canvas.journal, eventDc)
|
2019-09-07 08:39:26 +00:00
|
|
|
self.canvas.dirtyCursor = True
|
2019-09-16 14:54:07 +00:00
|
|
|
if self.backend.drawPatch(self.canvas, eventDc, patch) and isCursor:
|
2019-09-07 08:39:26 +00:00
|
|
|
patchDeltaCell = self.canvas.map[patch[1]][patch[0]]; patchDelta = [*patch[0:2], *patchDeltaCell];
|
|
|
|
self.canvas.journal.pushCursor(patchDelta)
|
|
|
|
|
2019-09-21 09:27:52 +00:00
|
|
|
def applyOperator(self, currentTool, mapPoint, mouseLeftDown, mousePoint, operator, viewRect):
|
|
|
|
self.canvas.dirtyCursor = False
|
|
|
|
if (currentTool.__class__ == ToolObject) \
|
|
|
|
and (currentTool.toolState >= currentTool.TS_SELECT):
|
|
|
|
region = currentTool.getRegion(self.canvas)
|
|
|
|
else:
|
|
|
|
region = self.canvas.map
|
|
|
|
if hasattr(operator, "apply2"):
|
|
|
|
if mouseLeftDown:
|
|
|
|
if self.commands.operatorState == None:
|
|
|
|
self.commands.operatorState = True
|
|
|
|
region = operator.apply2(mapPoint, mousePoint, region, copy.deepcopy(region))
|
|
|
|
self.commands.update(operator=self.commands.currentOperator.name)
|
|
|
|
elif self.commands.operatorState != None:
|
|
|
|
self.commands.currentOperator = None
|
|
|
|
self.commands.update(operator=None)
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
region = operator.apply(copy.deepcopy(region))
|
|
|
|
self.commands.currentOperator = None
|
|
|
|
if (currentTool.__class__ == ToolObject) \
|
|
|
|
and (currentTool.toolState >= currentTool.TS_SELECT):
|
|
|
|
eventDc = self.backend.getDeviceContext(self.GetClientSize(), self) if self.popupEventDc == None else self.popupEventDc
|
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
|
|
|
currentTool.setRegion(self.canvas, None, region, [len(region[0]), len(region)], currentTool.external)
|
|
|
|
currentTool.onSelectEvent(self.canvas, (0, 0), self.dispatchPatchSingle, eventDc, True, wx.MOD_NONE, None, currentTool.targetRect)
|
|
|
|
currentTool._drawSelectRect(currentTool.targetRect, self.dispatchPatchSingle, eventDc)
|
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
|
|
|
else:
|
|
|
|
eventDc = self.backend.getDeviceContext(self.GetClientSize(), self) if self.popupEventDc == None else self.popupEventDc
|
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
|
|
|
self.canvas.journal.begin()
|
|
|
|
for numRow in range(len(region)):
|
|
|
|
for numCol in range(len(region[numRow])):
|
|
|
|
self.dirty = True if not self.dirty else self.dirty
|
|
|
|
self.dispatchPatchSingle(eventDc, False, [numCol, numRow, *region[numRow][numCol]])
|
|
|
|
self.canvas.journal.end()
|
|
|
|
self.commands.update(dirty=self.dirty, undoLevel=self.canvas.journal.patchesUndoLevel)
|
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
|
|
|
def applyTool(self, eventDc, eventMouse, keyChar, keyCode, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, tool, viewRect, force=False):
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
libcanvas/Canvas.py:dispatchPatchSingle(): cloned from dispatchPatch().
lib{canvas/Canvas{,Journal},gui/GuiCanvasPanel}.py: replace dirtyJournal & pushDeltas() w/ explicit {begin,end}().
libgui/GuiCanvasPanel.py:applyTool(): updated.
libgui/GuiCanvasPanel.py:dispatchPatchSingle(): cloned from dispatchPatch().
libtools/Tool{,Circle,Fill,Line,Rect,Select{,Clone,Move},Text}.py:on{Mouse,Keyboard}Event(): return rc, dirty.
libtools/ToolSelect{Clone,Move}.py:onSelectEvent(): return rc, dirty.
2019-09-09 16:43:33 +00:00
|
|
|
dirty, self.canvas.dirtyCursor, rc = False, False, False
|
|
|
|
self.canvas.journal.begin()
|
2019-09-10 08:14:12 +00:00
|
|
|
if eventMouse:
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
if force:
|
|
|
|
self.lastCellState = None
|
2019-09-12 14:24:53 +00:00
|
|
|
if ((mapPoint[0] < self.canvas.size[0]) \
|
|
|
|
and (mapPoint[1] < self.canvas.size[1])) \
|
2019-09-13 18:20:26 +00:00
|
|
|
and ((self.lastCellState == None) \
|
|
|
|
or (self.lastCellState != [list(mapPoint), mouseDragging, mouseLeftDown, mouseRightDown, list(viewRect)])):
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
if tool.__class__ != ToolText:
|
|
|
|
self.brushPos = list(mapPoint)
|
2019-09-15 19:33:19 +00:00
|
|
|
if tool != None:
|
2019-09-16 14:54:07 +00:00
|
|
|
rc, dirty = tool.onMouseEvent(mapPoint, self.brushColours, self.brushPos, self.brushSize, self.canvas, self.dispatchPatchSingle, eventDc, keyModifiers, self.brushPos, mouseDragging, mouseLeftDown, mouseRightDown)
|
2019-09-15 19:33:19 +00:00
|
|
|
else:
|
2019-09-16 14:54:07 +00:00
|
|
|
self.dispatchPatchSingle(eventDc, True, [*mapPoint, self.brushColours[0], self.brushColours[0], 0, " "])
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
self.lastCellState = [list(mapPoint), mouseDragging, mouseLeftDown, mouseRightDown, list(viewRect)]
|
2019-09-10 08:14:12 +00:00
|
|
|
else:
|
2019-09-15 19:33:19 +00:00
|
|
|
if tool != None:
|
2019-09-16 14:54:07 +00:00
|
|
|
rc, dirty = tool.onKeyboardEvent(mapPoint, self.brushColours, self.brushPos, self.brushSize, self.canvas, self.dispatchPatchSingle, eventDc, keyChar, keyCode, keyModifiers, self.brushPos)
|
2019-09-16 06:05:50 +00:00
|
|
|
elif mapPoint != None:
|
2019-09-16 14:54:07 +00:00
|
|
|
self.dispatchPatchSingle(eventDc, True, [*mapPoint, self.brushColours[0], self.brushColours[0], 0, " "])
|
libcanvas/Canvas.py:dispatchPatchSingle(): cloned from dispatchPatch().
lib{canvas/Canvas{,Journal},gui/GuiCanvasPanel}.py: replace dirtyJournal & pushDeltas() w/ explicit {begin,end}().
libgui/GuiCanvasPanel.py:applyTool(): updated.
libgui/GuiCanvasPanel.py:dispatchPatchSingle(): cloned from dispatchPatch().
libtools/Tool{,Circle,Fill,Line,Rect,Select{,Clone,Move},Text}.py:on{Mouse,Keyboard}Event(): return rc, dirty.
libtools/ToolSelect{Clone,Move}.py:onSelectEvent(): return rc, dirty.
2019-09-09 16:43:33 +00:00
|
|
|
if dirty:
|
libgui/GuiCanvasInterface.py:canvasTool(): call applyTool() w/ new tool post-selection.
libgui/GuiCanvasPanel.py:{applyTool,onPanelInput}(): split from onPanelInput().
libtools/Tool{,Circle,Fill,Line,Rect,Select,Text}.py:on{Keyboard,Mouse}Event(): updated.
libtools/ToolFill.py:onMouseEvent(): display cursor.
libtools/ToolSelect{,Clone,Move}.py:onSelectEvent(): updated.
2019-09-09 16:18:54 +00:00
|
|
|
self.dirty = True
|
2019-09-10 10:06:56 +00:00
|
|
|
self.commands.update(dirty=self.dirty, cellPos=self.brushPos, undoLevel=self.canvas.journal.patchesUndoLevel)
|
2019-09-10 08:14:12 +00:00
|
|
|
else:
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
self.commands.update(cellPos=self.brushPos)
|
libcanvas/Canvas.py:dispatchPatchSingle(): cloned from dispatchPatch().
lib{canvas/Canvas{,Journal},gui/GuiCanvasPanel}.py: replace dirtyJournal & pushDeltas() w/ explicit {begin,end}().
libgui/GuiCanvasPanel.py:applyTool(): updated.
libgui/GuiCanvasPanel.py:dispatchPatchSingle(): cloned from dispatchPatch().
libtools/Tool{,Circle,Fill,Line,Rect,Select{,Clone,Move},Text}.py:on{Mouse,Keyboard}Event(): return rc, dirty.
libtools/ToolSelect{Clone,Move}.py:onSelectEvent(): return rc, dirty.
2019-09-09 16:43:33 +00:00
|
|
|
self.canvas.journal.end()
|
2019-09-15 13:57:38 +00:00
|
|
|
if rc and (tool.__class__ == ToolObject):
|
|
|
|
if tool.toolState > tool.TS_NONE:
|
|
|
|
self.commands.update(undoInhibit=True)
|
|
|
|
elif tool.toolState == tool.TS_NONE:
|
|
|
|
if tool.external:
|
|
|
|
self.dropTarget.done()
|
2019-09-16 06:05:50 +00:00
|
|
|
self.commands.currentTool, self.commands.lastTool = self.commands.lastTool, self.commands.currentTool
|
|
|
|
if self.commands.currentTool != None:
|
|
|
|
self.commands.update(toolName=self.commands.currentTool.name, undoInhibit=False)
|
|
|
|
else:
|
|
|
|
self.commands.update(toolName="Cursor", undoInhibit=False)
|
2019-09-15 13:57:38 +00:00
|
|
|
else:
|
|
|
|
self.commands.update(undoInhibit=False)
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
return rc
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-07 08:39:26 +00:00
|
|
|
def dispatchDeltaPatches(self, deltaPatches):
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDc = self.backend.getDeviceContext(self.GetClientSize(), self)
|
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
2019-09-12 15:03:21 +00:00
|
|
|
if self.canvas.dirtyCursor:
|
2019-09-16 14:54:07 +00:00
|
|
|
self.backend.drawCursorMaskWithJournal(self.canvas, self.canvas.journal, eventDc)
|
2019-09-12 15:03:21 +00:00
|
|
|
self.canvas.dirtyCursor = False
|
2019-09-07 08:39:26 +00:00
|
|
|
for patch in deltaPatches:
|
|
|
|
if patch == None:
|
|
|
|
continue
|
|
|
|
elif patch[0] == "resize":
|
2019-09-16 14:54:07 +00:00
|
|
|
del eventDc; self.resize(patch[1:], False);
|
|
|
|
eventDc = self.backend.getDeviceContext(self.GetClientSize(), self)
|
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
2019-09-07 08:39:26 +00:00
|
|
|
else:
|
2019-09-16 14:54:07 +00:00
|
|
|
self.canvas._commitPatch(patch); self.backend.drawPatch(self.canvas, eventDc, patch)
|
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-16 14:54:07 +00:00
|
|
|
def dispatchPatch(self, eventDc, isCursor, patch):
|
2019-09-08 17:04:27 +00:00
|
|
|
if self.canvas.dispatchPatch(isCursor, patch, False if isCursor else True):
|
2019-09-16 14:54:07 +00:00
|
|
|
self._drawPatch(eventDc, isCursor, patch)
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-16 14:54:07 +00:00
|
|
|
def dispatchPatchSingle(self, eventDc, isCursor, patch):
|
libcanvas/Canvas.py:dispatchPatchSingle(): cloned from dispatchPatch().
lib{canvas/Canvas{,Journal},gui/GuiCanvasPanel}.py: replace dirtyJournal & pushDeltas() w/ explicit {begin,end}().
libgui/GuiCanvasPanel.py:applyTool(): updated.
libgui/GuiCanvasPanel.py:dispatchPatchSingle(): cloned from dispatchPatch().
libtools/Tool{,Circle,Fill,Line,Rect,Select{,Clone,Move},Text}.py:on{Mouse,Keyboard}Event(): return rc, dirty.
libtools/ToolSelect{Clone,Move}.py:onSelectEvent(): return rc, dirty.
2019-09-09 16:43:33 +00:00
|
|
|
if self.canvas.dispatchPatchSingle(isCursor, patch, False if isCursor else True):
|
2019-09-16 14:54:07 +00:00
|
|
|
self._drawPatch(eventDc, isCursor, patch)
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-23 17:55:31 +00:00
|
|
|
def resize(self, newSize, commitUndo=True, dirty=True):
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
viewRect = self.GetViewStart()
|
2019-09-07 08:39:26 +00:00
|
|
|
oldSize = [0, 0] if self.canvas.map == None else self.canvas.size
|
|
|
|
deltaSize = [b - a for a, b in zip(oldSize, newSize)]
|
|
|
|
if self.canvas.resize(newSize, commitUndo):
|
2019-09-10 08:14:12 +00:00
|
|
|
super().resize([a * b for a, b in zip(newSize, self.backend.cellSize)])
|
2019-09-07 08:39:26 +00:00
|
|
|
self.backend.resize(newSize, self.backend.cellSize)
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDc = self.backend.getDeviceContext(self.GetClientSize(), self)
|
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
2019-09-07 08:39:26 +00:00
|
|
|
if deltaSize[0] > 0:
|
|
|
|
for numRow in range(oldSize[1]):
|
|
|
|
for numNewCol in range(oldSize[0], newSize[0]):
|
2019-09-16 14:54:07 +00:00
|
|
|
self._drawPatch(eventDc, False, [numNewCol, numRow, 1, 1, 0, " "])
|
2019-09-07 08:39:26 +00:00
|
|
|
if deltaSize[1] > 1:
|
|
|
|
for numNewRow in range(oldSize[1], newSize[1]):
|
|
|
|
for numNewCol in range(newSize[0]):
|
2019-09-16 14:54:07 +00:00
|
|
|
self._drawPatch(eventDc, False, [numNewCol, numNewRow, 1, 1, 0, " "])
|
2019-09-16 15:17:04 +00:00
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
2019-09-23 17:55:31 +00:00
|
|
|
self.Scroll(*viewRect); self.dirty = dirty;
|
|
|
|
self.commands.update(dirty=self.dirty, size=newSize, undoLevel=self.canvas.journal.patchesUndoLevel)
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-23 17:55:31 +00:00
|
|
|
def update(self, newSize, commitUndo=True, newCanvas=None, dirty=True):
|
|
|
|
self.resize(newSize, commitUndo, dirty)
|
2019-09-07 08:39:26 +00:00
|
|
|
self.canvas.update(newSize, newCanvas)
|
2019-09-11 06:28:56 +00:00
|
|
|
eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, self.GetViewStart())
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
2019-09-07 08:39:26 +00:00
|
|
|
for numRow in range(newSize[1]):
|
|
|
|
for numCol in range(newSize[0]):
|
2019-09-16 14:54:07 +00:00
|
|
|
self.backend.drawPatch(self.canvas, eventDc, [numCol, numRow, *self.canvas.map[numRow][numCol]])
|
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
2019-09-07 08:39:26 +00:00
|
|
|
|
2019-09-10 08:14:12 +00:00
|
|
|
def onKeyboardInput(self, event):
|
2019-09-15 19:33:19 +00:00
|
|
|
keyCode, keyModifiers = event.GetKeyCode(), event.GetModifiers()
|
|
|
|
viewRect = self.GetViewStart(); eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, viewRect);
|
2019-09-16 15:31:17 +00:00
|
|
|
if (keyCode == wx.WXK_PAUSE) \
|
2019-09-15 19:33:19 +00:00
|
|
|
and (keyModifiers == wx.MOD_SHIFT):
|
2019-09-15 13:17:27 +00:00
|
|
|
import pdb; pdb.set_trace()
|
2019-09-15 19:33:19 +00:00
|
|
|
elif keyCode in (wx.WXK_DOWN, wx.WXK_LEFT, wx.WXK_RIGHT, wx.WXK_UP):
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
if keyCode == wx.WXK_DOWN:
|
|
|
|
if self.brushPos[1] < (self.canvas.size[1] - 1):
|
|
|
|
self.brushPos = [self.brushPos[0], self.brushPos[1] + 1]
|
|
|
|
else:
|
|
|
|
self.brushPos = [self.brushPos[0], 0]
|
|
|
|
elif keyCode == wx.WXK_LEFT:
|
|
|
|
if self.brushPos[0] > 0:
|
|
|
|
self.brushPos = [self.brushPos[0] - 1, self.brushPos[1]]
|
|
|
|
else:
|
|
|
|
self.brushPos = [self.canvas.size[0] - 1, self.brushPos[1]]
|
|
|
|
elif keyCode == wx.WXK_RIGHT:
|
|
|
|
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]]
|
|
|
|
elif keyCode == wx.WXK_UP:
|
|
|
|
if self.brushPos[1] > 0:
|
|
|
|
self.brushPos = [self.brushPos[0], self.brushPos[1] - 1]
|
|
|
|
else:
|
|
|
|
self.brushPos = [self.brushPos[0], self.canvas.size[1] - 1]
|
2019-09-15 19:33:19 +00:00
|
|
|
self.commands.update(cellPos=self.brushPos)
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
self.applyTool(eventDc, True, None, None, None, self.brushPos, False, False, False, self.commands.currentTool, viewRect)
|
2019-09-16 15:31:17 +00:00
|
|
|
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)
|
2019-09-15 13:17:27 +00:00
|
|
|
else:
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
if not self.applyTool(eventDc, False, chr(event.GetUnicodeKey()), keyCode, keyModifiers, None, None, None, None, self.commands.currentTool, viewRect):
|
2019-09-15 13:17:27 +00:00
|
|
|
event.Skip()
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-12 14:24:53 +00:00
|
|
|
def onEnterWindow(self, event):
|
2019-09-13 18:20:26 +00:00
|
|
|
self.lastCellState = None
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-10 08:14:12 +00:00
|
|
|
def onLeaveWindow(self, event):
|
Implements merged object tool & flip operators.
assets/images/toolObject.png: added.
liboperators/Operator{,Flip{Horizontal,Vertical}}.py: initial implementation.
libroar/RoarCanvasCommands.py: adds RoarCanvasCommandsOperators.
libroar/RoarCanvasCommandsOperators.py: initial implementation.
libroar/Roar{CanvasCommands{,Tools},Client}.py: replaces ToolSelect{Clone,Move} w/ ToolObject.
libroar/RoarCanvasWindow.py:RoarCanvasWindowDropTarget.OnDropText(): update ToolObject() invocation.
libroar/RoarCanvasWindow.py:{applyTool,onMouseInput}(): pass keyModifiers to Tool.onMouseEvent().
libroar/RoarCanvasWindow.py:applyTool(): only switch back to lastTool if current object tool contains an external object.
libroar/RoarCanvasWindow.py:onLeaveWindow(): disable hiding cursor for now.
libtools/Tool{,Circle,Fill,Line,Rect,Text}.py:onMouseEvent(): update type signature.
libtools/Tool{Object,Select{,Clone,Move}}.py: merged into libtools/ToolObject.py.
roar.py: add liboperators to sys.path[].
assets/text/TODO: updated.
2019-09-15 09:06:25 +00:00
|
|
|
if False:
|
|
|
|
eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, self.GetViewStart())
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
|
|
|
self.backend.drawCursorMaskWithJournal(self.canvas, self.canvas.journal, eventDc)
|
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
2019-09-13 18:20:26 +00:00
|
|
|
self.lastCellState = None
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-10 08:14:12 +00:00
|
|
|
def onMouseInput(self, event):
|
2019-09-11 06:28:56 +00:00
|
|
|
viewRect = self.GetViewStart(); eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, viewRect);
|
2019-09-10 08:14:12 +00:00
|
|
|
mouseDragging, mouseLeftDown, mouseRightDown = event.Dragging(), event.LeftIsDown(), event.RightIsDown()
|
|
|
|
mapPoint = self.backend.xlateEventPoint(event, eventDc, viewRect)
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
if viewRect != (0, 0):
|
|
|
|
mapPoint = [a + b for a, b in zip(mapPoint, viewRect)]
|
2019-09-21 09:27:52 +00:00
|
|
|
if self.commands.currentOperator != None:
|
|
|
|
self.applyOperator(self.commands.currentTool, mapPoint, mouseLeftDown, event.GetLogicalPosition(eventDc), self.commands.currentOperator, viewRect)
|
|
|
|
elif mouseRightDown \
|
2019-09-15 11:52:44 +00:00
|
|
|
and (self.commands.currentTool.__class__ == ToolObject) \
|
|
|
|
and (self.commands.currentTool.toolState >= self.commands.currentTool.TS_SELECT):
|
|
|
|
self.popupEventDc = eventDc; self.PopupMenu(self.operatorsMenu); self.popupEventDc = None;
|
Fully implement {{arrow keys,backspace,enter},arrow keys} in {text,} tool{,s}.
libroar/RoarCanvasWindow.py:applyTool(): delegate updating of brushPos to ToolText if current tool.
libroar/RoarCanvasWindow.py:applyTool(): fix function result.
libroar/RoarCanvasWindow.py:applyTool(): pass updated set of arguments to on{Keyboard,Mouse}Event().
libroar/RoarCanvasWindow.py:onKeyboardInput(): allow wrapping around canvas when receiving cursor key input.
libroar/RoarCanvasWindow.py:onKeyboardInput(): supply keyCode or None to applyTool().
libroar/RoarCanvas{CommandsTools,Window}.py: supply keyCode or None to applyTool().
libtools/Tool{,Circle,Fill,Line,Object,Rect}.py:on{Keyboard,Mouse}Event(): update type signature.
libtools/ToolText.py:onKeyboardEvent(): fully implement {arrow keys,backspace,enter}.
libtools/ToolText.py:onKeyboardEvent(): update cursor when necessary.
libtools/ToolText.py:onMouseEvent(): correctly set brushPos if mouseLeftDown or mouseRightDown.
libtools/ToolText.py:__init__(): removed.
assets/text/TODO: updated.
2019-09-16 07:55:30 +00:00
|
|
|
elif not self.applyTool(eventDc, True, None, None, event.GetModifiers(), mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, self.commands.currentTool, viewRect):
|
2019-09-10 08:14:12 +00:00
|
|
|
event.Skip()
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-14 13:44:17 +00:00
|
|
|
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)
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDc = self.backend.getDeviceContext(self.GetClientSize(), self)
|
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
2019-09-14 13:44:17 +00:00
|
|
|
for numRow in range(self.canvas.size[1]):
|
|
|
|
for numCol in range(len(self.canvas.map[numRow])):
|
2019-09-16 14:54:07 +00:00
|
|
|
self._drawPatch(eventDc, False, [numCol, numRow, *self.canvas.map[numRow][numCol]])
|
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
2019-09-14 13:44:17 +00:00
|
|
|
else:
|
|
|
|
event.Skip()
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-10 08:14:12 +00:00
|
|
|
def onPaint(self, event):
|
2019-09-16 14:54:07 +00:00
|
|
|
eventDc = self.backend.getDeviceContext(self.GetClientSize(), self)
|
|
|
|
eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0);
|
|
|
|
self.backend.drawCursorMaskWithJournal(self.canvas, self.canvas.journal, eventDc)
|
|
|
|
eventDc.SetDeviceOrigin(*eventDcOrigin)
|
2019-09-15 10:58:39 +00:00
|
|
|
self.backend.onPaint(self.GetClientSize(), self, self.GetViewStart())
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-07 08:39:26 +00:00
|
|
|
#
|
2019-09-10 10:06:56 +00:00
|
|
|
# __init__(self, backend, canvas, cellSize, commands, parent, parentFrame, pos, scrollStep, size): initialisation method
|
|
|
|
def __init__(self, backend, canvas, cellSize, commands, parent, parentFrame, pos, scrollStep, size):
|
2019-09-15 14:54:19 +00:00
|
|
|
super().__init__(parent, pos, scrollStep)
|
|
|
|
self.size = size
|
2019-09-10 10:06:56 +00:00
|
|
|
self.backend, self.canvas, self.cellSize, self.commands, self.parentFrame = backend(self.size, cellSize), canvas, cellSize, commands(self, parentFrame), parentFrame
|
2019-09-13 18:20:26 +00:00
|
|
|
self.brushColours, self.brushPos, self.brushSize, self.dirty, self.lastCellState = [4, 1], [0, 0], [1, 1], False, None
|
2019-09-15 11:52:44 +00:00
|
|
|
self.popupEventDc = None
|
2019-09-12 10:49:53 +00:00
|
|
|
self.dropTarget = RoarCanvasWindowDropTarget(self)
|
|
|
|
self.SetDropTarget(self.dropTarget)
|
2019-09-14 13:44:17 +00:00
|
|
|
self.Bind(wx.EVT_MOUSEWHEEL, self.onMouseWheel)
|
2019-09-07 08:39:26 +00:00
|
|
|
|
2019-09-08 14:57:45 +00:00
|
|
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|