llcompilequeue.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLCOMPILEQUEUE_H
00033 #define LL_LLCOMPILEQUEUE_H
00034 
00035 #include "lldarray.h"
00036 #include "llinventory.h"
00037 #include "llviewerobject.h"
00038 #include "llvoinventorylistener.h"
00039 #include "llmap.h"
00040 #include "lluuid.h"
00041 
00042 #include "llfloater.h"
00043 #include "llscrolllistctrl.h"
00044 
00045 #include "llviewerinventory.h"
00046 
00047 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00048 // Class LLFloaterScriptQueue
00049 //
00050 // This class provides a mechanism of adding objects to a list that
00051 // will go through and execute action for the scripts on each object. The
00052 // objects will be accessed serially and the scripts may be
00053 // manipulated in parallel. For example, selecting two objects each
00054 // with three scripts will result in the first object having all three
00055 // scripts manipulated.
00056 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00057 
00058 class LLFloaterScriptQueue : public LLFloater, public LLVOInventoryListener
00059 {
00060 public:
00061         // addObject() accepts an object id.
00062         void addObject(const LLUUID& id);
00063 
00064         // start() returns TRUE if the queue has started, otherwise FALSE.
00065         BOOL start();
00066 
00067 protected:
00068         LLFloaterScriptQueue(const std::string& name, const LLRect& rect,
00069                                                  const char* title, const char* start_string);
00070         virtual ~LLFloaterScriptQueue();
00071 
00072         // This is the callback method for the viewer object currently
00073         // being worked on.
00074         /*virtual*/ void inventoryChanged(LLViewerObject* obj,
00075                                                                  InventoryObjectList* inv,
00076                                                                  S32 serial_num,
00077                                                                  void* queue);
00078         
00079         // This is called by inventoryChanged
00080         virtual void handleInventory(LLViewerObject* viewer_obj,
00081                                                                 InventoryObjectList* inv) = 0;
00082 
00083         static void onCloseBtn(void* user_data);
00084 
00085         // returns true if this is done
00086         BOOL isDone() const;
00087 
00088         // go to the next object. If no objects left, it falls out
00089         // silently and waits to be killed by the deleteIfDone() callback.
00090         BOOL nextObject();
00091         BOOL popNext();
00092 
00093         // Get this instances ID.
00094         const LLUUID& getID() const { return mID; } 
00095 
00096         // find an instance by ID. Return NULL if it does not exist.
00097         static LLFloaterScriptQueue* findInstance(const LLUUID& id);
00098         
00099 protected:
00100         // UI
00101         LLScrollListCtrl* mMessages;
00102         LLButton* mCloseBtn;
00103 
00104         // Object Queue
00105         LLDynamicArray<LLUUID> mObjectIDs;
00106         LLUUID mCurrentObjectID;
00107         BOOL mDone;
00108 
00109         LLUUID mID;
00110         static LLMap<LLUUID, LLFloaterScriptQueue*> sInstances;
00111 
00112         const char* mStartString;
00113 };
00114 
00115 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00116 // Class LLFloaterCompileQueue
00117 //
00118 // This script queue will recompile each script.
00119 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00120 
00121 class LLFloaterCompileQueue : public LLFloaterScriptQueue
00122 {
00123 public:
00124         // Use this method to create a compile queue. Once created, it
00125         // will be responsible for it's own destruction.
00126         static LLFloaterCompileQueue* create();
00127 
00128 protected:
00129         LLFloaterCompileQueue(const std::string& name, const LLRect& rect);
00130         virtual ~LLFloaterCompileQueue();
00131         
00132         // This is called by inventoryChanged
00133         virtual void handleInventory(LLViewerObject* viewer_obj,
00134                                                                 InventoryObjectList* inv);
00135 
00136         // This is the callback for when each script arrives
00137         static void scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
00138                                                                 LLAssetType::EType type,
00139                                                                 void* user_data, S32 status, LLExtStat ext_status);
00140 
00141         static void onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status);
00142         static void onSaveBytecodeComplete(const LLUUID& asset_id,
00143                                                                            void* user_data,
00144                                                                            S32 status, LLExtStat ext_status);
00145 
00146         // compile the file given and save it out.
00147         void compile(const char* filename, const LLUUID& asset_id);
00148         
00149         // remove any object in mScriptScripts with the matching uuid.
00150         void removeItemByAssetID(const LLUUID& asset_id);
00151 
00152         // save the items indicatd by the asset id.
00153         void saveItemByAssetID(const LLUUID& asset_id);
00154 
00155         // find old_asst_id, and set the asset id to new_asset_id
00156         void updateAssetID(const LLUUID& old_asset_id, const LLUUID& new_asset_id);
00157 
00158 protected:
00159         LLViewerInventoryItem::item_array_t mCurrentScripts;
00160 };
00161 
00162 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00163 // Class LLFloaterResetQueue
00164 //
00165 // This script queue will reset each script.
00166 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00167 
00168 class LLFloaterResetQueue : public LLFloaterScriptQueue
00169 {
00170 public:
00171         // Use this method to create a reset queue. Once created, it
00172         // will be responsible for it's own destruction.
00173         static LLFloaterResetQueue* create();
00174 
00175 protected:
00176         LLFloaterResetQueue(const std::string& name, const LLRect& rect);
00177         virtual ~LLFloaterResetQueue();
00178         
00179         // This is called by inventoryChanged
00180         virtual void handleInventory(LLViewerObject* viewer_obj,
00181                                                                 InventoryObjectList* inv);
00182 
00183 protected:
00184 };
00185 
00186 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00187 // Class LLFloaterRunQueue
00188 //
00189 // This script queue will set each script as running.
00190 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00191 
00192 class LLFloaterRunQueue : public LLFloaterScriptQueue
00193 {
00194 public:
00195         // Use this method to create a run queue. Once created, it
00196         // will be responsible for it's own destruction.
00197         static LLFloaterRunQueue* create();
00198 
00199 protected:
00200         LLFloaterRunQueue(const std::string& name, const LLRect& rect);
00201         virtual ~LLFloaterRunQueue();
00202         
00203         // This is called by inventoryChanged
00204         virtual void handleInventory(LLViewerObject* viewer_obj,
00205                                                                 InventoryObjectList* inv);
00206 
00207 protected:
00208 };
00209 
00210 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00211 // Class LLFloaterNotRunQueue
00212 //
00213 // This script queue will set each script as not running.
00214 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00215 
00216 class LLFloaterNotRunQueue : public LLFloaterScriptQueue
00217 {
00218 public:
00219         // Use this method to create a not run queue. Once created, it
00220         // will be responsible for it's own destruction.
00221         static LLFloaterNotRunQueue* create();
00222 
00223 protected:
00224         LLFloaterNotRunQueue(const std::string& name, const LLRect& rect);
00225         virtual ~LLFloaterNotRunQueue();
00226         
00227         // This is called by inventoryChanged
00228         virtual void handleInventory(LLViewerObject* viewer_obj,
00229                                                                 InventoryObjectList* inv);
00230 
00231 protected:
00232 };
00233 
00234 #endif // LL_LLCOMPILEQUEUE_H

Generated on Fri May 16 08:33:16 2008 for SecondLife by  doxygen 1.5.5