2019-09-01 14:34:00 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
#
|
2019-09-09 10:46:52 +00:00
|
|
|
# ToolSelectMove.py
|
2019-09-04 14:23:59 +00:00
|
|
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
2019-09-01 14:34:00 +00:00
|
|
|
#
|
|
|
|
|
2019-09-03 16:58:50 +00:00
|
|
|
from ToolSelect import ToolSelect
|
2019-09-01 14:34:00 +00:00
|
|
|
|
2019-09-03 16:58:50 +00:00
|
|
|
class ToolSelectMove(ToolSelect):
|
2019-09-01 14:34:00 +00:00
|
|
|
name = "Move selection"
|
|
|
|
|
|
|
|
#
|
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
|
|
|
# onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect, viewRect)
|
|
|
|
def onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect, viewRect):
|
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 = False
|
2019-09-01 14:34:00 +00:00
|
|
|
for numRow in range(len(self.toolSelectMap)):
|
|
|
|
for numCol in range(len(self.toolSelectMap[numRow])):
|
Initial canvas panel scrollbar implementation.
assets/text/TODO: updated.
libgui/GuiCanvasPanel.py:__init__(): provide self.winSize & call SetScrollRate().
libgui/GuiCanvasPanel.py:{_drawPatch,dispatch{DeltaPatches,Patch},onPanel{Input,LeaveWindow},resize,update}(): receive and/or pass viewRect.
libgui/GuiCanvasPanel.py:onPanelPaint(): updated.
libgui/GuiCanvasPanel.py:resize(): call SetVirtualSize().
libgui/GuiCanvasWxBackend.py:_{draw{Brush,Char}Patch,_get{Brush,Char}PatchColours,xlatePoint}(): updated.
libgui/GuiCanvasWxBackend.py:{draw{CursorMaskWithJournal,Patch},getDeviceContext,xlateEventPoint}(): receive and/or pass viewRect.
libgui/GuiCanvasWxBackend.py:getDeviceContext(): return ClientDC() if viewRect > (0, 0)
libgui/GuiCanvasWxBackend.py:onPanelPaintEvent(): blit subset of canvasBitmap into BufferedPaintDC() if viewRect > (0, 0).
libtools/Tool{,Circle,Fill,Line,Rect,Select{,Clone,Move},Text}.py: receive & pass viewRect to dispatchFn().
2019-09-09 10:30:25 +00:00
|
|
|
dispatchFn(eventDc, isCursor, [self.srcRect[0] + numCol, self.srcRect[1] + numRow, 1, 1, 0, " "], viewRect)
|
2019-09-01 14:34:00 +00:00
|
|
|
for numRow in range(len(self.toolSelectMap)):
|
|
|
|
for numCol in range(len(self.toolSelectMap[numRow])):
|
|
|
|
cellOld = self.toolSelectMap[numRow][numCol]
|
2019-09-03 13:48:48 +00:00
|
|
|
rectX, rectY = selectRect[0][0] + numCol, selectRect[0][1] + numRow
|
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 = False if isCursor else True
|
Initial canvas panel scrollbar implementation.
assets/text/TODO: updated.
libgui/GuiCanvasPanel.py:__init__(): provide self.winSize & call SetScrollRate().
libgui/GuiCanvasPanel.py:{_drawPatch,dispatch{DeltaPatches,Patch},onPanel{Input,LeaveWindow},resize,update}(): receive and/or pass viewRect.
libgui/GuiCanvasPanel.py:onPanelPaint(): updated.
libgui/GuiCanvasPanel.py:resize(): call SetVirtualSize().
libgui/GuiCanvasWxBackend.py:_{draw{Brush,Char}Patch,_get{Brush,Char}PatchColours,xlatePoint}(): updated.
libgui/GuiCanvasWxBackend.py:{draw{CursorMaskWithJournal,Patch},getDeviceContext,xlateEventPoint}(): receive and/or pass viewRect.
libgui/GuiCanvasWxBackend.py:getDeviceContext(): return ClientDC() if viewRect > (0, 0)
libgui/GuiCanvasWxBackend.py:onPanelPaintEvent(): blit subset of canvasBitmap into BufferedPaintDC() if viewRect > (0, 0).
libtools/Tool{,Circle,Fill,Line,Rect,Select{,Clone,Move},Text}.py: receive & pass viewRect to dispatchFn().
2019-09-09 10:30:25 +00:00
|
|
|
dispatchFn(eventDc, isCursor, [rectX + disp[0], rectY + disp[1], *cellOld], viewRect)
|
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
|
|
|
return dirty
|
2019-09-01 14:34:00 +00:00
|
|
|
|
|
|
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|