diff options
| author | James Cook <james@lindenlab.com> | 2009-07-07 00:53:05 +0000 |
|---|---|---|
| committer | James Cook <james@lindenlab.com> | 2009-07-07 00:53:05 +0000 |
| commit | 52aeaa32841e7d0b37abab0a2a2540c2be2f16b7 (patch) | |
| tree | d8f5c98644029dd289a97aa0d8b55c5a6200c214 /indra/newview/llfloateropenobject.cpp | |
| parent | 2c722655bd6701a3dc8518c6518c51f538765dcd (diff) | |
Merge skinning-14 to viewer-2, including refactoring many floaters to register them with LLFloaterReg, support for introspection of ParamBlock based UI widgets to dump XML schema, splitting llfolderview.cpp into three separate files to unravel dependencies and skeleton for for LLListView widget. Resolved conflicts in these files:
lldraghandle.h, lluictrl.h, llchiclet.cpp, llfolderview.h/cpp, lliinventorybridge.cpp, llpanelpicks.cpp, llviewermenu.cpp, floater_mute.xml, floater_preferences.xml, notifications.xml, panel_preferences_audio.xml, panel_preferences_graphics1.xml, panel_region_general.xml
svn merge -r124961:126284 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-14
Diffstat (limited to 'indra/newview/llfloateropenobject.cpp')
| -rw-r--r-- | indra/newview/llfloateropenobject.cpp | 83 |
1 files changed, 35 insertions, 48 deletions
diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index 4d782a1814..09460e41ad 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -46,9 +46,10 @@ #include "llagent.h" // for agent id #include "llalertdialog.h" #include "llinventorybridge.h" -#include "llinventoryview.h" +#include "llfloaterinventory.h" #include "llinventorymodel.h" #include "llpanelinventory.h" +#include "llfloaterreg.h" #include "llselectmgr.h" #include "lluiconstants.h" #include "llviewerobject.h" @@ -56,29 +57,44 @@ #include "llviewerwindow.h" -LLFloaterOpenObject* LLFloaterOpenObject::sInstance = NULL; - -LLFloaterOpenObject::LLFloaterOpenObject() -: LLFloater(), +LLFloaterOpenObject::LLFloaterOpenObject(const LLSD& key) +: LLFloater(key), mPanelInventory(NULL), mDirty(TRUE) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_openobject.xml"); +// LLUICtrlFactory::getInstance()->buildFloater(this,"floater_openobject.xml"); + mCommitCallbackRegistrar.add("OpenObject.MoveToInventory", boost::bind(&LLFloaterOpenObject::onClickMoveToInventory, this)); + mCommitCallbackRegistrar.add("OpenObject.MoveAndWear", boost::bind(&LLFloaterOpenObject::onClickMoveAndWear, this)); } LLFloaterOpenObject::~LLFloaterOpenObject() { - sInstance = NULL; +// sInstance = NULL; } // virtual BOOL LLFloaterOpenObject::postBuild() { - childSetAction("copy_to_inventory_button", onClickMoveToInventory, this); - childSetAction("copy_and_wear_button", onClickMoveAndWear, this); + mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); childSetTextArg("object_name", "[DESC]", std::string("Object") ); // *Note: probably do not want to translate this mPanelInventory = getChild<LLPanelInventory>("object_contents"); return TRUE; } + +void LLFloaterOpenObject::onOpen(const LLSD& key) +{ + LLObjectSelectionHandle object_selection = LLSelectMgr::getInstance()->getSelection(); + if (object_selection->getRootObjectCount() != 1) + { + LLNotifications::instance().add("UnableToViewContentsMoreThanOne"); + closeFloater(); + return; + } + if(!(object_selection->getPrimaryObject())) + { + closeFloater(); + return; + } +} void LLFloaterOpenObject::refresh() { mPanelInventory->refresh(); @@ -99,7 +115,6 @@ void LLFloaterOpenObject::refresh() } childSetTextArg("object_name", "[DESC]", name); - childSetEnabled("copy_to_inventory_button", enabled); childSetEnabled("copy_and_wear_button", enabled); @@ -115,34 +130,11 @@ void LLFloaterOpenObject::draw() LLFloater::draw(); } -// static void LLFloaterOpenObject::dirty() { - if (sInstance) sInstance->mDirty = TRUE; + mDirty = TRUE; } -// static -void LLFloaterOpenObject::show() -{ - LLObjectSelectionHandle object_selection = LLSelectMgr::getInstance()->getSelection(); - if (object_selection->getRootObjectCount() != 1) - { - LLNotifications::instance().add("UnableToViewContentsMoreThanOne"); - return; - } - - // Create a new instance only if needed - if (!sInstance) - { - sInstance = new LLFloaterOpenObject(); - sInstance->center(); - } - - sInstance->openFloater(); - sInstance->setFocus(TRUE); - - sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); -} void LLFloaterOpenObject::moveToInventory(bool wear) @@ -170,7 +162,7 @@ void LLFloaterOpenObject::moveToInventory(bool wear) } else { - parent_category_id = gAgent.getInventoryRootID(); + parent_category_id = gInventory.getRootFolderID(); } LLUUID category_id = gInventory.createNewCategory(parent_category_id, LLAssetType::AT_NONE, @@ -201,8 +193,8 @@ void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data) if (result == 0) { - LLInventoryView::showAgentInventory(); - LLInventoryView* view = LLInventoryView::getActiveInventory(); + LLFloaterInventory::showAgentInventory(); + LLFloaterInventory* view = LLFloaterInventory::getActiveInventory(); if (view) { view->getPanel()->setSelection(cat->mCatID, TAKE_FOCUS_NO); @@ -212,20 +204,15 @@ void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data) delete cat; } - -// static -void LLFloaterOpenObject::onClickMoveToInventory(void* data) +void LLFloaterOpenObject::onClickMoveToInventory() { - LLFloaterOpenObject* self = (LLFloaterOpenObject*)data; - self->moveToInventory(false); - self->closeFloater(); + moveToInventory(false); + closeFloater(); } -// static -void LLFloaterOpenObject::onClickMoveAndWear(void* data) +void LLFloaterOpenObject::onClickMoveAndWear() { - LLFloaterOpenObject* self = (LLFloaterOpenObject*)data; - self->moveToInventory(true); - self->closeFloater(); + moveToInventory(true); + closeFloater(); } |
