diff -r 7ae099f5a764 -r 6d6d484e501a doc/contributions.txt --- a/doc/contributions.txt Fri Aug 31 09:01:09 2012 -0400 +++ b/doc/contributions.txt Tue Sep 11 11:23:49 2012 +0200 @@ -740,6 +740,7 @@ STORM-281 MartinRJ Fayray STORM-1845 + BUG-59 Matthew Anthony Matthew Dowd VWR-1344 diff -r 7ae099f5a764 -r 6d6d484e501a indra/newview/llpreviewscript.h --- a/indra/newview/llpreviewscript.h Fri Aug 31 09:01:09 2012 -0400 +++ b/indra/newview/llpreviewscript.h Tue Sep 11 11:23:49 2012 +0200 @@ -45,6 +45,7 @@ struct LLEntryAndEdCore; class LLMenuBarGL; class LLFloaterScriptSearch; +class LLFloaterGotoLine; class LLKeywordToken; class LLVFS; class LLViewerInventoryItem; @@ -57,6 +58,7 @@ friend class LLPreviewLSL; friend class LLLiveLSLEditor; friend class LLFloaterScriptSearch; + friend class LLFloaterGotoLine; friend class LLScriptEdContainer; protected: diff -r 7ae099f5a764 -r 6d6d484e501a indra/newview/llpreviewscript.cpp --- a/indra/newview/llpreviewscript.cpp Fri Aug 31 09:01:09 2012 -0400 +++ b/indra/newview/llpreviewscript.cpp Tue Sep 11 11:23:49 2012 +0200 @@ -163,6 +163,128 @@ } /// --------------------------------------------------------------------------- +/// LLFloaterGotoLine +/// --------------------------------------------------------------------------- +class LLFloaterGotoLine : public LLFloater +{ +public: + LLFloaterGotoLine(LLScriptEdCore* editor_core); + ~LLFloaterGotoLine(); + + /*virtual*/ BOOL postBuild(); + static void show(LLScriptEdCore* editor_core); + + static void onBtnGoto(void* userdata); + void handleBtnGoto(); + + LLScriptEdCore* getEditorCore() { return mEditorCore; } + static LLFloaterGotoLine* getInstance() { return sInstance; } + + virtual bool hasAccelerators() const; + virtual BOOL handleKeyHere(KEY key, MASK mask); + +private: + + LLScriptEdCore* mEditorCore; + + static LLFloaterGotoLine* sInstance; +}; + +LLFloaterGotoLine* LLFloaterGotoLine::sInstance = NULL; + +LLFloaterGotoLine::LLFloaterGotoLine(LLScriptEdCore* editor_core) +: LLFloater(LLSD()), + mEditorCore(editor_core) +{ + buildFromFile("floater_goto_line.xml"); + + sInstance = this; + + // find floater in which script panel is embedded + LLView* viewp = (LLView*)editor_core; + while(viewp) + { + LLFloater* floaterp = dynamic_cast(viewp); + if (floaterp) + { + floaterp->addDependentFloater(this); + break; + } + viewp = viewp->getParent(); + } +} + +BOOL LLFloaterGotoLine::postBuild() +{ + getChild("goto_line")->setPrevalidate(LLTextValidate::validateNonNegativeS32); + childSetAction("goto_btn", onBtnGoto,this); + setDefaultBtn("goto_btn"); + + return TRUE; +} + +//static +void LLFloaterGotoLine::show(LLScriptEdCore* editor_core) +{ + if (sInstance && sInstance->mEditorCore && sInstance->mEditorCore != editor_core) + { + sInstance->closeFloater(); + delete sInstance; + } + + if (!sInstance) + { + // sInstance will be assigned in the constructor. + new LLFloaterGotoLine(editor_core); + } + + sInstance->openFloater(); +} + +LLFloaterGotoLine::~LLFloaterGotoLine() +{ + sInstance = NULL; +} + +// static +void LLFloaterGotoLine::onBtnGoto(void *userdata) +{ + LLFloaterGotoLine* self = (LLFloaterGotoLine*)userdata; + self->handleBtnGoto(); +} + +void LLFloaterGotoLine::handleBtnGoto() +{ + S32 row = 0; + S32 column = 0; + row = getChild("goto_line")->getValue().asInteger(); + if (row > 0) + { + mEditorCore->mEditor->setCursor(row, column); + mEditorCore->mEditor->setFocus(TRUE); + } +} + +bool LLFloaterGotoLine::hasAccelerators() const +{ + if (mEditorCore) + { + return mEditorCore->hasAccelerators(); + } + return FALSE; +} + +BOOL LLFloaterGotoLine::handleKeyHere(KEY key, MASK mask) +{ + if (mEditorCore) + { + return mEditorCore->handleKeyHere(key, mask); + } + + return FALSE; +} + +/// --------------------------------------------------------------------------- /// LLFloaterScriptSearch /// --------------------------------------------------------------------------- class LLFloaterScriptSearch : public LLFloater @@ -499,6 +621,9 @@ menuItem = getChild("Search / Replace..."); menuItem->setClickCallback(boost::bind(&LLFloaterScriptSearch::show, this)); + menuItem = getChild("Go to line..."); + menuItem->setClickCallback(boost::bind(&LLFloaterGotoLine::show, this)); + menuItem = getChild("Help..."); menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnHelp, this)); diff -r 7ae099f5a764 -r 6d6d484e501a indra/newview/skins/default/xui/en/floater_goto_line.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/indra/newview/skins/default/xui/en/floater_goto_line.xml Tue Sep 11 11:23:49 2012 +0200 @@ -0,0 +1,44 @@ + + +