コード例 #1
0
LLFolderViewItem* LLLandmarksPanel::selectItemInAccordionTab(LLPlacesInventoryPanel* inventory_list,
															 const std::string& tab_name,
															 const LLUUID& obj_id,
															 BOOL take_keyboard_focus) const
{
	if (!inventory_list)
		return NULL;

	LLFolderView* root = inventory_list->getRootFolder();

	LLFolderViewItem* item = inventory_list->getItemByID(obj_id);
	if (!item)
		return NULL;

	LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(tab_name);
	if (!tab->isExpanded())
	{
		tab->changeOpenClose(false);
	}

	root->setSelection(item, FALSE, take_keyboard_focus);

	LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion");
	LLRect screen_rc;
	localRectToScreen(item->getRect(), &screen_rc);
	accordion->notifyParent(LLSD().with("scrollToShowRect", screen_rc.getValue()));

	return item;
}
コード例 #2
0
void LLAccordionCtrlTab::showAndFocusHeader()
{
	LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);	
	header->setFocus(true);
	header->setSelected(mSelectionEnabled);

	LLRect screen_rc;
	LLRect selected_rc = header->getRect();
	localRectToScreen(selected_rc, &screen_rc);
	notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));

}
コード例 #3
0
ファイル: llnamelistctrl.cpp プロジェクト: Belxjander/Kirito
//virtual
BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
{
	BOOL handled = FALSE;
	S32 column_index = getColumnIndexFromOffset(x);
	LLNameListItem* hit_item = dynamic_cast<LLNameListItem*>(hitItem(x, y));
	if (hit_item
		&& column_index == mNameColumnIndex)
	{
		// ...this is the column with the avatar name
		LLUUID avatar_id = hit_item->getUUID();
		if (avatar_id.notNull())
		{
			// ...valid avatar id

			LLScrollListCell* hit_cell = hit_item->getColumn(column_index);
			if (hit_cell)
			{
				S32 row_index = getItemIndex(hit_item);
				LLRect cell_rect = getCellRect(row_index, column_index);
				// Convert rect local to screen coordinates
				LLRect sticky_rect;
				localRectToScreen(cell_rect, &sticky_rect);

				// Spawn at right side of cell
				LLPointer<LLUIImage> icon = LLUI::getUIImage("Info_Small");
				LLCoordGL pos( sticky_rect.mRight - info_icon_size, sticky_rect.mTop - (sticky_rect.getHeight() - icon->getHeight())/2 );

				// Should we show a group or an avatar inspector?
				bool is_group = hit_item->isGroup();
				bool is_experience = hit_item->isExperience();

				LLToolTip::Params params;
				params.background_visible( false );
				params.click_callback( boost::bind(&LLNameListCtrl::showInspector, this, avatar_id, is_group, is_experience) );
				params.delay_time(0.0f);		// spawn instantly on hover
				params.image( icon );
				params.message("");
				params.padding(0);
				params.pos(pos);
				params.sticky_rect(sticky_rect);

				LLToolTipMgr::getInstance()->show(params);
				handled = TRUE;
			}
		}
	}
	if (!handled)
	{
		handled = LLScrollListCtrl::handleToolTip(x, y, mask);
	}
	return handled;
}
コード例 #4
0
// rect is in document coordinates, constraint is in display coordinates relative to content window rect
void LLScrollContainer::scrollToShowRect(const LLRect& rect, const LLRect& constraint)
{
	if (!mScrolledView)
	{
		llwarns << "LLScrollContainer::scrollToShowRect with no view!" << llendl;
		return;
	}

	LLRect content_window_rect = getContentWindowRect();
	// get document rect
	LLRect scrolled_rect = mScrolledView->getRect();

	// shrink target rect to fit within constraint region, biasing towards top left
	LLRect rect_to_constrain = rect;
	rect_to_constrain.mBottom = llmax(rect_to_constrain.mBottom, rect_to_constrain.mTop - constraint.getHeight());
	rect_to_constrain.mRight = llmin(rect_to_constrain.mRight, rect_to_constrain.mLeft + constraint.getWidth());

	// calculate allowable positions for scroller window in document coordinates
	LLRect allowable_scroll_rect(rect_to_constrain.mRight - constraint.mRight,
								rect_to_constrain.mBottom - constraint.mBottom,
								rect_to_constrain.mLeft - constraint.mLeft,
								rect_to_constrain.mTop - constraint.mTop);

	// translate from allowable region for lower left corner to upper left corner
	allowable_scroll_rect.translate(0, content_window_rect.getHeight());

	S32 vert_pos = llclamp(mScrollbar[VERTICAL]->getDocPos(), 
					mScrollbar[VERTICAL]->getDocSize() - allowable_scroll_rect.mTop, // min vertical scroll
					mScrollbar[VERTICAL]->getDocSize() - allowable_scroll_rect.mBottom); // max vertical scroll	

	mScrollbar[VERTICAL]->setDocSize( scrolled_rect.getHeight() );
	mScrollbar[VERTICAL]->setPageSize( content_window_rect.getHeight() );
	mScrollbar[VERTICAL]->setDocPos( vert_pos );

	S32 horizontal_pos = llclamp(mScrollbar[HORIZONTAL]->getDocPos(), 
								allowable_scroll_rect.mLeft,
								allowable_scroll_rect.mRight);

	mScrollbar[HORIZONTAL]->setDocSize( scrolled_rect.getWidth() );
	mScrollbar[HORIZONTAL]->setPageSize( content_window_rect.getWidth() );
	mScrollbar[HORIZONTAL]->setDocPos( horizontal_pos );

	// propagate scroll to document
	updateScroll();

	// In case we are in accordion tab notify parent to show selected rectangle
	LLRect screen_rc;
	localRectToScreen(rect_to_constrain, &screen_rc);
	notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
}
コード例 #5
0
void LLAccordionCtrlTab::showAndFocusHeader()
{
	mHeader->setFocus(true);
	mHeader->setSelected(mSelectionEnabled);

	LLRect screen_rc;
	LLRect selected_rc = mHeader->getRect();
	localRectToScreen(selected_rc, &screen_rc);

	// This call to notifyParent() is intended to deliver "scrollToShowRect" command
	// to the parent LLAccordionCtrl so by calling it from the direct parent of this
	// accordion tab (assuming that the parent is an LLAccordionCtrl) the calls chain
	// is shortened and messages from inside the collapsed tabs are avoided.
	// See STORM-536.
	getParent()->notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
}
コード例 #6
0
bool LLPanelMediaHUD::isMouseOver()
{
	if( ! getVisible() )
	{
		return false;
	}
	LLRect screen_rect;
	LLCoordWindow cursor_pos_window;
	getWindow()->getCursorPosition(&cursor_pos_window);

	localRectToScreen(getLocalRect(), &screen_rect);
	// screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &local_mouse_x, &local_mouse_y);

	if(screen_rect.pointInRect(cursor_pos_window.mX, cursor_pos_window.mY))
	{
		return true;
	}
	return false;
}
コード例 #7
0
void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
{
	if (child && child->getVisible() && child->getRect().isValid())
	{
		LLRect screen_rect;
		localRectToScreen(child->getRect(),&screen_rect);
		
		if ( root_rect.overlaps(screen_rect)  && LLUI::sDirtyRect.overlaps(screen_rect))
		{
			glMatrixMode(GL_MODELVIEW);
			LLUI::pushMatrix();
			{
				LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f);
				child->draw();

			}
			LLUI::popMatrix();
		}
	}
}
コード例 #8
0
void LLParticipantList::refreshSpeakers()
{
	// store off current selection and scroll state to preserve across list rebuilds
	const S32 scroll_pos = mAvatarList->getScrollInterface()->getScrollPos();

	// decide whether it's ok to resort the list then update the speaker manager appropriately.
	// rapid resorting by activity makes it hard to interact with speakers in the list
	// so we freeze the sorting while the user appears to be interacting with the control.
	// we assume this is the case whenever the mouse pointer is within the active speaker
	// panel and hasn't been motionless for more than a few seconds. see DEV-6655 -MG
	LLRect screen_rect;
	localRectToScreen(getLocalRect(), &screen_rect);
	mSpeakerMgr->update(!(screen_rect.pointInRect(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY()) && gMouseIdleTimer.getElapsedTimeF32() < 5.f));

	std::vector<LLScrollListItem*> items = mAvatarList->getAllData();
	for (std::vector<LLScrollListItem*>::iterator item_it = items.begin(); item_it != items.end(); ++item_it)
	{
		LLScrollListItem* itemp = (*item_it);
		LLPointer<LLSpeaker> speakerp = mSpeakerMgr->findSpeaker(itemp->getUUID());
		if (speakerp.isNull()) continue;

		if (LLScrollListCell* icon_cell = itemp->getColumn(0))
		{
			if (speakerp->mStatus == LLSpeaker::STATUS_MUTED)
			{
				icon_cell->setValue("mute_icon.tga");
				static const LLCachedControl<LLColor4> sAscentMutedColor("AscentMutedColor");
				icon_cell->setColor(speakerp->mModeratorMutedVoice ? /*LLColor4::grey*/sAscentMutedColor : LLColor4(1.f, 71.f / 255.f, 71.f / 255.f, 1.f));
			}
			else
			{
				switch(llmin(2, llfloor((speakerp->mSpeechVolume / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 3.f)))
				{
					case 0:
						icon_cell->setValue("icn_active-speakers-dot-lvl0.tga");
						break;
					case 1:
						icon_cell->setValue("icn_active-speakers-dot-lvl1.tga");
						break;
					case 2:
						icon_cell->setValue("icn_active-speakers-dot-lvl2.tga");
						break;
				}
				// non voice speakers have hidden icons, render as transparent
				icon_cell->setColor(speakerp->mStatus > LLSpeaker::STATUS_VOICE_ACTIVE ? LLColor4::transparent : speakerp->mDotColor);
			}
		}
		// update name column
		if (LLScrollListCell* name_cell = itemp->getColumn(1))
		{
			if (speakerp->mStatus == LLSpeaker::STATUS_NOT_IN_CHANNEL)
			{
				// draw inactive speakers in different color
				static const LLCachedControl<LLColor4> sSpeakersInactive(gColors, "SpeakersInactive");
				name_cell->setColor(sSpeakersInactive);
			}
			else
			{
				bool found = mShowTextChatters || speakerp->mID == gAgentID;
				const LLWorld::region_list_t& regions = LLWorld::getInstance()->getRegionList();
				for (LLWorld::region_list_t::const_iterator iter = regions.begin(); !found && iter != regions.end(); ++iter)
				{
					// Are they in this sim?
					if (const LLViewerRegion* regionp = *iter)
						if (std::find(regionp->mMapAvatarIDs.begin(), regionp->mMapAvatarIDs.end(), speakerp->mID) != regionp->mMapAvatarIDs.end())
							found = true;
				}
				if (!found)
				{
					static const LLCachedControl<LLColor4> sSpeakersGhost(gColors, "SpeakersGhost");
					name_cell->setColor(sSpeakersGhost);
				}
				else
				{
					static const LLCachedControl<LLColor4> sDefaultListText(gColors, "DefaultListText");
					name_cell->setColor(sDefaultListText);
				}
			}

			std::string speaker_name = speakerp->mDisplayName.empty() ? LLCacheName::getDefaultName() : speakerp->mDisplayName;
			if (speakerp->mIsModerator)
				speaker_name += " " + getString("moderator_label");
			name_cell->setValue(speaker_name);
			static_cast<LLScrollListText*>(name_cell)->setFontStyle(speakerp->mIsModerator ? LLFontGL::BOLD : LLFontGL::NORMAL);
		}
		// update speaking order column
		if (LLScrollListCell* speaking_status_cell = itemp->getColumn(2))
		{
			// since we are forced to sort by text, encode sort order as string
			// print speaking ordinal in a text-sorting friendly manner
			speaking_status_cell->setValue(llformat("%010d", speakerp->mSortIndex));
		}
	}

	// we potentially modified the sort order by touching the list items
	mAvatarList->setNeedsSort();

	// keep scroll value stable
	mAvatarList->getScrollInterface()->setScrollPos(scroll_pos);
}
コード例 #9
0
void LLPanelActiveSpeakers::refreshSpeakers()
{
	// store off current selection and scroll state to preserve across list rebuilds
	LLUUID selected_id = mSpeakerList->getSelectedValue().asUUID();
	S32 scroll_pos = mSpeakerList->getScrollInterface()->getScrollPos();

	// decide whether it's ok to resort the list then update the speaker manager appropriately.
	// rapid resorting by activity makes it hard to interact with speakers in the list
	// so we freeze the sorting while the user appears to be interacting with the control.
	// we assume this is the case whenever the mouse pointer is within the active speaker
	// panel and hasn't been motionless for more than a few seconds. see DEV-6655 -MG
	LLRect screen_rect;
	localRectToScreen(getLocalRect(), &screen_rect);
	BOOL mouse_in_view = screen_rect.pointInRect(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY());
	F32 mouses_last_movement = gMouseIdleTimer.getElapsedTimeF32();
	BOOL sort_ok = ! (mouse_in_view && mouses_last_movement<RESORT_TIMEOUT);
	mSpeakerMgr->update(sort_ok);

	const std::string icon_image_0 = "icn_active-speakers-dot-lvl0.tga";
	const std::string icon_image_1 = "icn_active-speakers-dot-lvl1.tga";
	const std::string icon_image_2 = "icn_active-speakers-dot-lvl2.tga";

	std::vector<LLScrollListItem*> items = mSpeakerList->getAllData();

	std::string mute_icon_image = "mute_icon.tga";

	LLSpeakerMgr::speaker_list_t speaker_list;
	mSpeakerMgr->getSpeakerList(&speaker_list, mShowTextChatters);
	for (std::vector<LLScrollListItem*>::iterator item_it = items.begin();
		item_it != items.end();
		++item_it)
	{
		LLScrollListItem* itemp = (*item_it);
		LLUUID speaker_id = itemp->getUUID();

		LLPointer<LLSpeaker> speakerp = mSpeakerMgr->findSpeaker(speaker_id);
		if (!speakerp)
		{
			continue;
		}

		// since we are forced to sort by text, encode sort order as string
		std::string speaking_order_sort_string = llformat("%010d", speakerp->mSortIndex);

		LLScrollListCell* icon_cell = itemp->getColumn(0);
		if (icon_cell)
		{

			std::string icon_image_id;

			S32 icon_image_idx = llmin(2, llfloor((speakerp->mSpeechVolume / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 3.f));
			switch(icon_image_idx)
			{
			case 0:
				icon_image_id = icon_image_0;
				break;
			case 1:
				icon_image_id = icon_image_1;
				break;
			case 2:
				icon_image_id = icon_image_2;
				break;
			}

			LLColor4 icon_color;
			if (speakerp->mStatus == LLSpeaker::STATUS_MUTED)
			{
				icon_cell->setValue(mute_icon_image);
				if(speakerp->mModeratorMutedVoice)
				{
					icon_color.setVec(0.5f, 0.5f, 0.5f, 1.f);
				}
				else
				{
					icon_color.setVec(1.f, 71.f / 255.f, 71.f / 255.f, 1.f);
				}
			}
			else
			{
				icon_cell->setValue(icon_image_id);
				icon_color = speakerp->mDotColor;

				if (speakerp->mStatus > LLSpeaker::STATUS_VOICE_ACTIVE) // if voice is disabled for this speaker
				{
					// non voice speakers have hidden icons, render as transparent
					icon_color.setVec(0.f, 0.f, 0.f, 0.f);
				}
			}

			icon_cell->setColor(icon_color);

			if (speakerp->mStatus > LLSpeaker::STATUS_VOICE_ACTIVE && speakerp->mStatus != LLSpeaker::STATUS_MUTED) // if voice is disabled for this speaker
			{
				// non voice speakers have hidden icons, render as transparent
				icon_cell->setColor(LLColor4::transparent);
			}
		}

		// update name column
		LLScrollListCell* name_cell = itemp->getColumn(1);
		if (name_cell)
		{
			//FIXME: remove hard coding of font colors
			if (speakerp->mStatus == LLSpeaker::STATUS_NOT_IN_CHANNEL)	
			{
				// draw inactive speakers in gray
				name_cell->setColor(LLColor4::grey4);
			}
			else
			{
				name_cell->setColor(gColors.getColor("DefaultListText"));
			}

			std::string speaker_name;
			if (speakerp->mDisplayName.empty())
			{
				speaker_name = LLCacheName::getDefaultName();
			}
			else
			{
				speaker_name = speakerp->mDisplayName;
			}

			if (speakerp->mIsModerator)
			{
				speaker_name += std::string(" ") + getString("moderator_label");
			}
			
			name_cell->setValue(speaker_name);
			((LLScrollListText*)name_cell)->setFontStyle(speakerp->mIsModerator ? LLFontGL::BOLD : LLFontGL::NORMAL);
		}

		// update speaking order column
		LLScrollListCell* speaking_status_cell = itemp->getColumn(2);
		if (speaking_status_cell)
		{
			// print speaking ordinal in a text-sorting friendly manner
			speaking_status_cell->setValue(speaking_order_sort_string);
		}
	}
	
	// we potentially modified the sort order by touching the list items
	mSpeakerList->setSorted(FALSE);

	LLPointer<LLSpeaker> selected_speakerp = mSpeakerMgr->findSpeaker(selected_id);
	// update UI for selected participant
	if (mMuteVoiceCtrl)
	{
		mMuteVoiceCtrl->setValue(LLMuteList::getInstance()->isMuted(selected_id, LLMute::flagVoiceChat));
		mMuteVoiceCtrl->setEnabled(LLVoiceClient::voiceEnabled()
									&& gVoiceClient->getVoiceEnabled(selected_id)
									&& selected_id.notNull() 
									&& selected_id != gAgent.getID() 
									&& (selected_speakerp.notNull() && (selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT || selected_speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL)));

	}
	if (mMuteTextCtrl)
	{
		mMuteTextCtrl->setValue(LLMuteList::getInstance()->isMuted(selected_id, LLMute::flagTextChat));
		mMuteTextCtrl->setEnabled(selected_id.notNull() 
								&& selected_id != gAgent.getID() 
								&& selected_speakerp.notNull() 
								&& selected_speakerp->mType != LLSpeaker::SPEAKER_EXTERNAL
								&& !LLMuteList::getInstance()->isLinden(selected_speakerp->mDisplayName));
	}
	childSetValue("speaker_volume", gVoiceClient->getUserVolume(selected_id));
	childSetEnabled("speaker_volume", LLVoiceClient::voiceEnabled()
					&& gVoiceClient->getVoiceEnabled(selected_id)
					&& selected_id.notNull() 
					&& selected_id != gAgent.getID() 
					&& (selected_speakerp.notNull() && (selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT || selected_speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL)));

	childSetEnabled(
		"moderator_controls_label",
		selected_id.notNull());

	childSetEnabled(
		"moderator_allow_voice", 
		selected_id.notNull() 
		&& mSpeakerMgr->isVoiceActive()
		&& gVoiceClient->getVoiceEnabled(selected_id));

	childSetEnabled(
		"moderator_allow_text", 
		selected_id.notNull());

	if (mProfileBtn)
	{
		mProfileBtn->setEnabled(selected_id.notNull() && (selected_speakerp.notNull() && selected_speakerp->mType != LLSpeaker::SPEAKER_EXTERNAL) );
	}

	// show selected user name in large font
	if (mNameText)
	{
		if (selected_speakerp)
		{
			mNameText->setValue(selected_speakerp->mDisplayName);
		}
		else
		{
			mNameText->setValue(LLStringUtil::null);
		}
	}

	//update moderator capabilities
	LLPointer<LLSpeaker> self_speakerp = mSpeakerMgr->findSpeaker(gAgent.getID());
	if(self_speakerp)
	{
		childSetVisible("moderation_mode_panel", self_speakerp->mIsModerator && mSpeakerMgr->isVoiceActive());
		childSetVisible("moderator_controls", self_speakerp->mIsModerator);
	}

	// keep scroll value stable
	mSpeakerList->getScrollInterface()->setScrollPos(scroll_pos);
}