diff --git a/assets/text/TODO b/assets/text/TODO index 8887710..2d59c18 100644 --- a/assets/text/TODO +++ b/assets/text/TODO @@ -25,6 +25,6 @@ High-priority list: a) new canvas/startup b) place rect c) move mouse d) undo status changes a) text tool b) paste text c) undo 2) add hotkeys.txt mIRC art canvas to help menu -2) tools: erase, pick, unicode block elements +3) tools: erase, pick, unicode block elements vim:ff=dos tw=0 diff --git a/assets/text/hotkeys.txt b/assets/text/hotkeys.txt index 67b47e9..11c2899 100644 --- a/assets/text/hotkeys.txt +++ b/assets/text/hotkeys.txt @@ -1,15 +1,15 @@ - 0-9, 0-5, 6 Set foreground colour to #0-9, #10-15, transparent colour, resp. - 0-9, 0-5, 6 Set background colour to #0-9, #10-15, transparent colour, resp. - C U F L R E T Switch to circle, cursor, fill, line, rectangle, object, text tool - I Flip colours - N New canvas - O Open mIRC art file - S Save canvas as mIRC art file - X Exit - Y, Z Redo, undo, resp. - Break into Python debugger -(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 -(Fill tool) , Fill entire region ignoring character cells -(Object tool) Move selection instead of cloning \ No newline at end of file + 0-9, 0-5, 6 Set foreground colour to #0-9, #10-15, transparent colour, resp. + 0-9, 0-5, 6 Set background colour to #0-9, #10-15, transparent colour, resp. + C, U, F, L, R, E, T Switch to circle, cursor, fill, line, rectangle, object, text tool + I Flip colours + N New canvas + O Open mIRC art file + S Save canvas as mIRC art file + X Exit + Y, Z Redo, undo, resp. + Break into Python debugger +(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 +(Fill tool) , Fill entire region ignoring character cells +(Object tool) Move selection instead of cloning diff --git a/libroar/RoarCanvasCommandsFile.py b/libroar/RoarCanvasCommandsFile.py index 4189f72..590133b 100644 --- a/libroar/RoarCanvasCommandsFile.py +++ b/libroar/RoarCanvasCommandsFile.py @@ -27,8 +27,8 @@ class RoarCanvasCommandsFile(): try: rc, error, newMap, newPathName, newSize = f(pathName) if rc: + self.parentCanvas.update(newSize, False, newMap, dirty=newDirty) self.parentCanvas.dirty = newDirty - self.parentCanvas.update(newSize, False, newMap) self.canvasPathName = newPathName self.update(dirty=self.parentCanvas.dirty, pathName=self.canvasPathName, undoLevel=-1) self.parentCanvas.canvas.journal.resetCursor() @@ -216,7 +216,8 @@ class RoarCanvasCommandsFile(): def canvasImportmIRC(pathName): rc, error = self.parentCanvas.canvas.importStore.importTextFile(pathName) return (rc, error, self.parentCanvas.canvas.importStore.outMap, pathName, self.parentCanvas.canvas.importStore.inSize) - self._import(canvasImportmIRC, False, pathName) + if self._promptSaveChanges(): + self._import(canvasImportmIRC, False, pathName) @GuiCommandDecorator("Save", "&Save", ["", wx.ART_FILE_SAVE], [wx.ACCEL_CTRL, ord("S")], None) def canvasSave(self, event, newDirty=False): diff --git a/libroar/RoarCanvasWindow.py b/libroar/RoarCanvasWindow.py index 2f8b36e..40c7096 100644 --- a/libroar/RoarCanvasWindow.py +++ b/libroar/RoarCanvasWindow.py @@ -158,7 +158,7 @@ class RoarCanvasWindow(GuiWindow): if self.canvas.dispatchPatchSingle(isCursor, patch, False if isCursor else True): self._drawPatch(eventDc, isCursor, patch) - def resize(self, newSize, commitUndo=True): + def resize(self, newSize, commitUndo=True, dirty=True): viewRect = self.GetViewStart() oldSize = [0, 0] if self.canvas.map == None else self.canvas.size deltaSize = [b - a for a, b in zip(oldSize, newSize)] @@ -176,11 +176,11 @@ class RoarCanvasWindow(GuiWindow): for numNewCol in range(newSize[0]): self._drawPatch(eventDc, False, [numNewCol, numNewRow, 1, 1, 0, " "]) eventDc.SetDeviceOrigin(*eventDcOrigin) - self.Scroll(*viewRect) - self.commands.update(size=newSize, undoLevel=self.canvas.journal.patchesUndoLevel) + self.Scroll(*viewRect); self.dirty = dirty; + self.commands.update(dirty=self.dirty, size=newSize, undoLevel=self.canvas.journal.patchesUndoLevel) - def update(self, newSize, commitUndo=True, newCanvas=None): - self.resize(newSize, commitUndo) + def update(self, newSize, commitUndo=True, newCanvas=None, dirty=True): + self.resize(newSize, commitUndo, dirty) self.canvas.update(newSize, newCanvas) eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, self.GetViewStart()) eventDcOrigin = eventDc.GetDeviceOrigin(); eventDc.SetDeviceOrigin(0, 0); diff --git a/roar.py b/roar.py index da2d23a..72e3900 100755 --- a/roar.py +++ b/roar.py @@ -27,7 +27,7 @@ def main(*argv): roarClient.canvasPanel.commands.canvasPathName = argv[0] rc, error = roarClient.canvasPanel.canvas.importStore.importTextFile(argv[0]) if rc: - roarClient.canvasPanel.update(roarClient.canvasPanel.canvas.importStore.inSize, False, roarClient.canvasPanel.canvas.importStore.outMap) + roarClient.canvasPanel.update(roarClient.canvasPanel.canvas.importStore.inSize, False, roarClient.canvasPanel.canvas.importStore.outMap, dirty=False) roarClient.canvasPanel.commands.update(pathName=argv[0], undoLevel=-1) roarClient.canvasPanel.commands._pushRecent(argv[0]) else: