summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authordolphin <dolphin@lindenlab.com>2013-08-08 09:26:09 -0700
committerdolphin <dolphin@lindenlab.com>2013-08-08 09:26:09 -0700
commit6354ad379d0850b4cc3969130fb1b30b0e2c0ee9 (patch)
treeae9feb0a651f54d8f1b2a4a21911d66fff54a30b /indra
parent08a1ae6839f07aeadb58326208c2c01b2ef667c3 (diff)
Simplified the experience panel to only the required elements
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llpreviewscript.cpp259
-rwxr-xr-xindra/newview/llpreviewscript.h10
-rwxr-xr-xindra/newview/skins/default/xui/en/floater_live_lsleditor.xml2
-rwxr-xr-xindra/newview/skins/default/xui/en/panel_script_ed.xml257
4 files changed, 233 insertions, 295 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index ef2eb98ce9..bd8f65e767 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -119,6 +119,57 @@ static bool have_script_upload_cap(LLUUID& object_id)
return object && (! object->getRegion()->getCapability("UpdateScriptTask").empty());
}
+class ExperienceAssociationResponder : public LLHTTPClient::Responder
+{
+public:
+ ExperienceAssociationResponder(const LLUUID& parent):mParent(parent)
+ {
+ }
+
+ LLUUID mParent;
+
+ virtual void result(const LLSD& content)
+ {
+
+ LLLiveLSLEditor* scriptCore = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", mParent);
+
+ if(!scriptCore)
+ return;
+
+ LLUUID id;
+ if(content.has("experience"))
+ {
+ id=content["experience"].asUUID();
+ }
+ scriptCore->setAssociatedExperience(id);
+ }
+
+ virtual void error(U32 status, const std::string& reason)
+ {
+ llinfos << "Failed to look up associated script: " << status << ": " << reason << llendl;
+ }
+
+};
+
+class ExperienceResponder : public LLHTTPClient::Responder
+{
+public:
+ ExperienceResponder(const LLHandle<LLScriptEdCore>& parent):mParent(parent)
+ {
+ }
+
+ LLHandle<LLScriptEdCore> mParent;
+
+ virtual void result(const LLSD& content)
+ {
+ LLScriptEdCore* scriptCore = mParent.get();
+ if(!scriptCore)
+ return;
+
+ scriptCore->setExperienceIds(content["experience_ids"]);
+ }
+};
+
/// ---------------------------------------------------------------------------
/// LLLiveLSLFile
/// ---------------------------------------------------------------------------
@@ -377,44 +428,34 @@ LLScriptEdCore::~LLScriptEdCore()
void LLScriptEdCore::experienceChanged()
{
- enableSave(TRUE);
- getChildView("Save_btn")->setEnabled(TRUE);
- mAssociatedExperience = mExperiences->getSelectedValue().asUUID();
+ if(mAssociatedExperience != mExperiences->getSelectedValue().asUUID())
+ {
+ enableSave(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)
+
+ LLUUID id;
+ if(self->mExperienceEnabled->get())
{
- if(self->mAssociatedExperience.notNull())
+ if(self->mAssociatedExperience.isNull())
{
- self->enableSave(TRUE);
+ id=self->mExperienceIds.beginArray()->asUUID();
}
- self->setAssociatedExperience(LLUUID::null);
}
- else if (expand)
+
+ if(id != self->mAssociatedExperience)
{
- self->mExperiences->selectFirstItem();
- self->setAssociatedExperience(self->mExperiences->getSelectedValue().asUUID());
self->enableSave(TRUE);
}
+ self->setAssociatedExperience(id);
}
-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");
@@ -425,9 +466,6 @@ BOOL LLScriptEdCore::postBuild()
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);
@@ -1247,152 +1285,107 @@ bool LLScriptEdCore::enableLoadFromFileMenu(void* userdata)
return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : FALSE;
}
-
-void AddExperienceResult(LLHandle<LLScriptEdCore> panel, const LLSD& experience)
+LLUUID LLScriptEdCore::getAssociatedExperience()const
{
- LLScriptEdCore* scriptCore = panel.get();
- if(scriptCore)
- {
- scriptCore->addExperienceInfo(experience);
- }
+ return mAssociatedExperience;
}
-
-class ExperienceResponder : public LLHTTPClient::Responder
+void LLScriptEdCore::setExperienceIds( const LLSD& experience_ids )
{
-public:
- ExperienceResponder(const LLHandle<LLScriptEdCore>& parent):mParent(parent)
- {
- }
-
- LLHandle<LLScriptEdCore> mParent;
-
- virtual void result(const LLSD& content)
- {
- LLScriptEdCore* scriptCore = mParent.get();
- if(!scriptCore)
- return;
-
- scriptCore->clearExperiences();
+ mExperienceIds=experience_ids;
+ updateExperiencePanel();
+}
- LLSD experiences = content["experience_ids"];
- LLSD::array_const_iterator it = experiences.beginArray();
- for( /**/ ; it != experiences.endArray(); ++it)
- {
- LLUUID public_key = it->asUUID();
- LLExperienceCache::get(public_key, boost::bind(AddExperienceResult, mParent, _1));
- }
- }
-};
-
-class ExperienceAssociationResponder : public LLHTTPClient::Responder
+void LLScriptEdCore::updateExperiencePanel()
{
-public:
- ExperienceAssociationResponder(const LLUUID& parent):mParent(parent)
- {
- }
+ BOOL editable = mEditor->getEnabled();
- LLUUID mParent;
-
- virtual void result(const LLSD& content)
+ if(mAssociatedExperience.isNull())
{
-
- LLLiveLSLEditor* scriptCore = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", mParent);
-
- if(!scriptCore)
- return;
-
- LLUUID id;
- if(content.has("experience"))
+ mExperienceEnabled->set(FALSE);
+ mExperiences->setVisible(FALSE);
+ if(mExperienceIds.size()>0)
{
- id=content["experience"].asUUID();
+ mExperienceEnabled->setEnabled(TRUE);
+ mExperienceEnabled->setToolTip(getString("add_experiences"));
}
- scriptCore->setAssociatedExperience(id);
+ else
+ {
+ mExperienceEnabled->setEnabled(FALSE);
+ mExperienceEnabled->setToolTip(getString("no_experiences"));
+ }
+ getChild<LLButton>("view_profile")->setVisible(FALSE);
}
-
- virtual void error(U32 status, const std::string& reason)
+ else
{
- llinfos << "Failed to look up associated script: " << status << ": " << reason << llendl;
+ mExperienceEnabled->setToolTip(getString("experience_enabled"));
+ mExperienceEnabled->setEnabled(editable);
+ mExperienceEnabled->set(TRUE);
+ mExperiences->setVisible(TRUE);
+ getChild<LLButton>("view_profile")->setVisible(TRUE);
+ buildExperienceList();
}
-
-};
-
-void LLScriptEdCore::requestExperiences()
-{
- mExperiences->setEnabled(FALSE);
-
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
- std::string lookup_url=region->getCapability("GetCreatorExperiences");
- if(!lookup_url.empty())
- {
- LLHTTPClient::get(lookup_url, new ExperienceResponder(getDerivedHandle<LLScriptEdCore>()));
- }
- }
}
-void LLScriptEdCore::addExperienceInfo( const LLSD& experience )
-{
- mExperiences->setEnabled(TRUE);
- mExperiences->add(experience[LLExperienceCache::NAME], experience[LLExperienceCache::EXPERIENCE_ID].asUUID());
- if(mAssociatedExperience == experience[LLExperienceCache::EXPERIENCE_ID].asUUID())
+void LLScriptEdCore::addExperienceInfo(const LLSD& experience, BOOL enabled)
+{
+ LLUUID id = experience[LLExperienceCache::EXPERIENCE_ID].asUUID();
+ EAddPosition position = (id == mAssociatedExperience)?ADD_TOP:ADD_BOTTOM;
+ LLScrollListItem* item=mExperiences->add(experience[LLExperienceCache::NAME], id, position );
+ if(!enabled)
{
- setAssociatedExperience(mAssociatedExperience);
- }
- LLUICtrl* no_experiences=getChild<LLUICtrl>("No Experiences");
- if(no_experiences)
- {
- no_experiences->setVisible(FALSE);
+ item->setEnabled(FALSE);
}
}
-void LLScriptEdCore::clearExperiences()
+void LLScriptEdCore::buildExperienceList()
{
- mExperiences->removeall();
- mExperiences->setEnabled(FALSE);
- LLUICtrl* no_experiences=getChild<LLUICtrl>("No Experiences");
- if(no_experiences)
+ mExperiences->clear();
+ bool foundAssociated=false;
+ for(LLSD::array_const_iterator it = mExperienceIds.beginArray(); it != mExperienceIds.endArray(); ++it)
{
- no_experiences->setVisible(TRUE);
+ LLUUID id = it->asUUID();
+ foundAssociated |= (id == mAssociatedExperience);
+ LLExperienceCache::get(id, boost::bind(&LLScriptEdCore::addExperienceInfo, this, _1, TRUE));
+ }
+
+ if(!foundAssociated )
+ {
+ LLExperienceCache::get(mAssociatedExperience, boost::bind(&LLScriptEdCore::addExperienceInfo, this, _1, FALSE));
}
-}
-LLUUID LLScriptEdCore::getAssociatedExperience()const
-{
- return mAssociatedExperience;
}
+
void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id )
{
- mExperienceEnabled->setEnabled(TRUE);
mAssociatedExperience = experience_id;
- if(experience_id.notNull())
- {
- LLExperienceCache::get(experience_id, boost::bind(&LLScriptEdCore::addAssociatedExperience, this, _1));
- }
+ updateExperiencePanel();
}
-void LLScriptEdCore::addAssociatedExperience(const LLSD& experience)
-{
- if(mExperiences->setSelectedByValue(mAssociatedExperience, TRUE))
+
+void LLScriptEdCore::requestExperiences()
+{
+ if (!mEditor->getEnabled())
{
- mExperienceEnabled->set(TRUE);
- mExpandExperience->setEnabled(TRUE);
+ return;
}
- else
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
{
- mExperiences->add(experience[LLExperienceCache::NAME], experience[LLExperienceCache::EXPERIENCE_ID].asUUID(), ADD_TOP, FALSE);
- mExperienceEnabled->set(FALSE);
+ std::string lookup_url=region->getCapability("GetCreatorExperiences");
+ if(!lookup_url.empty())
+ {
+ LLHTTPClient::get(lookup_url, new ExperienceResponder(getDerivedHandle<LLScriptEdCore>()));
+ }
}
}
-
-
/// ---------------------------------------------------------------------------
/// LLScriptEdContainer
/// ---------------------------------------------------------------------------
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index 043bf9c0b7..9578396f91 100755
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -102,17 +102,18 @@ public:
static void onBtnLoadFromFile(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);
virtual bool hasAccelerators() const { return true; }
- void addExperienceInfo( const LLSD& experience );
- void clearExperiences();
+ void addExperienceInfo( const LLSD& experience, BOOL enabled );
+ void setExperienceIds(const LLSD& experience_ids);
+ void buildExperienceList();
LLUUID getAssociatedExperience()const;
void setAssociatedExperience( const LLUUID& experience_id );
+ void updateExperiencePanel();
private:
void onBtnHelp();
@@ -148,8 +149,6 @@ private:
LLComboBox *mFunctions;
LLComboBox *mExperiences;
LLCheckBoxCtrl *mExperienceEnabled;
- LLUICtrl *mExperienceDetails;
- LLButton *mExpandExperience;
BOOL mForceClose;
LLPanel* mCodePanel;
LLScrollListCtrl* mErrorList;
@@ -162,6 +161,7 @@ private:
BOOL mHasScriptData;
LLLiveLSLFile* mLiveFile;
LLUUID mAssociatedExperience;
+ LLSD mExperienceIds;
LLScriptEdContainer* mContainer; // parent view
};
diff --git a/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml b/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml
index 5cd7cd196d..562936ed80 100755
--- a/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml
+++ b/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml
@@ -7,7 +7,7 @@
height="580"
layout="topleft"
min_height="271"
- min_width="290"
+ min_width="328"
name="script ed float"
help_topic="script_ed_float"
save_rect="true"
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 331157d713..18a8ddc1bf 100755
--- a/indra/newview/skins/default/xui/en/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml
@@ -3,7 +3,7 @@
bevel_style="none"
border_style="line"
follows="left|top|right|bottom"
- height="730"
+ height="515"
layout="topleft"
left="0"
name="script panel"
@@ -32,6 +32,18 @@
name="external_editor_not_set">
Select an editor by setting the environment variable LL_SCRIPT_EDITOR or the ExternalEditor setting.
</panel.string>
+ <panel.string
+ name="experience_enabled">
+ Uncheck to remove the current experience
+ </panel.string>
+ <panel.string
+ name="no_experiences">
+ You are not authorized for any experiences
+ </panel.string>
+ <panel.string
+ name="add_experiences">
+ Select to add an experience
+ </panel.string>
<menu_bar
bg_visible="false"
follows="left|top"
@@ -144,160 +156,93 @@
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>
+ <text_editor
+ left="0"
+ type="string"
+ length="1"
+ follows="left|top|right|bottom"
+ font="Monospace"
+ height="346"
+ 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>
+ <scroll_list
+ top_pad="10"
+ left="0"
+ 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="0"/>
+ <button
+ follows="right|bottom"
+ height="23"
+ label="Save"
+ label_selected="Save"
+ layout="topleft"
+ top_pad="-35"
+ right="482"
+ name="Save_btn"
+ width="81" />
+ <button
+ enabled="false"
+ follows="right|bottom"
+ height="23"
+ label="Edit..."
+ layout="topleft"
+ top_pad="-23"
+ right="396"
+ name="Edit_btn"
+ width="81" />
+ <check_box width="130"
+ height="21"
+ enabled="false"
+ left="0"
+ top="490"
+ layout="topleft"
+ follows="bottom|left"
+ label="Use Experience:"
+ name="enable_xp"/>
+ <combo_box
+ label=""
+ top_pad="-23"
+ left="135"
+ right="454"
+ layout="topleft"
+ follows="left|bottom|right"
+ visible="false"
+ name="Experiences..."/>
+ <button label="&gt;"
+ name="view_profile"
+ height="23"
+ width="23"
+ right="482"
+ layout="topleft"
+ top_pad="-23"
+ follows="right"
+ visible="false"/>
- </layout_panel>
- </layout_stack>
</panel>