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: e5202255f29107fce7fef0d3337a5364d5549bc8 $ 00013 // 00014 00015 00016 00017 #ifndef _HOBJECTS_H 00018 #define _HOBJECTS_H 00019 00020 #ifdef H_PACK_8 00021 #pragma pack(push) 00022 #pragma pack(8) 00023 #endif 00024 00025 #include "HTools.h" 00026 #include "HEventListener.h" 00027 #include "HEventManager.h" 00028 #include "HBaseOperator.h" 00029 00030 class HBaseView; 00031 class HTClient; 00032 class HBaseOperator; 00033 class HImagePanel; 00034 00035 enum HButtonState 00036 { 00037 ButtonDown, 00038 ButtonPressed, 00039 ButtonUp 00040 }; 00041 00043 00048 class MVO_API HEdgeVertexSelectionObject : public HObject, public HMouseListener 00049 { 00050 public: 00056 HEdgeVertexSelectionObject(HBaseView *view); 00057 ~HEdgeVertexSelectionObject(); 00058 00065 virtual int OnMouseMove(HEventInfo &hevent); 00072 virtual int OnLButtonDown(HEventInfo &hevent); 00079 virtual int OnLButtonUp(HEventInfo &hevent); 00080 00087 void IncludeEntity(HBaseView *view, HC_KEY movekey); 00088 00092 static const char * GetStaticName(); 00093 00097 const char * GetName(); 00098 00099 00100 protected: 00101 HPoint m_Point1; 00102 HPoint m_Point2; 00103 HC_KEY m_SegKey; 00104 HBaseView *m_pView; 00107 private: 00108 bool m_bFound; 00109 bool m_blButtonDown; 00110 00111 }; 00112 00113 00115 class MVO_API HImageRegion 00116 { 00117 public: 00118 00124 HImageRegion(int identifier, char const * const name); 00125 ~HImageRegion(); 00126 00136 bool IsSelected(float x, float y, HC_KEY region_image_key, int width, int height); 00137 00142 char const * GetName() { return m_Name; } 00147 int GetID() { return m_Id; } 00148 private: 00149 bool m_bHighlighted; 00150 char *m_Name; 00151 int m_Id; 00152 }; 00154 class MVO_API HImagePanelManagerObject : public HObject 00155 { 00156 public: 00157 00158 00162 HImagePanelManagerObject(); 00163 ~HImagePanelManagerObject(); 00164 00168 static const char * GetStaticName(); 00169 00173 const char * GetName(); 00174 00179 void AddImagePanel(HImagePanel *ip); 00187 bool DeleteImagePanel(char const * name, bool doDelete = true, HImagePanel **ip = 0); 00194 bool DeleteImagePanel(HImagePanel *ip, bool doDelete = true); 00200 HImagePanel * GetImagePanelByName(char const * name); 00201 00202 protected: 00203 00204 00205 struct vlist_s* m_ImagePanelList; 00207 }; 00208 00209 00211 00219 class MVO_API HImagePanel : public HBaseOperator 00220 { 00221 public: 00222 00223 00234 HImagePanel(HBaseView *view, HC_KEY startkey, int width, int height, float xpos, float ypos, char const * const name); 00235 virtual ~HImagePanel(); 00236 00243 HImageRegion * FindSelectedRegion(float xpos, float ypos); 00244 00249 virtual int OnLButtonDownAndMove(HEventInfo &hevent); 00254 virtual int OnLButtonDown(HEventInfo &hevent); 00259 virtual int OnLButtonUp(HEventInfo &hevent); 00260 00266 void AddImageRegion(int identifier, char const * const name); 00271 char const * GetPanelName() { return m_Name; } 00272 00278 void SetImageAction(int (* image_action)(HImageRegion *ii, void *data, HButtonState button_state), void *data) 00279 { 00280 m_ImageAction = image_action; 00281 m_ImageActionData = data; 00282 } 00286 static bool ButtonTimerClbk(float request_time, float actual_time, void * user_data); 00287 00301 void SetImagesFromFile(char const * normal_image_path, char const * highlighted_image_path, char const * region_image_path); 00302 void SetImages(HC_KEY NormalImageKey, HC_KEY HighlightedImageKey, HC_KEY RegionImageKey); 00303 00304 void ZoomIn(); 00305 void ZoomOut(); 00306 00307 void SetPosition(float x, float y, float z = 0.0f); 00308 00309 private: 00315 void SetImageFromFile(char const * path, HC_KEY &image_key); 00320 void ComposeWorkerImage(HImageRegion *reg); 00321 HC_KEY m_Key; 00322 HBaseView *m_pView; 00323 struct vlist_s* m_ImageRegionList; 00324 int m_width; 00325 int m_height; 00327 int (* m_ImageAction)(HImageRegion *ii,void *data, HButtonState button_state); 00328 void * m_ImageActionData; 00329 HTClient* m_pButtonTimer; 00330 HImageRegion *m_CurrentImage; 00331 HC_KEY m_NormalImageKey; 00332 HC_KEY m_HighlightedImageKey; 00333 HC_KEY m_RegionImageKey; 00334 HC_KEY m_WorkerImageKey; 00335 bool m_bFound; 00336 bool m_blButtonDown; 00337 HPoint m_ptLast; 00338 char *m_Name; 00339 }; 00340 00342 class MVO_API HInfoWindowObject : public HObject 00343 { 00344 public: 00353 HInfoWindowObject(HBaseView *view, float startposx = -0.95f, float startposy = 0.3, int maxlines = 20, int displaylength = 7); 00354 ~HInfoWindowObject(); 00355 00359 static const char *GetStaticName(); 00360 00364 const char *GetName(); 00372 void AddLine(char const * text, char const * font = 0, char const * color = 0, bool EraseAfterDisplay = false, int DisplayLength = -1); 00374 void UpdateInfoBox(); 00376 void Flush(); 00377 00379 static void WindowResizeCallback(int signal, void * signal_data, void * user_data); 00380 00381 protected: 00382 HBaseView *m_pView; 00383 HC_KEY m_InfoWindowKey; 00384 char * m_InfoText[25]; 00385 char * m_InfoTextFont[25]; 00386 char * m_InfoTextColor[25]; 00387 int m_LineNum; 00388 int m_LineMax; 00389 float m_StartPosX; 00390 float m_StartPosY; 00391 HTClient* m_InfoWindowTimer; 00397 static bool InfowWindowTimerClbk(float request_time, float actual_time, void * user_data); 00400 void DoTimer(); 00402 void FlushInternal(); 00403 00404 float m_TimeStamp; 00405 float m_transmission; 00406 bool m_bEraseAfterDisplay; 00407 int m_TempDisplayLength; 00408 int m_DefaultDisplayLength; 00410 }; 00411 00412 00414 00419 class MVO_API HLightsObject : public HObject, public HObjectManipulationListener 00420 { 00421 public: 00426 HLightsObject(HBaseView *view); 00427 ~HLightsObject(); 00431 static const char * GetStaticName(); 00432 00436 const char * GetName(); 00437 00445 int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 00446 00454 static void InsertLocalLight(HBaseView *view, HPoint &pos); 00463 static void InsertDistantLight(HBaseView *view, HPoint &pos); 00473 static void InsertSpotLight(HBaseView *view, HPoint &pos); 00474 00480 static void TurnLightsOnOff(HBaseView *view,bool onoff); 00481 00482 protected: 00491 static void SetupLightSegment(HBaseView *view, HPoint &pos, HC_KEY &outerkey, HC_KEY &geometrykey); 00492 00501 static void SetupLightSegmentFromKey(HBaseView *view, HPoint &pos, HC_KEY &outerkey, HC_KEY &geometrykey); 00502 00503 00504 HBaseView *m_pView; 00506 }; 00507 00508 00510 00515 class MVO_API HDraggerObject : public HObject, public HObjectManipulationListener 00516 { 00517 public: 00523 HDraggerObject(HBaseView *view = 0); 00524 ~HDraggerObject(); 00528 static const char * GetStaticName(); 00532 const char * GetName(); 00542 void SetupDraggerSegment(HBaseView *view, HPoint &pos, float *rotmat, HC_KEY &outerkey, HC_KEY &geometrykey); 00555 HC_KEY Insert(HBaseView *view, HPoint &pos, float *rot, HBhvAnimation *ani, HBhvAnimation *rotani, int kfr, bool allowpos); 00556 00564 int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 00573 int ObjectMovedEvent(HBaseView *view, HC_KEY key, HPoint *pos); 00574 00575 protected: 00576 HBaseView *m_pView; 00578 }; 00579 00580 00581 00582 #ifdef H_PACK_8 00583 #pragma pack(pop) 00584 #endif 00585 00586 #endif 00587 00588 00589