Exemplo n.º 1
0
void LLNotifyBoxView::showOnly(LLView * view)
{
	if(view) 
	{
		// assumes that the argument is actually a child
		LLNotifyBox * shown = dynamic_cast<LLNotifyBox*>(view);
		if(!shown)
		{
			return ;
		}

		// make every other notification invisible
		for(child_list_const_iter_t iter = getChildList()->begin();
			iter != getChildList()->end();
			iter++)
		{
			if(isGroupNotifyBox(*iter))
			{
				continue;
			}

			LLNotifyBox * box = (LLNotifyBox*)(*iter);
			if(box != view && box->getVisible() && !box->isTip())
			{
				box->setVisible(FALSE);
			}
		}
		shown->setVisible(TRUE);
		sendChildToFront(shown);
	}
}
BOOL LLToolBar::postBuild()
{
	mCommunicateBtn.connect(this, "communicate_btn");
	mCommunicateBtn->setCommitCallback(boost::bind(&LLToolBar::onClickCommunicate, this, _2));
	mFlyBtn.connect(this, "fly_btn");
	mBuildBtn.connect(this, "build_btn");
	mMapBtn.connect(this, "map_btn");
	mRadarBtn.connect(this, "radar_btn");
	mInventoryBtn.connect(this, "inventory_btn");

	for (child_list_const_iter_t child_iter = getChildList()->begin();
		 child_iter != getChildList()->end(); ++child_iter)
	{
		LLView *view = *child_iter;
		LLButton* buttonp = dynamic_cast<LLButton*>(view);
		if(buttonp)
		{
			buttonp->setSoundFlags(LLView::SILENT);
		}
	}

#if LL_DARWIN
	LLResizeHandle::Params p;
	p.rect(LLRect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT));
	p.name(std::string(""));
	p.min_width(RESIZE_HANDLE_WIDTH);
	p.min_height(RESIZE_HANDLE_HEIGHT);
	p.corner(LLResizeHandle::RIGHT_BOTTOM);
	addChildInBack(new LLFakeResizeHandle(p));
	reshape(getRect().getWidth(), getRect().getHeight());
#endif // LL_DARWIN

	return TRUE;
}
Exemplo n.º 3
0
void AIHTTPView::draw()
{
  for_each(mServiceBars.begin(), mServiceBars.end(), KillView());
  mServiceBars.clear();
	  
  if (mGLHTTPHeaderBar)
  {
	removeChild(mGLHTTPHeaderBar);
	mGLHTTPHeaderBar->die();
  }

  CreateServiceBar functor(this);
  AIPerService::copy_forEach(functor);

  sTime_40ms = get_clock_count() * AICurlPrivate::curlthread::HTTPTimeout::sClockWidth_40ms;

  mGLHTTPHeaderBar = new AIGLHTTPHeaderBar("gl httpheader bar", this);
  addChild(mGLHTTPHeaderBar);

  reshape(mWidth, getRect().getHeight(), TRUE);

  for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter)
  {
	LLView* viewp = *child_iter;
	if (viewp->getRect().mBottom < 0)
	{
	  viewp->setVisible(FALSE);
	}
  }

  LLContainerView::draw();
}
LLRect LLContainerView::getRequiredRect()
{
	LLRect req_rect;
	//LLView *childp;
	U32 total_height = 0;
	
	// Determine the sizes and locations of all contained views

	// Leave some space for the top label/grab handle

	if (mShowLabel)
	{
		total_height = 20;
	}
		

	if (mDisplayChildren)
	{
		// Determine total height
		U32 child_height = 0;
		for (child_list_const_iter_t child_iter = getChildList()->begin();
			 child_iter != getChildList()->end(); ++child_iter)
		{
			LLView *childp = *child_iter;
			LLRect child_rect = childp->getRequiredRect();
			child_height += child_rect.getHeight();
			child_height += 2;
		}

		total_height += child_height;
	}
	req_rect.mTop = total_height;
	return req_rect;
}
Exemplo n.º 5
0
BOOL LLToolBar::postBuild()
{
	for (child_list_const_iter_t child_iter = getChildList()->begin();
		 child_iter != getChildList()->end(); ++child_iter)
	{
		LLView *view = *child_iter;
		LLButton* buttonp = dynamic_cast<LLButton*>(view);
		if(buttonp)
		{
			buttonp->setSoundFlags(LLView::SILENT);
		}
	}

#if LL_DARWIN
	if(mResizeHandle == NULL)
	{
		LLRect rect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT);
		LLResizeHandle::Params p;
		p.name("");
		p.rect(rect);
		p.min_width(RESIZE_HANDLE_WIDTH);
		p.min_height(RESIZE_HANDLE_HEIGHT);
		p.enabled(false);
		mResizeHandle = LLUICtrlFactory::create<LLResizeHandle>(p);
		addChildInBack(mResizeHandle);
		LLLayoutStack* toolbar_stack = getChild<LLLayoutStack>("toolbar_stack");
		toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight());
	}
