diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterscriptexperience.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llfloaterscriptexperience.h | 45 | ||||
-rwxr-xr-x | indra/newview/llpreviewscript.cpp | 91 | ||||
-rwxr-xr-x | indra/newview/llpreviewscript.h | 15 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/panel_script_ed.xml | 509 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_script_experience.xml | 97 |
6 files changed, 544 insertions, 226 deletions
diff --git a/indra/newview/llfloaterscriptexperience.cpp b/indra/newview/llfloaterscriptexperience.cpp new file mode 100644 index 0000000000..497522e821 --- /dev/null +++ b/indra/newview/llfloaterscriptexperience.cpp @@ -0,0 +1,13 @@ +#include "llviewerprecompiledheaders.h" + +#include "llfloaterscriptexperience.h" + +LLFloaterScriptExperience::LLFloaterScriptExperience(const LLSD& data) + :LLFloater(data) +{ +} + +BOOL LLFloaterScriptExperience::postBuild() +{ + return TRUE; +} diff --git a/indra/newview/llfloaterscriptexperience.h b/indra/newview/llfloaterscriptexperience.h new file mode 100644 index 0000000000..c79ff78131 --- /dev/null +++ b/indra/newview/llfloaterscriptexperience.h @@ -0,0 +1,45 @@ +/** + * @file llfloaterscriptexperience.h + * @brief LLFloaterScriptExperience class definition + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * 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. + * + * 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. + * + * 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$ + */ + +#ifndef LL_LLFLOATERSCRIPTEXPERIENCE_H +#define LL_LLFLOATERSCRIPTEXPERIENCE_H + +#include "llfloater.h" + +class LLFloaterScriptExperience : + public LLFloater +{ +public: + LLFloaterScriptExperience(const LLSD& data); + +protected: + /*virtual*/ BOOL postBuild(); + +private: + +}; + +#endif //LL_LLFLOATERSCRIPTEXPERIENCE_H diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index bba0f1330c..ef2eb98ce9 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -378,9 +378,43 @@ LLScriptEdCore::~LLScriptEdCore() void LLScriptEdCore::experienceChanged() { enableSave(TRUE); - getChildView("Save_btn")->setEnabled(true); + getChildView("Save_btn")->setEnabled(TRUE); + mAssociatedExperience = mExperiences->getSelectedValue().asUUID(); } +void LLScriptEdCore::onToggleExperience( LLUICtrl *ui, void* userdata ) +{ + LLScriptEdCore* self = (LLScriptEdCore*)userdata; + BOOL checked = self->mExperienceEnabled->get(); + BOOL expand = checked && self->mAssociatedExperience.isNull(); + self->mExpandExperience->setToggleState(expand); + self->mExpandExperience->setEnabled(checked); + self->mExperienceDetails->setVisible(expand); + if(!checked) + { + if(self->mAssociatedExperience.notNull()) + { + self->enableSave(TRUE); + } + self->setAssociatedExperience(LLUUID::null); + } + else if (expand) + { + self->mExperiences->selectFirstItem(); + self->setAssociatedExperience(self->mExperiences->getSelectedValue().asUUID()); + self->enableSave(TRUE); + } +} + +void LLScriptEdCore::onToggleExperienceDetails( void* userdata ) +{ + LLScriptEdCore* self = (LLScriptEdCore*)userdata; + BOOL checked = self->mExperienceEnabled->get(); + BOOL expanded = self->mExpandExperience->getToggleState(); + self->mExperienceDetails->setVisible(checked && expanded); +} + + BOOL LLScriptEdCore::postBuild() { mErrorList = getChild<LLScrollListCtrl>("lsl errors"); @@ -390,6 +424,14 @@ BOOL LLScriptEdCore::postBuild() mExperiences = getChild<LLComboBox>("Experiences..."); mExperiences->setCommitCallback(boost::bind(&LLScriptEdCore::experienceChanged, this)); + mExperienceEnabled = getChild<LLCheckBoxCtrl>("enable_xp"); + mExpandExperience = getChild<LLButton>("Expand Experience"); + mExperienceDetails = getChild<LLUICtrl>("Experience Details"); + mExpandExperience->setClickedCallback(boost::bind(&LLScriptEdCore::onToggleExperienceDetails, this)); + + childSetCommitCallback("enable_xp", onToggleExperience, this); + + childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); mEditor = getChild<LLViewerTextEditor>("Script Editor"); @@ -1258,10 +1300,15 @@ public: LLLiveLSLEditor* scriptCore = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", mParent); - if(!scriptCore || !content.has("experience")) + if(!scriptCore) return; - scriptCore->setAssociatedExperience(content["experience"].asUUID()); + LLUUID id; + if(content.has("experience")) + { + id=content["experience"].asUUID(); + } + scriptCore->setAssociatedExperience(id); } virtual void error(U32 status, const std::string& reason) @@ -1294,31 +1341,53 @@ void LLScriptEdCore::addExperienceInfo( const LLSD& experience ) { setAssociatedExperience(mAssociatedExperience); } + LLUICtrl* no_experiences=getChild<LLUICtrl>("No Experiences"); + if(no_experiences) + { + no_experiences->setVisible(FALSE); + } } void LLScriptEdCore::clearExperiences() { mExperiences->removeall(); - mExperiences->add("No Experience", LLUUID::null); + mExperiences->setEnabled(FALSE); + LLUICtrl* no_experiences=getChild<LLUICtrl>("No Experiences"); + if(no_experiences) + { + no_experiences->setVisible(TRUE); + } } -LLUUID LLScriptEdCore::getSelectedExperience()const +LLUUID LLScriptEdCore::getAssociatedExperience()const { - return mExperiences->getSelectedValue().asUUID(); + return mAssociatedExperience; } void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id ) { + mExperienceEnabled->setEnabled(TRUE); mAssociatedExperience = experience_id; if(experience_id.notNull()) { - if(!mExperiences->setSelectedByValue(mAssociatedExperience, TRUE)) - { - mExperiences->setSelectedByValue(LLUUID::null, TRUE); - } + LLExperienceCache::get(experience_id, boost::bind(&LLScriptEdCore::addAssociatedExperience, this, _1)); } } +void LLScriptEdCore::addAssociatedExperience(const LLSD& experience) +{ + + if(mExperiences->setSelectedByValue(mAssociatedExperience, TRUE)) + { + mExperienceEnabled->set(TRUE); + mExpandExperience->setEnabled(TRUE); + } + else + { + mExperiences->add(experience[LLExperienceCache::NAME], experience[LLExperienceCache::EXPERIENCE_ID].asUUID(), ADD_TOP, FALSE); + mExperienceEnabled->set(FALSE); + } +} @@ -2284,7 +2353,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) BOOL is_running = getChild<LLCheckBoxCtrl>( "running")->get(); if (!url.empty()) { - uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running, mScriptEd->getSelectedExperience()); + uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running, mScriptEd->getAssociatedExperience()); } else if (gAssetStorage) { diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 28e71b111a..043bf9c0b7 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -100,7 +100,9 @@ public: static void onBtnInsertSample(void*); static void onBtnInsertFunction(LLUICtrl*, void*); static void onBtnLoadFromFile(void*); - static void onBtnSaveToFile(void*); + static void onBtnSaveToFile(void*); + static void onToggleExperience(LLUICtrl *ui, void* userdata); + static void onToggleExperienceDetails(void* userdata); static bool enableSaveToFileMenu(void* userdata); static bool enableLoadFromFileMenu(void* userdata); @@ -108,7 +110,8 @@ public: virtual bool hasAccelerators() const { return true; } void addExperienceInfo( const LLSD& experience ); void clearExperiences(); - LLUUID getSelectedExperience()const; + LLUUID getAssociatedExperience()const; + void setAssociatedExperience( const LLUUID& experience_id ); private: @@ -125,7 +128,8 @@ private: void enableSave(BOOL b) {mEnableSave = b;} void requestExperiences(); - void experienceChanged(); + void experienceChanged(); + void addAssociatedExperience(const LLSD& experience); protected: void deleteBridges(); @@ -142,7 +146,10 @@ private: void (*mSearchReplaceCallback) (void* userdata); void* mUserdata; LLComboBox *mFunctions; - LLComboBox *mExperiences; + LLComboBox *mExperiences; + LLCheckBoxCtrl *mExperienceEnabled; + LLUICtrl *mExperienceDetails; + LLButton *mExpandExperience; BOOL mForceClose; LLPanel* mCodePanel; LLScrollListCtrl* mErrorList; diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index 7e4ac1d7fb..331157d713 100755 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -1,216 +1,303 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel - bevel_style="none" - border_style="line" - follows="left|top|right|bottom" - height="522" - layout="topleft" - left="0" - name="script panel" - width="497"> - <panel.string - name="loading"> - Loading... - </panel.string> - <panel.string - name="can_not_view"> - You can not view or edit this script, since it has been set as "no copy". You need full permissions to view or edit a script inside an object. - </panel.string> - <panel.string - name="public_objects_can_not_run"> - Public Objects cannot run scripts - </panel.string> - <panel.string - name="script_running"> - Running - </panel.string> - <panel.string - name="Title"> - Script: [NAME] - </panel.string> - <panel.string - name="external_editor_not_set"> - Select an editor by setting the environment variable LL_SCRIPT_EDITOR or the ExternalEditor setting. - </panel.string> - <menu_bar - bg_visible="false" - follows="left|top" - height="18" - layout="topleft" - left="0" - mouse_opaque="false" - name="script_menu" - width="476"> - <menu - top="0" - height="62" - label="File" - layout="topleft" - left="0" - mouse_opaque="false" - name="File" - width="138"> - <menu_item_call - label="Save" - layout="topleft" - name="Save" /> - <menu_item_separator - layout="topleft" /> - <menu_item_call - label="Revert All Changes" - layout="topleft" - name="Revert All Changes" /> - <menu_item_separator - layout="topleft" /> - <menu_item_call - label="Load from file..." - layout="topleft" - name="LoadFromFile" /> - <menu_item_call - label="Save to file..." - layout="topleft" - name="SaveToFile" /> - </menu> - <menu - top="0" - height="198" - label="Edit" - layout="topleft" - mouse_opaque="false" - name="Edit" - width="139"> - <menu_item_call - enabled="false" - label="Undo" - layout="topleft" - name="Undo" /> - <menu_item_call - enabled="false" - label="Redo" - layout="topleft" - name="Redo" /> - <menu_item_separator - layout="topleft" /> - <menu_item_call - enabled="false" - label="Cut" - layout="topleft" - name="Cut" /> - <menu_item_call - enabled="false" - label="Copy" - layout="topleft" - name="Copy" /> - <menu_item_call - enabled="false" - label="Paste" - layout="topleft" - name="Paste" /> - <menu_item_separator - layout="topleft" - name="separator2" /> - <menu_item_call - label="Select All" - layout="topleft" - name="Select All" /> - <menu_item_call - enabled="false" - label="Deselect" - layout="topleft" - name="Deselect" /> - <menu_item_separator - layout="topleft" - name="separator3" /> - <menu_item_call - label="Search / Replace..." - layout="topleft" - name="Search / Replace..." /> - </menu> - <menu - top="0" - height="34" - label="Help" - layout="topleft" - mouse_opaque="false" - name="Help" - width="112"> - <menu_item_call - label="Help..." - layout="topleft" - name="Help..." /> - <menu_item_call - label="Keyword Help..." - layout="topleft" - name="Keyword Help..." /> - </menu> - </menu_bar> - <text_editor - left="0" - type="string" - length="1" - follows="left|top|right|bottom" - font="Monospace" - height="376" - ignore_tab="false" - layout="topleft" - max_length="65536" - name="Script Editor" - text_readonly_color="DkGray" - width="487" - show_line_numbers="true" - enable_tooltip_paste="true" - word_wrap="true"> - Loading... - </text_editor> - <scroll_list - top_pad="10" + bevel_style="none" + border_style="line" + follows="left|top|right|bottom" + height="730" + layout="topleft" + left="0" + name="script panel" + width="497"> + <panel.string + name="loading"> + Loading... + </panel.string> + <panel.string + name="can_not_view"> + You can not view or edit this script, since it has been set as "no copy". You need full permissions to view or edit a script inside an object. + </panel.string> + <panel.string + name="public_objects_can_not_run"> + Public Objects cannot run scripts + </panel.string> + <panel.string + name="script_running"> + Running + </panel.string> + <panel.string + name="Title"> + Script: [NAME] + </panel.string> + <panel.string + name="external_editor_not_set"> + Select an editor by setting the environment variable LL_SCRIPT_EDITOR or the ExternalEditor setting. + </panel.string> + <menu_bar + bg_visible="false" + follows="left|top" + height="18" + layout="topleft" left="0" - follows="left|right|bottom" - height="60" - layout="topleft" - name="lsl errors" - width="487" /> - <text - follows="left|bottom" - height="12" - layout="topleft" - left="0" - name="line_col" - width="128" /> - <combo_box - follows="left|bottom" - height="23" - label="Insert..." - layout="topleft" - name="Insert..." - width="128" /> - <button - follows="right|bottom" - height="23" - label="Save" - label_selected="Save" - layout="topleft" - top_pad="-35" - right="487" - name="Save_btn" - width="81" /> - <button - enabled="false" - follows="right|bottom" - height="23" - label="Edit..." - layout="topleft" - top_pad="-23" - right="400" - name="Edit_btn" - width="81" /> - <combo_box - follows="right|bottom" - height="23" - label="Experience..." + mouse_opaque="false" + name="script_menu" + width="476"> + <menu + top="0" + height="62" + label="File" layout="topleft" - name="Experiences..." - width="196" - right="487" - top_pad="5" /> + left="0" + mouse_opaque="false" + name="File" + width="138"> + <menu_item_call + label="Save" + layout="topleft" + name="Save" /> + <menu_item_separator + layout="topleft" /> + <menu_item_call + label="Revert All Changes" + layout="topleft" + name="Revert All Changes" /> + <menu_item_separator + layout="topleft" /> + <menu_item_call + label="Load from file..." + layout="topleft" + name="LoadFromFile" /> + <menu_item_call + label="Save to file..." + layout="topleft" + name="SaveToFile" /> + </menu> + <menu + top="0" + height="198" + label="Edit" + layout="topleft" + mouse_opaque="false" + name="Edit" + width="139"> + <menu_item_call + enabled="false" + label="Undo" + layout="topleft" + name="Undo" /> + <menu_item_call + enabled="false" + label="Redo" + layout="topleft" + name="Redo" /> + <menu_item_separator + layout="topleft" /> + <menu_item_call + enabled="false" + label="Cut" + layout="topleft" + name="Cut" /> + <menu_item_call + enabled="false" + label="Copy" + layout="topleft" + name="Copy" /> + <menu_item_call + enabled="false" + label="Paste" + layout="topleft" + name="Paste" /> + <menu_item_separator + layout="topleft" + name="separator2" /> + <menu_item_call + label="Select All" + layout="topleft" + name="Select All" /> + <menu_item_call + enabled="false" + label="Deselect" + layout="topleft" + name="Deselect" /> + <menu_item_separator + layout="topleft" + name="separator3" /> + <menu_item_call + label="Search / Replace..." + layout="topleft" + name="Search / Replace..." /> + </menu> + <menu + top="0" + height="34" + label="Help" + layout="topleft" + mouse_opaque="false" + name="Help" + width="112"> + <menu_item_call + label="Help..." + layout="topleft" + name="Help..." /> + <menu_item_call + label="Keyword Help..." + layout="topleft" + name="Keyword Help..." /> + </menu> + </menu_bar> + <layout_stack width="497" + height="700" + orientation="vertical" + follows="all"> + <layout_panel auto_resize="true" + height="350" + follows="all" > + <text_editor + left="3" + type="string" + length="1" + follows="left|top|right|bottom" + font="Monospace" + height="376" + ignore_tab="false" + layout="topleft" + max_length="65536" + name="Script Editor" + text_readonly_color="DkGray" + width="482" + show_line_numbers="true" + enable_tooltip_paste="true" + word_wrap="true"> + Loading... + </text_editor> + </layout_panel> + <layout_panel auto_resize="false" + height="115"> + <scroll_list + top_pad="10" + left="3" + follows="left|right|bottom" + height="60" + layout="topleft" + name="lsl errors" + width="482" /> + <text + follows="left|bottom" + height="12" + layout="topleft" + left="11" + name="line_col" + width="128" /> + <combo_box + follows="left|bottom" + height="23" + label="Insert..." + layout="topleft" + name="Insert..." + width="128" + left="3"/> + <button + follows="right|bottom" + height="23" + label="Save" + label_selected="Save" + layout="topleft" + top_pad="-35" + right="485" + name="Save_btn" + width="81" /> + <button + enabled="false" + follows="right|bottom" + height="23" + label="Edit..." + layout="topleft" + top_pad="-23" + right="400" + name="Edit_btn" + width="81" /> + </layout_panel> + <layout_panel auto_resize="false" + height="45" width="497"> + <layout_stack height="45" + width="497" + orientation="horizontal" follows="left|top|right"> + <layout_panel auto_resize="true" + width="197" + height="45" + follows="let|top|right" left="0"> + <button name="Expand Experience" + width="197" + height="35" + is_toggle="true" + tab_stop="false" + pad_left="35" + left="0" + label="Experience" + halign="left" + enabled="false" + handle_right_mouse="false" + follows="top|left|right" + image_unselected="MarketplaceBtn_Off" + image_selected="MarketplaceBtn_Selected"> + </button> + </layout_panel> + <layout_panel auto_resize="false" width="150" left="203" follows="top|right"> + <check_box + follows="top|right" + height="25" + enabled="false" + label="Use Experience:" + name="enable_xp"/> + </layout_panel> + </layout_stack> + </layout_panel> + <layout_panel visible="false" + auto_resize="false" + height="65" + name="Experience Details"> + <layout_stack + follows="top|left|right" + + width="480" + height="65" + name="xp_details" + left="4" + top="0" + orientation="horizontal" + layout="topleft" + visible="true"> + <layout_panel width="157" + height="65" + auto_resize="false"> + <text bottom_delta="25"> + Associate with: + </text> + </layout_panel> + + <layout_panel width="330" + height="65" + auto_resize="true"> + <combo_box left="0" + bottom_delta="33" + label="Choose Experience..." + name="Experiences..." + follows="top|left|right" + /> + </layout_panel> + </layout_stack> + <text + follows="top|left|right" + width="497" + height="15" + bottom_delta="-12" + left="0" + halign="center" + name="No Experiences" + visible="true" + text_color="AlertCautionTextColor"> + You are not a contributor to any experiences. + </text> + + </layout_panel> + </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_script_experience.xml b/indra/newview/skins/default/xui/en/panel_script_experience.xml new file mode 100644 index 0000000000..e798638751 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_script_experience.xml @@ -0,0 +1,97 @@ +<panel + name="script_experience" + title="EXPERIENCE" + width="400" + follows="top|left|right" + top="0" + left="0" + layout="topleft"> + <!-- <floater.string name="EXPERIENCE">EXPERIENCE!!!!</floater.string> + + <floater.string name="Script:">Script:</floater.string> + <floater.string name="Associated with:">Associated with:</floater.string> + <floater.string name="You can contribute:">You can contribute:</floater.string> + <floater.string name="Associate with:">Associate with:</floater.string> + <floater.string name="Yes">Yes</floater.string> + <floater.string name="No">No</floater.string> + <floater.string name="(none)"></floater.string> + <floater.string name="Choose Experience...">Choose Experience...</floater.string> + <floater.string name="You are not a contributor to any experiences.">You are not a contributor to any experiences.</floater.string> + --> + + <button name="Expand Experience" width="200" + height="35" + is_toggle="true" + tab_stop="false" + pad_left="35" + top="0" + left="3" + label="Experience" + halign="left" + handle_right_mouse="false" + follows="top|left|right" + image_unselected="MarketplaceBtn_Off" + image_selected="MarketplaceBtn_Selected"> + </button> + <check_box + follows="top|right" height="25" label="Uses Experience" left="215" width="0" top="0" name="enable_xp" + /> + <layout_stack + follows="top|left|right" + + width="384" + height="140" + name="xp_details" + left="4" + top="45" + orientation="horizontal" + layout="topleft" + visible="false"> + <layout_panel width="120" + height="140"> + <text > + Script: + </text> + <text bottom_delta="25"> + Associated with: + </text> + <text bottom_delta="25"> + You can contribute: + </text> + <text bottom_delta="25"> + Associate with: + </text> + </layout_panel> + + <layout_panel width="250" + height="140"> + <text > + EasySit Animator 1.2.4 + </text> + <text bottom_delta="25" + text_color="HTMLLinkColor" font.style="UNDERLINE"> + Kyle's Superhero RPG + </text> + <text bottom_delta="25"> + Yes + </text> + <combo_box left="0" bottom_delta="33" + label="Choose Experience..." + name="Experiences..." + follows="top|left|right" + /> + </layout_panel> + </layout_stack> + <text + follows="top|left|right" + width="400" + height="15" + bottom_delta="-12" + left="0" + halign="center" + name="No Experiences" + visible="false" + text_color="AlertCautionTextColor"> + You are not a contributor to any experiences. + </text> +</panel> |