BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; if (getSoundFlags() & MOUSE_UP) { make_ui_sound("UISndClickRelease"); } // We only handle the click if the click both started and ended within us if (hasMouseCapture()) { // Release the mouse gFocusMgr.setMouseCapture( NULL ); // DO THIS AT THE VERY END to allow the button to be destroyed // as a result of being clicked. If mouseup in the widget, // it's been clicked if (mClickedCallback && !handled) { mClickedCallback(); handled = TRUE; } } else { handled = LLTextBase::handleMouseUp(x, y, mask); } return handled; }
BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) { if (!childrenHandleMouseDown(x, y, mask)) { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); if (hasTabStop() && !getIsChrome()) { setFocus(TRUE); } /* * ATTENTION! This call fires another mouse down callback. * If you wish to remove this call emit that signal directly * by calling LLUICtrl::mMouseDownSignal(x, y, mask); */ LLUICtrl::handleMouseDown(x, y, mask); LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); if(mMouseDownSignal) (*mMouseDownSignal)(this, LLSD()); mMouseDownTimer.start(); mMouseDownFrame = (S32) LLFrameTimer::getFrameCount(); mMouseHeldDownCount = 0; if (getSoundFlags() & MOUSE_DOWN) { make_ui_sound("UISndClick"); } } return TRUE; }
BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; // We only handle the click if the click both started and ended within us // HACK: Only do this if there actually is a click callback, so that // overly large text boxes in the older UI won't start eating clicks. if (mClickedCallback && hasMouseCapture()) { handled = TRUE; // Release the mouse gFocusMgr.setMouseCapture( NULL ); if (getSoundFlags() & MOUSE_UP) { make_ui_sound("UISndClickRelease"); } // DO THIS AT THE VERY END to allow the button to be destroyed as a result of being clicked. // If mouseup in the widget, it's been clicked if (mClickedCallback) { (*mClickedCallback)( mCallbackUserData ); } } return handled; }
// static void LLAvatarActions::startAdhocCall(const std::vector<LLUUID>& ids) { if (ids.size() == 0) { return; } // convert vector into LLDynamicArray for addSession LLDynamicArray<LLUUID> id_array; for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) { id_array.push_back(*it); } // create the new ad hoc voice session const std::string title = LLTrans::getString("conference-title"); LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], id_array, true); if (session_id == LLUUID::null) { return; } gIMMgr->autoStartCallOnStartup(session_id); make_ui_sound("UISndStartIM"); }
static void on_avatar_name_cache_start_im(const LLUUID& agent_id, const LLAvatarName& av_name) { static LLCachedControl<bool> tear_off("OtherChatsTornOff"); if (!tear_off) gIMMgr->setFloaterOpen(true); gIMMgr->addSession(LLCacheName::cleanFullName(av_name.getLegacyName()), IM_NOTHING_SPECIAL, agent_id); make_ui_sound("UISndStartIM"); }
// static void LLPanelFriends::onClickIM(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; //llinfos << "LLPanelFriends::onClickIM()" << llendl; LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs(); if(ids.size() > 0) { if(ids.size() == 1) { LLUUID agent_id = ids[0]; const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(agent_id); std::string fullname; if(info && gCacheName->getFullName(agent_id, fullname)) { gIMMgr->setFloaterOpen(TRUE); gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id); } } else { gIMMgr->setFloaterOpen(TRUE); gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); } make_ui_sound("UISndStartIM"); } }
void FloaterAvatarList::chat_alerts(avatar_entry *entry, bool same_region, bool in_draw, bool in_chat) { static BOOL *sEmeraldRadarChatAlerts = rebind_llcontrol<BOOL>("EmeraldRadarChatAlerts",&gSavedSettings,true); static BOOL *sEmeraldRadarAlertSim = rebind_llcontrol<BOOL>("EmeraldRadarAlertSim",&gSavedSettings,true); static BOOL *sEmeraldRadarAlertDraw = rebind_llcontrol<BOOL>("EmeraldRadarAlertDraw",&gSavedSettings,true); static BOOL *sEmeraldRadarAlertChatRange = rebind_llcontrol<BOOL>("EmeraldRadarAlertChatRange",&gSavedSettings,true); static F32 *sEmeraldAvatarAgeAlertDays = rebind_llcontrol<F32>("EmeraldAvatarAgeAlertDays",&gSavedSettings,true); if(*sEmeraldRadarChatAlerts) { if(entry->last_in_sim != same_region && *sEmeraldRadarAlertSim) { LLChat chat; chat.mFromName = entry->name; chat.mURL = llformat("secondlife:///app/agent/%s/about",entry->id.asString().c_str()); chat.mText = entry->name+" has "+(same_region ? "entered" : "left")+" the sim."; chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::addChat(chat); } if(entry->last_in_draw != in_draw && *sEmeraldRadarAlertDraw) { LLChat chat; chat.mFromName = entry->name; chat.mURL = llformat("secondlife:///app/agent/%s/about",entry->id.asString().c_str()); chat.mText = entry->name+" has "+(in_draw ? "entered" : "left")+" draw distance."; chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::addChat(chat); } if(entry->last_in_chat != in_chat && *sEmeraldRadarAlertChatRange) { LLChat chat; chat.mFromName = entry->name; chat.mURL = llformat("secondlife:///app/agent/%s/about",entry->id.asString().c_str()); chat.mText = entry->name+" has "+(in_chat ? "entered" : "left")+" chat range."; chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::addChat(chat); } if(!entry->age_alerted && entry->has_info) { entry->age_alerted = true; if(entry->account_age < *sEmeraldAvatarAgeAlertDays) { LLChat chat; chat.mFromName = entry->name; chat.mURL = llformat("secondlife:///app/agent/%s/about",entry->id.asString().c_str()); make_ui_sound("EmeraldAvatarAgeAlertSoundUUID"); chat.mText = entry->name+" has triggered your avatar age alert."; chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::addChat(chat); } } } }
BOOL LLModalDialog::handleDoubleClick(S32 x, S32 y, MASK mask) { if (!LLFloater::handleDoubleClick(x, y, mask)) { // Click outside the panel make_ui_sound("UISndInvalidOp"); } return TRUE; }
static void on_avatar_name_cache_start_call(const LLUUID& agent_id, const LLAvatarName& av_name) { LLUUID session_id = gIMMgr->addSession(LLCacheName::cleanFullName(av_name.getLegacyName()), IM_NOTHING_SPECIAL, agent_id); if (session_id.notNull()) { gIMMgr->startCall(session_id); } make_ui_sound("UISndStartIM"); }
void LLStatusBar::setBalance(S32 balance) { mTextBalance->setText(gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str() + LLResMgr::getInstance()->getMonetaryString(balance - mUPC)); if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) { if (mBalance > balance) make_ui_sound("UISndMoneyChangeDown"); else make_ui_sound("UISndMoneyChangeUp"); } if( balance != mBalance ) { mBalanceTimer->reset(ICON_TIMER_EXPIRY); mBalance = balance; } }
void LLAlertDialog::setVisible( BOOL visible ) { LLModalDialog::setVisible( visible ); if( visible ) { centerOnScreen(); make_ui_sound("UISndAlert"); } }
// static void LLAvatarActions::startConference(const uuid_vec_t& ids) { for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { // [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h const LLUUID& idAgent = *it; if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) { make_ui_sound("UISndInvalidOp"); RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", LLSLURL("agent", idAgent, "completename").getSLURLString())); return; } // [/RLVa:KB] } static LLCachedControl<bool> tear_off("OtherChatsTornOff"); if (!tear_off) gIMMgr->setFloaterOpen(true); const std::string title = LLTrans::getString("conference-title"); gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], ids); make_ui_sound("UISndStartIM"); }
void LLToastAlertPanel::setVisible( BOOL visible ) { // only make the "ding" sound if it's newly visible if( visible && !LLToastPanel::getVisible() ) { make_ui_sound("UISndAlert"); } LLToastPanel::setVisible( visible ); }
void LLStatusBar::setBalance(S32 balance) { if (balance > getBalance() && getBalance() != 0) { LLFirstUse::receiveLindens(); } std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); LLStringUtil::format_map_t string_args; string_args["[AMT]"] = llformat("%s", money_str.c_str()); std::string label_str = getString("buycurrencylabel", string_args); mBoxBalance->setValue(label_str); // Resize the L$ balance background to be wide enough for your balance plus the buy button { const S32 HPAD = 24; LLRect balance_rect = mBoxBalance->getTextBoundingRect(); LLRect buy_rect = getChildView("buyL")->getRect(); LLRect shop_rect = getChildView("goShop")->getRect(); LLView* balance_bg_view = getChildView("balance_bg"); LLRect balance_bg_rect = balance_bg_view->getRect(); balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + shop_rect.getWidth() + balance_rect.getWidth() + HPAD); balance_bg_view->setShape(balance_bg_rect); } if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) { if (mBalance > balance) make_ui_sound("UISndMoneyChangeDown"); else make_ui_sound("UISndMoneyChangeUp"); } if( balance != mBalance ) { mBalanceTimer->reset(); mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); mBalance = balance; } }
BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) { if (!LLFloater::handleMouseDown(x, y, mask)) { if (mModal) { // Click was outside the panel make_ui_sound("UISndInvalidOp"); } } return TRUE; }
void PieMenu::show(S32 x,S32 y) { // if the menu is already there, do nothing if(getVisible()) return; // play a sound make_ui_sound("UISndPieMenuAppear"); lldebugs << "PieMenu::show(): " << x << " " << y << llendl; // make sure the menu is always the correct size reshape(PIE_OUTER_SIZE*2,PIE_OUTER_SIZE*2,FALSE); // remember our center point mCenterX=x; mCenterY=y; // get the 3D view rectangle LLRect screen=LLMenuGL::sMenuContainer->getMenuRect(); // check if the pie menu is out of bounds and move it accordingly if(x-PIE_OUTER_SIZE<0) x=PIE_OUTER_SIZE; else if(x+PIE_OUTER_SIZE>screen.getWidth()) x=screen.getWidth()-PIE_OUTER_SIZE; if(y-PIE_OUTER_SIZE<screen.mBottom) y=PIE_OUTER_SIZE+screen.mBottom; else if(y+PIE_OUTER_SIZE-screen.mBottom>screen.getHeight()) y=screen.getHeight()-PIE_OUTER_SIZE+screen.mBottom; // move the mouse pointer into the center of the menu LLUI::setMousePositionLocal(getParent(),x,y); // set our drawing origin to the center of the menu, taking UI scale into account LLVector2 scale=gViewerWindow->getDisplayScale(); setOrigin(x-PIE_OUTER_SIZE/scale.mV[VX],y-PIE_OUTER_SIZE/scale.mV[VY]); // grab mouse control gFocusMgr.setMouseCapture(this); // this was the first click for the menu mFirstClick=TRUE; // set up the slices pointer to the menu's own slices mSlices=&mMySlices; // cleanup mSlice=0; mOldSlice=0; // draw the menu on screen setVisible(TRUE); LLView::setVisible(TRUE); }
void LLStatusBar::setBalance(S32 balance) { LLString balance_str; gResMgr->getMonetaryString( balance_str, balance ); mTextBalance->setText( balance_str ); if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) { if (mBalance > balance) make_ui_sound("UISndMoneyChangeDown"); else make_ui_sound("UISndMoneyChangeUp"); } if( balance != mBalance ) { mBalanceTimer->reset(); mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); mBalance = balance; } }
// static LLUUID LLGroupActions::startIM(const LLUUID& group_id) { if (group_id.isNull()) return LLUUID::null; // [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) ) { make_ui_sound("UISndInvalidOp"); RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString())); return LLUUID::null; } // [/RLVa:KB] LLGroupData group_data; if (gAgent.getGroupData(group_id, group_data)) { // <exodus> // Unmute the group if the user tries to start a session with it. exoGroupMuteList::instance().remove(group_id); // </exodus> LLUUID session_id = gIMMgr->addSession( group_data.mName, IM_SESSION_GROUP_START, group_id); if (session_id != LLUUID::null) { LLIMFloater::show(session_id); } make_ui_sound("UISndStartIM"); return session_id; } else { // this should never happen, as starting a group IM session // relies on you belonging to the group and hence having the group data make_ui_sound("UISndInvalidOp"); return LLUUID::null; } }
// HACK: Committing a button is the same as instantly clicking it. // virtual void LLButton::onCommit() { // WARNING: Sometimes clicking a button destroys the floater or // panel containing it. Therefore we need to call mClickedCallback // LAST, otherwise this becomes deleted memory. LLUICtrl::onCommit(); if (mMouseDownCallback) { (*mMouseDownCallback)(mCallbackUserData); } if (mMouseUpCallback) { (*mMouseUpCallback)(mCallbackUserData); } if (getSoundFlags() & MOUSE_DOWN) { make_ui_sound("UISndClick"); } if (getSoundFlags() & MOUSE_UP) { make_ui_sound("UISndClickRelease"); } if (mIsToggle) { toggleState(); } // do this last, as it can result in destroying this button if (mClickedCallback) { (*mClickedCallback)( mCallbackUserData ); } }
// static void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids) { if (ids.size() == 0) { return; } // convert vector into LLDynamicArray for addSession LLDynamicArray<LLUUID> id_array; for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { // [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h const LLUUID& idAgent = *it; if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) { make_ui_sound("UISndInvalidOp"); RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", LLSLURL("agent", idAgent, "completename").getSLURLString())); return; } id_array.push_back(idAgent); // [/RLVa:KB] // id_array.push_back(*it); } // create the new ad hoc voice session const std::string title = LLTrans::getString("conference-title"); LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], id_array); if (session_id.isNull()) { return; } gIMMgr->autoStartCallOnStartup(session_id); make_ui_sound("UISndStartIM"); }
BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) { // only do sticky-focus on non-chrome widgets if (!getIsChrome()) { setFocus(TRUE); } if( mMouseDownCallback ) { mMouseDownCallback( this, mCallbackUserData ); } if (MASK_CONTROL & mask) // if CTRL is modifying { setCurSliderValue(mInitialValue); onCommit(); } else { // scroll through thumbs to see if we have a new one selected and select that one std::map<std::string, LLRect>::iterator mIt = mThumbRects.begin(); for(; mIt != mThumbRects.end(); mIt++) { // check if inside. If so, set current slider and continue if(mIt->second.pointInRect(x,y)) { mCurSlider = mIt->first; break; } } // Find the offset of the actual mouse location from the center of the thumb. if (mThumbRects[mCurSlider].pointInRect(x,y)) { mMouseOffset = (mThumbRects[mCurSlider].mLeft + MULTI_THUMB_WIDTH/2) - x; } else { mMouseOffset = 0; } // Start dragging the thumb // No handler needed for focus lost since this class has no state that depends on it. gFocusMgr.setMouseCapture( this ); mDragStartThumbRect = mThumbRects[mCurSlider]; } make_ui_sound("UISndClick"); return TRUE; }
// static void LLAvatarActions::startCall(const LLUUID& id) { if (id.isNull()) { return; } std::string name; gCacheName->getFullName(id, name); LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id, true); if (session_id != LLUUID::null) { gIMMgr->startCall(session_id); } make_ui_sound("UISndStartIM"); }
// static void LLAvatarActions::startConference(const std::vector<LLUUID>& ids) { // *HACK: Copy into dynamic array LLDynamicArray<LLUUID> id_array; for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) { id_array.push_back(*it); } const std::string title = LLTrans::getString("conference-title"); LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], id_array); if (session_id != LLUUID::null) { LLIMFloater::show(session_id); } make_ui_sound("UISndStartIM"); }
// protected void LLFloaterWorldMap::fly() { LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); // Start the autopilot and close the floater, // so we can see where we're flying if (!pos_global.isExactlyZero()) { gAgent.startAutoPilotGlobal( pos_global ); close(); } else { make_ui_sound("UISndInvalidOp"); } }
BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) { // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) { // Always release the mouse gFocusMgr.setMouseCapture( NULL ); /* * ATTENTION! This call fires another mouse up callback. * If you wish to remove this call emit that signal directly * by calling LLUICtrl::mMouseUpSignal(x, y, mask); */ LLUICtrl::handleMouseUp(x, y, mask); LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); // Regardless of where mouseup occurs, handle callback if(mMouseUpSignal) (*mMouseUpSignal)(this, LLSD()); resetMouseDownTimer(); // DO THIS AT THE VERY END to allow the button to be destroyed as a result of being clicked. // If mouseup in the widget, it's been clicked if (pointInView(x, y)) { if (getSoundFlags() & MOUSE_UP) { make_ui_sound("UISndClickRelease"); } if (mIsToggle) { toggleState(); } LLUICtrl::onCommit(); } } else { childrenHandleMouseUp(x, y, mask); } return TRUE; }
void PieMenu::hide() { // if the menu is already hidden, do nothing if(!getVisible()) return; // make a sound when hiding make_ui_sound("UISndPieMenuHide"); lldebugs << "Clearing selections" << llendl; mSlices=&mMySlices; #if PIE_POPUP_EFFECT // safety in case the timer was still running mPopupTimer.stop(); #endif LLView::setVisible(FALSE); }
// static void LLAvatarActions::startIM(const LLUUID& id) { if (id.isNull()) return; std::string name; if (!gCacheName->getFullName(id, name)) { gCacheName->get(id, FALSE, boost::bind(&LLAvatarActions::startIM, id)); return; } LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id); if (session_id != LLUUID::null) { LLIMFloater::show(session_id); } make_ui_sound("UISndStartIM"); }
BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = LLTextBase::handleMouseDown(x, y, mask); if (getSoundFlags() & MOUSE_DOWN) { make_ui_sound("UISndClick"); } if (!handled && mClickedCallback) { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); handled = TRUE; } return handled; }
BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; if( hasMouseCapture() ) { gFocusMgr.setMouseCapture( NULL ); if (mMouseUpSignal) (*mMouseUpSignal)( this, getValueF32() ); handled = TRUE; make_ui_sound("UISndClickRelease"); } else { handled = TRUE; } return handled; }
BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; // HACK: Only do this if there actually is a click callback, so that // overly large text boxes in the older UI won't start eating clicks. if (mClickedCallback) { handled = TRUE; // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); if (getSoundFlags() & MOUSE_DOWN) { make_ui_sound("UISndClick"); } } return handled; }