summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewscript.h')
-rw-r--r--indra/newview/llpreviewscript.h44
1 files changed, 35 insertions, 9 deletions
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index f4b31e5962..f86be615c4 100644
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -35,6 +35,7 @@
#include "lliconctrl.h"
#include "llframetimer.h"
+class LLLiveLSLFile;
class LLMessageSystem;
class LLTextEditor;
class LLButton;
@@ -47,6 +48,7 @@ class LLFloaterScriptSearch;
class LLKeywordToken;
class LLVFS;
class LLViewerInventoryItem;
+class LLScriptEdContainer;
// Inner, implementation class. LLPreviewScript and LLLiveLSLEditor each own one of these.
class LLScriptEdCore : public LLPanel
@@ -55,9 +57,12 @@ class LLScriptEdCore : public LLPanel
friend class LLPreviewLSL;
friend class LLLiveLSLEditor;
friend class LLFloaterScriptSearch;
+ friend class LLScriptEdContainer;
-public:
+protected:
+ // Supposed to be invoked only by the container.
LLScriptEdCore(
+ LLScriptEdContainer* container,
const std::string& sample,
const LLHandle<LLFloater>& floater_handle,
void (*load_callback)(void* userdata),
@@ -65,6 +70,7 @@ public:
void (*search_replace_callback)(void* userdata),
void* userdata,
S32 bottom_pad = 0); // pad below bottom row of buttons
+public:
~LLScriptEdCore();
void initMenu();
@@ -72,14 +78,20 @@ public:
virtual void draw();
/*virtual*/ BOOL postBuild();
BOOL canClose();
+ void setEnableEditing(bool enable);
void setScriptText(const std::string& text, BOOL is_valid);
+ bool loadScriptText(const std::string& filename);
+ bool writeToFile(const std::string& filename);
+ void sync();
void doSave( BOOL close_after_save );
bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
bool handleReloadFromServerDialog(const LLSD& notification, const LLSD& response);
+ void openInExternalEditor();
+
static void onCheckLock(LLUICtrl*, void*);
static void onHelpComboCommit(LLUICtrl* ctrl, void* userdata);
static void onClickBack(void* userdata);
@@ -127,11 +139,28 @@ private:
S32 mLiveHelpHistorySize;
BOOL mEnableSave;
BOOL mHasScriptData;
+ LLLiveLSLFile* mLiveFile;
+
+ LLScriptEdContainer* mContainer; // parent view
};
+class LLScriptEdContainer : public LLPreview
+{
+ friend class LLScriptEdCore;
+
+public:
+ LLScriptEdContainer(const LLSD& key);
+
+protected:
+ std::string getTmpFileName();
+ bool onExternalChange(const std::string& filename);
+ virtual void saveIfNeeded(bool sync = true) = 0;
+
+ LLScriptEdCore* mScriptEd;
+};
// Used to view and edit a LSL from your inventory.
-class LLPreviewLSL : public LLPreview
+class LLPreviewLSL : public LLScriptEdContainer
{
public:
LLPreviewLSL(const LLSD& key );
@@ -145,7 +174,7 @@ protected:
void closeIfNeeded();
virtual void loadAsset();
- void saveIfNeeded();
+ /*virtual*/ void saveIfNeeded(bool sync = true);
void uploadAssetViaCaps(const std::string& url,
const std::string& filename,
const LLUUID& item_id);
@@ -169,7 +198,6 @@ protected:
protected:
- LLScriptEdCore* mScriptEd;
// Can safely close only after both text and bytecode are uploaded
S32 mPendingUploads;
@@ -177,11 +205,11 @@ protected:
// Used to view and edit an LSL that is attached to an object.
-class LLLiveLSLEditor : public LLPreview
+class LLLiveLSLEditor : public LLScriptEdContainer
{
+ friend class LLLiveLSLFile;
public:
LLLiveLSLEditor(const LLSD& key);
- ~LLLiveLSLEditor();
static void processScriptRunningReply(LLMessageSystem* msg, void**);
@@ -202,7 +230,7 @@ private:
virtual void loadAsset();
void loadAsset(BOOL is_new);
- void saveIfNeeded();
+ /*virtual*/ void saveIfNeeded(bool sync = true);
void uploadAssetViaCaps(const std::string& url,
const std::string& filename,
const LLUUID& task_id,
@@ -227,7 +255,6 @@ private:
static void onRunningCheckboxClicked(LLUICtrl*, void* userdata);
static void onReset(void* userdata);
-// void loadScriptText(const std::string& filename); // unused
void loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type);
static void onErrorList(LLUICtrl*, void* user_data);
@@ -238,7 +265,6 @@ private:
private:
bool mIsNew;
- LLScriptEdCore* mScriptEd;
//LLUUID mTransmitID;
LLCheckBoxCtrl* mRunningCheckbox;
BOOL mAskedForRunningInfo;