objmode.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *<
00003     FILE: objmode.h
00004 
00005     DESCRIPTION: Provides some standard modes for subobject manipulation
00006 
00007     CREATED BY: Rolf Berteig
00008 
00009     HISTORY: Created 3-14-95
00010 
00011  *> Copyright (c) 1994, All Rights Reserved.
00012  **********************************************************************/
00013 #pragma once
00014 
00015 #include "maxheap.h"
00016 #include "matrix3.h"
00017 #include "ipoint2.h"
00018 #include "quat.h"
00019 #include "sceneapi.h"
00020 #include "ref.h"
00021 #include "mouseman.h"
00022 #include "maxapi.h"
00023 #pragma warning(push)
00024 #pragma warning(disable:4100)
00025 class Transformer: public MaxHeapOperators
00026 {
00027     protected:
00028         Matrix3 tmAxis;
00029         IObjParam* ip;
00030         IPoint2 mBase;
00031         IPoint2 mCur;
00032         
00033     public:
00034         CoreExport Transformer(IObjParam* i);
00035         CoreExport virtual ~Transformer();
00036         CoreExport virtual void BeginDrag( IPoint2& m, Matrix3& tmAxis );
00037         CoreExport virtual void EndDrag( IPoint2& m );
00038         CoreExport void SetMouse( IPoint2& m );
00039 #ifdef _OSNAP
00040         CoreExport virtual void SnapPreview(ViewExp* vpt, IPoint2 in, IPoint2 out, Matrix3* m , DWORD flags){};
00041 #endif
00042         virtual void Accumulate() {mBase=mCur;}
00043         Matrix3& Axis() { return tmAxis; }
00044         IPoint2 Base() { return mBase; }
00045     };
00046 
00047 class MoveTransformer : public Transformer
00048 {
00049         Point3 lastDelta;
00050         Point3 absSnapOrigin;
00051         BOOL selfSnap;
00052     public:
00053         void SetSelfSnap(BOOL ss) {selfSnap=ss;}
00054         BOOL GetSelfSnap() {return selfSnap;}
00055         CoreExport void BeginDrag( IPoint2& m, Matrix3& tmAxis );
00056         CoreExport void EndDrag( IPoint2& m );
00057         CoreExport Point3 Eval(ViewExp* vpt,BOOL status=TRUE);
00058         CoreExport MoveTransformer(IObjParam* i,BOOL so=FALSE);
00059         CoreExport void Accumulate();
00060 #ifdef _OSNAP
00061         CoreExport void SnapPreview(ViewExp* vpt, IPoint2 in, IPoint2 out, Matrix3 *m , DWORD flags);
00062 #endif
00063         };  
00064 
00065 class RotateTransformer : public Transformer {
00066         Quat qPrev;
00067         bool   mSelfSnap;
00068         Point3 mSnapOrigin;
00069 
00070 #ifndef NO_THREE_POINT_ALIGN
00071         class TPARotateTransformerImpl;
00072         friend class TPARotateTransformerImpl;
00073         MaxSDK::Util::AutoPtr<TPARotateTransformerImpl> mTPARotateTransformerImpl;
00074 #endif
00075 
00076     public:
00077         CoreExport AngAxis Eval(ViewExp* vpt,BOOL status=TRUE);
00078         CoreExport void BeginDrag( IPoint2& m, Matrix3& tmAxis );
00079         CoreExport void EndDrag( IPoint2& m );
00080         //gets the current rotation defined by the mouse point projected in the current plane.
00081         CoreExport AngAxis GetMouseOrientation(ViewExp* vpt);
00082         
00083         CoreExport void SetSelfSnap(bool ss);
00084         CoreExport bool GetSelfSnap();
00085         CoreExport RotateTransformer(IObjParam* i,bool so=false);
00086         CoreExport virtual ~RotateTransformer();
00087 
00088 #ifdef _OSNAP
00089         CoreExport void SnapPreview(ViewExp* vpt, IPoint2 in, IPoint2 out, Matrix3 *m , DWORD flags);
00090 #endif
00091         };  
00092 
00093 class ScaleTransformer : public Transformer {
00094     public:
00095         CoreExport Point3 Eval(ViewExp* vpt,BOOL status=TRUE);
00096         ScaleTransformer(IObjParam* i) : Transformer(i) {}
00097 #ifdef _OSNAP
00098         CoreExport void BeginDrag( IPoint2& m, Matrix3& tmAxis );
00099         CoreExport void SnapPreview(ViewExp* vpt, IPoint2 in, IPoint2 out, Matrix3 *m , DWORD flags);
00100 #endif
00101         };  
00102 
00103 
00108 class ChangeFGObject : public ChangeForegroundCallback
00109 {
00110         ReferenceTarget* obj;
00111         BOOL valid;
00112     public:     
00113         ChangeFGObject() { obj = NULL; valid = TRUE; }
00114         ChangeFGObject(ReferenceTarget* o) { obj = o; valid = TRUE; }
00115         void SetObj(ReferenceTarget* o ) { obj = o; }
00116         
00125         BOOL IsValid() { return valid; }
00132         void Invalidate() { valid = FALSE; }
00137         void Validate() { valid = TRUE; }
00147         void callback(TimeValue t,IScene *scene)
00148         {
00149             obj->FlagDependents(t);
00150         }
00151     };
00152 
00153 
00154 
00155 class SelectionProcessor : public MouseCallBack {
00156     friend class PaintSelectionProcessor; //used internally
00157     private:
00158         MouseCallBack *mcallback;
00159         BOOL brokenThresh, hitSel, drag, toggle, cloning, clear, invert;
00160         IPoint2 offset;
00161         IPoint2 om,lm;
00162 
00163     protected:
00164         IObjParam* ip;
00165 
00166         virtual BOOL HitTest( ViewExp* vpt, IPoint2 *p, int type, int flags )=0;
00167         virtual BOOL AnyHits( ViewExp* vpt )=0;
00168         virtual HCURSOR GetTransformCursor()=0;
00169         virtual void Select(ViewExp* vpt,BOOL all,BOOL clear,BOOL invert)=0;
00170         virtual void DeSelect(ViewExp* vpt,BOOL all)=0;
00171         virtual void ClearSelection()=0;
00172         virtual void CloneSelected(int initialCall=TRUE)=0;
00173         virtual void AbortClone()=0;
00174         virtual void AcceptClone()=0;
00175         virtual void SelectChildren(ViewExp* vpt) {}
00176 
00177     public:
00178         SelectionProcessor(MouseCallBack *m,IObjParam* i) 
00179             { mcallback = m; ip = i; offset = IPoint2(0,0); }
00180         
00181         CoreExport virtual int proc( 
00182             HWND hwnd, 
00183             int msg, 
00184             int point, 
00185             int flags, 
00186             IPoint2 m );
00187 
00188         CoreExport void pan(IPoint2 d);
00189     };
00190 
00191 
00192 class TransformModBox : public MouseCallBack {
00193     protected:
00194         BaseObject* obj;
00195         IObjParam* ip;      
00196         Matrix3 ptm;
00197 
00198     public:
00199         CoreExport TransformModBox(BaseObject* o, IObjParam* i);
00200         CoreExport ~TransformModBox();
00201 
00202         // These are called before and after the DoTransform operations
00203         CoreExport virtual void PreTransform();
00204         CoreExport virtual void PreTransformHolding();
00205         CoreExport virtual void PostTransformHolding();
00206         CoreExport virtual void PostTransform();
00207         CoreExport virtual void CancelTransform();
00208 
00209         virtual Transformer& GetTransformer()=0;
00210         virtual void DoTransform(ViewExp* vpt)=0;
00211         virtual HCURSOR GetTransformCursor()=0;
00212         virtual int UndoStringID()=0;
00213 
00214         CoreExport int proc( 
00215             HWND hwnd, 
00216             int msg, 
00217             int point, 
00218             int flags, 
00219             IPoint2 m );
00220     };
00221 
00222 
00223 class GenModSelectionProcessor : public SelectionProcessor {
00224     protected:
00225         BaseObject* obj;
00226         BOOL transformGizmoActive;
00227 
00228         CoreExport BOOL HitTest( ViewExp* vpt, IPoint2 *p, int type, int flags );
00229         BOOL AnyHits( ViewExp* vpt ) { return vpt->NumSubObjHits(); }       
00230         CoreExport void Select(ViewExp* vpt,BOOL all,BOOL clear,BOOL invert);
00231         CoreExport void DeSelect(ViewExp* vpt,BOOL all);
00232         CoreExport void ClearSelection();
00233         CoreExport void CloneSelected(int initialCall=TRUE);
00234         CoreExport void AbortClone();
00235         CoreExport void AcceptClone();
00236 
00237     public:
00238         GenModSelectionProcessor(MouseCallBack *mc, BaseObject* o, IObjParam* i) 
00239             : SelectionProcessor(mc,i) {obj = o; transformGizmoActive=FALSE; }
00240     };
00241 
00242 class SubModSelectionProcessor : public GenModSelectionProcessor {
00243     private:        
00244         TransformModBox *tproc;
00245         BOOL supportTransformGizmo;
00246 
00247     protected:
00248         HCURSOR GetTransformCursor() { return tproc ? tproc->GetTransformCursor() : LoadCursor(NULL, IDC_ARROW); }
00249         
00250     public:
00251         SubModSelectionProcessor(TransformModBox *mc, BaseObject* o, IObjParam* i) 
00252             : GenModSelectionProcessor(mc,o,i) { 
00253                 tproc = mc; supportTransformGizmo=FALSE; }
00254 
00255         // Transform Gizmo Interface
00256         BOOL SupportTransformGizmo() { return supportTransformGizmo; }
00257         void DeactivateTransformGizmo() {
00258             if (transformGizmoActive) {
00259                 ip->DeactivateTransformGizmo();
00260                 transformGizmoActive = FALSE;
00261                 }
00262             }
00263         // End of Transform Gizmo Interface
00264         // Private gizmo stuff
00265         void SetSupportTransformGizmo(BOOL b) { supportTransformGizmo = b; }
00266     };
00267 
00268 
00269 class MoveModBox : public TransformModBox {
00270     private:
00271         MoveTransformer moveTrans;
00272     public:
00273         MoveModBox(BaseObject* o, IObjParam* i) : moveTrans(i,TRUE), TransformModBox(o,i) {}
00274         Transformer& GetTransformer() { return moveTrans; }
00275         CoreExport void DoTransform(ViewExp* vpt);
00276         HCURSOR GetTransformCursor() { return ip->GetSysCursor(SYSCUR_MOVE); }
00277         CoreExport int UndoStringID();
00278         };
00279 class RotateModBox : public TransformModBox {
00280     private:
00281         RotateTransformer rotTrans;
00282     public:
00283         RotateModBox(BaseObject* o, IObjParam* i) : rotTrans(i), TransformModBox(o,i) {}
00284         Transformer& GetTransformer() { return rotTrans; }
00285         CoreExport void DoTransform(ViewExp* vpt);
00286         HCURSOR GetTransformCursor() { return ip->GetSysCursor(SYSCUR_ROTATE); }
00287         CoreExport int UndoStringID();
00288         };
00289 class ScaleModBox : public TransformModBox {
00290     private:
00291         ScaleTransformer scaleTrans;
00292     public:
00293         ScaleModBox(BaseObject* o, IObjParam* i) : scaleTrans(i), TransformModBox(o,i) {}
00294         Transformer& GetTransformer() { return scaleTrans; }
00295         CoreExport void DoTransform(ViewExp* vpt);
00296         CoreExport HCURSOR GetTransformCursor();
00297         CoreExport int UndoStringID();
00298         };
00299 class SelectModBox : public TransformModBox {
00300     private:
00301         MoveTransformer moveTrans;
00302     public:
00303         SelectModBox(BaseObject* o, IObjParam* i) : moveTrans(i), TransformModBox(o,i) {}
00304         Transformer& GetTransformer() { return moveTrans; }
00305         void DoTransform(ViewExp* vpt) {}
00306         HCURSOR GetTransformCursor() { return ip->GetSysCursor(SYSCUR_SELECT); }
00307         CoreExport int UndoStringID();
00308         };
00309 
00310 
00311 class MoveModBoxCMode : public CommandMode
00312 {
00313     private:
00314         ChangeFGObject fgProc;
00315         SubModSelectionProcessor mouseProc;
00316         MoveModBox transProc;
00317         IObjParam* ip;
00318 
00319     public:
00320         MoveModBoxCMode( BaseObject *o, IObjParam *i ) : 
00321             fgProc((ReferenceTarget*)o), transProc(o,i), mouseProc(&transProc,o,i) 
00322                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00323         
00324         int Class() { return MOVE_COMMAND; }
00325         int ID() { return CID_SUBOBJMOVE; }
00326         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00327         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00328         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00329         void EnterMode() { ip->SetToolButtonState(MOVE_BUTTON,TRUE); }
00330         void ExitMode() { ip->SetToolButtonState(MOVE_BUTTON,FALSE); }
00331     };
00332 
00333 class RotateModBoxCMode : public CommandMode
00334 {
00335     private:
00336         ChangeFGObject fgProc;
00337         SubModSelectionProcessor mouseProc;
00338         RotateModBox transProc;
00339         IObjParam* ip;
00340 
00341     public:
00342         RotateModBoxCMode( BaseObject* o, IObjParam* i ) : 
00343             fgProc((ReferenceTarget*)o), transProc(o,i), mouseProc(&transProc,o,i) 
00344                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00345         
00346         int Class() { return ROTATE_COMMAND; }
00347         int ID() { return CID_SUBOBJROTATE; }
00348         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00349         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00350         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00351         void EnterMode() { ip->SetToolButtonState(ROTATE_BUTTON,TRUE); }
00352         void ExitMode() { ip->SetToolButtonState(ROTATE_BUTTON,FALSE); }
00353     };
00354 
00355 class UScaleModBoxCMode : public CommandMode
00356 {
00357     private:
00358         ChangeFGObject fgProc;
00359         SubModSelectionProcessor mouseProc;
00360         ScaleModBox transProc;
00361         IObjParam* ip;
00362 
00363     public:
00364         UScaleModBoxCMode( BaseObject* o, IObjParam* i ) : 
00365             fgProc((ReferenceTarget*)o), transProc(o,i), mouseProc(&transProc,o,i) 
00366                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00367         
00368         int Class() { return USCALE_COMMAND; }
00369         int ID() { return CID_SUBOBJUSCALE; }
00370         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00371         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00372         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00373         void EnterMode() { ip->SetToolButtonState(USCALE_BUTTON,TRUE); }
00374         void ExitMode() { ip->SetToolButtonState(USCALE_BUTTON,FALSE); }
00375     };
00376 
00377 class NUScaleModBoxCMode : public CommandMode {
00378     
00379     private:
00380         ChangeFGObject fgProc;
00381         SubModSelectionProcessor mouseProc;
00382         ScaleModBox transProc;
00383         IObjParam* ip;
00384 
00385     public:
00386         NUScaleModBoxCMode( BaseObject* o, IObjParam* i ) : 
00387             fgProc((ReferenceTarget*)o), transProc(o,i), mouseProc(&transProc,o,i) 
00388                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00389         
00390         int Class() { return SCALE_COMMAND; }
00391         int ID() { return CID_SUBOBJSCALE; }
00392         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00393         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00394         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00395         void EnterMode() { ip->SetToolButtonState(NUSCALE_BUTTON,TRUE); }
00396         void ExitMode() { ip->SetToolButtonState(NUSCALE_BUTTON,FALSE); }
00397     };
00398 
00399 class SquashModBoxCMode : public CommandMode {
00400     
00401     private:
00402         ChangeFGObject fgProc;
00403         SubModSelectionProcessor mouseProc;
00404         ScaleModBox transProc;
00405         IObjParam* ip;
00406 
00407     public:
00408         SquashModBoxCMode( BaseObject* o, IObjParam* i ) : 
00409             fgProc((ReferenceTarget*)o), transProc(o,i), mouseProc(&transProc,o,i) 
00410                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00411         
00412         int Class() { return SQUASH_COMMAND; }
00413         int ID() { return CID_SUBOBJSQUASH; }
00414         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00415         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00416         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00417         void EnterMode() { ip->SetToolButtonState(SQUASH_BUTTON,TRUE); }
00418         void ExitMode() { ip->SetToolButtonState(SQUASH_BUTTON,FALSE); }
00419     };
00420 
00421 class SelectModBoxCMode : public CommandMode {
00422     
00423     private:
00424         ChangeFGObject fgProc;
00425         SubModSelectionProcessor mouseProc;
00426         SelectModBox transProc;
00427         IObjParam* ip;
00428 
00429     public:
00430         SelectModBoxCMode( BaseObject* o, IObjParam* i ) : 
00431             fgProc((ReferenceTarget*)o), transProc(o,i), mouseProc(NULL/*&transProc*/,o,i) 
00432                 { ip = i; }
00433         
00434         int Class() { return SELECT_COMMAND; }
00435         int ID() { return CID_SUBOBJSELECT; }
00436         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00437         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00438         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00439         void EnterMode() { ip->SetToolButtonState(SELECT_BUTTON,TRUE); }
00440         void ExitMode() { ip->SetToolButtonState(SELECT_BUTTON,FALSE); }
00441     };
00442 
00443 
00444 
00446 
00447 class TransformCtrlApparatus : public MouseCallBack {
00448     protected:
00449         Control *ctrl;
00450         IObjParam* ip;      
00451         Matrix3 ptm;
00452 
00453     public:
00454         CoreExport TransformCtrlApparatus(Control *c, IObjParam* i);
00455         CoreExport ~TransformCtrlApparatus();
00456 
00457         virtual Transformer& GetTransformer()=0;
00458         virtual void DoTransform(ViewExp* vpt)=0;
00459         virtual HCURSOR GetTransformCursor()=0;
00460         virtual int UndoStringID()=0;
00461 
00462         CoreExport int proc( 
00463             HWND hwnd, 
00464             int msg, 
00465             int point, 
00466             int flags, 
00467             IPoint2 m );
00468     };
00469 
00470 
00471 class GenControlSelectionProcessor : public SelectionProcessor {
00472     protected:
00473         Control *ctrl;
00474         BOOL transformGizmoActive;
00475 
00476         CoreExport BOOL HitTest( ViewExp* vpt, IPoint2 *p, int type, int flags );
00477         BOOL AnyHits( ViewExp* vpt ) { return vpt->NumSubObjHits(); }       
00478         CoreExport void Select(ViewExp* vpt,BOOL all,BOOL clear,BOOL invert);
00479         CoreExport void DeSelect(ViewExp* vpt,BOOL all);
00480         CoreExport void ClearSelection();
00481         void CloneSelected(int initialCall=TRUE) {};
00482         void AbortClone() {};
00483         void AcceptClone() {};
00484 
00485     public:
00486         GenControlSelectionProcessor(MouseCallBack *mc,Control *c,IObjParam* i) 
00487             : SelectionProcessor(mc,i) {ctrl=c; transformGizmoActive=FALSE; }
00488     };
00489 
00490 class SubControlSelectionProcessor : public GenControlSelectionProcessor {
00491     private:        
00492         TransformCtrlApparatus *tproc;
00493         BOOL supportTransformGizmo;
00494 
00495     protected:
00496         HCURSOR GetTransformCursor() { return tproc->GetTransformCursor(); }
00497         
00498     public:
00499         SubControlSelectionProcessor(TransformCtrlApparatus *tc,Control *c,IObjParam* i) 
00500             : GenControlSelectionProcessor(tc,c,i) { 
00501                 tproc = tc; supportTransformGizmo=FALSE; }
00502 
00503         // Transform Gizmo Interface
00504         BOOL SupportTransformGizmo() { return supportTransformGizmo; }
00505         void DeactivateTransformGizmo() {
00506             if (transformGizmoActive) {
00507                 ip->DeactivateTransformGizmo();
00508                 transformGizmoActive = FALSE;
00509                 }
00510             }
00511         // End of Transform Gizmo Interface
00512         // Private gizmo stuff
00513         void SetSupportTransformGizmo(BOOL b) { supportTransformGizmo = b; }
00514 
00515     };
00516 
00517 
00518 class MoveCtrlApparatus : public TransformCtrlApparatus {
00519     private:
00520         MoveTransformer moveTrans;
00521     public:
00522         MoveCtrlApparatus(Control *c, IObjParam* i) : moveTrans(i,TRUE), TransformCtrlApparatus(c,i) {}
00523         Transformer& GetTransformer() { return moveTrans; }
00524         CoreExport void DoTransform(ViewExp* vpt);
00525         HCURSOR GetTransformCursor() { return ip->GetSysCursor(SYSCUR_MOVE); }
00526         CoreExport int UndoStringID();
00527         };
00528 class RotateCtrlApparatus : public TransformCtrlApparatus {
00529     private:
00530         RotateTransformer rotTrans;
00531     public:
00532         RotateCtrlApparatus(Control *c, IObjParam* i) : rotTrans(i), TransformCtrlApparatus(c,i) {}
00533         Transformer& GetTransformer() { return rotTrans; }
00534         CoreExport void DoTransform(ViewExp* vpt);
00535         HCURSOR GetTransformCursor() { return ip->GetSysCursor(SYSCUR_ROTATE); }
00536         CoreExport int UndoStringID();
00537         };
00538 class ScaleCtrlApparatus : public TransformCtrlApparatus {
00539     private:
00540         ScaleTransformer scaleTrans;
00541     public:
00542         ScaleCtrlApparatus(Control *c, IObjParam* i) : scaleTrans(i), TransformCtrlApparatus(c,i) {}
00543         Transformer& GetTransformer() { return scaleTrans; }
00544         CoreExport void DoTransform(ViewExp* vpt);
00545         CoreExport HCURSOR GetTransformCursor();
00546         CoreExport int UndoStringID();
00547         };
00548 class SelectCtrlApparatus : public TransformCtrlApparatus {
00549     private:
00550         MoveTransformer moveTrans;
00551     public:
00552         SelectCtrlApparatus(Control *c, IObjParam* i) : moveTrans(i), TransformCtrlApparatus(c,i) {}
00553         Transformer& GetTransformer() { return moveTrans; }
00554         void DoTransform(ViewExp* vpt) {}
00555         HCURSOR GetTransformCursor() { return ip->GetSysCursor(SYSCUR_SELECT); }
00556         CoreExport int UndoStringID();
00557         };
00558 #pragma warning(pop)
00559 
00560 class MoveCtrlApparatusCMode : public CommandMode {
00561     
00562     private:
00563         ChangeFGObject fgProc;
00564         SubControlSelectionProcessor mouseProc;
00565         MoveCtrlApparatus transProc;
00566         IObjParam* ip;
00567 
00568     public:
00569         MoveCtrlApparatusCMode( Control* c, IObjParam* i ) : 
00570             fgProc((ReferenceTarget*)c), transProc(c,i), mouseProc(&transProc,c,i) 
00571                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00572         
00573         int Class() { return MOVE_COMMAND; }
00574         int ID() { return CID_SUBOBJMOVE; }
00575         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00576         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00577         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00578         void EnterMode() { ip->SetToolButtonState(MOVE_BUTTON,TRUE); }
00579         void ExitMode() { ip->SetToolButtonState(MOVE_BUTTON,FALSE); }
00580     };
00581 
00582 class RotateCtrlApparatusCMode : public CommandMode {
00583     
00584     private:
00585         ChangeFGObject fgProc;
00586         SubControlSelectionProcessor mouseProc;
00587         RotateCtrlApparatus transProc;
00588         IObjParam* ip;
00589 
00590     public:
00591         RotateCtrlApparatusCMode( Control *c, IObjParam* i ) : 
00592             fgProc((ReferenceTarget*)c), transProc(c,i), mouseProc(&transProc,c,i) 
00593                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00594         
00595         int Class() { return ROTATE_COMMAND; }
00596         int ID() { return CID_SUBOBJROTATE; }
00597         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00598         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00599         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00600         void EnterMode() { ip->SetToolButtonState(ROTATE_BUTTON,TRUE); }
00601         void ExitMode() { ip->SetToolButtonState(ROTATE_BUTTON,FALSE); }
00602     };
00603 
00604 class UScaleCtrlApparatusCMode : public CommandMode {
00605     
00606     private:
00607         ChangeFGObject fgProc;
00608         SubControlSelectionProcessor mouseProc;
00609         ScaleCtrlApparatus transProc;
00610         IObjParam* ip;
00611 
00612     public:
00613         UScaleCtrlApparatusCMode( Control *c, IObjParam* i ) : 
00614             fgProc((ReferenceTarget*)c), transProc(c,i), mouseProc(&transProc,c,i) 
00615                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00616         
00617         int Class() { return USCALE_COMMAND; }
00618         int ID() { return CID_SUBOBJUSCALE; }
00619         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00620         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00621         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00622         void EnterMode() { ip->SetToolButtonState(USCALE_BUTTON,TRUE); }
00623         void ExitMode() { ip->SetToolButtonState(USCALE_BUTTON,FALSE); }
00624     };
00625 
00626 class NUScaleCtrlApparatusCMode : public CommandMode {
00627     
00628     private:
00629         ChangeFGObject fgProc;
00630         SubControlSelectionProcessor mouseProc;
00631         ScaleCtrlApparatus transProc;
00632         IObjParam* ip;
00633 
00634     public:
00635         NUScaleCtrlApparatusCMode( Control *c, IObjParam* i ) : 
00636             fgProc((ReferenceTarget*)c), transProc(c,i), mouseProc(&transProc,c,i) 
00637                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00638         
00639         int Class() { return SCALE_COMMAND; }
00640         int ID() { return CID_SUBOBJSCALE; }
00641         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00642         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00643         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00644         void EnterMode() { ip->SetToolButtonState(NUSCALE_BUTTON,TRUE); }
00645         void ExitMode() { ip->SetToolButtonState(NUSCALE_BUTTON,FALSE); }
00646     };
00647 
00648 class SquashCtrlApparatusCMode : public CommandMode {
00649     
00650     private:
00651         ChangeFGObject fgProc;
00652         SubControlSelectionProcessor mouseProc;
00653         ScaleCtrlApparatus transProc;
00654         IObjParam* ip;
00655 
00656     public:
00657         SquashCtrlApparatusCMode( Control *c, IObjParam* i ) : 
00658             fgProc((ReferenceTarget*)c), transProc(c,i), mouseProc(&transProc,c,i) 
00659                 { ip = i; mouseProc.SetSupportTransformGizmo(TRUE); }
00660         
00661         int Class() { return SQUASH_COMMAND; }
00662         int ID() { return CID_SUBOBJSQUASH; }
00663         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00664         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00665         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00666         void EnterMode() { ip->SetToolButtonState(SQUASH_BUTTON,TRUE); }
00667         void ExitMode() { ip->SetToolButtonState(SQUASH_BUTTON,FALSE); }
00668     };
00669 
00670 class SelectCtrlApparatusCMode : public CommandMode {
00671     
00672     private:
00673         ChangeFGObject fgProc;
00674         SubControlSelectionProcessor mouseProc;
00675         SelectCtrlApparatus transProc;
00676         IObjParam* ip;
00677 
00678     public:
00679         SelectCtrlApparatusCMode( Control *c, IObjParam* i ) :
00680             fgProc((ReferenceTarget*)c), transProc(c,i), mouseProc(NULL,c,i) 
00681                 { ip = i; }
00682         
00683         int Class() { return SELECT_COMMAND; }
00684         int ID() { return CID_SUBOBJSELECT; }
00685         MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00686         ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00687         BOOL ChangeFG( CommandMode* oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00688         void EnterMode() { ip->SetToolButtonState(SELECT_BUTTON,TRUE); }
00689         void ExitMode() { ip->SetToolButtonState(SELECT_BUTTON,FALSE); }
00690     };
00691 
00692 
00693 
00694 #define MOVE_INTERSECTION   1
00695 #define MOVE_PROJECTION     2
00696 
00701 CoreExport float GetPerspMouseSpeed();
00710 CoreExport void SetPerspMouseSpeed(float speed);
00721 CoreExport void SetMoveModeType(int moveType);
00730 CoreExport int GetMoveModeType();
00731 
00732 CoreExport void SetRotationIncrement(float inc);
00733 CoreExport float GetRotationIncrement();
00734 
00735 CoreExport int GetPaintSelBrushSize();
00736 CoreExport void SetPaintSelBrushSize(int size);