summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rw-r--r--indra/newview/llpreviewscript.cpp90
1 files changed, 51 insertions, 39 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 7b926f468d..cf2ea38288 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -2,31 +2,25 @@
* @file llpreviewscript.cpp
* @brief LLPreviewScript class implementation
*
- * $LicenseInfo:firstyear=2002&license=viewergpl$
- *
- * Copyright (c) 2002-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 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.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * 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.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * 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$
*/
@@ -144,6 +138,9 @@ public:
LLScriptEdCore* getEditorCore() { return mEditorCore; }
static LLFloaterScriptSearch* getInstance() { return sInstance; }
+ virtual bool hasAccelerators() const;
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
+
private:
LLScriptEdCore* mEditorCore;
@@ -157,7 +154,7 @@ LLFloaterScriptSearch::LLFloaterScriptSearch(LLScriptEdCore* editor_core)
: LLFloater(LLSD()),
mEditorCore(editor_core)
{
- LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml", NULL);
+ buildFromFile("floater_script_search.xml");
sInstance = this;
@@ -219,7 +216,7 @@ void LLFloaterScriptSearch::onBtnSearch(void *userdata)
void LLFloaterScriptSearch::handleBtnSearch()
{
LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->selectNext(childGetText("search_text"), caseChk->get());
+ mEditorCore->mEditor->selectNext(getChild<LLUICtrl>("search_text")->getValue().asString(), caseChk->get());
}
// static
@@ -232,7 +229,7 @@ void LLFloaterScriptSearch::onBtnReplace(void *userdata)
void LLFloaterScriptSearch::handleBtnReplace()
{
LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->replaceText(childGetText("search_text"), childGetText("replace_text"), caseChk->get());
+ mEditorCore->mEditor->replaceText(getChild<LLUICtrl>("search_text")->getValue().asString(), getChild<LLUICtrl>("replace_text")->getValue().asString(), caseChk->get());
}
// static
@@ -245,10 +242,27 @@ void LLFloaterScriptSearch::onBtnReplaceAll(void *userdata)
void LLFloaterScriptSearch::handleBtnReplaceAll()
{
LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->replaceTextAll(childGetText("search_text"), childGetText("replace_text"), caseChk->get());
+ mEditorCore->mEditor->replaceTextAll(getChild<LLUICtrl>("search_text")->getValue().asString(), getChild<LLUICtrl>("replace_text")->getValue().asString(), caseChk->get());
}
+bool LLFloaterScriptSearch::hasAccelerators() const
+{
+ if (mEditorCore)
+ {
+ return mEditorCore->hasAccelerators();
+ }
+ return FALSE;
+}
+BOOL LLFloaterScriptSearch::handleKeyHere(KEY key, MASK mask)
+{
+ if (mEditorCore)
+ {
+ return mEditorCore->handleKeyHere(key, mask);
+ }
+
+ return FALSE;
+}
/// ---------------------------------------------------------------------------
/// LLScriptEdCore
@@ -457,7 +471,7 @@ bool LLScriptEdCore::hasChanged()
void LLScriptEdCore::draw()
{
BOOL script_changed = hasChanged();
- childSetEnabled("Save_btn", script_changed);
+ getChildView("Save_btn")->setEnabled(script_changed);
if( mEditor->hasFocus() )
{
@@ -469,11 +483,11 @@ void LLScriptEdCore::draw()
args["[LINE]"] = llformat ("%d", line);
args["[COLUMN]"] = llformat ("%d", column);
cursor_pos = LLTrans::getString("CursorPos", args);
- childSetText("line_col", cursor_pos);
+ getChild<LLUICtrl>("line_col")->setValue(cursor_pos);
}
else
{
- childSetText("line_col", LLStringUtil::null);
+ getChild<LLUICtrl>("line_col")->setValue(LLStringUtil::null);
}
updateDynamicHelp();
@@ -660,13 +674,13 @@ void LLScriptEdCore::onBtnDynamicHelp()
if (!live_help_floater)
{
live_help_floater = new LLFloater(LLSD());
- LLUICtrlFactory::getInstance()->buildFloater(live_help_floater, "floater_lsl_guide.xml", NULL);
+ live_help_floater->buildFromFile("floater_lsl_guide.xml", NULL);
LLFloater* parent = dynamic_cast<LLFloater*>(getParent());
llassert(parent);
if (parent)
parent->addDependentFloater(live_help_floater, TRUE);
live_help_floater->childSetCommitCallback("lock_check", onCheckLock, this);
- live_help_floater->childSetValue("lock_check", gSavedSettings.getBOOL("ScriptHelpFollowsCursor"));
+ live_help_floater->getChild<LLUICtrl>("lock_check")->setValue(gSavedSettings.getBOOL("ScriptHelpFollowsCursor"));
live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, this);
live_help_floater->childSetAction("back_btn", onClickBack, this);
live_help_floater->childSetAction("fwd_btn", onClickForward, this);
@@ -948,7 +962,6 @@ LLPreviewLSL::LLPreviewLSL(const LLSD& key )
mPendingUploads(0)
{
mFactoryMap["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this);
- //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_preview.xml", FALSE);
}
// virtual
@@ -959,10 +972,10 @@ BOOL LLPreviewLSL::postBuild()
llassert(item);
if (item)
{
- childSetText("desc", item->getDescription());
+ getChild<LLUICtrl>("desc")->setValue(item->getDescription());
}
childSetCommitCallback("desc", LLPreview::onText, this);
- childSetPrevalidate("desc", &LLTextValidate::validateASCIIPrintableNoPipe);
+ getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}
@@ -1040,8 +1053,8 @@ void LLPreviewLSL::loadAsset()
mScriptEd->mFunctions->setEnabled(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
}
- childSetVisible("lock", !is_modifiable);
- mScriptEd->childSetEnabled("Insert...", is_modifiable);
+ getChildView("lock")->setVisible( !is_modifiable);
+ mScriptEd->getChildView("Insert...")->setEnabled(is_modifiable);
}
else
{
@@ -1423,20 +1436,19 @@ LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) :
mIsNew(false)
{
mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this);
- //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_live_lsleditor.xml", FALSE);
}
BOOL LLLiveLSLEditor::postBuild()
{
childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this);
- childSetEnabled("running", FALSE);
+ getChildView("running")->setEnabled(FALSE);
childSetAction("Reset",&LLLiveLSLEditor::onReset,this);
- childSetEnabled("Reset", TRUE);
+ getChildView("Reset")->setEnabled(TRUE);
mMonoCheckbox = getChild<LLCheckBoxCtrl>("mono");
childSetCommitCallback("mono", &LLLiveLSLEditor::onMonoCheckboxClicked, this);
- childSetEnabled("mono", FALSE);
+ getChildView("mono")->setEnabled(FALSE);
mScriptEd->mEditor->makePristine();
mScriptEd->mEditor->setFocus(TRUE);