#endif // LL_DARWIN

	layoutButtons();

	return TRUE;
}
Exemplo n.º 6
0
// virtual
void LLRadioGroup::setEnabled(BOOL enabled)
{
	for (child_list_const_iter_t child_iter = getChildList()->begin();
		 child_iter != getChildList()->end(); ++child_iter)
	{
		LLView *child = *child_iter;
		child->setEnabled(enabled);
	}
	LLView::setEnabled(enabled);
}
void LLContainerView::setDisplayChildren(const BOOL displayChildren)
{
	mDisplayChildren = displayChildren;
	for (child_list_const_iter_t child_iter = getChildList()->begin();
		 child_iter != getChildList()->end(); ++child_iter)
	{
		LLView *childp = *child_iter;
		childp->setVisible(mDisplayChildren);
	}
}
void LLAccordionCtrl::addCollapsibleCtrl(LLView* view)
{
	LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view);
	if(!accordion_tab)
		return;
	if(std::find(getChildList()->begin(),getChildList()->end(),accordion_tab) == getChildList()->end())
		addChild(accordion_tab);
	mAccordionTabs.push_back(accordion_tab);
	
	accordion_tab->setDropDownStateChangedCallback( boost::bind(&LLAccordionCtrl::onCollapseCtrlCloseOpen, this, mAccordionTabs.size() - 1) );

}
Exemplo n.º 9
0
LLView*	LLAccordionCtrlTab::findContainerView()
{
	for(child_list_const_iter_t it = getChildList()->begin(); 
		getChildList()->end() != it; ++it)
	{
		LLView* child = *it;
		if(DD_HEADER_NAME == child->getName())
			continue;
		if(!child->getVisible())
			continue;
		return child;
	}
	return NULL;
}
Exemplo n.º 10
0
BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen)
{
	for (child_list_const_iter_t child_iter = getChildList()->begin();
			child_iter != getChildList()->end(); ++child_iter)
	{
		LLView *viewp = *child_iter;
		S32 local_x = x - viewp->getRect().mLeft;
		S32 local_y = y - viewp->getRect().mBottom;
		if( viewp->pointInView(local_x, local_y) 
			&& viewp->getVisible() 
			&& viewp->getEnabled()
			&& viewp->handleToolTip(local_x, local_y, msg, sticky_rect_screen ) )
		{
			return TRUE;
		}
	}

	if( mSegments.empty() )
	{
		return TRUE;
	}

	const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
	if( cur_segment )
	{
		BOOL has_tool_tip = FALSE;
		if( cur_segment->getStyle()->getIsEmbeddedItem() )
		{
			LLWString wtip;
			has_tool_tip = getEmbeddedItemToolTipAtPos(cur_segment->getStart(), wtip);
			msg = wstring_to_utf8str(wtip);
		}
		else
		{
			has_tool_tip = cur_segment->getToolTip( msg );
		}
		if( has_tool_tip )
		{
			// Just use a slop area around the cursor
			// Convert rect local to screen coordinates
			S32 SLOP = 8;
			localPointToScreen( 
				x - SLOP, y - SLOP, 
				&(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
			sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;
			sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;
		}
	}
	return TRUE;
}
Exemplo n.º 11
0
// virtual
LLXMLNodePtr LLPanel::getXML(bool save_children) const
{
	LLXMLNodePtr node = LLUICtrl::getXML();

	node->setName(LL_PANEL_TAG);

	if (mBorder && mBorder->getVisible())
	{
		node->createChild("border", TRUE)->setBoolValue(TRUE);
	}

	if (!mRectControl.empty())
	{
		node->createChild("rect_control", TRUE)->setStringValue(mRectControl);
	}

	if (!mLabel.empty())
	{
		node->createChild("label", TRUE)->setStringValue(mLabel);
	}
	
	ui_string_map_t::const_iterator i = mUIStrings.begin();
	ui_string_map_t::const_iterator end = mUIStrings.end();
	for (; i != end; ++i)
	{
		LLXMLNodePtr child_node = node->createChild("string", FALSE);
		child_node->setStringValue(i->second);
		child_node->createChild("name", TRUE)->setStringValue(i->first);
	}

	if (save_children)
	{
		LLView::child_list_const_reverse_iter_t rit;
		for (rit = getChildList()->rbegin(); rit != getChildList()->rend(); ++rit)
		{
			LLView* childp = *rit;

			if (childp->getSaveToXML())
			{
				LLXMLNodePtr xml_node = childp->getXML();

				node->addChild(xml_node);
			}
		}
	}

	return node;
}
Exemplo n.º 12
0
LLNotifyBox* LLNotifyBoxView::getFirstNontipBox() const
{
	// *TODO: Don't make assumptions like this!
	// assumes every child is a notify box
	for(child_list_const_iter_t iter = getChildList()->begin();
			iter != getChildList()->end();
			iter++)
	{
		// hack! *TODO: Integrate llnotify and llgroupnotify
		if (isGroupNotifyBox(*iter))
			continue;

		LLNotifyBox* box = static_cast<LLNotifyBox*>(*iter);
		if (!box->isTip() && !box->isDead())
			return box;
	}
	return NULL;
}
Exemplo n.º 13
0
void LLPanelProfile::setAllChildrenVisible(BOOL visible)
{
	const child_list_t* child_list = getChildList();
	child_list_const_iter_t child_it = child_list->begin();
	for (; child_it != child_list->end(); ++child_it)
	{
		LLView* viewp = *child_it;
		viewp->setVisible(visible);
	}
}
Exemplo n.º 14
0
void LLNotifyBoxView::showOnly(LLView* view)
{
	// assumes that the argument is actually a child
	if (!dynamic_cast<LLNotifyBox*>(view)) return;

	// make every other notification invisible
	for(child_list_const_iter_t iter = getChildList()->begin();
			iter != getChildList()->end();
			iter++)
	{
		if (view == (*iter)) continue;
		LLView* view(*iter);
		if (isGroupNotifyBox(view) || !view->getVisible())
			continue;
		if (!static_cast<LLNotifyBox*>(view)->isTip())
			view->setVisible(false);
	}
	view->setVisible(true);
	sendChildToFront(view);
}
Exemplo n.º 15
0
void LLOverlayBar::layoutButtons()
{
	S32 width = mRect.getWidth();
	if (width > 800) width = 800;

	S32 count = getChildCount();
	const S32 PAD = gSavedSettings.getS32("StatusBarPad");

	F32 segment_width = (F32)(width) / (F32)count;

	S32 btn_width = lltrunc(segment_width - PAD);

	S32 remote_width = mMusicRemote->getRect().getWidth();

	// Evenly space all views
	LLRect r;
	S32 i = 0;
	for (child_list_const_iter_t child_iter = getChildList()->begin();
		 child_iter != getChildList()->end(); ++child_iter)
	{
		LLView *view = *child_iter;
		r = view->getRect();
		r.mLeft = (width) - llround((i+1)*segment_width);
		r.mRight = r.mLeft + btn_width;
		view->setRect(r);
		i++;
	}

	// Fix up remotes to have constant width because they can't shrink
	r = mMusicRemote->getRect();
	r.mRight = r.mLeft + remote_width;
	mMusicRemote->setRect(r);

	r = mMediaRemote->getRect();
	r.mLeft = mMusicRemote->getRect().mRight + PAD;
	r.mRight = r.mLeft + remote_width;
	mMediaRemote->setRect(r);

	updateRect();
}
LLScrollingPanelParamBase::LLScrollingPanelParamBase( const std::string& name,
							LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, bool bVisualHint, LLRect rect )
	: LLScrollingPanel( name, rect ),
	mParam(param),
	mAllowModify(allow_modify),
	mWearable(wearable)
{
	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_scrolling_param.xml");
	//Set up the slider
	mSlider = getChild<LLSliderCtrl>("param slider");

	//Kill everything that isn't the slider...
	if(!bVisualHint)
	{
		child_list_t to_remove;
		child_list_t::const_iterator it;
		for (it = getChildList()->begin(); it != getChildList()->end(); it++)
		{
			if ((*it) != mSlider && (*it)->getName() != "panel border")
			{
				to_remove.push_back(*it);
			}
		}
		for (it = to_remove.begin(); it != to_remove.end(); it++)
		{
			removeChild(*it);
			delete (*it);
		}
		mSlider->translate(0,/*PARAM_HINT_HEIGHT*/128);
		reshape(getRect().getWidth(),getRect().getHeight()-128);
	}
	
	mSlider->setValue(weightToPercent(param->getWeight()));
	mSlider->setLabelArg("[DESC]", param->getDisplayName());
	mSlider->setEnabled(mAllowModify);
	mSlider->setCommitCallback(boost::bind(&LLScrollingPanelParamBase::onSliderMoved, this, _1));

	setVisible(FALSE);
	setBorderVisible( FALSE );
}
Exemplo n.º 17
0
LLXMLNodePtr LLLayoutStack::getXML(bool save_children) const
{
	LLXMLNodePtr node = LLView::getXML();
	node->setName(LL_LAYOUT_STACK_TAG);

	if (mOrientation == HORIZONTAL)
	{
		node->createChild("orientation", TRUE)->setStringValue("horizontal");
	}
	else
	{
		node->createChild("orientation", TRUE)->setStringValue("vertical");
	}

	if (save_children)
	{
		LLView::child_list_const_reverse_iter_t rit;
		for (rit = getChildList()->rbegin(); rit != getChildList()->rend(); ++rit)
		{
			LLView* childp = *rit;

			if (childp->getSaveToXML())
			{
				LLXMLNodePtr xml_node = childp->getXML();

				if (xml_node->hasName(LL_PANEL_TAG))
				{
					xml_node->setName(LL_LAYOUT_PANEL_TAG);
				}

				node->addChild(xml_node);
			}
		}
	}

	return node;
}
Exemplo n.º 18
0
// virtual
LLXMLNodePtr LLPanel::getXML(bool save_children) const
{
	LLXMLNodePtr node = LLView::getXML();

	if (mBorder && mBorder->getVisible())
	{
		node->createChild("border", TRUE)->setBoolValue(TRUE);
	}

	if (!mRectControl.empty())
	{
		node->createChild("rect_control", TRUE)->setStringValue(mRectControl);
	}

	if (!mLabel.empty())
	{
		node->createChild("label", TRUE)->setStringValue(mLabel);
	}

	if (save_children)
	{
		LLView::child_list_const_reverse_iter_t rit;
		for (rit = getChildList()->rbegin(); rit != getChildList()->rend(); ++rit)
		{
			LLView* childp = *rit;

			if (childp->getSaveToXML())
			{
				LLXMLNodePtr xml_node = childp->getXML();

				node->addChild(xml_node);
			}
		}
	}

	return node;
}
Exemplo n.º 19
0
//*TODO redo panel toggling
void LLPanelProfile::togglePanel(LLPanel* panel, const LLSD& key)
{
	// TRUE - we need to open/expand "panel"
	bool expand = getChildList()->front() != panel;  // mTabCtrl->getVisible();

	if (expand)
	{
		openPanel(panel, key);
	}
	else 
	{
		closePanel(panel);

		getTabCtrl()->getCurrentPanel()->onOpen(getAvatarId());
	}
}
Exemplo n.º 20
0
void LLNotifyBoxView::purgeMessagesMatching(const Matcher& matcher)
{
	// Make a *copy* of the child list to iterate over 
	// since we'll be removing items from the real list as we go.
	LLView::child_list_t notification_queue(*getChildList());
	for(LLView::child_list_iter_t iter = notification_queue.begin();
		iter != notification_queue.end();
		iter++)
	{
		if (isGroupNotifyBox(*iter))
			continue;

		LLNotifyBox* notification = static_cast<LLNotifyBox*>(*iter);
		if (matcher.matches(notification->getNotification()))
		{
			removeChild(notification);
		}
	}
}
//hack
void FSPanelClassifieds::closePanel(LLPanel* panel)
{
	panel->setVisible(FALSE);

	if (panel->getParent() == this) 
	{
		removeChild(panel);

		// Prevent losing focus by the floater
		const child_list_t* child_list = getChildList();
		if (child_list->size() > 0)
		{
			child_list->front()->setFocus(TRUE);
		}
		else
		{
			llwarns << "No underlying panel to focus." << llendl;
		}
	}
}
Exemplo n.º 22
0
void LLPanelProfile::closePanel(LLPanel* panel)
{
	panel->setVisible(FALSE);

	if (panel->getParent() == this) 
	{
		removeChild(panel);

		// Make the underlying panel visible.
		mChildStack.pop();

		// Prevent losing focus by the floater
		const child_list_t* child_list = getChildList();
		if (child_list->size() > 0)
		{
			child_list->front()->setFocus(TRUE);
		}
		else
		{
			LL_WARNS() << "No underlying panel to focus." << LL_ENDL;
		}
	}
}
Exemplo n.º 23
0
//---------------------------------------------------------------------------------
BOOL LLAccordionCtrl::postBuild()
{
	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);

	LLRect scroll_rect;
	scroll_rect.setOriginAndSize( 
		getRect().getWidth() - scrollbar_size,
		1,
		scrollbar_size,
		getRect().getHeight() - 1);
	
	LLScrollbar::Params sbparams;
	sbparams.name("scrollable vertical");
	sbparams.rect(scroll_rect);
	sbparams.orientation(LLScrollbar::VERTICAL);
	sbparams.doc_size(mInnerRect.getHeight());
	sbparams.doc_pos(0);
	sbparams.page_size(mInnerRect.getHeight());
	sbparams.step_size(VERTICAL_MULTIPLE);
	sbparams.follows.flags(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM);
	sbparams.change_callback(boost::bind(&LLAccordionCtrl::onScrollPosChangeCallback, this, _1, _2));
	
	mScrollbar = LLUICtrlFactory::create<LLScrollbar> (sbparams);
	LLView::addChild( mScrollbar );
	mScrollbar->setVisible( false );
	mScrollbar->setFollowsRight();
	mScrollbar->setFollowsTop();
	mScrollbar->setFollowsBottom();

	//if it was created from xml...
	std::vector<LLUICtrl*> accordion_tabs;
	for(child_list_const_iter_t it = getChildList()->begin(); 
		getChildList()->end() != it; ++it)
	{
		LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(*it);
		if(accordion_tab == NULL)
			continue;
		if(std::find(mAccordionTabs.begin(),mAccordionTabs.end(),accordion_tab) == mAccordionTabs.end())
		{
			accordion_tabs.push_back(accordion_tab);
		}
	}

	for(std::vector<LLUICtrl*>::reverse_iterator it = accordion_tabs.rbegin();it!=accordion_tabs.rend();++it)
		addCollapsibleCtrl(*it);

	arrange	();

	if(mSingleExpansion)
	{
		if(!mAccordionTabs[0]->getDisplayChildren())
			mAccordionTabs[0]->setDisplayChildren(true);
		for(size_t i=1;i<mAccordionTabs.size();++i)
		{
			if(mAccordionTabs[i]->getDisplayChildren())
				mAccordionTabs[i]->setDisplayChildren(false);
		}
	}

	updateNoTabsHelpTextVisibility();

	return TRUE;
}
void LLTextureView::draw()
{
    if (!mFreezeView)
    {
// 		LLViewerObject *objectp;
// 		S32 te;

        for_each(mTextureBars.begin(), mTextureBars.end(), KillView());
        mTextureBars.clear();

        if (mGLTexMemBar)
        {
            removeChild(mGLTexMemBar);
            mGLTexMemBar->die();
            mGLTexMemBar = 0;
        }

        if (mAvatarTexBar)
        {
            removeChild(mAvatarTexBar);
            mAvatarTexBar->die();
            mAvatarTexBar = 0;
        }

        typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t;
        display_list_t display_image_list;

        if (mPrintList)
        {
            llinfos << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << llendl;
        }

        for (LLViewerTextureList::image_priority_list_t::iterator iter = gTextureList.mImageList.begin();
                iter != gTextureList.mImageList.end(); )
        {
            LLPointer<LLViewerFetchedTexture> imagep = *iter++;
            if(!imagep->hasFetcher())
            {
                continue ;
            }

            S32 cur_discard = imagep->getDiscardLevel();
            S32 desired_discard = imagep->mDesiredDiscardLevel;

            if (mPrintList)
            {
                S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory() : 0 ;
                llinfos << imagep->getID()
                        << "\t" << tex_mem
                        << "\t" << imagep->getBoostLevel()
                        << "\t" << imagep->getDecodePriority()
                        << "\t" << imagep->getWidth()
                        << "\t" << imagep->getHeight()
                        << "\t" << cur_discard
                        << llendl;
            }

            if (imagep->getID() == LLAppViewer::getTextureFetch()->mDebugID)
            {
                static S32 debug_count = 0;
                ++debug_count; // for breakpoints
            }

            F32 pri;
            if (mOrderFetch)
            {
                pri = ((F32)imagep->mFetchPriority)/256.f;
            }
            else
            {
                pri = imagep->getDecodePriority();
            }
            pri = llclamp(pri, 0.0f, HIGH_PRIORITY-1.f);

            if (sDebugImages.find(imagep) != sDebugImages.end())
            {
                pri += 4*HIGH_PRIORITY;
            }

            if (!mOrderFetch)
            {
                if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance())
                {
                    struct f : public LLSelectedTEFunctor
                    {
                        LLViewerFetchedTexture* mImage;
                        f(LLViewerFetchedTexture* image) : mImage(image) {}
                        virtual bool apply(LLViewerObject* object, S32 te)
                        {
                            return (mImage == object->getTEImage(te));
                        }
                    } func(imagep);
                    const bool firstonly = true;
                    bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly);
                    if (match)
                    {
                        pri += 3*HIGH_PRIORITY;
                    }
                }

                if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard))
                {
                    LLSelectNode* hover_node = LLSelectMgr::instance().getHoverNode();
                    if (hover_node)
                    {
                        LLViewerObject *objectp = hover_node->getObject();
                        if (objectp)
                        {
                            S32 tex_count = objectp->getNumTEs();
                            for (S32 i = 0; i < tex_count; i++)
                            {
                                if (imagep == objectp->getTEImage(i))
                                {
                                    pri += 2*HIGH_PRIORITY;
                                    break;
                                }
                            }
                        }
                    }
                }

                if (pri > 0.f && pri < HIGH_PRIORITY)
                {
                    if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f ||
                            imagep->mFetchDeltaTime < 0.25f)
                    {
                        pri += 1*HIGH_PRIORITY;
                    }
                }
            }

            if (pri > 0.0f)
            {
                display_image_list.insert(std::make_pair(pri, imagep));
            }
        }

        if (mPrintList)
        {
            mPrintList = FALSE;
        }

        static S32 max_count = 50;
        S32 count = 0;
        mNumTextureBars = 0 ;
        for (display_list_t::iterator iter = display_image_list.begin();
                iter != display_image_list.end(); iter++)
        {
            LLViewerFetchedTexture* imagep = iter->second;
            S32 hilite = 0;
            F32 pri = iter->first;
            if (pri >= 1 * HIGH_PRIORITY)
            {
                hilite = (S32)((pri+1) / HIGH_PRIORITY) - 1;
            }
            if ((hilite || count < max_count-10) && (count < max_count))
            {
                if (addBar(imagep, hilite))
                {
                    count++;
                }
            }
        }

        if (mOrderFetch)
            sortChildren(LLTextureBar::sort_fetch());
        else
            sortChildren(LLTextureBar::sort());

        LLGLTexMemBar::Params tmbp;
        LLRect tmbr;
        tmbp.name("gl texmem bar");
        tmbp.rect(tmbr);
        tmbp.follows.flags = FOLLOWS_LEFT|FOLLOWS_TOP;
        tmbp.texture_view(this);
        mGLTexMemBar = LLUICtrlFactory::create<LLGLTexMemBar>(tmbp);
        addChild(mGLTexMemBar);
        sendChildToFront(mGLTexMemBar);

        LLAvatarTexBar::Params atbp;
        LLRect atbr;
        atbp.name("gl avatartex bar");
        atbp.texture_view(this);
        atbp.rect(atbr);
        mAvatarTexBar = LLUICtrlFactory::create<LLAvatarTexBar>(atbp);
        addChild(mAvatarTexBar);
        sendChildToFront(mAvatarTexBar);

        reshape(getRect().getWidth(), getRect().getHeight(), TRUE);

        LLUI::popMatrix();
        LLUI::pushMatrix();
        LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom);

        for (child_list_const_iter_t child_iter = getChildList()->begin();
                child_iter != getChildList()->end(); ++child_iter)
        {
            LLView *viewp = *child_iter;
            if (viewp->getRect().mBottom < 0)
            {
                viewp->setVisible(FALSE);
            }
        }
    }

    LLContainerView::draw();

}
void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent)
{
	// Determine the sizes and locations of all contained views
	S32 total_height = 0;
	S32 top, left, right, bottom;
	//LLView *childp;

	// These will be used for the children
	left = 4;
	top = getRect().getHeight() - 4;
	right = width - 2;
	bottom = top;
	
	// Leave some space for the top label/grab handle
	if (mShowLabel)
	{
		total_height += 20;
	}

	if (mDisplayChildren)
	{
		// Determine total height
		U32 child_height = 0;
		for (child_list_const_iter_t child_iter = getChildList()->begin();
			 child_iter != getChildList()->end(); ++child_iter)
		{
			LLView *childp = *child_iter;
			if (!childp->getVisible())
			{
				LL_WARNS() << "Incorrect visibility!" << LL_ENDL;
			}
			LLRect child_rect = childp->getRequiredRect();
			child_height += child_rect.getHeight();
			child_height += 2;
		}
		total_height += child_height;
	}

	if (total_height < height)
		total_height = height;
	
	if (followsTop())
	{
		// HACK: casting away const. Should use setRect or some helper function instead.
		const_cast<LLRect&>(getRect()).mBottom = getRect().mTop - total_height;
	}
	else
	{
		// HACK: casting away const. Should use setRect or some helper function instead.
		const_cast<LLRect&>(getRect()).mTop = getRect().mBottom + total_height;
	}
	// HACK: casting away const. Should use setRect or some helper function instead.
		const_cast<LLRect&>(getRect()).mRight = getRect().mLeft + width;

	top = total_height;
	if (mShowLabel)
		{
			top -= 20;
		}
	
	bottom = top;

	if (mDisplayChildren)
	{
		// Iterate through all children, and put in container from top down.
		for (child_list_const_iter_t child_iter = getChildList()->begin();
			 child_iter != getChildList()->end(); ++child_iter)
		{
			LLView *childp = *child_iter;
			LLRect child_rect = childp->getRequiredRect();
			bottom -= child_rect.getHeight();
			LLRect r(left, bottom + child_rect.getHeight(), right, bottom);
			childp->setRect(r);
			childp->reshape(right - left, top - bottom);
			top = bottom - 2;
			bottom = top;
		}
	}
	
	if (!called_from_parent)
	{
		if (getParent())
		{
			getParent()->reshape(getParent()->getRect().getWidth(), getParent()->getRect().getHeight(), FALSE);
		}
	}

}
void LLScrollContainer::draw()
{
	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
	if (mAutoScrolling)
	{
		// add acceleration to autoscroll
		mAutoScrollRate = llmin(mAutoScrollRate + (LLFrameTimer::getFrameDeltaTimeF32() * AUTO_SCROLL_RATE_ACCEL), mMaxAutoScrollRate);
	}
	else
	{
		// reset to minimum for next time
		mAutoScrollRate = mMinAutoScrollRate;
	}
	// clear this flag to be set on next call to autoScroll
	mAutoScrolling = FALSE;

	// auto-focus when scrollbar active
	// this allows us to capture user intent (i.e. stop automatically scrolling the view/etc)
	if (!hasFocus() 
		&& (mScrollbar[VERTICAL]->hasMouseCapture() || mScrollbar[HORIZONTAL]->hasMouseCapture()))
	{
		focusFirstItem();
	}

	// Draw background
	if( mIsOpaque )
	{
		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
		gGL.color4fv( mBackgroundColor.get().mV );
		gl_rect_2d( mInnerRect );
	}
	
	// Draw mScrolledViews and update scroll bars.
	// get a scissor region ready, and draw the scrolling view. The
	// scissor region ensures that we don't draw outside of the bounds
	// of the rectangle.
	if( mScrolledView )
	{
		updateScroll();

		// Draw the scrolled area.
		{
			S32 visible_width = 0;
			S32 visible_height = 0;
			BOOL show_v_scrollbar = FALSE;
			BOOL show_h_scrollbar = FALSE;
			calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar );

			LLLocalClipRect clip(LLRect(mInnerRect.mLeft, 
					mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0) + visible_height,
					mInnerRect.mRight - (show_v_scrollbar ? scrollbar_size: 0),
					mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0)
					));
			drawChild(mScrolledView);
		}
	}

	// Highlight border if a child of this container has keyboard focus
	if( mBorder->getVisible() )
	{
		mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus(this) );
	}

	// Draw all children except mScrolledView
	// Note: scrollbars have been adjusted by above drawing code
	for (child_list_const_reverse_iter_t child_iter = getChildList()->rbegin();
		 child_iter != getChildList()->rend(); ++child_iter)
	{
		LLView *viewp = *child_iter;
		if( sDebugRects )
		{
			sDepth++;
		}
		if( (viewp != mScrolledView) && viewp->getVisible() )
		{
			drawChild(viewp);
		}
		if( sDebugRects )
		{
			sDepth--;
		}
	}
} // end draw
Exemplo n.º 27
0
void LLOverlayBar::draw()
{
	// retrieve rounded rect image
	LLUUID image_id;
	image_id.set(gViewerArt.getString("rounded_square.tga"));
	LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);

	if (imagep)
	{
		LLGLSTexture texture_enabled;
		LLViewerImage::bindTexture(imagep);

		const S32 PAD = gSavedSettings.getS32("StatusBarPad");

		// draw rounded rect tabs behind all children
		LLRect r;
		// focus highlights
		LLColor4 color = gColors.getColor("FloaterFocusBorderColor");
		glColor4fv(color.mV);
		if(gFocusMgr.childHasKeyboardFocus(gBottomPanel))
		{
			for (child_list_const_iter_t child_iter = getChildList()->begin();
				child_iter != getChildList()->end(); ++child_iter)
			{
				LLView *view = *child_iter;
				if(view->getEnabled() && view->getVisible())
				{
					r = view->getRect();
					gl_segmented_rect_2d_tex(r.mLeft - PAD/3 - 1, 
											r.mTop + 3, 
											r.mRight + PAD/3 + 1,
											r.mBottom, 
											imagep->getWidth(), 
											imagep->getHeight(), 
											16, 
											ROUNDED_RECT_TOP);
				}
			}
		}

		// main tabs
		for (child_list_const_iter_t child_iter = getChildList()->begin();
			child_iter != getChildList()->end(); ++child_iter)
		{
			LLView *view = *child_iter;
			if(view->getEnabled() && view->getVisible())
			{
				r = view->getRect();
				// draw a nice little pseudo-3D outline
				color = gColors.getColor("DefaultShadowDark");
				glColor4fv(color.mV);
				gl_segmented_rect_2d_tex(r.mLeft - PAD/3 + 1, r.mTop + 2, r.mRight + PAD/3, r.mBottom, 
										 imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP);
				color = gColors.getColor("DefaultHighlightLight");
				glColor4fv(color.mV);
				gl_segmented_rect_2d_tex(r.mLeft - PAD/3, r.mTop + 2, r.mRight + PAD/3 - 3, r.mBottom, 
										 imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP);
				// here's the main background.  Note that it overhangs on the bottom so as to hide the
				// focus highlight on the bottom panel, thus producing the illusion that the focus highlight
				// continues around the tabs
				color = gColors.getColor("FocusBackgroundColor");
				glColor4fv(color.mV);
				gl_segmented_rect_2d_tex(r.mLeft - PAD/3 + 1, r.mTop + 1, r.mRight + PAD/3 - 1, r.mBottom - 1, 
										 imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP);
			}
		}
	}

	// draw children on top
	LLPanel::draw();
}
Exemplo n.º 28
0
void LLTextureView::draw()
{
	if (!mFreezeView)
	{
// 		LLViewerObject *objectp;
// 		S32 te;

		for_each(mTextureBars.begin(), mTextureBars.end(), DeletePointer());
		mTextureBars.clear();
	
		delete mGLTexMemBar;
		mGLTexMemBar = 0;
	
		typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t;
		display_list_t display_image_list;
	
		if (mPrintList)
		{
			llinfos << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << llendl;
		}
	
		for (LLViewerImageList::image_priority_list_t::iterator iter = gImageList.mImageList.begin();
			 iter != gImageList.mImageList.end(); )
		{
			LLPointer<LLViewerImage> imagep = *iter++;

			S32 cur_discard = imagep->getDiscardLevel();
			S32 desired_discard = imagep->mDesiredDiscardLevel;
			
			if (mPrintList)
			{
				llinfos << imagep->getID()
						<< "\t" <<  imagep->mTextureMemory
						<< "\t" << imagep->getBoostLevel()
						<< "\t" << imagep->getDecodePriority()
						<< "\t" << imagep->getWidth()
						<< "\t" << imagep->getHeight()
						<< "\t" << cur_discard
						<< llendl;
			}
		
#if 0
			if (imagep->getDontDiscard())
			{
				continue;
			}

			if (imagep->isMissingAsset())
			{
				continue;
			}
#endif

#define HIGH_PRIORITY 100000000.f
			F32 pri;
			if (mOrderFetch)
			{
				pri = ((F32)imagep->mFetchPriority)/256.f;
			}
			else
			{
				pri = imagep->getDecodePriority();
			}
			
			if (sDebugImages.find(imagep) != sDebugImages.end())
			{
				pri += 4*HIGH_PRIORITY;
			}

			if (!mOrderFetch)
			{
#if 1
			if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance())
			{
				struct f : public LLSelectedTEFunctor
				{
					LLViewerImage* mImage;
					f(LLViewerImage* image) : mImage(image) {}
					virtual bool apply(LLViewerObject* object, S32 te)
					{
						return (mImage == object->getTEImage(te));
					}
				} func(imagep);
				const bool firstonly = true;
				bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly);
				if (match)
				{
					pri += 3*HIGH_PRIORITY;
				}
			}
#endif
#if 1
			if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard))
			{
				LLViewerObject *objectp = gHoverView->getLastHoverObject();
				if (objectp)
				{
					S32 tex_count = objectp->getNumTEs();
					for (S32 i = 0; i < tex_count; i++)
					{
						if (imagep == objectp->getTEImage(i))
						{
							pri += 2*HIGH_PRIORITY;
							break;
						}
					}
				}
			}
