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 00010 #ifndef _HOBJECTS_H 00011 #define _HOBJECTS_H 00012 00013 #ifdef H_PACK_8 00014 #pragma pack(push) 00015 #pragma pack(8) 00016 #endif 00017 00018 #include "HTools.h" 00019 #include "HEventListener.h" 00020 #include "HEventManager.h" 00021 #include "HBaseOperator.h" 00022 00023 class HBaseView; 00024 class HTClient; 00025 class HBaseOperator; 00026 class HImagePanel; 00027 00028 enum HButtonState 00029 { 00030 ButtonDown, 00031 ButtonPressed, 00032 ButtonUp 00033 }; 00034 00036 00041 class MVO_API HEdgeVertexSelectionObject : public HObject, public HMouseListener 00042 { 00043 public: 00049 HEdgeVertexSelectionObject(HBaseView *view); 00050 ~HEdgeVertexSelectionObject(); 00051 00058 virtual int OnMouseMove(HEventInfo &hevent); 00065 virtual int OnLButtonDown(HEventInfo &hevent); 00072 virtual int OnLButtonUp(HEventInfo &hevent); 00073 00080 void IncludeEntity(HBaseView *view, HC_KEY movekey); 00081 00085 static const char * GetStaticName(); 00086 00090 const char * GetName(); 00091 00092 00093 protected: 00094 HPoint m_Point1; 00095 HPoint m_Point2; 00096 HC_KEY m_SegKey; 00097 HBaseView *m_pView; 00100 private: 00101 bool m_bFound; 00102 bool m_blButtonDown; 00103 00104 }; 00105 00106 00108 class MVO_API HImageRegion 00109 { 00110 public: 00111 00117 HImageRegion(int identifier, char const * const name); 00118 ~HImageRegion(); 00119 00129 bool IsSelected(float x, float y, HC_KEY region_image_key, int width, int height); 00130 00135 char const * GetName() { return m_Name; } 00140 int GetID() { return m_Id; } 00141 private: 00142 bool m_bHighlighted; 00143 char *m_Name; 00144 int m_Id; 00145 }; 00147 class MVO_API HImagePanelManagerObject : public HObject 00148 { 00149 public: 00150 00151 00155 HImagePanelManagerObject(); 00156 ~HImagePanelManagerObject(); 00157 00161 static const char * GetStaticName(); 00162 00166 const char * GetName(); 00167 00172 void AddImagePanel(HImagePanel *ip); 00180 bool DeleteImagePanel(char const * name, bool doDelete = true, HImagePanel **ip = 0); 00187 bool DeleteImagePanel(HImagePanel *ip, bool doDelete = true); 00193 HImagePanel * GetImagePanelByName(char const * name); 00194 00195 protected: 00196 00197 00198 struct vlist_s* m_ImagePanelList; 00200 }; 00201 00202 00204 00212 class MVO_API HImagePanel : public HBaseOperator 00213 { 00214 public: 00215 00216 00227 HImagePanel(HBaseView *view, HC_KEY startkey, int width, int height, float xpos, float ypos, char const * const name); 00228 virtual ~HImagePanel(); 00229 00236 HImageRegion * FindSelectedRegion(float xpos, float ypos); 00237 00242 virtual int OnLButtonDownAndMove(HEventInfo &hevent); 00247 virtual int OnLButtonDown(HEventInfo &hevent); 00252 virtual int OnLButtonUp(HEventInfo &hevent); 00253 00259 void AddImageRegion(int identifier, char const * const name); 00264 char const * GetPanelName() { return m_Name; } 00265 00271 void SetImageAction(int (* image_action)(HImageRegion *ii, void *data, HButtonState button_state), void *data) 00272 { 00273 m_ImageAction = image_action; 00274 m_ImageActionData = data; 00275 } 00279 static bool ButtonTimerClbk(float request_time, float actual_time, void * user_data); 00280 00294 void SetImagesFromFile(char const * normal_image_path, char const * highlighted_image_path, char const * region_image_path); 00295 void SetImages(HC_KEY NormalImageKey, HC_KEY HighlightedImageKey, HC_KEY RegionImageKey); 00296 00297 void ZoomIn(); 00298 void ZoomOut(); 00299 00300 void SetPosition(float x, float y, float z = 0.0f); 00301 00302 private: 00308 void SetImageFromFile(char const * path, HC_KEY &image_key); 00313 void ComposeWorkerImage(HImageRegion *reg); 00314 HC_KEY m_Key; 00315 HBaseView *m_pView; 00316 struct vlist_s* m_ImageRegionList; 00317 int m_width; 00318 int m_height; 00320 int (* m_ImageAction)(HImageRegion *ii,void *data, HButtonState button_state); 00321 void * m_ImageActionData; 00322 HTClient* m_pButtonTimer; 00323 HImageRegion *m_CurrentImage; 00324 HC_KEY m_NormalImageKey; 00325 HC_KEY m_HighlightedImageKey; 00326 HC_KEY m_RegionImageKey; 00327 HC_KEY m_WorkerImageKey; 00328 bool m_bFound; 00329 bool m_blButtonDown; 00330 HPoint m_ptLast; 00331 char *m_Name; 00332 }; 00333 00335 class MVO_API HInfoWindowObject : public HObject 00336 { 00337 public: 00346 HInfoWindowObject(HBaseView *view, float startposx = -0.95f, float startposy = 0.3, int maxlines = 20, int displaylength = 7); 00347 ~HInfoWindowObject(); 00348 00352 static const char *GetStaticName(); 00353 00357 const char *GetName(); 00365 void AddLine(char const * text, char const * font = 0, char const * color = 0, bool EraseAfterDisplay = false, int DisplayLength = -1); 00367 void UpdateInfoBox(); 00369 void Flush(); 00370 00372 static void WindowResizeCallback(int signal, void * signal_data, void * user_data); 00373 00374 protected: 00375 HBaseView *m_pView; 00376 HC_KEY m_InfoWindowKey; 00377 char * m_InfoText[25]; 00378 char * m_InfoTextFont[25]; 00379 char * m_InfoTextColor[25]; 00380 int m_LineNum; 00381 int m_LineMax; 00382 float m_StartPosX; 00383 float m_StartPosY; 00384 HTClient* m_InfoWindowTimer; 00390 static bool InfowWindowTimerClbk(float request_time, float actual_time, void * user_data); 00393 void DoTimer(); 00395 void FlushInternal(); 00396 00397 float m_TimeStamp; 00398 float m_transmission; 00399 bool m_bEraseAfterDisplay; 00400 int m_TempDisplayLength; 00401 int m_DefaultDisplayLength; 00403 }; 00404 00405 00407 00412 class MVO_API HLightsObject : public HObject, public HObjectManipulationListener 00413 { 00414 public: 00419 HLightsObject(HBaseView *view); 00420 ~HLightsObject(); 00424 static const char * GetStaticName(); 00425 00429 const char * GetName(); 00430 00438 int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 00439 00447 static void InsertLocalLight(HBaseView *view, HPoint &pos); 00456 static void InsertDistantLight(HBaseView *view, HPoint &pos); 00466 static void InsertSpotLight(HBaseView *view, HPoint &pos); 00467 00473 static void TurnLightsOnOff(HBaseView *view,bool onoff); 00474 00475 protected: 00484 static void SetupLightSegment(HBaseView *view, HPoint &pos, HC_KEY &outerkey, HC_KEY &geometrykey); 00485 00494 static void SetupLightSegmentFromKey(HBaseView *view, HPoint &pos, HC_KEY &outerkey, HC_KEY &geometrykey); 00495 00496 00497 HBaseView *m_pView; 00499 }; 00500 00501 00503 00508 class MVO_API HDraggerObject : public HObject, public HObjectManipulationListener 00509 { 00510 public: 00516 HDraggerObject(HBaseView *view = 0); 00517 ~HDraggerObject(); 00521 static const char * GetStaticName(); 00525 const char * GetName(); 00535 void SetupDraggerSegment(HBaseView *view, HPoint &pos, float rotmat[], HC_KEY &outerkey, HC_KEY &geometrykey); 00548 HC_KEY Insert(HBaseView *view, HPoint &pos, float rotmat[], HBhvAnimation *ani, HBhvAnimation *rotani, int kfr, bool allowpos); 00549 00557 int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 00566 int ObjectMovedEvent(HBaseView *view, HC_KEY key, HPoint *pos); 00567 00568 protected: 00569 HBaseView *m_pView; 00571 }; 00572 00573 00574 00575 #ifdef H_PACK_8 00576 #pragma pack(pop) 00577 #endif 00578 00579 #endif 00580 00581 00582