00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id$ 00013 // 00018 #ifndef _H_HUtilitySubwindow_H 00019 #define _H_HUtilitySubwindow_H 00020 00021 #ifdef H_PACK_8 00022 #pragma pack(push) 00023 #pragma pack(8) 00024 #endif 00025 00026 #include "HTools.h" 00027 #include "HEventListener.h" 00028 #include "HBaseOperator.h" 00029 #include "HEventManager.h" 00030 00031 00032 #define SUBWINDOW_NOTYPE 0 //!< The basic window type. 00033 #define SUBWINDOW_MAGNIFIER 1//!< The subwindow acts as a magnifying glass. 00034 #define SUBWINDOW_SNAPSHOT 2//!< The subwindow can take snapshots of the scene. 00035 #define SUBWINDOW_POINTER 3//!< The subwindow acts as a view into the scene where the directiona and extent can be controlled by a pointer. 00036 00037 00038 #define SW_ACTION_NOACTION 0 //!< There is no subwindow action. 00039 #define SW_ACTION_MOVE 1 //!< Subwindow action is move. 00040 #define SW_ACTION_SIZING 2 //!< Subwindow action is resizing. 00041 #define SW_ACTION_MAGNIFYING 3 //!< Subwindow action is manifying. 00042 #define SW_ACTION_POINTERMOVE 4 //!< Subwindow action is moving the pointer. 00043 #define SW_ACTION_DRAGGING 5 //!< Subwindow action is dragging the scene inside the subwindow. 00044 00045 #define SW_BORDER 1 //!< Subwindow has borders. 00046 #define SW_SIZE_FIELD 2 //!< Subwindow has a resize area. 00047 #define SW_MOVE_FIELD 4 //!< Subwindow can be moved. 00048 #define SW_DRAG_FIELD 8 //!< Subwindow allows the scene to be moved inside the window. 00049 #define SW_DELETE_FIELD 16 //!< Subwindow has a close button. 00050 #define SW_MAGNIFIER_FIELD 32 //!< Subwindow has a magnifier slider. 00051 #define SW_BACKGROUND_BOX 64 //!< Subwindow has a shadow. 00052 00053 00054 class HBaseView; 00055 00056 00058 class MVO_API HSubwindow : public HObject, public HBaseOperator, public HUpdateListener, public HFitWorldListener, public HObjectManipulationListener 00064 { 00065 00066 public: 00067 00075 HSubwindow (HBaseView* view, int DoRepeat=0, int DoCapture=1); 00079 HSubwindow (); 00080 virtual ~HSubwindow(); 00081 00082 00093 virtual void Insert(float left, float right, float bottom, float top, int type = SUBWINDOW_NOTYPE, long appearance = 00094 SW_BORDER | SW_SIZE_FIELD | SW_MOVE_FIELD | SW_DRAG_FIELD | SW_DELETE_FIELD | SW_MAGNIFIER_FIELD | SW_BACKGROUND_BOX); 00095 00100 virtual void Reset(); 00101 00102 00106 virtual bool IsActive(); 00107 00112 virtual void GetFromKey(HC_KEY key); 00113 00118 virtual bool IsSubwindow(HC_KEY key); 00119 00127 virtual bool FindSubwindow(HBaseView *view, HPoint pos, bool &pointerselected); 00128 00134 virtual HC_KEY FindSubwindowFromSegment(HC_KEY key); 00135 00141 virtual void GetPosition(float &x,float &y); 00142 00148 virtual void SetPosition(float x,float y); 00149 00150 00154 virtual HC_KEY GetWindowKey(); 00155 00161 virtual void GetSize(float &x,float &y); 00162 00168 virtual void SetSize(float deltax, float deltay); 00169 00170 00175 virtual void MakeCameraSnapshot(HBaseView *view); 00176 00182 virtual void ConvertFromSubwindowToView(HPoint &in_point, HPoint &out_point); 00183 00189 virtual void ConvertFromViewToSubwindow(HPoint const & in_point, HPoint & out_point); 00190 00191 00198 virtual void ChangeType(int type, long appearance = SW_BORDER | SW_SIZE_FIELD | SW_MOVE_FIELD | SW_DRAG_FIELD | SW_DELETE_FIELD | SW_MAGNIFIER_FIELD | SW_BACKGROUND_BOX); 00199 00205 virtual void GetPointerPosition(float &x,float &y); 00206 00212 virtual void SetPointerPosition(float x,float y); 00213 00221 virtual void SetSize(float left, float right, float bottom, float top); 00222 00232 virtual void ComputeCoordinates(HBaseView *view, const char *in_system, HPoint &from, const char *out_system, HPoint &to); 00233 00234 00241 virtual void Drag(HBaseView *view, HPoint p1, HPoint p2); 00242 00247 virtual void SyncViewToWindow(HBaseView *view); 00248 00253 virtual int GetType() { return m_Type; } 00254 00259 virtual HC_KEY GetKey() { return m_OuterKey; } 00260 00264 virtual const char * GetName(); 00268 static const char * GetStaticName(); 00269 00276 virtual int OnLButtonDown (HEventInfo &hevent); 00283 virtual int OnLButtonUp (HEventInfo &hevent); 00284 00291 virtual int CameraChangedEvent(HBaseView *view); 00298 virtual int PreFitWorldEvent(HBaseView *view); 00299 00306 virtual int PostFitWorldEvent(HBaseView *view); 00307 00308 00317 virtual int OnLButtonDownAndMove(HEventInfo &hevent); 00318 00326 virtual int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 00327 00335 virtual int ObjectMovedEvent(HBaseView *view, HC_KEY key, HPoint *p); 00343 virtual int ObjectScaledEvent(HBaseView *view, HC_KEY key, HPoint &scale); 00344 00345 protected: 00346 00350 void GetParameters(); 00356 bool IsInSizeArea(HPoint &point); 00362 bool IsInMagnifyArea(HPoint &point); 00367 void CopyViewLight(HBaseView *view); 00372 void BuildMagnifyController(float pos); 00373 00374 00380 void ChangeMagnification(HBaseView *view, HPoint & p); 00385 void Magnify(HBaseView *view); 00386 00390 void ShowPointer(); 00396 bool IsInCloseArea(HPoint &point); 00402 bool IsInDragArea(HPoint &point); 00403 00407 void BuildBorder(); 00413 bool IsInMoveArea(HPoint &point); 00419 void ChangeMagnification(HBaseView *view, float magnification); 00423 void MakeKeyframe(); 00424 00428 void MakeScaleKeyframe(); 00429 00430 HC_KEY m_OuterKey; 00431 HC_KEY m_WindowKey; 00434 float m_Left; 00435 float m_Right; 00436 float m_Bottom; 00437 float m_Top; 00439 int m_Type; 00440 float m_Magnification; 00441 float m_OldMagnification; 00442 long m_Appearance; 00443 HPoint m_Pointer; 00444 int m_Action; 00445 HPoint m_ptLast; 00446 }; 00447 00448 00449 #ifdef H_PACK_8 00450 #pragma pack(pop) 00451 #endif 00452 00453 #endif 00454 00455 00456 00457 00458 00459 00460 00461 00462