Fix dirty flag updating on {new,open,resize}.

assets/text/hotkeys.txt: updated.
assets/text/TODO: updated.
This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-23 19:55:31 +02:00
parent bff70b409b
commit a48d7f3d32
5 changed files with 25 additions and 24 deletions

View File

@ -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

View File

@ -1,15 +1,15 @@
<Ctrl> 0-9, <Ctrl> <Shift> 0-5, <Ctrl> <Shift> 6 Set foreground colour to #0-9, #10-15, transparent colour, resp.
<Ctrl> <Alt> 0-9, <Ctrl> <Alt> <Shift> 0-5, <Ctrl> <Alt> <Shift> 6 Set background colour to #0-9, #10-15, transparent colour, resp.
<Ctrl> C U F L R E T Switch to circle, cursor, fill, line, rectangle, object, text tool
<Ctrl> I Flip colours
<Ctrl> N New canvas
<Ctrl> O Open mIRC art file
<Ctrl> S Save canvas as mIRC art file
<Ctrl> X Exit
<Ctrl> Y, Z Redo, undo, resp.
<Shift> <Pause> Break into Python debugger
(Canvas) <Down>, <Left>, <Right>, <Up> Move canvas cursor
(Canvas) <Left mouse button>, <Space> Apply current tool with foreground colour or initiate tool action (line and object tool)
(Canvas) <Right mouse button> Apply current tool with background colour
(Fill tool) <Ctrl> <Left mouse button>, <Right mouse button> Fill entire region ignoring character cells
(Object tool) <Ctrl> <Left mouse button> Move selection instead of cloning
<Ctrl> 0-9, <Ctrl> <Shift> 0-5, <Ctrl> <Shift> 6 Set foreground colour to #0-9, #10-15, transparent colour, resp.
<Ctrl> <Alt> 0-9, <Ctrl> <Alt> <Shift> 0-5, <Ctrl> <Alt> <Shift> 6 Set background colour to #0-9, #10-15, transparent colour, resp.
<Ctrl> C, U, F, L, R, E, T Switch to circle, cursor, fill, line, rectangle, object, text tool
<Ctrl> I Flip colours
<Ctrl> N New canvas
<Ctrl> O Open mIRC art file
<Ctrl> S Save canvas as mIRC art file
<Ctrl> X Exit
<Ctrl> Y, Z Redo, undo, resp.
<Shift> <Pause> Break into Python debugger
(Canvas) <Down>, <Left>, <Right>, <Up> Move canvas cursor
(Canvas) <Left mouse button>, <Space> Apply current tool with foreground colour or initiate tool action (line and object tool)
(Canvas) <Right mouse button> Apply current tool with background colour
(Fill tool) <Ctrl> <Left mouse button>, <Right mouse button> Fill entire region ignoring character cells
(Object tool) <Ctrl> <Left mouse button> Move selection instead of cloning

View File

@ -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):

View File

@ -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);

View File

@ -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: