diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llselectmgr.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 68 | ||||
-rw-r--r-- | indra/newview/llviewermenu.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 6 |
4 files changed, 46 insertions, 66 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 27cf29cee0..434d7a4492 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2799,6 +2799,8 @@ void LLSelectMgr::selectDelete() return; } + LLObjectSelectionHandle* selection_handlep = new LLObjectSelectionHandle(getSelection()); + if(locked_but_deleteable_object || no_copy_but_deleteable_object || !all_owned_by_you) @@ -2815,49 +2817,49 @@ void LLSelectMgr::selectDelete() //Locked only gViewerWindow->alertXml( "ConfirmObjectDeleteLock", &LLSelectMgr::confirmDelete, - this); + selection_handlep); } else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you) { //No Copy only gViewerWindow->alertXml( "ConfirmObjectDeleteNoCopy", &LLSelectMgr::confirmDelete, - this); + selection_handlep); } else if(!locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you) { //not owned only gViewerWindow->alertXml( "ConfirmObjectDeleteNoOwn", &LLSelectMgr::confirmDelete, - this); + selection_handlep); } else if(locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you) { //locked and no copy gViewerWindow->alertXml( "ConfirmObjectDeleteLockNoCopy", &LLSelectMgr::confirmDelete, - this); + selection_handlep); } else if(locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you) { //locked and not owned gViewerWindow->alertXml( "ConfirmObjectDeleteLockNoOwn", &LLSelectMgr::confirmDelete, - this); + selection_handlep); } else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && !all_owned_by_you) { //no copy and not owned gViewerWindow->alertXml( "ConfirmObjectDeleteNoCopyNoOwn", &LLSelectMgr::confirmDelete, - this); + selection_handlep); } else { //locked, no copy and not owned gViewerWindow->alertXml( "ConfirmObjectDeleteLockNoCopyNoOwn", &LLSelectMgr::confirmDelete, - this); + selection_handlep); } @@ -2872,8 +2874,15 @@ void LLSelectMgr::selectDelete() // static void LLSelectMgr::confirmDelete(S32 option, void* data) { - LLSelectMgr* self = (LLSelectMgr*)data; - if(!self) return; + LLObjectSelectionHandle handle = *(LLObjectSelectionHandle*)data; + delete (LLObjectSelectionHandle*)data; + + if (!handle->getObjectCount()) + { + llwarns << "Nothing to delete!" << llendl; + return; + } + switch(option) { case 0: @@ -2882,19 +2891,19 @@ void LLSelectMgr::confirmDelete(S32 option, void* data) LLUUID trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); // attempt to derez into the trash. LLDeRezInfo* info = new LLDeRezInfo(DRD_TRASH, trash_id); - self->sendListToRegions("DeRezObject", + gSelectMgr->sendListToRegions("DeRezObject", packDeRezHeader, packObjectLocalID, (void*)info, SEND_ONLY_ROOTS); // VEFFECT: Delete Object - one effect for all deletes - if (self->mSelectedObjects->mSelectType != SELECT_TYPE_HUD) + if (gSelectMgr->mSelectedObjects->mSelectType != SELECT_TYPE_HUD) { LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); - effectp->setPositionGlobal( self->getSelectionCenterGlobal() ); + effectp->setPositionGlobal( gSelectMgr->getSelectionCenterGlobal() ); effectp->setColor(LLColor4U(gAgent.getEffectColor())); F32 duration = 0.5f; - duration += self->mSelectedObjects->getObjectCount() / 64.f; + duration += gSelectMgr->mSelectedObjects->getObjectCount() / 64.f; effectp->setDuration(duration); } @@ -2902,7 +2911,7 @@ void LLSelectMgr::confirmDelete(S32 option, void* data) // Keep track of how many objects have been deleted. F64 obj_delete_count = gViewerStats->getStat(LLViewerStats::ST_OBJECT_DELETE_COUNT); - obj_delete_count += self->mSelectedObjects->getObjectCount(); + obj_delete_count += gSelectMgr->mSelectedObjects->getObjectCount(); gViewerStats->setStat(LLViewerStats::ST_OBJECT_DELETE_COUNT, obj_delete_count ); } break; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e9e98a4916..275db0f906 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4136,10 +4136,8 @@ void handle_take() !you_own_everything) { - if(locked_but_takeable_object && you_own_everything) { - gViewerWindow->alertXml("ConfirmObjectTakeLock", confirm_take, (void*)cat_id); @@ -4147,7 +4145,6 @@ void handle_take() } else if(!locked_but_takeable_object && !you_own_everything) { - gViewerWindow->alertXml("ConfirmObjectTakeNoOwn", confirm_take, (void*)cat_id); @@ -6093,54 +6090,47 @@ void complete_give_money(S32 option, void* user_data) gAgent.clearBusy(); } - LLUUID* object_id = (LLUUID*)user_data; + LLObjectSelectionHandle handle(*(LLObjectSelectionHandle*)user_data); + delete (LLObjectSelectionHandle*)user_data; - LLViewerObject* object = gObjectList.findObject(*object_id); - if (object) + LLViewerObject *objectp = handle->getFirstRootObject(); + + // Show avatar's name if paying attachment + if (objectp && objectp->isAttachment()) { - if (object->isAvatar()) + while (objectp && !objectp->isAvatar()) + { + objectp = (LLViewerObject*)objectp->getParent(); + } + } + + if (objectp) + { + if (objectp->isAvatar()) { const BOOL is_group = FALSE; LLFloaterPay::payDirectly(&give_money, - *object_id, + objectp->getID(), is_group); } else { - LLFloaterPay::payViaObject(&give_money, *object_id); + LLFloaterPay::payViaObject(&give_money, objectp->getID()); } } - - delete object_id; } bool handle_give_money_dialog() { - LLViewerObject *objectp = gViewerWindow->lastObjectHit(); - LLUUID* object_id = new LLUUID(); - - // Show avatar's name if paying attachment - if (objectp && objectp->isAttachment()) - { - while (objectp && !objectp->isAvatar()) - { - objectp = (LLViewerObject*)objectp->getParent(); - } - } - - if (objectp) - { - *object_id = objectp->getID(); - } - + LLObjectSelectionHandle* handlep = new LLObjectSelectionHandle(gSelectMgr->getSelection()); if (gAgent.getBusy()) { // warn users of being in busy mode during a transaction - gViewerWindow->alertXml("BusyModePay", complete_give_money, object_id); + gViewerWindow->alertXml("BusyModePay", complete_give_money, handlep); } else { - complete_give_money(1, object_id); + complete_give_money(1, handlep); } return true; } @@ -6793,24 +6783,6 @@ void near_attach_object(BOOL success, void *user_data) LLObjectAttachToAvatar::setObjectSelection(NULL); } -// move this somewhere global -void handle_attach_to_avatar(void* user_data) -{ - LLViewerObject* selectedObject = gSelectMgr->getSelection()->getFirstRootObject(); - if (selectedObject) - { - LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; - - if (attachment && attachment->getObject()) - { - gViewerWindow->alertXml("ReplaceAttachment", confirm_replace_attachment, user_data); - } - else - { - confirm_replace_attachment(0, user_data); - } - } -} void confirm_replace_attachment(S32 option, void* user_data) { if (option == 0/*YES*/) diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index f2d7e360c7..70d34c73c3 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -68,7 +68,6 @@ BOOL is_agent_mappable(const LLUUID& agent_id); void menu_toggle_control( void* user_data ); void check_toggle_control( LLUICtrl *, void* user_data ); -void handle_attach_to_avatar(void* user_data); void confirm_replace_attachment(S32 option, void* user_data); void handle_detach_from_avatar(void* user_data); void attach_label(LLString& label, void* user_data); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 9d4367cc79..aebcfdb9ce 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2699,13 +2699,13 @@ BOOL LLViewerWindow::handlePerFrameHover() gChatBar->startChat(NULL); } - // cleanup unused selections - if (gParcelMgr) + // cleanup unused selections when no modal dialogs are open + if (gParcelMgr && LLModalDialog::activeCount() == 0) { gParcelMgr->deselectUnused(); } - if (gSelectMgr) + if (gSelectMgr && LLModalDialog::activeCount() == 0) { gSelectMgr->deselectUnused(); } |