From da4ef4214247fba1f14d8d30f8b34c108a8f2eb0 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Tue, 28 Jan 2014 12:20:41 +0200 Subject: MAINT-3643 FIXED Copy previous search / replace strings in LSL editor --- indra/newview/llpreviewscript.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index f6f9dc90a9..53a5ed1476 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -192,11 +192,11 @@ public: private: LLScriptEdCore* mEditorCore; - static LLFloaterScriptSearch* sInstance; protected: LLLineEditor* mSearchBox; + LLLineEditor* mReplaceBox; void onSearchBoxCommit(); }; @@ -205,6 +205,7 @@ LLFloaterScriptSearch* LLFloaterScriptSearch::sInstance = NULL; LLFloaterScriptSearch::LLFloaterScriptSearch(LLScriptEdCore* editor_core) : LLFloater(LLSD()), mSearchBox(NULL), + mReplaceBox(NULL), mEditorCore(editor_core) { buildFromFile("floater_script_search.xml"); @@ -227,6 +228,7 @@ LLFloaterScriptSearch::LLFloaterScriptSearch(LLScriptEdCore* editor_core) BOOL LLFloaterScriptSearch::postBuild() { + mReplaceBox = getChild("replace_text"); mSearchBox = getChild("search_text"); mSearchBox->setCommitCallback(boost::bind(&LLFloaterScriptSearch::onSearchBoxCommit, this)); mSearchBox->setCommitOnFocusLost(FALSE); @@ -242,8 +244,12 @@ BOOL LLFloaterScriptSearch::postBuild() //static void LLFloaterScriptSearch::show(LLScriptEdCore* editor_core) { + LLSD::String search_text; + LLSD::String replace_text; if (sInstance && sInstance->mEditorCore && sInstance->mEditorCore != editor_core) { + search_text=sInstance->mSearchBox->getValue().asString(); + replace_text=sInstance->mReplaceBox->getValue().asString(); sInstance->closeFloater(); delete sInstance; } @@ -252,6 +258,8 @@ void LLFloaterScriptSearch::show(LLScriptEdCore* editor_core) { // sInstance will be assigned in the constructor. new LLFloaterScriptSearch(editor_core); + sInstance->mSearchBox->setValue(search_text); + sInstance->mReplaceBox->setValue(replace_text); } sInstance->openFloater(); @@ -272,7 +280,7 @@ void LLFloaterScriptSearch::onBtnSearch(void *userdata) void LLFloaterScriptSearch::handleBtnSearch() { LLCheckBoxCtrl* caseChk = getChild("case_text"); - mEditorCore->mEditor->selectNext(getChild("search_text")->getValue().asString(), caseChk->get()); + mEditorCore->mEditor->selectNext(mSearchBox->getValue().asString(), caseChk->get()); } // static @@ -285,7 +293,7 @@ void LLFloaterScriptSearch::onBtnReplace(void *userdata) void LLFloaterScriptSearch::handleBtnReplace() { LLCheckBoxCtrl* caseChk = getChild("case_text"); - mEditorCore->mEditor->replaceText(getChild("search_text")->getValue().asString(), getChild("replace_text")->getValue().asString(), caseChk->get()); + mEditorCore->mEditor->replaceText(mSearchBox->getValue().asString(), mReplaceBox->getValue().asString(), caseChk->get()); } // static @@ -298,7 +306,7 @@ void LLFloaterScriptSearch::onBtnReplaceAll(void *userdata) void LLFloaterScriptSearch::handleBtnReplaceAll() { LLCheckBoxCtrl* caseChk = getChild("case_text"); - mEditorCore->mEditor->replaceTextAll(getChild("search_text")->getValue().asString(), getChild("replace_text")->getValue().asString(), caseChk->get()); + mEditorCore->mEditor->replaceTextAll(mSearchBox->getValue().asString(), mReplaceBox->getValue().asString(), caseChk->get()); } bool LLFloaterScriptSearch::hasAccelerators() const @@ -329,7 +337,7 @@ void LLFloaterScriptSearch::onSearchBoxCommit() if (mEditorCore && mEditorCore->mEditor) { LLCheckBoxCtrl* caseChk = getChild("case_text"); - mEditorCore->mEditor->selectNext(getChild("search_text")->getValue().asString(), caseChk->get()); + mEditorCore->mEditor->selectNext(mSearchBox->getValue().asString(), caseChk->get()); } } -- cgit v1.2.3