MAINT-3643 FIXED Copy previous search / replace strings in LSL editor
parent
27044252fc
commit
da4ef42142
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue