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 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 class LLFloaterScriptQueue : public LLFloater, public LLVOInventoryListener
00059 {
00060 public:
00061         
00062         void addObject(const LLUUID& id);
00063 
00064         
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         
00073         
00074          void inventoryChanged(LLViewerObject* obj,
00075                                                                  InventoryObjectList* inv,
00076                                                                  S32 serial_num,
00077                                                                  void* queue);
00078         
00079         
00080         virtual void handleInventory(LLViewerObject* viewer_obj,
00081                                                                 InventoryObjectList* inv) = 0;
00082 
00083         static void onCloseBtn(void* user_data);
00084 
00085         
00086         BOOL isDone() const;
00087 
00088         
00089         
00090         BOOL nextObject();
00091         BOOL popNext();
00092 
00093         
00094         const LLUUID& getID() const { return mID; } 
00095 
00096         
00097         static LLFloaterScriptQueue* findInstance(const LLUUID& id);
00098         
00099 protected:
00100         
00101         LLScrollListCtrl* mMessages;
00102         LLButton* mCloseBtn;
00103 
00104         
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 
00117 
00118 
00119 
00120 
00121 class LLFloaterCompileQueue : public LLFloaterScriptQueue
00122 {
00123 public:
00124         
00125         
00126         static LLFloaterCompileQueue* create();
00127 
00128 protected:
00129         LLFloaterCompileQueue(const std::string& name, const LLRect& rect);
00130         virtual ~LLFloaterCompileQueue();
00131         
00132         
00133         virtual void handleInventory(LLViewerObject* viewer_obj,
00134                                                                 InventoryObjectList* inv);
00135 
00136         
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         
00147         void compile(const char* filename, const LLUUID& asset_id);
00148         
00149         
00150         void removeItemByAssetID(const LLUUID& asset_id);
00151 
00152         
00153         void saveItemByAssetID(const LLUUID& asset_id);
00154 
00155         
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 
00164 
00165 
00166 
00167 
00168 class LLFloaterResetQueue : public LLFloaterScriptQueue
00169 {
00170 public:
00171         
00172         
00173         static LLFloaterResetQueue* create();
00174 
00175 protected:
00176         LLFloaterResetQueue(const std::string& name, const LLRect& rect);
00177         virtual ~LLFloaterResetQueue();
00178         
00179         
00180         virtual void handleInventory(LLViewerObject* viewer_obj,
00181                                                                 InventoryObjectList* inv);
00182 
00183 protected:
00184 };
00185 
00186 
00187 
00188 
00189 
00190 
00191 
00192 class LLFloaterRunQueue : public LLFloaterScriptQueue
00193 {
00194 public:
00195         
00196         
00197         static LLFloaterRunQueue* create();
00198 
00199 protected:
00200         LLFloaterRunQueue(const std::string& name, const LLRect& rect);
00201         virtual ~LLFloaterRunQueue();
00202         
00203         
00204         virtual void handleInventory(LLViewerObject* viewer_obj,
00205                                                                 InventoryObjectList* inv);
00206 
00207 protected:
00208 };
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 class LLFloaterNotRunQueue : public LLFloaterScriptQueue
00217 {
00218 public:
00219         
00220         
00221         static LLFloaterNotRunQueue* create();
00222 
00223 protected:
00224         LLFloaterNotRunQueue(const std::string& name, const LLRect& rect);
00225         virtual ~LLFloaterNotRunQueue();
00226         
00227         
00228         virtual void handleInventory(LLViewerObject* viewer_obj,
00229                                                                 InventoryObjectList* inv);
00230 
00231 protected:
00232 };
00233 
00234 #endif // LL_LLCOMPILEQUEUE_H