home *** CD-ROM | disk | FTP | other *** search
- /*
- File: DraftWn.h
-
- Contains: definition of the DraftWin and DraftInfoRec classes
-
- Owned by: Eric House
-
- Copyright: © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <18> 9/8/95 TÇ 1252120 FB1: New documents saved w/ StdFile
- & trashed if closed w/o saving
- <17> 9/7/95 EL 1281410: Extra session parameter in
- DeleteSelectedDraft so it can open and
- close draft and rename windows.
- <16> 8/29/95 TJ The Method for ~DummyDraftInfoRec is only
- defined in debug builds. Set the Class
- definition to match it.
- <15> 8/25/95 eeh 1230007: cleanup
- <14> 8/25/95 eeh 1230007: dummy recs etc. (incomplete)
- <13> 8/16/95 eeh 1248265: add fReadyToClose
- <12> 7/18/95 eeh 1222282 (partial): new param to MakeAList
- <11> 5/18/95 eeh 1236414: add hasWriteAccess param to
- Drafts()
- <10> 5/10/95 eeh 1239830 : add kDraftWinLowMemAbort;
- 1215536: add DraftSaved and get/setters for
- DraftWindow fields
- <9> 5/4/95 eeh 1232095: add DeleteSelectedDraft
- <8> 4/14/95 TÇ #1235279 BB: InfoUtil & StdTypIO functions
- should take Environment* and SU* when
- possible
- <7> 4/10/95 EL 1215536: extra parameter in
- InitDraftInfoRec so we can get the next
- draft property.
- <6> 3/24/95 eeh 1229961, 1215528: change callbacks to use
- IText*
- <5> 3/15/95 eeh 1193824: added fListH, fListRect, and
- fCreateSet
- <4> 12/19/94 eeh 1192626: change params to MakeAList and
- Drafts
- <3> 8/29/94 TÇ #1183567 StdTypIO routine implementation &
- fixup
- <2> 6/27/94 TÇ added fEV to DraftWindow and
- DraftInfoRec
- <1> 6/27/94 TÇ first checked in
- <0> 6/27/94 SV SOMverted
- <10> 5/3/94 eeh bug #1155857: param changes to MakeAList
- and GetUserStrings
- <9> 3/31/94 eeh bug #1153999: made fModifiedBy a ODIText*
- <8> 2/8/94 JA Minor tweaks for CodeWarrior.
- <7> 1/25/94 NP TÇ: implemented
- <6> 1/14/94 TÇ added some skeleton code from HI
- <5> 1/13/94 TÇ reworked apis for latest round of HI
- changes
- <4> 8/24/93 TÇ removed code made obsolete by HI Changes
- <3> 8/18/93 TÇ removed SetPreviousComment support
- <2> 8/11/93 TÇ move property & type constants to StdProps
- and StdTypes
- <1> 7/14/93 TÇ first checked in
-
- To Do:
- */
-
- #ifndef _DRAFTWN_
- #define _DRAFTWN_
-
- #ifndef _PLFMDEF_
- #include "PlfmDef.h"
- #endif
-
- #ifndef SOM_ODDraft_xh
- #include <Draft.xh>
- #endif
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __LISTS__
- #include <Lists.h>
- #endif
-
- //==============================================================================
- // Constants
- //==============================================================================
-
- #define kDraftWinNone 0
- #define kDraftWinOpen 1
- #define kDraftWinDone 2
- #define kDraftWinCreate 3
- #define kDraftWinDelete 4
- #define kDraftWinLowMemAbort 5
-
- //==============================================================================
- // Scalar Types
- //==============================================================================
-
- typedef ODULong DraftWinAction;
- struct DWStringsArray ;
-
- enum DraftInfoRecType { kDIRTypeUnknown, kDIRTypeFull, kDIRTypeDummy };
-
- //==============================================================================
- // Classes defined in this interface
- //==============================================================================
-
- class DraftWindow; // very platform dependent
- class DraftInfoRec;
- class DummyDraftInfoRec;
- class FullDraftInfoRec;
-
- //==============================================================================
- // Classes used by this interface
- //==============================================================================
-
- class DraftInfoRec
- {
- public:
- DraftInfoRec();
- ODVMethod ~DraftInfoRec();
-
- ODMethod DraftInfoRecType GetDIRType() { return fDIRType; }
-
- // I really don't need First() anymore.
- // ODMethod DraftInfoRec* First() { return fFirst; }
- ODMethod DraftInfoRec* Next() { return fNext; }
- ODMethod void SetNext(DraftInfoRec* next)
- {fNext = next; }
- ODMethod ODBoolean ShouldHilite() { return fShouldHilite; }
- ODMethod void SetShouldHilite( ODBoolean should )
- { fShouldHilite = should ; }
-
- ODMethod ODIText* GetComment() { return fComment; }
- ODMethod void SetComment( ODIText* comment) { fComment = comment; }
-
- protected:
- ODMethod void SetDIRType(DraftInfoRecType typ)
- { fDIRType = typ; }
-
- private:
- DraftInfoRecType fDIRType;
- DraftInfoRec* fNext;
- // DraftInfoRec* fFirst;
- ODBoolean fShouldHilite;
- ODIText* fComment;
- };
-
- class DummyDraftInfoRec : public DraftInfoRec
- {
- public:
- DummyDraftInfoRec();
- #if ODDebug
- ODVMethod ~DummyDraftInfoRec();
- #endif
- ODMethod void SetCommentOwner( FullDraftInfoRec* owner)
- { fCommentOwner = owner; }
- ODMethod FullDraftInfoRec* GetCommentOwner()
- { return fCommentOwner; }
-
- private:
- FullDraftInfoRec* fCommentOwner;
- };
-
- class FullDraftInfoRec : public DraftInfoRec
- {
- public:
-
- FullDraftInfoRec();
- ODNVMethod void InitDraftInfoRec(Environment* ev, ODDraft* draft);
- // note: draft reference is consumed in Init and released in destructor
- ODVMethod ~FullDraftInfoRec();
-
- ODMethod ODULong Number() { return fDraftNumber; }
- ODMethod void SetNumber(ODULong num)
- { fDraftNumber = num; }
- ODMethod ODDraft* Draft() { return fDraft; }
-
- ODMethod ODIText* GetNumberString() {return fDraftNumberString;}
- ODMethod void SetNumberString(ODIText* str)
- {fDraftNumberString = str;}
- ODMethod ODIText* GetCreated() {return fSavedString;}
- ODMethod ODIText* GetModifiedBy() {return fModifiedBy;}
-
- ODMethod ODBoolean IsExpanded() { return fCachedComment != kODNULL;}
-
- ODMethod void CacheComment()
- { fCachedComment = GetComment(); SetComment(kODNULL); }
- ODMethod void UncacheComment()
- { SetComment(fCachedComment); fCachedComment = kODNULL; }
- #if ODDebug
- ODMethod ODIText* GetCachedComment() { return fCachedComment; }
- #endif
-
- ODMethod ODBoolean CanExpand() { return fCanExpand; }
- // The only thing to set this to is true.
- ODMethod void SetCanExpand() { fCanExpand = kODTrue; }
-
- private:
- ODDraft* fDraft;
- ODStorageUnit* fDraftProperties;
- ODDraftID fDraftID;
- ODULong fDraftNumber;
- ODIText* fDraftNumberString;
- ODULong fSaved;
- ODIText* fSavedString;
- ODIText* fCachedComment; // null unless expanded
- ODIText* fModifiedBy;
- ODBoolean fCanExpand; // the comment is too long and may be expanded
- };
-
-
- //==============================================================================
- // DraftWindow
- //==============================================================================
-
- class DraftWindow
- {
- public:
-
- DraftWindow();
- ODNVMethod void InitDraftWindow(Environment* ev, ODDraft* draft);
- ODVMethod ~DraftWindow();
-
- ODMethod DraftWinAction Drafts(Environment* ev, ODDraft* draft,
- DraftWinAction prevAction, ODBoolean hasWriteAccess);
- ODMethod FullDraftInfoRec* InternalizeHistory(Environment* ev);
- ODMethod ODDraft* GetSelectedDraft() {return fSelectedDraft;}
-
- //ODMethod void DraftCreated(Environment* ev, ODDraft* draft);
- ODMethod void DraftSaved(Environment* ev, ODDraft* draft);
- // used to set the Draft Properties
- // can be used independently of other methods including initialize
-
-
- ODMethod ODSShort CountDrafts() ;
- ODMethod ListHandle GetListHandle() {return fListH;}
- ODMethod ODBoolean CreateIsSet() {return fCreateSet;}
- ODMethod void SetReadyToClose(ODBoolean readyToClose)
- { fReadyToClose = readyToClose; }
- ODMethod ODBoolean ReadyToClose()
- { return fReadyToClose; }
- ODMethod void GetListRect(Rect* r) {*r = fListRect;}
- ODMethod void DeleteSelectedDraft(Environment* ev, ODSession* session);
-
- ODMethod void SetHilite( DraftInfoRec* from, short whichRow );
- ODMethod ODBoolean ProcessMousedownInList( DialogPtr dialog,
- ListHandle listH, Point mpt );
-
- protected:
- ODMethod ODBoolean CreateDraft(Environment* ev);
- ODMethod ODBoolean RemoveSelectedDrafts(Environment* ev);
- ODMethod void Print();
-
- ODMethod ListHandle MakeAList( DialogPtr dlg, ODSShort* numLines,
- long refcon );
-
- #if ODDebug
- ODMethod void CheckConsistency();
- #endif
- private:
- ODDraft* fDraft;
- ODDocument* fDocument;
- FullDraftInfoRec* fDraftInfo;
- ODDraft* fSelectedDraft;
- ODULong fSelectedDraftNumber;
- ListHandle fListH;
- Rect fListRect;
- ODBoolean fCreateSet;
- FullDraftInfoRec* fHilitedRow;
- ODBoolean fReadyToClose;
- };
-
- #endif // _DRAFTWIN_
-