00001 
00032 #ifndef LL_LLTOOLBRUSH_H
00033 #define LL_LLTOOLBRUSH_H
00034 
00035 #include "lltool.h"
00036 #include "v3math.h"
00037 #include "lleditmenuhandler.h"
00038 
00039 class LLSurface;
00040 class LLVector3d;
00041 class LLViewerRegion;
00042 
00043 template<class DATA_TYPE> class LLLinkedList;
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 class LLToolBrushLand : public LLTool, public LLEditMenuHandler
00052 {
00053 public:
00054         LLToolBrushLand();
00055         
00056         
00057         virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
00058         virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );          
00059         virtual BOOL handleHover( S32 x, S32 y, MASK mask );
00060         virtual void handleSelect();
00061         virtual void handleDeselect();
00062 
00063         
00064         
00065         virtual BOOL isAlwaysRendered() { return TRUE; }
00066 
00067         
00068         virtual void render();
00069 
00070         
00071         static void onIdle(void* brush_tool);  
00072 
00073         void                    onMouseCaptureLost();
00074 
00075         void modifyLandInSelectionGlobal();
00076         virtual void    undo();
00077         virtual BOOL    canUndo()       { return TRUE; }
00078 
00079         
00080         virtual BOOL    canRedo()       { return FALSE; }
00081 
00082 
00083 protected:
00084         void brush( void );
00085         void modifyLandAtPointGlobal( const LLVector3d &spot, MASK mask );
00086 
00087         void determineAffectedRegions(LLLinkedList<LLViewerRegion>& regions,
00088                                                                   const LLVector3d& spot) const;
00089         void renderOverlay(LLSurface& land, const LLVector3& pos_region,
00090                                            const LLVector3& pos_world);
00091 
00092         
00093         bool canTerraform(LLViewerRegion* regionp) const;
00094 
00095         
00096         void alertNoTerraform(LLViewerRegion* regionp);
00097 
00098 protected:
00099         F32 mStartingZ;
00100         S32 mMouseX;
00101         S32 mMouseY;
00102         S32 mBrushIndex;
00103         BOOL mGotHover;
00104         BOOL mLastShowParcelOwners;
00105         BOOL mBrushSelected;
00106         LLLinkedList<LLViewerRegion> mLastAffectedRegions;
00107 };
00108 
00109 extern LLToolBrushLand *gToolLand;
00110 
00111 #endif // LL_LLTOOLBRUSH_H