#endif
#if 1
			if (pri > 0.f && pri < HIGH_PRIORITY)
			{
				if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f ||
					imagep->mFetchDeltaTime < 0.25f)
				{
					pri += 1*HIGH_PRIORITY;
				}
			}
#endif
			}
			
	 		if (pri > 0.0f)
			{
				display_image_list.insert(std::make_pair(pri, imagep));
			}
		}
		
		if (mPrintList)
		{
			mPrintList = FALSE;
		}
		
		static S32 max_count = 50;
		S32 count = 0;
		for (display_list_t::iterator iter = display_image_list.begin();
			 iter != display_image_list.end(); iter++)
		{
			LLViewerImage* imagep = iter->second;
			S32 hilite = 0;
			F32 pri = iter->first;
			if (pri >= 1 * HIGH_PRIORITY)
			{
				hilite = (S32)((pri+1) / HIGH_PRIORITY) - 1;
			}
			if ((hilite || count < max_count-10) && (count < max_count))
			{
				if (addBar(imagep, hilite))
				{
					count++;
				}
			}
		}

		if (mOrderFetch)
			sortChildren(LLTextureBar::sort_fetch());
		else
			sortChildren(LLTextureBar::sort());

		mGLTexMemBar = new LLGLTexMemBar("gl texmem bar", this);
		addChild(mGLTexMemBar);
	
		reshape(getRect().getWidth(), getRect().getHeight(), TRUE);

		/*
		  count = gImageList.getNumImages();
		  std::string info_string;
		  info_string = llformat("Global Info:\nTexture Count: %d", count);
		  mInfoTextp->setText(info_string);
		*/


		for (child_list_const_iter_t child_iter = getChildList()->begin();
			 child_iter != getChildList()->end(); ++child_iter)
		{
			LLView *viewp = *child_iter;
			if (viewp->getRect().mBottom < 0)
			{
				viewp->setVisible(FALSE);
			}
		}
	}
	
	LLContainerView::draw();

}
Exemplo n.º 29
0
BOOL LLToolBar::postBuild()
{
    childSetCommitCallback("communicate_btn", onClickCommunicate, this);

    childSetAction("chat_btn", onClickChat, this);
    childSetControlName("chat_btn", "ChatVisible");

    childSetAction("appearance_btn", onClickAppearance, this);
    childSetControlName("appearance_btn", "");

    childSetAction("radar_list_btn", onClickRadarList, this);
    childSetControlName("radar_list_btn", "RadarListBtnState");

    childSetAction("fly_btn", onClickFly, this);
    childSetControlName("fly_btn", "FlyBtnState");

    childSetAction("sit_btn", onClickSit, this);
    childSetControlName("sit_btn", "SitBtnState");

    childSetAction("snapshot_btn", onClickSnapshot, this);
    childSetControlName("snapshot_btn", "");

    childSetAction("directory_btn", onClickDirectory, this);
    childSetControlName("directory_btn", "ShowDirectory");

    childSetAction("build_btn", onClickBuild, this);
    childSetControlName("build_btn", "BuildBtnState");

    childSetAction("radar_btn", onClickRadar, this);
    childSetControlName("radar_btn", "ShowMiniMap");

    childSetAction("map_btn", onClickMap, this);
    childSetControlName("map_btn", "ShowWorldMap");

    childSetAction("inventory_btn", onClickInventory, this);
    childSetControlName("inventory_btn", "ShowInventory");

    for (child_list_const_iter_t child_iter = getChildList()->begin();
            child_iter != getChildList()->end(); ++child_iter)
    {
        LLView *view = *child_iter;
        LLButton* buttonp = dynamic_cast<LLButton*>(view);
        if(buttonp)
        {
            buttonp->setSoundFlags(LLView::SILENT);
        }
    }

#if LL_DARWIN
    if(mResizeHandle == NULL)
    {
        LLRect rect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT);
        mResizeHandle = new LLFakeResizeHandle(std::string(""), rect, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT);
        this->addChildAtEnd(mResizeHandle);
        LLLayoutStack* toolbar_stack = getChild<LLLayoutStack>("toolbar_stack");
        toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight());
    }
#endif // LL_DARWIN

    layoutButtons();

    return TRUE;
}