home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-12 | 1.8 KB | 78 lines | [TEXT/CWIE] |
- /*
- CDeleteEntryAction.cp
-
- Copyright © 1995 Alastair Rankine.
- All Rights Reserved.
- */
-
- #include "CDeleteEntryAction.h"
- #include "CLookupDocument.h"
- #include "CEntryList.h"
- #include "ResourceIDs.h"
-
- #include <UAEGizmos.h>
-
- // ------------------------------------------------------------
- // CLASS CDeleteEntryAction
-
-
- CDeleteEntryAction::CDeleteEntryAction(CLookupDocument & inDocument, UInt16 inRow)
- : LAEAction(STRx_RedoEdit, str_RedoDelete)
- {
- const CEntry & theEntry = inDocument.GetEntryAt(inRow);
-
- LAEStream redo(kAECoreSuite, kAEDelete);
-
- // keyDirectObject - The record to delete
- redo.WriteKey(keyDirectObject);
- redo.WriteSpecifier(&theEntry);
-
- // Close the stream, and assign the AE to the Redo event.
- StAEDescriptor redoEvent;
- redo.Close(&redoEvent.mDesc);
- SetRedoAE(redoEvent.mDesc);
-
- LAEStream undo(kAECoreSuite, kAECreateElement);
-
- // keyAEObjectClass - Create a CEntry
- undo.WriteKey(keyAEObjectClass);
- undo.WriteTypeDesc(CEntry::kModelID);
-
- undo.WriteKey(keyAEInsertHere);
- undo.OpenRecord(typeInsertionLoc);
- // Is there a record before this one?
- if(!inRow)
- {
- // No, insert at the beginning...
- undo.WriteKey(keyAEObject);
- undo.WriteSpecifier(&inDocument);
- undo.WriteKey(keyAEPosition);
- undo.WriteEnumDesc(kAEBeginning);
- }
- else
- {
- // Yes, insert after it:
- undo.WriteKey(keyAEObject);
- undo.WriteSpecifier(inDocument.GetEntryPtrAt(inRow - 1));
- undo.WriteKey(keyAEPosition);
- undo.WriteEnumDesc(kAEAfter);
- }
- undo.CloseRecord();
-
- // keyAEPropData - Copy the properties from inEntry
- StAEDescriptor objProps;
- theEntry.GetDifferentAEProperties(sEmptyEntry, objProps.mDesc);
- undo.WriteKeyDesc(keyAEPropData, objProps.mDesc);
-
- // Close the stream, and assign the AE to the Redo event.
- StAEDescriptor undoEvent;
- undo.Close(&undoEvent.mDesc);
- SetUndoAE(undoEvent.mDesc);
- }
-
-
-
-
-
-
-