summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authormaxim@mnikolenko <maxim@mnikolenko>2014-01-28 12:20:41 +0200
committermaxim@mnikolenko <maxim@mnikolenko>2014-01-28 12:20:41 +0200
commitda4ef4214247fba1f14d8d30f8b34c108a8f2eb0 (patch)
tree499e8a5eef719048f84a93a7a234ca575bffc0af /indra
parent27044252fc91fbc3f8da23e8728c992c1e7fd041 (diff)
MAINT-3643 FIXED Copy previous search / replace strings in LSL editor
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llpreviewscript.cpp18
1 files changed, 13 insertions, 5 deletions
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<LLLineEditor>("replace_text");
mSearchBox = getChild<LLLineEditor>("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<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->selectNext(getChild<LLUICtrl>("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<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->replaceText(getChild<LLUICtrl>("search_text")->getValue().asString(), getChild<LLUICtrl>("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<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->replaceTextAll(getChild<LLUICtrl>("search_text")->getValue().asString(), getChild<LLUICtrl>("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<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->selectNext(getChild<LLUICtrl>("search_text")->getValue().asString(), caseChk->get());
+ mEditorCore->mEditor->selectNext(mSearchBox->getValue().asString(), caseChk->get());
}
}