home *** CD-ROM | disk | FTP | other *** search
- /*
- File: CPProcessMap.h
- Contains: CPProcessMap OpenDoc part editor class definition.
- Written by: PartMaker
-
- Change History (most recent first):
-
- <3> 4/14/95 JS Updated for Developer Release 2
- <2> 3/8/95 JS Updated to b1c13/c14
- <1> 2/2/95 RA first checked in
- <0> PartMaker source by E. Soldan, T. Çelik, J. Alfke, R. Adkins, J. Schalk
- */
-
- #ifndef _PROCESSMAP_
- #define _PROCESSMAP_
-
- //========================================================================================
- // OpenDoc Interfaces
- //========================================================================================
-
- #ifndef ODDebug
- #define ODDebug 0
- #endif
-
- #ifndef _ALTPOINT_
- #include <AltPoint.h>
- #endif
- #ifndef _EXCEPT_
- #include <Except.h>
- #endif
- #ifndef SOM_Module_OpenDoc_Global_TypesB_defined
- #include <ODTypesB.xh>
- #endif
- #ifndef _USERSRCM_
- #include <UseRsrcM.h>
- #endif
- #ifndef _INFOUTIL_
- #include <InfoUtil.h>
- #endif
- #ifndef _ITEXT_
- #include <IText.h>
- #endif
- #ifndef SOM_ODDraft_xh
- #include <Draft.xh>
- #endif
- #ifndef SOM_ODArbitrator_xh
- #include <Arbitrat.xh>
- #endif
- #ifndef SOM_ODCanvas_xh
- #include <Canvas.xh>
- #endif
- #ifndef SOM_ODPart_xh
- #include <Part.xh>
- #endif
- #ifndef SOM_ODFacet_xh
- #include <Facet.xh>
- #endif
- #ifndef SOM_ODFrame_xh
- #include <Frame.xh>
- #endif
- #ifndef SOM_ODFrameFacetIterator_xh
- #include <FrFaItr.xh>
- #endif
- #ifndef SOM_ODFoci_xh
- #include <Foci.xh>
- #endif
- #ifndef SOM_ODInfo_xh
- #include <Info.xh>
- #endif
- #ifndef SOM_ODPstObj_
- #include <PstObj.xh>
- #endif
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
- #ifndef SOM_ODStdProps_xh
- #include <StdProps.xh>
- #endif
- #ifndef SOM_ODStdTypes_xh
- #include <StdTypes.xh>
- #endif
- #ifndef SOM_ODCmdDefs_xh
- #include <CmdDefs.xh>
- #endif
- #ifndef SOM_ODStorageU_xh
- #include <StorageU.xh>
- #endif
- #ifndef SOM_ODTrnsform_xh
- #include <Trnsform.xh>
- #endif
- #ifndef SOM_ODFocusSet_xh
- #include <FocusSet.xh>
- #endif
- #ifndef SOM_ODFoci_xh
- #include <Foci.xh>
- #endif
- #ifndef SOM_ODMenuBar_xh
- #include <MenuBar.xh>
- #endif
- #ifndef SOM_ODWindow_xh
- #include <Window.xh>
- #endif
- #ifndef SOM_ODWinStat_xh
- #include <WinStat.xh>
- #endif
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
- #ifndef _STDDEFS_
- #include <StdDefs.xh>
- #endif
- #ifndef _PLFMDEF_
- #include <PlfmDef.h>
- #endif
- #ifndef _PASCLSTR_
- #include <PasclStr.h>
- #endif
- #ifndef _FOCUSLIB_
- #include <FocusLib.h>
- #endif
- #ifndef _STDTYPIO_
- #include <StdTypIO.h>
- #endif
- #ifndef _STORUTIL_
- #include <StorUtil.h>
- #endif
- #ifndef _ODMEMORY_
- #include "ODMemory.h"
- #endif
- #ifndef _WINUTILS_
- #include <WinUtils.h>
- #endif
- #ifndef _POUTILS_
- #include <POUtils.h>
- #endif
- #ifndef _ISOSTR_
- #include <ISOStr.h>
- #endif
- #ifndef _BNDNSUTL_
- #include <BndNSUtl.h>
- #endif
- #ifndef SOM_ODObjectNameSpace_xh
- #include "ObjectNS.xh"
- #endif
- #ifndef SOM_ODBaseNameSpaceManager_xh
- #include <NmSpcMgB.xh>
- #endif
- #ifndef SOM_ODValueNameSpace_xh
- #include "ValueNS.xh"
- #endif
- #ifndef SOM_ODNameSpaceManager_xh
- #include <NmSpcMg.xh>
- #endif
-
- #ifndef SOM_ODDispatcher_xh
- #include <Disptch.xh>
- #endif
-
- //========================================================================================
- // ProcessMap Interfaces
- //========================================================================================
-
- #ifndef _PROCESSMAPDEF_
- #include "ProcessMapDef.h"
- #endif
- #ifndef _PARTUTILS_
- #include "PartUtils.h"
- #endif
- #ifndef _FRAMELIST_
- #include "FrameList.h"
- #endif
-
- //========================================================================================
- // Macintosh ToolBox Interfaces
- //========================================================================================
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
- #ifndef __RESOURCES__
- #include <Resources.h>
- #endif
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- //========================================================================================
- // Miscellaneous
- //========================================================================================
-
- #ifndef qTraceEnteringMethods
- #define qTraceEnteringMethods 1
- #endif
-
- #if qTraceEnteringMethods
- #define EnteringMethod(s) {if (AreTraceKeysDown()) DebugStr((StringPtr)s);}
- #else
- #define EnteringMethod(s)
- #endif
-
- #ifdef applec
- #pragma segment ProcessMap
- #endif
-
- //========================================================================================
- // Constants
- //========================================================================================
-
- const short kContentStringResID = 5000;
- const short kContentStringID = 1;
- const short kAboutTextID = 2;
-
- //========================================================================================
- // Forward declarations
- //========================================================================================
-
- class ODFocusSet;
- class ODMenuBar;
- class ODSession;
- class ODWindow;
- class ODFrame;
- class ODFacet;
- class ODShape;
- class ODStorageUnit;
- class ODStorageUnitView;
- class ODEmbeddedFramesIterator;
- class ODLink;
- class ODLinkSource;
- class ODTypeList;
- class ODPart;
- class ODDragItemIterator;
- class ODCanvas;
- class ODExtension;
- class ODObjectSpec;
-
- //========================================================================================
- // CPProcessMap
- //========================================================================================
- class CMyProcess
- {
- public:
- CMyProcess(){pName = new char[63];}
- ~CMyProcess(){delete []pName;}
- Boolean IsSameOne(CMyProcess& theProcess)
- {
- Boolean f=true;
- if(lStartAddress != theProcess.lStartAddress) f=false;
- if(lEndAddress != theProcess.lEndAddress) f=false;
- if(thePSN.highLongOfPSN!= theProcess.thePSN.highLongOfPSN) f=false;
- if(thePSN.lowLongOfPSN != theProcess.thePSN.lowLongOfPSN) f=false;
-
- return f;
- };
- CMyProcess& operator=(CMyProcess& theProcess)
- {
- BlockMoveData(theProcess.pName, this->pName, theProcess.pName[0]+1);
- this->lStartAddress = theProcess.lStartAddress;
- this->lEndAddress = theProcess.lEndAddress;
- this->thePSN = theProcess.thePSN;
- return *this;
- };
-
- long lStartAddress;
- long lEndAddress;
- ProcessSerialNumber thePSN;
- char* pName;
- };
-
- class CPProcessMap
- {
- public:
- // Constructor, Destructor (CPProcessMap.cpp) =========================================
- CPProcessMap();
- ~CPProcessMap();
-
- // ODRefCntObject, ODPersistentObject, Memory Management (CPProcessMap.cpp) ===========
- void IncrementRefCount (Environment* ev);
- void Release (Environment* ev);
- void CloneInto (Environment* ev, ODDraftKey key,
- ODStorageUnit* toSU, ODFrame* scope);
- ODSize Purge (Environment* ev, ODSize size);
-
- // Internalize/Externalize (CPProcessMap.InEx.cpp) ====================================
- void InitPart (Environment* ev, ODStorageUnit* su, ODPart* self);
- void InitPartFromStorage (Environment* ev, ODStorageUnit* so, ODPart* self);
- void PrivInternalizeStateInfo(Environment* ev, ODStorageUnit* storageUnit);
- void PrivInternalizeContent (Environment* ev, ODStorageUnit* storageUnit);
- void Externalize (Environment* ev);
- void PrivCheckAndAddProperties (Environment* ev, ODStorageUnit* storageUnit);
- void PrivCleanContentProperty (Environment* ev, ODStorageUnit* storageUnit);
- void PrivExternalizeStateInfo (Environment* ev, ODStorageUnit* storageUnit,
- ODDraftKey key, ODFrame* scopeFrame);
- void PrivExternalizeContent (Environment* ev, ODStorageUnit* storageUnit);
- void ReleaseAll (Environment* ev);
-
- // Imaging (CPProcessMap.Image.cpp) ===================================================
- void Draw (Environment* ev, ODFacet* facet, ODShape* invalidShape);
- void FacetAdded (Environment* ev, ODFacet* facet);
- void FacetRemoved (Environment* ev, ODFacet* facet);
- void GeometryChanged (Environment* ev, ODFacet* facet,
- ODBoolean clipShapeChanged,
- ODBoolean externalTransformChanged);
- void CanvasUpdated (Environment* ev, ODCanvas* canvas);
- void CanvasChanged (Environment* ev, ODFacet* facet);
- void HighlightChanged (Environment* ev, ODFacet* facet);
- ODULong GetPrintResolution (Environment* ev, ODFrame* frame);
-
- // Part Activation (CPProcessMap.Focus.cpp) ===========================================
- ODBoolean BeginRelinquishFocus (Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame, ODFrame* proposedFrame);
- void CommitRelinquishFocus (Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame, ODFrame* proposedFrame);
- void AbortRelinquishFocus (Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame, ODFrame* proposedFrame);
- void FocusAcquired (Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame);
- void FocusLost (Environment* ev, ODTypeToken focus,
- ODFrame* ownerFrame);
-
- // Binding (CPProcessMap.Bind.cpp) ====================================================
- void ExternalizeKinds (Environment* ev, ODTypeList* kindList);
- void ChangeKind (Environment* ev, ODType kind);
-
- // UI Events (CPProcessMap.Event.cpp) =================================================
- ODBoolean HandleEvent (Environment* ev, ODEventData* event, ODFrame* frame,
- ODFacet* facet, ODEventInfo* eventInfo);
- void AdjustMenus (Environment* ev, ODFrame* frame);
-
- // ODObject (CPProcessMap.Ext.cpp) ====================================================
- ODBoolean HasExtension (Environment* ev, ODType extensionName);
- ODExtension*GetExtension (Environment* ev, ODType extensionName);
- void ReleaseExtension (Environment* ev, ODExtension* extension);
-
- // Layout (CPProcessMap.Frame.cpp) ====================================================
- void DisplayFrameAdded (Environment* ev, ODFrame* frame);
- void DisplayFrameRemoved (Environment* ev, ODFrame* frame);
- void DisplayFrameConnected (Environment* ev, ODFrame* frame);
- void DisplayFrameClosed (Environment* ev, ODFrame* frame);
- void AttachSourceFrame (Environment* ev, ODFrame* frame,
- ODFrame* sourceFrame);
- void FrameShapeChanged (Environment* ev, ODFrame* frame);
- void ViewTypeChanged (Environment* ev, ODFrame* frame);
- void PresentationChanged (Environment* ev, ODFrame* frame);
- void SequenceChanged (Environment* ev, ODFrame* frame);
- ODInfoType ReadPartInfo (Environment* ev, ODFrame* frame,
- ODStorageUnitView* suView);
- void WritePartInfo (Environment* ev, ODInfoType partInfo,
- ODStorageUnitView* suView);
- void ClonePartInfo (Environment *ev, ODDraftKey key,
- ODInfoType partInfo,
- ODStorageUnitView* suView,
- ODFrame* scopeFrame);
- ODID Open (Environment* ev, ODFrame* frame);
-
- // Undo (CPProcessMap.Undo.cpp) =======================================================
- void UndoAction (Environment* ev, ODActionData* actionState);
- void RedoAction (Environment* ev, ODActionData* actionState);
- void DisposeActionState (Environment* ev, ODActionData* actionState,
- ODDoneState doneState);
- void WriteActionState (Environment* ev, ODActionData* actionState,
- ODStorageUnitView* suView);
- ODActionData ReadActionState (Environment* ev, ODStorageUnitView* suView);
-
- // DragAndDrop (CPProcessMap.DD.cpp) ==================================================
- void FulfillPromise (Environment* ev, ODStorageUnitView *promiseSUView);
- void DropCompleted (Environment* ev, ODPart* destPart,
- ODDropResult dropResult);
- ODDragResult DragEnter (Environment* ev, ODDragItemIterator* dragInfo,
- ODFacet* facet, ODPoint* where);
- ODDragResult DragWithin (Environment* ev, ODDragItemIterator* dragInfo,
- ODFacet* facet, ODPoint* where);
- void DragLeave (Environment* ev, ODFacet* facet, ODPoint* where);
- ODDropResult Drop (Environment* ev, ODDragItemIterator* dropInfo,
- ODFacet* facet, ODPoint* where);
-
- // Linking (CPProcessMap.Link.cpp) ====================================================
- ODLinkSource* CreateLink (Environment* ev, ODByteArray* data);
- void RevealLink (Environment* ev, ODLinkSource* linkSource);
- void LinkUpdated (Environment* ev, ODLink* updatedLink, ODChangeID id);
-
- void EmbeddedFrameChanged (Environment* ev, ODFrame* frame, ODChangeID change);
- void LinkStatusChanged (Environment* ev, ODFrame* frame);
-
- // Embedding (CPProcessMap.Embed.cpp) =================================================
- ODFrame* RequestEmbeddedFrame (Environment* ev, ODFrame* containingFrame,
- ODFrame* baseFrame,
- ODShape* frameShape, ODPart* embedPart,
- ODTypeToken viewType, ODTypeToken presentation,
- ODBoolean isOverlaid);
- void RemoveEmbeddedFrame (Environment* ev, ODFrame* embeddedFrame);
- ODShape* RequestFrameShape (Environment* ev, ODFrame* embeddedFrame,
- ODShape* frameShape);
- void UsedShapeChanged (Environment* ev, ODFrame* embeddedFrame);
- ODShape* AdjustBorderShape (Environment* ev, ODFacet* embeddedFacet,
- ODShape* shape);
- void ContainingPartPropertiesChanged
- (Environment* ev, ODFrame* frame,
- ODStorageUnit* propertyUnit);
- ODStorageUnit* GetContainingPartProperties
- (Environment* ev, ODFrame* frame);
- ODBoolean RevealFrame (Environment* ev, ODFrame* embeddedFrame,
- ODShape* revealShape);
- void EmbeddedFrameSpec (Environment* ev, ODFrame* embeddedFrame,
- ODObjectSpec* spec);
- ODEmbeddedFramesIterator*
- CreateEmbeddedFramesIterator
- (Environment* ev, ODFrame* frame);
-
-
- //====================================================================================
- public: // CPProcessMap - implementation-specific methods:
-
- void PrivInitProcessMap (Environment* ev, ODStorageUnit* su, ODPart* self);
- void PrivSetDirty (Environment* ev);
- ODBoolean PrivGetDirty (Environment* ev) {return fDirty;}
-
- ODWindow* PrivCreateWindow (Environment *ev, ODFrame* sourceFrame);
- ODID PrivOpenInitialWindow (Environment *ev);
- ODID PrivOpenSavedWindow (Environment *ev, ODFrame* frame);
- ODBoolean PrivWantResizableWindow (void);
-
- ODBoolean PrivHandleMenuEvent (Environment* ev, ODFrame* frame, ODEventData* event);
- ODBoolean PrivHandleMouseDown (Environment* ev, ODEventData* event,
- ODFrame* frame, ODFacet* facet);
- ODBoolean PrivUsedShapeHandleMouseDown
- (Environment* ev, ODEventData* event,
- ODFrame* frame, ODFacet* facet);
-
- void PrivInvalAllDisplayFrames (Environment* ev);
- ODShape* PrivGetFrameShape (Environment* ev, ODFrame* frame);
- ODShape* PrivGetUsedShape (Environment* ev, ODFrame* frame);
- void PrivAdjustFacets (Environment* ev, ODFrame* frame);
-
- //====================================================================================
- private: // CPProcessMap - implementation-specific fields:
-
- ODSession* fSession; // Reference to session object
- ODPart* fSelf; // Passed into InitPart and InitPartFromStorage.
- ODStorageUnit* fStorageUnit; // Storage Unit for this Part
- ODBoolean fReadOnlyStorage; // SU is froma locked document or draft
- FrameList fDisplayFrames; // List of all my display frames
- ODDraftKey fDraftKey; // For cloning purposes only
-
- Boolean fDirty; // Document dirty or not
- ODID fWindowID; // Window ID if Show As Window
-
- ODFocusSet* fFocusSet; // Foci this part wants/has
- ODTypeToken fSelectionFocus; // Selection Focus
- ODTypeToken fMenuFocus; // Menu Focus
- ODTypeToken fKeyFocus; // Keyboard Focus
- ODTypeToken fModalFocus; // Modal Focus
-
- ODMenuBar* fMenuBar; // Menu bar
- MenuHandle fMenu; // Handle to my one (so far) menu
-
- Str255 fTextData; // Data that get Internalized/Externalized
-
- long lLogicalSize;
- long lPhysicalSize;
- long lSystemHeap;
- long lAboveBufPtr;
-
- long lLastTick;
-
- short sNumOfProcess;
- #define MAX_PROCESS 20
- CMyProcess* aProcesses;
-
- Boolean fHorizontal;
- Rect rctBar;
- short sSysFontHeight;
- short sSysFontLeading;
- char PrevName[32];
-
- void DrawProcessMap(Environment* ev, ODFacet* facet);
- void DrawProcessName(StringPtr p, long from, long to);
- Boolean RefreshProcessMap(void);
- };
-
- #endif
-