00001
00032 #ifndef LL_TOOLPLACER_H
00033 #define LL_TOOLPLACER_H
00034
00035 #include "llprimitive.h"
00036 #include "llpanel.h"
00037 #include "lltool.h"
00038
00039 class LLButton;
00040 class LLViewerRegion;
00041
00043
00044
00045 class LLToolPlacer
00046 : public LLTool
00047 {
00048 public:
00049 LLToolPlacer();
00050
00051 virtual BOOL placeObject(S32 x, S32 y, MASK mask);
00052 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
00053 virtual void handleSelect();
00054 virtual void handleDeselect();
00055
00056 static void setObjectType( LLPCode type ) { sObjectType = type; }
00057 static LLPCode getObjectType() { return sObjectType; }
00058
00059 protected:
00060 static LLPCode sObjectType;
00061
00062 private:
00063 BOOL addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics );
00064 BOOL raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face,
00065 BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region );
00066 BOOL addDuplicate(S32 x, S32 y);
00067 };
00068
00070
00071
00072
00073 const S32 TOOL_PLACER_NUM_BUTTONS = 14;
00074
00075
00076 class LLToolPlacerPanel : public LLPanel
00077 {
00078 public:
00079
00080 LLToolPlacerPanel(const std::string& name, const LLRect& rect);
00081
00082 static void setObjectType( void* data );
00083
00084 static LLPCode sCube;
00085 static LLPCode sPrism;
00086 static LLPCode sPyramid;
00087 static LLPCode sTetrahedron;
00088 static LLPCode sCylinder;
00089 static LLPCode sCylinderHemi;
00090 static LLPCode sCone;
00091 static LLPCode sConeHemi;
00092 static LLPCode sTorus;
00093 static LLPCode sSquareTorus;
00094 static LLPCode sTriangleTorus;
00095 static LLPCode sSphere;
00096 static LLPCode sSphereHemi;
00097 static LLPCode sTree;
00098 static LLPCode sGrass;
00099
00100 private:
00101 void addButton( const LLString& up_state, const LLString& down_state, LLPCode* pcode );
00102
00103 private:
00104 static S32 sButtonsAdded;
00105 static LLButton* sButtons[ TOOL_PLACER_NUM_BUTTONS ];
00106 };
00107
00108 #endif