mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 23:36:36 +00:00
1b31d34d25
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.
25 lines
950 B
Python
25 lines
950 B
Python
#!/usr/bin/env python3
|
|
#
|
|
# ToolSelectClone.py
|
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
|
#
|
|
|
|
from ToolSelect import ToolSelect
|
|
|
|
class ToolSelectClone(ToolSelect):
|
|
name = "Clone selection"
|
|
|
|
#
|
|
# onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect, viewRect)
|
|
def onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect, viewRect):
|
|
dirty = False
|
|
for numRow in range(len(self.toolSelectMap)):
|
|
for numCol in range(len(self.toolSelectMap[numRow])):
|
|
cellOld = self.toolSelectMap[numRow][numCol]
|
|
rectX, rectY = selectRect[0][0] + numCol, selectRect[0][1] + numRow
|
|
dirty = False if isCursor else True
|
|
dispatchFn(eventDc, isCursor, [rectX + disp[0], rectY + disp[1], *cellOld], viewRect)
|
|
return dirty
|
|
|
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|