Code I property pMember -- Bitmap member used for canvas property pRect -- rect of altered area property pBefore -- image of altered rect before -- alteration property pAfter -- image of altered rect after alteration on new(me, aDataList) ------------------------------------ -- INPUT: must be a property list with the -- structure: -- [#member: , -- #rect: , -- #before: , -- #after: ] -- ACTION: Stores a pointer to the member whose image is -- altered, along with the rect of the dirtied -- area and the image of that rect before and -- after the change -- OUTPUT: Returns a pointer to this instance -------------------------------------------------------- pMember = aDataList.member pRect = aDataList.rect pBefore = aDataList.before pAfter = aDataList.after return me end new Code II property pColor on Paint_SetBrushColor(me, aColor) if pColor = aColor then -- The color has not changed exit end if pColor = aColor sprite(me.spriteNum).color = pColor end Paint_SetBrushColor Code III on Paint_SetBrushColor(me, aColor, isUndo) if pColor = aColor then exit end if -- Add your lines here if not isUndo then tUndoData = [:] tUndoData[#before] = pColor tUndoData[#after] = aColor UndoAction("Select Color Undo", tUndoData) end if pColor = aColor sprite(me.spriteNum).color = pColor end Paint_ShowBrushColor Code IV property pBefore -- color before alteration property pAfter -- color after alteration on new(me, aDataList) ------------------------------------ -- INPUT: must be a property list with the -- structure: -- [#before: , -- #after: ] -- ACTION: stores the color before and after the color -- change -- OUTPUT: a pointer to this instance -------------------------------------------------------- pBefore = aDataList.before pAfter = aDataList.after return me end new on undo(me) ---------------------------------------------- -- SENT BY the mDo() handler of the Undo Step instance -- that this instance is the ancestor of -- ACTION: restores the brush to its original color -------------------------------------------------------- isUndo = TRUE sendAllSprites(#Paint_SetBrushColor, pBefore, isUndo) end undo on redo(me) ---------------------------------------------- -- SENT BY the mDo() handler of the Undo Step instance -- that this instance is the ancestor of -- ACTION: re-adopts the altered brush color -------------------------------------------------------- isUndo = TRUE sendAllSprites(#Paint_SetBrushColor, pAfter, isUndo) end redo