00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 00014 #ifndef _H_HUtilitySubwindow_H 00015 #define _H_HUtilitySubwindow_H 00016 00017 #ifdef H_PACK_8 00018 #pragma pack(push) 00019 #pragma pack(8) 00020 #endif 00021 00022 #include "HTools.h" 00023 #include "HEventListener.h" 00024 #include "HBaseOperator.h" 00025 #include "HEventManager.h" 00026 00027 00028 #define SUBWINDOW_NOTYPE 0 //!< The basic window type. 00029 #define SUBWINDOW_MAGNIFIER 1//!< The subwindow acts as a magnifying glass. 00030 #define SUBWINDOW_SNAPSHOT 2//!< The subwindow can take snapshots of the scene. 00031 #define SUBWINDOW_POINTER 3//!< The subwindow acts as a view into the scene where the directiona and extent can be controlled by a pointer. 00032 00033 00034 #define SW_ACTION_NOACTION 0 //!< There is no subwindow action. 00035 #define SW_ACTION_MOVE 1 //!< Subwindow action is move. 00036 #define SW_ACTION_SIZING 2 //!< Subwindow action is resizing. 00037 #define SW_ACTION_MAGNIFYING 3 //!< Subwindow action is manifying. 00038 #define SW_ACTION_POINTERMOVE 4 //!< Subwindow action is moving the pointer. 00039 #define SW_ACTION_DRAGGING 5 //!< Subwindow action is dragging the scene inside the subwindow. 00040 00041 #define SW_BORDER 1 //!< Subwindow has borders. 00042 #define SW_SIZE_FIELD 2 //!< Subwindow has a resize area. 00043 #define SW_MOVE_FIELD 4 //!< Subwindow can be moved. 00044 #define SW_DRAG_FIELD 8 //!< Subwindow allows the scene to be moved inside the window. 00045 #define SW_DELETE_FIELD 16 //!< Subwindow has a close button. 00046 #define SW_MAGNIFIER_FIELD 32 //!< Subwindow has a magnifier slider. 00047 #define SW_BACKGROUND_BOX 64 //!< Subwindow has a shadow. 00048 00049 00050 class HBaseView; 00051 00052 00054 class MVO_API HSubwindow : public HObject, public HBaseOperator, public HUpdateListener, public HFitWorldListener, public HObjectManipulationListener 00060 { 00061 00062 public: 00063 00071 HSubwindow (HBaseView* view, int DoRepeat=0, int DoCapture=1); 00075 HSubwindow (); 00076 virtual ~HSubwindow(); 00077 00078 00089 virtual void Insert(float left, float right, float bottom, float top, int type = SUBWINDOW_NOTYPE, long appearance = 00090 SW_BORDER | SW_SIZE_FIELD | SW_MOVE_FIELD | SW_DRAG_FIELD | SW_DELETE_FIELD | SW_MAGNIFIER_FIELD | SW_BACKGROUND_BOX); 00091 00096 virtual void Reset(); 00097 00098 00102 virtual bool IsActive(); 00103 00108 virtual void GetFromKey(HC_KEY key); 00109 00114 virtual bool IsSubwindow(HC_KEY key); 00115 00123 virtual bool FindSubwindow(HBaseView *view, HPoint pos, bool &pointerselected); 00124 00130 virtual HC_KEY FindSubwindowFromSegment(HC_KEY key); 00131 00137 virtual void GetPosition(float &x,float &y); 00138 00144 virtual void SetPosition(float x,float y); 00145 00146 00150 virtual HC_KEY GetWindowKey(); 00151 00157 virtual void GetSize(float &x,float &y); 00158 00164 virtual void SetSize(float deltax, float deltay); 00165 00166 00171 virtual void MakeCameraSnapshot(HBaseView *view); 00172 00178 virtual void ConvertFromSubwindowToView(HPoint &in_point, HPoint &out_point); 00179 00185 virtual void ConvertFromViewToSubwindow(HPoint const & in_point, HPoint & out_point); 00186 00187 00194 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); 00195 00201 virtual void GetPointerPosition(float &x,float &y); 00202 00208 virtual void SetPointerPosition(float x,float y); 00209 00217 virtual void SetSize(float left, float right, float bottom, float top); 00218 00228 virtual void ComputeCoordinates(HBaseView *view, const char *in_system, HPoint &from, const char *out_system, HPoint &to); 00229 00230 00237 virtual void Drag(HBaseView *view, HPoint p1, HPoint p2); 00238 00243 virtual void SyncViewToWindow(HBaseView *view); 00244 00249 virtual int GetType() { return m_Type; } 00250 00255 virtual HC_KEY GetKey() { return m_OuterKey; } 00256 00260 virtual const char * GetName(); 00264 static const char * GetStaticName(); 00265 00272 virtual int OnLButtonDown (HEventInfo &hevent); 00279 virtual int OnLButtonUp (HEventInfo &hevent); 00280 00287 virtual int CameraChangedEvent(HBaseView *view); 00294 virtual int PreFitWorldEvent(HBaseView *view); 00295 00302 virtual int PostFitWorldEvent(HBaseView *view); 00303 00304 00313 virtual int OnLButtonDownAndMove(HEventInfo &hevent); 00314 00322 virtual int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 00323 00331 virtual int ObjectMovedEvent(HBaseView *view, HC_KEY key, HPoint *p); 00339 virtual int ObjectScaledEvent(HBaseView *view, HC_KEY key, HPoint &scale); 00340 00341 protected: 00342 00346 void GetParameters(); 00352 bool IsInSizeArea(HPoint &point); 00358 bool IsInMagnifyArea(HPoint &point); 00363 void CopyViewLight(HBaseView *view); 00368 void BuildMagnifyController(float pos); 00369 00370 00376 void ChangeMagnification(HBaseView *view, HPoint & p); 00381 void Magnify(HBaseView *view); 00382 00386 void ShowPointer(); 00392 bool IsInCloseArea(HPoint &point); 00398 bool IsInDragArea(HPoint &point); 00399 00403 void BuildBorder(); 00409 bool IsInMoveArea(HPoint &point); 00415 void ChangeMagnification(HBaseView *view, float magnification); 00419 void MakeKeyframe(); 00420 00424 void MakeScaleKeyframe(); 00425 00426 HC_KEY m_OuterKey; 00427 HC_KEY m_WindowKey; 00430 float m_Left; 00431 float m_Right; 00432 float m_Bottom; 00433 float m_Top; 00435 int m_Type; 00436 float m_Magnification; 00437 float m_OldMagnification; 00438 long m_Appearance; 00439 HPoint m_Pointer; 00440 int m_Action; 00441 HPoint m_ptLast; 00442 }; 00443 00444 00445 #ifdef H_PACK_8 00446 #pragma pack(pop) 00447 #endif 00448 00449 #endif 00450 00451 00452 00453 00454 00455 00456 00457 00458