From 6ab7c443eb09697ba68d74bbd24fcf5563f30bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Tue, 24 Sep 2019 15:44:54 +0200 Subject: [PATCH] Erase back- w/ foreground colour on . assets/text/hotkeys.txt: updated. assets/text/TODO: updated. --- assets/text/TODO | 38 +++++++++++++++++++------------------- assets/text/hotkeys.txt | 1 + libtools/ToolErase.py | 18 +++++++++++------- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/assets/text/TODO b/assets/text/TODO index d9818a9..ebf0f0a 100644 --- a/assets/text/TODO +++ b/assets/text/TODO @@ -1,28 +1,28 @@ 1) ANSI CSI CU[BDPU] sequences & italic -2) Documentation, instrumentation & unit tests -3) Layers & layout (e.g. for comics, zines, etc.) -4) Open and toggle a reference image in the background -5) Client-Server or Peer-to-Peer realtime collaboration -6) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.) -7) {record,replay} {keyboard,mouse,...} events in debugging builds -8) Unit tools: arrow, {cloud,speech bubble}, curve, measure, polygon, triangle -9) Integrate ENNTool code in the form of OpenGL-based animation window (see 13) and 14)) -10) Composition, parametrisation & keying of tools from higher-order operators (brushes, functions, filters, outlines, patterns & shaders) and unit tools -11) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...) -12) GUI TODO list: +2) Fix & finish Arabic/RTL text tool support +3) Documentation, instrumentation & unit tests +4) Layers & layout (e.g. for comics, zines, etc.) +5) Open and toggle a reference image in the background +6) Client-Server or Peer-to-Peer realtime collaboration +7) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.) +8) {record,replay} {keyboard,mouse,...} events in debugging builds +9) Unit tools: arrow, {cloud,speech bubble}, curve, measure, polygon, triangle +10) Integrate ENNTool code in the form of OpenGL-based animation window (see 13) and 14)) +11) Composition, parametrisation & keying of tools from higher-order operators (brushes, functions, filters, outlines, patterns & shaders) and unit tools +12) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...) +13) GUI TODO list: a) switch to Gtk b) replace logo w/ canvas panel in About dialogue c) Settings/Settings window (e.g. autosave, hide cursor on leaving window, ...) d) replace resize buttons w/ {-,edit box,+} buttons & lock button re: ratio (ty lol3) Release roadmap: -1) BUG: fix & finish Arabic/RTL text tool support -2) BUG: a) text tool b) paste text c) undo -3) {copy,cut,delete,insert from,paste}, edit asset in new canvas, import from {canvas,object} -4) add hotkeys.txt mIRC art canvas to help menu -5) operators: crop, scale, shift, slice -6) auto{load,save} & {backup,restore} -7) tools: unicode block elements -8) floating/dockable toolbar +1) {copy,cut,delete,insert from,paste}, edit asset in new canvas, import from {canvas,object} +2) BUG: a) apply tool b) move cursor c) undo d) cursor artifacts +3) add hotkeys.txt mIRC art canvas to help menu +4) operators: crop, scale, shift, slice +5) auto{load,save} & {backup,restore} +6) tools: unicode block elements +7) floating/dockable toolbar vim:ff=dos tw=0 diff --git a/assets/text/hotkeys.txt b/assets/text/hotkeys.txt index 92de855..f825282 100644 --- a/assets/text/hotkeys.txt +++ b/assets/text/hotkeys.txt @@ -11,5 +11,6 @@ (Canvas) , , , Move canvas cursor (Canvas) , Apply current tool with foreground colour or initiate tool action (line and object tool) (Canvas) Apply current tool with background colour +(Erase tool) Erase background colour with foreground colour (Fill tool) , Fill entire region ignoring character cells (Object tool) Move selection instead of cloning diff --git a/libtools/ToolErase.py b/libtools/ToolErase.py index 4d865fb..95e352d 100644 --- a/libtools/ToolErase.py +++ b/libtools/ToolErase.py @@ -13,21 +13,25 @@ class ToolErase(Tool): # onMouseEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown) def onMouseEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown): brushColours, brushSize, dirty = list(brushColours), list(brushSize), False - if mouseRightDown: - brushColours = [brushColours[0], brushColours[0]] - else: - brushColours = [brushColours[1], brushColours[1]] if brushSize[0] > 1: brushSize[0] *= 2 for brushRow in range(brushSize[1]): for brushCol in range(brushSize[0]): - patchColours = [brushColours[1]] * 2 - patch = [mapPoint[0] + brushCol, mapPoint[1] + brushRow, *patchColours, 0, " "] - if mouseLeftDown or mouseRightDown: + if mouseLeftDown: + patch = [mapPoint[0] + brushCol, mapPoint[1] + brushRow, brushColours[1], brushColours[1], 0, " "] + if not dirty: + dirty = True + dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch); + elif mouseRightDown \ + and ((mapPoint[0] + brushCol) < canvas.size[0]) \ + and ((mapPoint[1] + brushRow) < canvas.size[1]) \ + and (canvas.map[mapPoint[1] + brushRow][mapPoint[0] + brushCol][1] == brushColours[1]): + patch = [mapPoint[0] + brushCol, mapPoint[1] + brushRow, canvas.map[mapPoint[1] + brushRow][mapPoint[0] + brushCol][0], brushColours[0], *canvas.map[mapPoint[1] + brushRow][mapPoint[0] + brushCol][2:]] if not dirty: dirty = True dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch); else: + patch = [mapPoint[0] + brushCol, mapPoint[1] + brushRow, brushColours[1], brushColours[1], 0, " "] dispatchFn(eventDc, True, patch) return True, dirty