From a5261a5fa8fad810ecb5c260d92c3e771822bf58 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Feb 2024 23:46:23 +0100 Subject: Convert BOOL to bool in llui --- indra/newview/llpreviewscript.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'indra/newview/llpreviewscript.h') diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index b01c7fd4ad..11a02400cd 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -95,13 +95,11 @@ protected: public: ~LLScriptEdCore(); - void initializeKeywords(); void initMenu(); void processKeywords(); - void processLoaded(); virtual void draw(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); BOOL canClose(); void setEnableEditing(bool enable); bool canLoadOrSaveToFile( void* userdata ); @@ -153,7 +151,7 @@ private: void selectFirstError(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); void enableSave(BOOL b) {mEnableSave = b;} @@ -223,11 +221,11 @@ public: virtual void callbackLSLCompileSucceeded(); virtual void callbackLSLCompileFailed(const LLSD& compile_errors); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); protected: virtual void draw(); - virtual BOOL canClose(); + virtual bool canClose(); void closeIfNeeded(); virtual void loadAsset(); @@ -269,7 +267,7 @@ public: bool is_script_running); virtual void callbackLSLCompileFailed(const LLSD& compile_errors); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); void setIsNew() { mIsNew = TRUE; } @@ -282,15 +280,13 @@ public: void updateExperiencePanel(); void requestExperiences(); void experienceChanged(); - void addAssociatedExperience(const LLSD& experience); private: - virtual BOOL canClose(); + virtual bool canClose(); void closeIfNeeded(); virtual void draw(); virtual void loadAsset(); - void loadAsset(BOOL is_new); /*virtual*/ void saveIfNeeded(bool sync = true); BOOL monoChecked() const; @@ -307,8 +303,6 @@ private: void loadScriptText(const LLUUID &uuid, LLAssetType::EType type); - static void onErrorList(LLUICtrl*, void* user_data); - static void* createScriptEdPanel(void* userdata); static void onMonoCheckboxClicked(LLUICtrl*, void* userdata); -- cgit v1.2.3 From 0fb52bd372aad468c890fc57f4ae3b8be7dad463 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Wed, 21 Feb 2024 03:31:20 +0200 Subject: viewer#848 Xcode buildfix --- indra/newview/llpreviewscript.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpreviewscript.h') diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 11a02400cd..a0cef6553a 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -313,10 +313,10 @@ private: private: bool mIsNew; //LLUUID mTransmitID; - LLCheckBoxCtrl* mRunningCheckbox; + //LLCheckBoxCtrl* mRunningCheckbox; BOOL mAskedForRunningInfo; BOOL mHaveRunningInfo; - LLButton* mResetButton; + //LLButton* mResetButton; LLPointer mItem; BOOL mCloseAfterSave; // need to save both text and script, so need to decide when done -- cgit v1.2.3 From 60d3dd98a44230c21803c1606552ee098ed9fa7c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 21 Feb 2024 21:05:14 +0100 Subject: Convert remaining BOOL to bool --- indra/newview/llpreviewscript.h | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'indra/newview/llpreviewscript.h') diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index a0cef6553a..4fbfd989c1 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -87,7 +87,7 @@ protected: const std::string& sample, const LLHandle& floater_handle, void (*load_callback)(void* userdata), - void (*save_callback)(void* userdata, BOOL close_after_save), + void (*save_callback)(void* userdata, bool close_after_save), void (*search_replace_callback)(void* userdata), void* userdata, bool live, @@ -100,17 +100,17 @@ public: virtual void draw(); /*virtual*/ bool postBuild(); - BOOL canClose(); + bool canClose(); void setEnableEditing(bool enable); bool canLoadOrSaveToFile( void* userdata ); - void setScriptText(const std::string& text, BOOL is_valid); + void setScriptText(const std::string& text, bool is_valid); void makeEditorPristine(); bool loadScriptText(const std::string& filename); bool writeToFile(const std::string& filename); void sync(); - void doSave( BOOL close_after_save ); + void doSave( bool close_after_save ); bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response); bool handleReloadFromServerDialog(const LLSD& notification, const LLSD& response); @@ -153,12 +153,12 @@ private: virtual bool handleKeyHere(KEY key, MASK mask); - void enableSave(BOOL b) {mEnableSave = b;} + void enableSave(bool b) {mEnableSave = b;} protected: void deleteBridges(); void setHelpPage(const std::string& help_string); - void updateDynamicHelp(BOOL immediate = FALSE); + void updateDynamicHelp(bool immediate = false); bool isKeyword(LLKeywordToken* token); void addHelpItemToHistory(const std::string& help_string); static void onErrorList(LLUICtrl*, void* user_data); @@ -170,11 +170,11 @@ private: std::string mScriptName; LLScriptEditor* mEditor; void (*mLoadCallback)(void* userdata); - void (*mSaveCallback)(void* userdata, BOOL close_after_save); + void (*mSaveCallback)(void* userdata, bool close_after_save); void (*mSearchReplaceCallback) (void* userdata); void* mUserdata; LLComboBox *mFunctions; - BOOL mForceClose; + bool mForceClose; LLPanel* mCodePanel; LLScrollListCtrl* mErrorList; std::vector mBridges; @@ -182,12 +182,12 @@ private: LLKeywordToken* mLastHelpToken; LLFrameTimer mLiveHelpTimer; S32 mLiveHelpHistorySize; - BOOL mEnableSave; - BOOL mHasScriptData; + bool mEnableSave; + bool mHasScriptData; LLLiveLSLFile* mLiveFile; LLUUID mAssociatedExperience; - BOOL mScriptRemoved; - BOOL mSaveDialogShown; + bool mScriptRemoved; + bool mSaveDialogShown; LLUUID mAssetID; LLScriptEdContainer* mContainer; // parent view @@ -233,7 +233,7 @@ protected: static void onSearchReplace(void* userdata); static void onLoad(void* userdata); - static void onSave(void* userdata, BOOL close_after_save); + static void onSave(void* userdata, bool close_after_save); static void onLoadComplete(const LLUUID& uuid, LLAssetType::EType type, @@ -269,7 +269,7 @@ public: /*virtual*/ bool postBuild(); - void setIsNew() { mIsNew = TRUE; } + void setIsNew() { mIsNew = true; } static void setAssociatedExperience( LLHandle editor, const LLSD& experience ); static void onToggleExperience(LLUICtrl *ui, void* userdata); @@ -288,12 +288,12 @@ private: virtual void loadAsset(); /*virtual*/ void saveIfNeeded(bool sync = true); - BOOL monoChecked() const; + bool monoChecked() const; static void onSearchReplace(void* userdata); static void onLoad(void* userdata); - static void onSave(void* userdata, BOOL close_after_save); + static void onSave(void* userdata, bool close_after_save); static void onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type, @@ -314,20 +314,20 @@ private: bool mIsNew; //LLUUID mTransmitID; //LLCheckBoxCtrl* mRunningCheckbox; - BOOL mAskedForRunningInfo; - BOOL mHaveRunningInfo; + bool mAskedForRunningInfo; + bool mHaveRunningInfo; //LLButton* mResetButton; LLPointer mItem; - BOOL mCloseAfterSave; + bool mCloseAfterSave; // need to save both text and script, so need to decide when done S32 mPendingUploads; - BOOL mIsSaving; + bool mIsSaving; - BOOL getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert + bool getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert LLCheckBoxCtrl* mMonoCheckbox; - BOOL mIsModifiable; + bool mIsModifiable; LLComboBox* mExperiences; -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/newview/llpreviewscript.h | 718 ++++++++++++++++++++-------------------- 1 file changed, 359 insertions(+), 359 deletions(-) (limited to 'indra/newview/llpreviewscript.h') diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 84933bcedf..9a3bc35f12 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -1,359 +1,359 @@ -/** - * @file llpreviewscript.h - * @brief LLPreviewScript class definition - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLPREVIEWSCRIPT_H -#define LL_LLPREVIEWSCRIPT_H - -#include "llpreview.h" -#include "lltabcontainer.h" -#include "llinventory.h" -#include "llcombobox.h" -#include "lliconctrl.h" -#include "llframetimer.h" -#include "llfloatergotoline.h" -#include "lllivefile.h" -#include "llsyntaxid.h" -#include "llscripteditor.h" - -class LLLiveLSLFile; -class LLMessageSystem; -class LLScriptEditor; -class LLButton; -class LLCheckBoxCtrl; -class LLScrollListCtrl; -class LLViewerObject; -struct LLEntryAndEdCore; -class LLMenuBarGL; -class LLFloaterScriptSearch; -class LLKeywordToken; -class LLViewerInventoryItem; -class LLScriptEdContainer; -class LLFloaterGotoLine; -class LLFloaterExperienceProfile; -class LLScriptMovedObserver; - -class LLLiveLSLFile : public LLLiveFile -{ -public: - typedef boost::function change_callback_t; - - LLLiveLSLFile(std::string file_path, change_callback_t change_cb); - ~LLLiveLSLFile(); - - void ignoreNextUpdate() { mIgnoreNextUpdate = true; } - -protected: - /*virtual*/ bool loadFile(); - - change_callback_t mOnChangeCallback; - bool mIgnoreNextUpdate; -}; - -// Inner, implementation class. LLPreviewScript and LLLiveLSLEditor each own one of these. -class LLScriptEdCore : public LLPanel -{ - friend class LLPreviewScript; - friend class LLPreviewLSL; - friend class LLLiveLSLEditor; - friend class LLFloaterScriptSearch; - friend class LLScriptEdContainer; - friend class LLFloaterGotoLine; - -protected: - // Supposed to be invoked only by the container. - LLScriptEdCore( - LLScriptEdContainer* container, - const std::string& sample, - const LLHandle& floater_handle, - void (*load_callback)(void* userdata), - void (*save_callback)(void* userdata, bool close_after_save), - void (*search_replace_callback)(void* userdata), - void* userdata, - bool live, - S32 bottom_pad = 0); // pad below bottom row of buttons -public: - ~LLScriptEdCore(); - - void initMenu(); - void processKeywords(); - - virtual void draw(); - /*virtual*/ bool postBuild(); - bool canClose(); - void setEnableEditing(bool enable); - bool canLoadOrSaveToFile( void* userdata ); - - void setScriptText(const std::string& text, bool is_valid); - void makeEditorPristine(); - 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); - static void onClickForward(void* userdata); - static void onBtnInsertSample(void*); - static void onBtnInsertFunction(LLUICtrl*, void*); - static void onBtnLoadFromFile(void*); - static void onBtnSaveToFile(void*); - - static void loadScriptFromFile(const std::vector& filenames, void* data); - static void saveScriptToFile(const std::vector& filenames, void* data); - - static bool enableSaveToFileMenu(void* userdata); - static bool enableLoadFromFileMenu(void* userdata); - - virtual bool hasAccelerators() const { return true; } - LLUUID getAssociatedExperience()const; - void setAssociatedExperience( const LLUUID& experience_id ); - - void setScriptName(const std::string& name){mScriptName = name;}; - - void setItemRemoved(bool script_removed){mScriptRemoved = script_removed;}; - - void setAssetID( const LLUUID& asset_id){ mAssetID = asset_id; }; - LLUUID getAssetID() { return mAssetID; } - - bool isFontSizeChecked(const LLSD &userdata); - void onChangeFontSize(const LLSD &size_name); - - virtual bool handleKeyHere(KEY key, MASK mask); - void selectAll() { mEditor->selectAll(); } - - private: - void onBtnDynamicHelp(); - void onBtnUndoChanges(); - - bool hasChanged(); - - void selectFirstError(); - - void enableSave(bool b) {mEnableSave = b;} - -protected: - void deleteBridges(); - void setHelpPage(const std::string& help_string); - void updateDynamicHelp(bool immediate = false); - bool isKeyword(LLKeywordToken* token); - void addHelpItemToHistory(const std::string& help_string); - static void onErrorList(LLUICtrl*, void* user_data); - - bool mLive; - -private: - std::string mSampleText; - std::string mScriptName; - LLScriptEditor* mEditor; - void (*mLoadCallback)(void* userdata); - void (*mSaveCallback)(void* userdata, bool close_after_save); - void (*mSearchReplaceCallback) (void* userdata); - void* mUserdata; - LLComboBox *mFunctions; - bool mForceClose; - LLPanel* mCodePanel; - LLScrollListCtrl* mErrorList; - std::vector mBridges; - LLHandle mLiveHelpHandle; - LLKeywordToken* mLastHelpToken; - LLFrameTimer mLiveHelpTimer; - S32 mLiveHelpHistorySize; - bool mEnableSave; - bool mHasScriptData; - LLLiveLSLFile* mLiveFile; - LLUUID mAssociatedExperience; - bool mScriptRemoved; - bool mSaveDialogShown; - LLUUID mAssetID; - - LLScriptEdContainer* mContainer; // parent view - -public: - boost::signals2::connection mSyntaxIDConnection; - -}; - -class LLScriptEdContainer : public LLPreview -{ - friend class LLScriptEdCore; - -public: - LLScriptEdContainer(const LLSD& key); - LLScriptEdContainer(const LLSD& key, const bool live); - - bool handleKeyHere(KEY key, MASK mask); - -protected: - std::string getTmpFileName(const std::string& script_name); - bool onExternalChange(const std::string& filename); - virtual void saveIfNeeded(bool sync = true) = 0; - - LLScriptEdCore* mScriptEd; -}; - -// Used to view and edit an LSL script from your inventory. -class LLPreviewLSL : public LLScriptEdContainer -{ -public: - LLPreviewLSL(const LLSD& key ); - ~LLPreviewLSL(); - - LLUUID getScriptID() { return mItemUUID; } - - void setDirty() { mDirty = true; } - - virtual void callbackLSLCompileSucceeded(); - virtual void callbackLSLCompileFailed(const LLSD& compile_errors); - - /*virtual*/ bool postBuild(); - -protected: - virtual void draw(); - virtual bool canClose(); - void closeIfNeeded(); - - virtual void loadAsset(); - /*virtual*/ void saveIfNeeded(bool sync = true); - - static void onSearchReplace(void* userdata); - static void onLoad(void* userdata); - static void onSave(void* userdata, bool close_after_save); - - static void onLoadComplete(const LLUUID& uuid, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status); - -protected: - static void* createScriptEdPanel(void* userdata); - - static void finishedLSLUpload(LLUUID itemId, LLSD response); - static bool failedLSLUpload(LLUUID itemId, LLUUID taskId, LLSD response, std::string reason); -protected: - - // Can safely close only after both text and bytecode are uploaded - S32 mPendingUploads; - - LLScriptMovedObserver* mItemObserver; - -}; - - -// Used to view and edit an LSL script that is attached to an object. -class LLLiveLSLEditor : public LLScriptEdContainer -{ - friend class LLLiveLSLFile; -public: - LLLiveLSLEditor(const LLSD& key); - - - static void processScriptRunningReply(LLMessageSystem* msg, void**); - - virtual void callbackLSLCompileSucceeded(const LLUUID& task_id, - const LLUUID& item_id, - bool is_script_running); - virtual void callbackLSLCompileFailed(const LLSD& compile_errors); - - /*virtual*/ bool postBuild(); - - void setIsNew() { mIsNew = true; } - - static void setAssociatedExperience( LLHandle editor, const LLSD& experience ); - static void onToggleExperience(LLUICtrl *ui, void* userdata); - static void onViewProfile(LLUICtrl *ui, void* userdata); - - void setExperienceIds(const LLSD& experience_ids); - void buildExperienceList(); - void updateExperiencePanel(); - void requestExperiences(); - void experienceChanged(); - - void setObjectName(std::string name) { mObjectName = name; } - -private: - virtual bool canClose(); - void closeIfNeeded(); - virtual void draw(); - - virtual void loadAsset(); - /*virtual*/ void saveIfNeeded(bool sync = true); - bool monoChecked() const; - - - static void onSearchReplace(void* userdata); - static void onLoad(void* userdata); - static void onSave(void* userdata, bool close_after_save); - - static void onLoadComplete(const LLUUID& asset_uuid, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status); - static void onRunningCheckboxClicked(LLUICtrl*, void* userdata); - static void onReset(void* userdata); - - void loadScriptText(const LLUUID &uuid, LLAssetType::EType type); - - static void* createScriptEdPanel(void* userdata); - - static void onMonoCheckboxClicked(LLUICtrl*, void* userdata); - - static void finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, bool isRunning); - static void receiveExperienceIds(LLSD result, LLHandle parent); - -private: - bool mIsNew; - //LLUUID mTransmitID; - //LLCheckBoxCtrl* mRunningCheckbox; - bool mAskedForRunningInfo; - bool mHaveRunningInfo; - //LLButton* mResetButton; - LLPointer mItem; - bool mCloseAfterSave; - // need to save both text and script, so need to decide when done - S32 mPendingUploads; - - bool mIsSaving; - - bool getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert - - LLCheckBoxCtrl* mMonoCheckbox; - bool mIsModifiable; - - - LLComboBox* mExperiences; - LLCheckBoxCtrl* mExperienceEnabled; - LLSD mExperienceIds; - - LLHandle mExperienceProfile; - std::string mObjectName; -}; - -#endif // LL_LLPREVIEWSCRIPT_H +/** + * @file llpreviewscript.h + * @brief LLPreviewScript class definition + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPREVIEWSCRIPT_H +#define LL_LLPREVIEWSCRIPT_H + +#include "llpreview.h" +#include "lltabcontainer.h" +#include "llinventory.h" +#include "llcombobox.h" +#include "lliconctrl.h" +#include "llframetimer.h" +#include "llfloatergotoline.h" +#include "lllivefile.h" +#include "llsyntaxid.h" +#include "llscripteditor.h" + +class LLLiveLSLFile; +class LLMessageSystem; +class LLScriptEditor; +class LLButton; +class LLCheckBoxCtrl; +class LLScrollListCtrl; +class LLViewerObject; +struct LLEntryAndEdCore; +class LLMenuBarGL; +class LLFloaterScriptSearch; +class LLKeywordToken; +class LLViewerInventoryItem; +class LLScriptEdContainer; +class LLFloaterGotoLine; +class LLFloaterExperienceProfile; +class LLScriptMovedObserver; + +class LLLiveLSLFile : public LLLiveFile +{ +public: + typedef boost::function change_callback_t; + + LLLiveLSLFile(std::string file_path, change_callback_t change_cb); + ~LLLiveLSLFile(); + + void ignoreNextUpdate() { mIgnoreNextUpdate = true; } + +protected: + /*virtual*/ bool loadFile(); + + change_callback_t mOnChangeCallback; + bool mIgnoreNextUpdate; +}; + +// Inner, implementation class. LLPreviewScript and LLLiveLSLEditor each own one of these. +class LLScriptEdCore : public LLPanel +{ + friend class LLPreviewScript; + friend class LLPreviewLSL; + friend class LLLiveLSLEditor; + friend class LLFloaterScriptSearch; + friend class LLScriptEdContainer; + friend class LLFloaterGotoLine; + +protected: + // Supposed to be invoked only by the container. + LLScriptEdCore( + LLScriptEdContainer* container, + const std::string& sample, + const LLHandle& floater_handle, + void (*load_callback)(void* userdata), + void (*save_callback)(void* userdata, bool close_after_save), + void (*search_replace_callback)(void* userdata), + void* userdata, + bool live, + S32 bottom_pad = 0); // pad below bottom row of buttons +public: + ~LLScriptEdCore(); + + void initMenu(); + void processKeywords(); + + virtual void draw(); + /*virtual*/ bool postBuild(); + bool canClose(); + void setEnableEditing(bool enable); + bool canLoadOrSaveToFile( void* userdata ); + + void setScriptText(const std::string& text, bool is_valid); + void makeEditorPristine(); + 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); + static void onClickForward(void* userdata); + static void onBtnInsertSample(void*); + static void onBtnInsertFunction(LLUICtrl*, void*); + static void onBtnLoadFromFile(void*); + static void onBtnSaveToFile(void*); + + static void loadScriptFromFile(const std::vector& filenames, void* data); + static void saveScriptToFile(const std::vector& filenames, void* data); + + static bool enableSaveToFileMenu(void* userdata); + static bool enableLoadFromFileMenu(void* userdata); + + virtual bool hasAccelerators() const { return true; } + LLUUID getAssociatedExperience()const; + void setAssociatedExperience( const LLUUID& experience_id ); + + void setScriptName(const std::string& name){mScriptName = name;}; + + void setItemRemoved(bool script_removed){mScriptRemoved = script_removed;}; + + void setAssetID( const LLUUID& asset_id){ mAssetID = asset_id; }; + LLUUID getAssetID() { return mAssetID; } + + bool isFontSizeChecked(const LLSD &userdata); + void onChangeFontSize(const LLSD &size_name); + + virtual bool handleKeyHere(KEY key, MASK mask); + void selectAll() { mEditor->selectAll(); } + + private: + void onBtnDynamicHelp(); + void onBtnUndoChanges(); + + bool hasChanged(); + + void selectFirstError(); + + void enableSave(bool b) {mEnableSave = b;} + +protected: + void deleteBridges(); + void setHelpPage(const std::string& help_string); + void updateDynamicHelp(bool immediate = false); + bool isKeyword(LLKeywordToken* token); + void addHelpItemToHistory(const std::string& help_string); + static void onErrorList(LLUICtrl*, void* user_data); + + bool mLive; + +private: + std::string mSampleText; + std::string mScriptName; + LLScriptEditor* mEditor; + void (*mLoadCallback)(void* userdata); + void (*mSaveCallback)(void* userdata, bool close_after_save); + void (*mSearchReplaceCallback) (void* userdata); + void* mUserdata; + LLComboBox *mFunctions; + bool mForceClose; + LLPanel* mCodePanel; + LLScrollListCtrl* mErrorList; + std::vector mBridges; + LLHandle mLiveHelpHandle; + LLKeywordToken* mLastHelpToken; + LLFrameTimer mLiveHelpTimer; + S32 mLiveHelpHistorySize; + bool mEnableSave; + bool mHasScriptData; + LLLiveLSLFile* mLiveFile; + LLUUID mAssociatedExperience; + bool mScriptRemoved; + bool mSaveDialogShown; + LLUUID mAssetID; + + LLScriptEdContainer* mContainer; // parent view + +public: + boost::signals2::connection mSyntaxIDConnection; + +}; + +class LLScriptEdContainer : public LLPreview +{ + friend class LLScriptEdCore; + +public: + LLScriptEdContainer(const LLSD& key); + LLScriptEdContainer(const LLSD& key, const bool live); + + bool handleKeyHere(KEY key, MASK mask); + +protected: + std::string getTmpFileName(const std::string& script_name); + bool onExternalChange(const std::string& filename); + virtual void saveIfNeeded(bool sync = true) = 0; + + LLScriptEdCore* mScriptEd; +}; + +// Used to view and edit an LSL script from your inventory. +class LLPreviewLSL : public LLScriptEdContainer +{ +public: + LLPreviewLSL(const LLSD& key ); + ~LLPreviewLSL(); + + LLUUID getScriptID() { return mItemUUID; } + + void setDirty() { mDirty = true; } + + virtual void callbackLSLCompileSucceeded(); + virtual void callbackLSLCompileFailed(const LLSD& compile_errors); + + /*virtual*/ bool postBuild(); + +protected: + virtual void draw(); + virtual bool canClose(); + void closeIfNeeded(); + + virtual void loadAsset(); + /*virtual*/ void saveIfNeeded(bool sync = true); + + static void onSearchReplace(void* userdata); + static void onLoad(void* userdata); + static void onSave(void* userdata, bool close_after_save); + + static void onLoadComplete(const LLUUID& uuid, + LLAssetType::EType type, + void* user_data, S32 status, LLExtStat ext_status); + +protected: + static void* createScriptEdPanel(void* userdata); + + static void finishedLSLUpload(LLUUID itemId, LLSD response); + static bool failedLSLUpload(LLUUID itemId, LLUUID taskId, LLSD response, std::string reason); +protected: + + // Can safely close only after both text and bytecode are uploaded + S32 mPendingUploads; + + LLScriptMovedObserver* mItemObserver; + +}; + + +// Used to view and edit an LSL script that is attached to an object. +class LLLiveLSLEditor : public LLScriptEdContainer +{ + friend class LLLiveLSLFile; +public: + LLLiveLSLEditor(const LLSD& key); + + + static void processScriptRunningReply(LLMessageSystem* msg, void**); + + virtual void callbackLSLCompileSucceeded(const LLUUID& task_id, + const LLUUID& item_id, + bool is_script_running); + virtual void callbackLSLCompileFailed(const LLSD& compile_errors); + + /*virtual*/ bool postBuild(); + + void setIsNew() { mIsNew = true; } + + static void setAssociatedExperience( LLHandle editor, const LLSD& experience ); + static void onToggleExperience(LLUICtrl *ui, void* userdata); + static void onViewProfile(LLUICtrl *ui, void* userdata); + + void setExperienceIds(const LLSD& experience_ids); + void buildExperienceList(); + void updateExperiencePanel(); + void requestExperiences(); + void experienceChanged(); + + void setObjectName(std::string name) { mObjectName = name; } + +private: + virtual bool canClose(); + void closeIfNeeded(); + virtual void draw(); + + virtual void loadAsset(); + /*virtual*/ void saveIfNeeded(bool sync = true); + bool monoChecked() const; + + + static void onSearchReplace(void* userdata); + static void onLoad(void* userdata); + static void onSave(void* userdata, bool close_after_save); + + static void onLoadComplete(const LLUUID& asset_uuid, + LLAssetType::EType type, + void* user_data, S32 status, LLExtStat ext_status); + static void onRunningCheckboxClicked(LLUICtrl*, void* userdata); + static void onReset(void* userdata); + + void loadScriptText(const LLUUID &uuid, LLAssetType::EType type); + + static void* createScriptEdPanel(void* userdata); + + static void onMonoCheckboxClicked(LLUICtrl*, void* userdata); + + static void finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, bool isRunning); + static void receiveExperienceIds(LLSD result, LLHandle parent); + +private: + bool mIsNew; + //LLUUID mTransmitID; + //LLCheckBoxCtrl* mRunningCheckbox; + bool mAskedForRunningInfo; + bool mHaveRunningInfo; + //LLButton* mResetButton; + LLPointer mItem; + bool mCloseAfterSave; + // need to save both text and script, so need to decide when done + S32 mPendingUploads; + + bool mIsSaving; + + bool getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert + + LLCheckBoxCtrl* mMonoCheckbox; + bool mIsModifiable; + + + LLComboBox* mExperiences; + LLCheckBoxCtrl* mExperienceEnabled; + LLSD mExperienceIds; + + LLHandle mExperienceProfile; + std::string mObjectName; +}; + +#endif // LL_LLPREVIEWSCRIPT_H -- cgit v1.2.3