notetrck.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2006 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 // FILE:        notetrck.h
00012 // DESCRIPTION: Note track plug-in class
00013 // AUTHOR:      Rolf Berteig
00014 // HISTORY:     created July 20, 1995
00015 //**************************************************************************/
00016 #pragma once
00017 #include "maxheap.h"
00018 #include "ref.h"
00019 #include "plugapi.h"
00020 #include "AnimPropertyID.h"
00021 #include "TrackClipObject.h"
00022 
00023 class NoteTrack : public ReferenceTarget {
00024     public:
00025         SClass_ID SuperClassID() {return SClass_ID(NOTETRACK_CLASS_ID);}
00026         RefResult AutoDelete() {return REF_SUCCEED;}
00027     };
00028 
00029 class NoteAnimProperty : public AnimProperty {
00030     public:     
00031         NoteTrack *note;
00032         DWORD ID() {return PROPID_NOTETRACK;}
00033 
00034         NoteAnimProperty(NoteTrack *n=NULL) {note = n;}
00035         ~NoteAnimProperty() {if (note) note->DeleteMe();}
00036     };
00037 
00038 
00041 CoreExport NoteTrack *NewDefaultNoteTrack();
00042 
00043 
00044 
00045 
00046 // Standard note track plug-in class definitions:
00047 
00048 // Note Key Flags
00049 #define NOTEKEY_SELECTED    (1<<0)
00050 #define NOTEKEY_LOCKED      (1<<1)
00051 #define NOTEKEY_FLAGGED     (1<<2)
00052 
00070 class NoteKey: public MaxHeapOperators {
00071     public:
00072         TimeValue time;
00073         MSTR note;
00074         DWORD flags;
00075         
00078         NoteKey(TimeValue t,const MSTR &n,DWORD f=0) {time=t;note=n;flags=f;}
00081         NoteKey(NoteKey& n) {time=n.time;note=n.note;flags=n.flags;}
00082 
00087         void SetFlag(DWORD mask) { flags|=(mask); }
00092         void ClearFlag(DWORD mask) { flags &= ~(mask); }
00098         BOOL TestFlag(DWORD mask) { return(flags&(mask)?1:0); }
00099     };
00100 
00106 class NoteKeyTab : public Tab<NoteKey*> {
00107     public:
00109         ~NoteKeyTab() {Clear();}
00111         CoreExport void Clear();
00116         CoreExport void DelKey(int i);
00121         CoreExport NoteKeyTab &operator=(NoteKeyTab &keys);
00125         CoreExport void KeysChanged();
00126     };
00127 
00128 class NoteKeyClipObject : public TrackClipObject {
00129     public:
00130         NoteKeyTab tab;
00131 
00132         Class_ID ClassID() {return Class_ID(NOTETRACK_CLASS_ID,0);}
00133         SClass_ID SuperClassID() { return NOTETRACK_CLASS_ID; }
00134         CoreExport void DeleteThis();
00135 
00136         NoteKeyClipObject(Interval iv) : TrackClipObject(iv) {}
00137     };
00138 
00147 class DefNoteTrack : public NoteTrack {
00148     public:
00149         NoteKeyTab keys;
00150         
00151         DefNoteTrack() {}
00152         DefNoteTrack(DefNoteTrack &n) {keys=n.keys;}
00153         DefNoteTrack& operator=(DefNoteTrack &track) {keys=track.keys;return *this;}
00154         CoreExport void HoldTrack();
00155 
00156         Class_ID ClassID() {return Class_ID(NOTETRACK_CLASS_ID,0);}
00157 
00158         // Tree view methods from animatable
00159         int NumKeys() {return keys.Count();}
00160         TimeValue GetKeyTime(int index) {return keys[index]->time;}
00161         CoreExport void MapKeys(TimeMap *map,DWORD flags );
00162         CoreExport void DeleteKeys( DWORD flags );
00163         CoreExport void CloneSelectedKeys(BOOL offset);     
00164         CoreExport void DeleteTime( Interval iv, DWORD flags );
00165         CoreExport void ReverseTime( Interval iv, DWORD flags );
00166         CoreExport void ScaleTime( Interval iv, float s);
00167         CoreExport void InsertTime( TimeValue ins, TimeValue amount );
00168         CoreExport void AddNewKey(TimeValue t,DWORD flags);
00169         CoreExport int GetSelKeyCoords(TimeValue &t, float &val,DWORD flags);
00170         CoreExport void SetSelKeyCoords(TimeValue t, float val,DWORD flags);
00171         #pragma warning(push)
00172         #pragma warning(disable:4100)
00173         CoreExport int GetTrackVSpace( int lineHeight ) {return 1;}
00174         CoreExport BOOL CanCopyTrack(Interval iv,DWORD flags) {return 1;}
00175         CoreExport BOOL CanPasteTrack(TrackClipObject *cobj,Interval iv,DWORD flags) {return cobj->ClassID()==ClassID();}
00176         CoreExport TrackClipObject *CopyTrack(Interval iv,DWORD flags);
00177         CoreExport void PasteTrack(TrackClipObject *cobj,Interval iv,DWORD flags);
00178         CoreExport Interval GetTimeRange(DWORD flags) ;     
00179         CoreExport int HitTestTrack(TrackHitTab& hits,Rect& rcHit,Rect& rcTrack,float zoom,int scroll,DWORD flags );
00180         CoreExport int PaintTrack(ParamDimensionBase *dim,HDC hdc,Rect& rcTrack,Rect& rcPaint,float zoom,int scroll,DWORD flags );
00181         CoreExport void SelectKeys( TrackHitTab& sel, DWORD flags );
00182         CoreExport void SelectKeyByIndex(int i,BOOL sel);
00183         CoreExport int NumSelKeys();
00184         CoreExport void FlagKey(TrackHitRecord hit);
00185         CoreExport int GetFlagKeyIndex();       
00186         CoreExport BOOL IsAnimated() {return TRUE;}
00187         CoreExport void EditTrackParams(TimeValue t,ParamDimensionBase *dim,MCHAR *pname,HWND hParent,IObjParam *ip,DWORD flags);
00188         CoreExport int TrackParamsType() {return TRACKPARAMS_KEY;}
00189         CoreExport BOOL SupportTimeOperations() {return TRUE;}
00190 
00191         CoreExport IOResult Save(ISave *isave);
00192         CoreExport IOResult Load(ILoad *iload);
00193 
00194         CoreExport void DeleteThis();
00195         RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
00196              PartID& partID, RefMessage message) {return REF_SUCCEED;}
00197         #pragma warning(pop)
00198         CoreExport RefTargetHandle Clone(RemapDir &remap);
00199     };
00200 
00201 
00202