diff options
| author | Cinder <cinder.roxley@phoenixviewer.com> | 2014-04-18 12:52:07 -0600 | 
|---|---|---|
| committer | Cinder <cinder.roxley@phoenixviewer.com> | 2014-04-18 12:52:07 -0600 | 
| commit | 8c39617c9ac469a8635d511142148ad5a38de836 (patch) | |
| tree | 591229faa57bc569504a27b2f14416e721ccc9c2 | |
| parent | 20a7d749cf8ea76c1481022f17153e72670b23ec (diff) | |
Begin moving script editor portions of LLTextEditor to their own derived class.
This should fix the run off segment bugs by not overriding LLTextBase::clearSegments() in LLTextEditor
TODO: Move the rest of the script stuff out of LLTextEditor for simplicity sake
| -rwxr-xr-x | indra/llui/lltextbase.cpp | 1 | ||||
| -rwxr-xr-x | indra/llui/lltexteditor.cpp | 8 | ||||
| -rwxr-xr-x | indra/llui/lltexteditor.h | 1 | ||||
| -rwxr-xr-x | indra/newview/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/newview/llfloatergotoline.cpp | 2 | ||||
| -rwxr-xr-x | indra/newview/llpreviewscript.cpp | 4 | ||||
| -rwxr-xr-x | indra/newview/llpreviewscript.h | 4 | ||||
| -rw-r--r-- | indra/newview/llscripteditor.cpp | 51 | ||||
| -rw-r--r-- | indra/newview/llscripteditor.h | 51 | ||||
| -rwxr-xr-x | indra/newview/skins/default/xui/en/panel_script_ed.xml | 4 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/script_editor.xml | 5 | 
11 files changed, 116 insertions, 17 deletions
| diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index ee16d3de7c..c4664d6fe0 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -923,7 +923,6 @@ void LLTextBase::createDefaultSegment()  	// ensures that there is always at least one segment  	if (mSegments.empty())  	{ -		  		LLStyleConstSP sp(new LLStyle(getStyleParams()));  		LLTextSegmentPtr default_segment = new LLNormalTextSegment( sp, 0, getLength() + 1, *this);  		mSegments.insert(default_segment); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index df8d37e3aa..8120f3f9a1 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2529,14 +2529,6 @@ void LLTextEditor::loadKeywords()  	}  } -void LLTextEditor::clearSegments() -{ -	if (!mSegments.empty()) -	{ -		mSegments.clear(); -	} -} -  void LLTextEditor::updateSegments()  {  	if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly) diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 698153587f..09c56fca5a 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -208,7 +208,6 @@ public:  	const LLTextSegmentPtr	getPreviousSegment() const;  	void			getSelectedSegments(segment_vec_t& segments) const; -	void			clearSegments();  	void			setShowContextMenu(bool show) { mShowContextMenu = show; }  	bool			getShowContextMenu() const { return mShowContextMenu; } diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 34eab9fa33..f4c1d0b151 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -494,6 +494,7 @@ set(viewer_SOURCE_FILES      llsaveoutfitcombobtn.cpp      llsceneview.cpp      llscreenchannel.cpp +    llscripteditor.cpp      llscriptfloater.cpp      llscrollingpanelparam.cpp      llscrollingpanelparambase.cpp @@ -1074,6 +1075,7 @@ set(viewer_HEADER_FILES      llsaveoutfitcombobtn.h      llsceneview.h      llscreenchannel.h +    llscripteditor.h      llscriptfloater.h      llscrollingpanelparam.h      llscrollingpanelparambase.h diff --git a/indra/newview/llfloatergotoline.cpp b/indra/newview/llfloatergotoline.cpp index d66e418926..3b34f03532 100644 --- a/indra/newview/llfloatergotoline.cpp +++ b/indra/newview/llfloatergotoline.cpp @@ -30,7 +30,7 @@  #include "llpreviewscript.h"  #include "llfloaterreg.h"  #include "lllineeditor.h" -#include "llviewertexteditor.h" +#include "llscripteditor.h"  #include "llviewerwindow.h"  LLFloaterGotoLine* LLFloaterGotoLine::sInstance = NULL; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 84e7a1650d..0d95874406 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -69,6 +69,7 @@  #include "llkeyboard.h"  #include "llscrollcontainer.h"  #include "llcheckboxctrl.h" +#include "llscripteditor.h"  #include "llselectmgr.h"  #include "lltooldraganddrop.h"  #include "llscrolllistctrl.h" @@ -77,7 +78,6 @@  #include "lldir.h"  #include "llcombobox.h"  #include "llviewerstats.h" -#include "llviewertexteditor.h"  #include "llviewerwindow.h"  #include "lluictrlfactory.h"  #include "llmediactrl.h" @@ -399,7 +399,7 @@ BOOL LLScriptEdCore::postBuild()  	childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); -	mEditor = getChild<LLViewerTextEditor>("Script Editor"); +	mEditor = getChild<LLScriptEditor>("Script Editor");  	childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this);  	childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,FALSE)); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index dc4f828cf1..913303d57d 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -39,7 +39,7 @@  class LLLiveLSLFile;  class LLMessageSystem; -class LLTextEditor; +class LLScriptEditor;  class LLButton;  class LLCheckBoxCtrl;  class LLScrollListCtrl; @@ -140,7 +140,7 @@ protected:  private:  	std::string		mSampleText; -	LLTextEditor*	mEditor; +	LLScriptEditor*	mEditor;  	void			(*mLoadCallback)(void* userdata);  	void			(*mSaveCallback)(void* userdata, BOOL close_after_save);  	void			(*mSearchReplaceCallback) (void* userdata); diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp new file mode 100644 index 0000000000..7067f49fba --- /dev/null +++ b/indra/newview/llscripteditor.cpp @@ -0,0 +1,51 @@ +/** + * @file llecripteditor.cpp + * @author Cinder Roxley + * @brief Text editor widget used for viewing and editing scripts + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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$ + */ + +#include "linden_common.h" +#include "llscripteditor.h" + +static LLDefaultChildRegistry::Register<LLScriptEditor> r("script_editor"); + +LLScriptEditor::LLScriptEditor::Params::Params() +{ + +} + + +LLScriptEditor::LLScriptEditor(const Params& p) +:	LLTextEditor(p) +{ +	 +} + +void LLScriptEditor::clearSegments() +{ +	if (!mSegments.empty()) +	{ +		mSegments.clear(); +	} +} diff --git a/indra/newview/llscripteditor.h b/indra/newview/llscripteditor.h new file mode 100644 index 0000000000..1e05e337c5 --- /dev/null +++ b/indra/newview/llscripteditor.h @@ -0,0 +1,51 @@ +/** + * @file llecripteditor.h + * @author Cinder Roxley + * @brief Text editor widget used for viewing and editing scripts + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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_SCRIPTEDITOR_H +#define LL_SCRIPTEDITOR_H + +#include "lltexteditor.h" + +class LLScriptEditor : public LLTextEditor +{ +	friend class LLUICtrlFactory; +public: +	 +	struct Params : public LLInitParam::Block<Params, LLTextEditor::Params> +	{ +		Params(); +	}; +	 +	virtual ~LLScriptEditor() {}; +	void clearSegments(); +	 +protected: +	LLScriptEditor(const Params& p); + +}; + +#endif // LL_SCRIPTEDITOR_H diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index d1b35dce9d..3e88e2dc04 100755 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -148,7 +148,7 @@               name="Keyword Help..." />          </menu>      </menu_bar> -    <text_editor +    <script_editor      left="0"       type="string"       length="1" @@ -165,7 +165,7 @@       enable_tooltip_paste="true"       word_wrap="true">          Loading... -    </text_editor> +    </script_editor>      <scroll_list      top_pad="10"      left="0" diff --git a/indra/newview/skins/default/xui/en/script_editor.xml b/indra/newview/skins/default/xui/en/script_editor.xml new file mode 100644 index 0000000000..d24833e85c --- /dev/null +++ b/indra/newview/skins/default/xui/en/script_editor.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<script_editor +    name="script_editor" +    parse_urls="false"> +</script_editor> | 
