From ec9da605c120b9df648eb163dc8647f955275f5f Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 4 Nov 2009 16:25:13 -0500 Subject: EXT-2216 : Task properties sidepanel Subclassing sidepanel item/task info with llsidepanelinventorysubpanel. Some bug fixing and cleanup. --HG-- branch : avatar-pipeline --- indra/newview/llsidepanelinventorysubpanel.cpp | 155 +++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 indra/newview/llsidepanelinventorysubpanel.cpp (limited to 'indra/newview/llsidepanelinventorysubpanel.cpp') diff --git a/indra/newview/llsidepanelinventorysubpanel.cpp b/indra/newview/llsidepanelinventorysubpanel.cpp new file mode 100644 index 0000000000..8522456777 --- /dev/null +++ b/indra/newview/llsidepanelinventorysubpanel.cpp @@ -0,0 +1,155 @@ +/** + * @file llsidepanelinventorysubpanel.cpp + * @brief A floater which shows an inventory item's properties. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * 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 + * + * 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 + * + * 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. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsidepanelinventorysubpanel.h" + +#include "roles_constants.h" + +#include "llagent.h" +#include "llavataractions.h" +#include "llbutton.h" +#include "llfloaterreg.h" +#include "llgroupactions.h" +#include "llinventorymodel.h" +#include "lllineeditor.h" +#include "llradiogroup.h" +#include "llviewercontrol.h" +#include "llviewerinventory.h" +#include "llviewerobjectlist.h" + + +///---------------------------------------------------------------------------- +/// Class LLSidepanelInventorySubpanel +///---------------------------------------------------------------------------- + +// Default constructor +LLSidepanelInventorySubpanel::LLSidepanelInventorySubpanel() + : LLPanel(), + mIsDirty(TRUE), + mIsEditing(FALSE), + mEditBtn(NULL), + mCancelBtn(NULL), + mSaveBtn(NULL) +{ +} + +// Destroys the object +LLSidepanelInventorySubpanel::~LLSidepanelInventorySubpanel() +{ +} + +// virtual +BOOL LLSidepanelInventorySubpanel::postBuild() +{ + mEditBtn = getChild("edit_btn"); + mEditBtn->setClickedCallback(boost::bind(&LLSidepanelInventorySubpanel::onEditButtonClicked, this)); + + mSaveBtn = getChild("save_btn"); + mSaveBtn->setClickedCallback(boost::bind(&LLSidepanelInventorySubpanel::onSaveButtonClicked, this)); + + mCancelBtn = getChild("cancel_btn"); + mCancelBtn->setClickedCallback(boost::bind(&LLSidepanelInventorySubpanel::onCancelButtonClicked, this)); + return TRUE; +} + +void LLSidepanelInventorySubpanel::setVisible(BOOL visible) +{ + if (visible) + { + dirty(); + setIsEditing(FALSE); + } + LLPanel::setVisible(visible); +} + +void LLSidepanelInventorySubpanel::setIsEditing(BOOL edit) +{ + mIsEditing = edit; + mIsDirty = TRUE; +} + +BOOL LLSidepanelInventorySubpanel::getIsEditing() const +{ + return mIsEditing; +} + +void LLSidepanelInventorySubpanel::reset() +{ + mIsDirty = TRUE; +} + +void LLSidepanelInventorySubpanel::draw() +{ + if (mIsDirty) + { + mIsDirty = FALSE; + refresh(); + updateVerbs(); + } + + LLPanel::draw(); +} + +void LLSidepanelInventorySubpanel::dirty() +{ + mIsDirty = TRUE; +} + +void LLSidepanelInventorySubpanel::updateVerbs() +{ + mEditBtn->setVisible(!mIsEditing); + mSaveBtn->setVisible(mIsEditing); + mCancelBtn->setVisible(mIsEditing); +} + +void LLSidepanelInventorySubpanel::onEditButtonClicked() +{ + setIsEditing(TRUE); + refresh(); + updateVerbs(); +} + +void LLSidepanelInventorySubpanel::onSaveButtonClicked() +{ + save(); + setIsEditing(FALSE); + refresh(); + updateVerbs(); +} + +void LLSidepanelInventorySubpanel::onCancelButtonClicked() +{ + setIsEditing(FALSE); + refresh(); + updateVerbs(); +} -- cgit v1.2.3 From 280e01729173e79e37939c3e764f9f3f674f79da Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 5 Nov 2009 15:00:36 -0500 Subject: EXT-2229 : Task SP : Update task on new selection Using activePanel hack to update selection when it changes. --HG-- branch : avatar-pipeline --- indra/newview/llsidepanelinventorysubpanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llsidepanelinventorysubpanel.cpp') diff --git a/indra/newview/llsidepanelinventorysubpanel.cpp b/indra/newview/llsidepanelinventorysubpanel.cpp index 8522456777..162198f1c5 100644 --- a/indra/newview/llsidepanelinventorysubpanel.cpp +++ b/indra/newview/llsidepanelinventorysubpanel.cpp @@ -87,7 +87,6 @@ void LLSidepanelInventorySubpanel::setVisible(BOOL visible) if (visible) { dirty(); - setIsEditing(FALSE); } LLPanel::setVisible(visible); } @@ -123,6 +122,7 @@ void LLSidepanelInventorySubpanel::draw() void LLSidepanelInventorySubpanel::dirty() { mIsDirty = TRUE; + setIsEditing(FALSE); } void LLSidepanelInventorySubpanel::updateVerbs() -- cgit v1.2.3