Пример #1
0
void
Work::complete(CompleteResult result)
{
    CLOG(DEBUG, "Work") << "completed " << getUniqueName();
    auto& succ =
        mApp.getMetrics().NewMeter({"work", "unit", "success"}, "unit");
    auto& fail =
        mApp.getMetrics().NewMeter({"work", "unit", "failure"}, "unit");

    switch (result)
    {
    case WORK_COMPLETE_OK:
        setState(onSuccess());
        break;
    case WORK_COMPLETE_FAILURE:
        setState(WORK_FAILURE_RETRY);
        break;
    case WORK_COMPLETE_FATAL:
        setState(WORK_FAILURE_FATAL);
        break;
    }

    switch (getState())
    {
    case WORK_SUCCESS:
        succ.Mark();
        CLOG(DEBUG, "Work")
            << "notifying parent of successful " << getUniqueName();
        notifyParent();
        break;

    case WORK_FAILURE_RETRY:
        fail.Mark();
        onFailureRetry();
        scheduleRetry();
        break;

    case WORK_FAILURE_RAISE:
    case WORK_FAILURE_FATAL:
        fail.Mark();
        onFailureRaise();
        CLOG(DEBUG, "Work") << "notifying parent of failed " << getUniqueName();
        notifyParent();
        break;

    case WORK_PENDING:
        succ.Mark();
        advance();
        break;

    case WORK_RUNNING:
        succ.Mark();
        scheduleRun();
        break;

    default:
        assert(false);
        break;
    }
}
Пример #2
0
void LLScrollingPanelList::notifySizeChanged(S32 height)
{
    LLSD info;
    info["action"] = "size_changes";
    info["height"] = height;
    notifyParent(info);
}
// virtual
void LLPanelLandmarkInfo::processParcelInfo(const LLParcelData& parcel_data)
{
	LLPanelPlaceInfo::processParcelInfo(parcel_data);

	// HACK: Flag 0x2 == adult region,
	// Flag 0x1 == mature region, otherwise assume PG
	if (parcel_data.flags & 0x2)
	{
		mMaturityRatingIcon->setValue(icon_r);
		mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_ADULT));
	}
	else if (parcel_data.flags & 0x1)
	{
		mMaturityRatingIcon->setValue(icon_m);
		mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_MATURE));
	}
	else
	{
		mMaturityRatingIcon->setValue(icon_pg);
		mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_PG));
	}

	LLSD info;
	info["update_verbs"] = true;
	info["global_x"] = parcel_data.global_x;
	info["global_y"] = parcel_data.global_y;
	info["global_z"] = parcel_data.global_z;
	notifyParent(info);
}
void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name)
{
//	setAvatarName(av_name.mDisplayName);
//	setAvatarToolTip(av_name.mUsername);
// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a
    bool fRlvFilter = (mRlvCheckShowNames) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES));
    if (mShowDisplayName && !mShowUsername)
        setAvatarName( (!fRlvFilter) ? av_name.mDisplayName : RlvStrings::getAnonym(av_name) );
    else if (!mShowDisplayName && mShowUsername)
        setAvatarName( (!fRlvFilter) ? av_name.mUsername : RlvStrings::getAnonym(av_name) );
    else
        setAvatarName( (!fRlvFilter) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name) );

    // NOTE: If you change this, you will break sorting the contacts list
    //  by username unless you go change the comparator too. -- TS
    setAvatarToolTip( (!fRlvFilter) ? av_name.mUsername : RlvStrings::getAnonym(av_name) );
    // TODO-RLVa: bit of a hack putting this here. Maybe find a better way?
    mAvatarIcon->setDrawTooltip(!fRlvFilter);
// [/RLVa:KB]

    //KC - store the username for use in sorting
    mUserName = av_name.mUsername;

    //requesting the list to resort
    notifyParent(LLSD().with("sort", LLSD()));

    //update children, because this call tends to effect the size of the name field width
    updateChildren();
}
Пример #5
0
void LLPanelTipToast::onMessageTextClick()
{
	// notify parent toast about need hide
	LLSD info;
	info["action"] = "hide_toast";
	notifyParent(info);
}
Пример #6
0
void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name)
{
    setAvatarName(av_name.mDisplayName);
    setAvatarToolTip(av_name.mUsername);

    //requesting the list to resort
    notifyParent(LLSD().with("sort", LLSD()));
}
//////////////////////////////////////////////////////////////////////////
// PRIVATE SECTION
//////////////////////////////////////////////////////////////////////////
void LLOutputMonitorCtrl::notifyParentVisibilityChanged()
{
	LL_DEBUGS("SpeakingIndicator") << "Notify parent that visibility was changed: " << mSpeakerId << ", new_visibility: " << getVisible() << LL_ENDL;

	LLSD params = LLSD().with("visibility_changed", getVisible());

	notifyParent(params);
}
Пример #8
0
void LLPanelPickEdit::onClickSave()
{
	sendUpdate();

	mLocationChanged = false;

	LLSD params;
	params["action"] = "save_new_pick";
	notifyParent(params);
}
Пример #9
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()));

}
// 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()));
}
// virtual
void LLPanelLandmarkInfo::processParcelInfo(const LLParcelData& parcel_data)
{
	LLPanelPlaceInfo::processParcelInfo(parcel_data);

	// HACK: Flag 0x2 == adult region,
	// Flag 0x1 == mature region, otherwise assume PG
	if (parcel_data.flags & 0x2)
	{
		mMaturityRatingIcon->setValue(icon_r);
		mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_ADULT));
	}
	else if (parcel_data.flags & 0x1)
	{
		mMaturityRatingIcon->setValue(icon_m);
		mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_MATURE));
	}
	else
	{
		mMaturityRatingIcon->setValue(icon_pg);
		mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_PG));
	}

	S32 region_x;
	S32 region_y;
	S32 region_z;

	// If the region position is zero, grab position from the global
	if(mPosRegion.isExactlyZero())
	{
		region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS;
		region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS;
		region_z = llround(parcel_data.global_z);
	}
	else
	{
		region_x = llround(mPosRegion.mV[VX]);
		region_y = llround(mPosRegion.mV[VY]);
		region_z = llround(mPosRegion.mV[VZ]);
	}

	LLSD info;
	info["update_verbs"] = true;
	info["global_x"] = parcel_data.global_x;
	info["global_y"] = parcel_data.global_y;
	info["global_z"] = parcel_data.global_z;
	notifyParent(info);
}
Пример #12
0
void GroupToggleButton::toggle() {
  if (status == STATUS_OFF) {
    if (isInited()) {
      off->setVisible(0);
      on->setVisible(1);
      //rootwndholder_setRootWnd(on);
    }
    status = STATUS_ON;
  } else {
    if (isInited()) {
      on->setVisible(0);
      off->setVisible(1);
      //rootwndholder_setRootWnd(off);
    }
    status = STATUS_OFF;
  }
  notifyParent(ChildNotify::GROUPCLICKTGBUTTON_TOGGLE, status);
}
Пример #13
0
void Property::rejectTempValue()
{
    if (mTempValue.get() == 0)
    {
        LOG_WARNING() << "Temp value is empty.";
        return;
    }

    if (mValueSemaphore.tryAcquire(1, 100))
    {
        createStringValue();

        mTempValue.reset();
        mUpdateFlag = UF_NONE;
        mValueSemaphore.release();

        notifyParent();
    }
    else
        LOG_ERROR() << "Could not acquire value semaphore.";
}
Пример #14
0
static void scroll( HWND hwnd, int direction, int timeOut ) {

    LONG page_size = getEnd( hwnd ) - getStart( hwnd );
    if ( page_size <= getGranularity( hwnd ) ) {
        page_size = getGranularity( hwnd );
    }
    if ( page_size <= 0 ) {
        page_size = 1;
    }

    LONG delta = 0;
    if ( -1 == direction ) {
        delta = -page_size;
        if ( getStart( hwnd ) + delta < getLower( hwnd ) ) {
            delta = getLower( hwnd ) - getStart( hwnd );
        }
    } else {
        delta = page_size;
        if ( getUpper( hwnd ) < getEnd( hwnd ) + delta ) {
            delta = getUpper( hwnd ) - getEnd( hwnd );
        }
    }

    int start = adjust( hwnd, getStart( hwnd ) + delta );
    int end   = adjust( hwnd, getEnd  ( hwnd ) + delta );
    if ( start != getStart( hwnd ) || end != getEnd( hwnd ) ) {
        setStart( hwnd, start );
        setEnd  ( hwnd, end   );
        invalidateRect( hwnd );
        invalidateCursor();
        notifyParent( hwnd );
    }

    // TODO: discuss SPI_GETKEYBOARDDELAY
    if ( 0 < timeOut ) {
        SetTimer( hwnd, 1, timeOut, 0 );
    }
}
Пример #15
0
BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
{
	BOOL reset_selection = (mask != MASK_SHIFT);
	BOOL handled = FALSE;
	switch (key)
	{
		case KEY_RETURN:
		{
			if (mSelectedItemPairs.size() && mask == MASK_NONE)
			{
				mOnReturnSignal(this, getValue());
				handled = TRUE;
			}
			break;
		}
		case KEY_UP:
		{
			if ( !selectNextItemPair(true, reset_selection) && reset_selection)
			{
				// If case we are in accordion tab notify parent to go to the previous accordion
				if(notifyParent(LLSD().with("action","select_prev")) > 0 )//message was processed
					resetSelection();
			}
			break;
		}
		case KEY_DOWN:
		{
			if ( !selectNextItemPair(false, reset_selection) && reset_selection)
			{
				// If case we are in accordion tab notify parent to go to the next accordion
				if( notifyParent(LLSD().with("action","select_next")) > 0 ) //message was processed
					resetSelection();
			}
			break;
		}
		case 'A':
		{
			if(MASK_CONTROL & mask)
			{
				selectAll();
				handled = TRUE;
			}
			break;
		}
		default:
			break;
	}

	if ( ( key == KEY_UP || key == KEY_DOWN ) && mSelectedItemPairs.size() )
	{
		ensureSelectedVisible();
		/*
		LLRect visible_rc = getVisibleContentRect();
		LLRect selected_rc = getLastSelectedItemRect();

		if ( !visible_rc.contains (selected_rc) )
		{
			// But scroll in Items panel coordinates
			scrollToShowRect(selected_rc);
		}

		// In case we are in accordion tab notify parent to show selected rectangle
		LLRect screen_rc;
		localRectToScreen(selected_rc, &screen_rc);
		notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));*/

		handled = TRUE;
	}

	return handled ? handled : LLScrollContainer::handleKeyHere(key, mask);
}
Пример #16
0
BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
{
	BOOL	handled = FALSE;

	// We only handle the click if the click both started and ended within us
	if( hasMouseCapture() )
	{
		S32 screen_x;
		S32 screen_y;
		localPointToScreen(x, y, &screen_x, &screen_y);
		
		S32 delta_x = screen_x - mDragLastScreenX;
		S32 delta_y = screen_y - mDragLastScreenY;
				
		LLCoordGL mouse_dir;
		// use hysteresis on mouse motion to preserve user intent when mouse stops moving
		mouse_dir.mX = (screen_x == mLastMouseScreenX) ? mLastMouseDir.mX : screen_x - mLastMouseScreenX;
		mouse_dir.mY = (screen_y == mLastMouseScreenY) ? mLastMouseDir.mY : screen_y - mLastMouseScreenY;
		mLastMouseDir = mouse_dir;
		mLastMouseScreenX = screen_x;
		mLastMouseScreenY = screen_y;

		// Make sure the mouse in still over the application.  We don't want to make the parent
		// so big that we can't see the resize handle any more.
		LLRect valid_rect = getRootView()->getRect();
		
		if( valid_rect.localPointInRect( screen_x, screen_y ) && mResizingView )
		{
			// undock floater when user resize it
			LLFloater* parent = dynamic_cast<LLFloater*>( getParent());
			if (parent && parent->isDocked())
			{
				parent->setDocked( false, false);
			}

			// Resize the parent
			LLRect orig_rect = mResizingView->getRect();
			LLRect scaled_rect = orig_rect;
				
			S32 new_width = orig_rect.getWidth();
			S32 new_height = orig_rect.getHeight();

			switch( mSide )
			{
			case LEFT:
				new_width = llclamp(orig_rect.getWidth() - delta_x, mMinSize, mMaxSize);
				delta_x = orig_rect.getWidth() - new_width;
				scaled_rect.translate(delta_x, 0);
				break;

			case TOP:
				new_height = llclamp(orig_rect.getHeight() + delta_y, mMinSize, mMaxSize);
				delta_y = new_height - orig_rect.getHeight();
				break;
			
			case RIGHT:
				new_width = llclamp(orig_rect.getWidth() + delta_x, mMinSize, mMaxSize);
				delta_x = new_width - orig_rect.getWidth();
				break;
		
			case BOTTOM:
				new_height = llclamp(orig_rect.getHeight() - delta_y, mMinSize, mMaxSize);
				delta_y = orig_rect.getHeight() - new_height;
				scaled_rect.translate(0, delta_y);
				break;
			}

			notifyParent(LLSD().with("action", "resize")
				.with("view_name", mResizingView->getName())
				.with("new_height", new_height)
				.with("new_width", new_width));

			scaled_rect.mTop = scaled_rect.mBottom + new_height;
			scaled_rect.mRight = scaled_rect.mLeft + new_width;
			mResizingView->setRect(scaled_rect);

			LLView* snap_view = NULL;

			if (mSnappingEnabled)
			{
				static LLUICachedControl<S32> snap_margin ("SnapMargin", 0);
				switch( mSide )
				{
				case LEFT:
					snap_view = mResizingView->findSnapEdge(scaled_rect.mLeft, mouse_dir, SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, snap_margin);
					break;
				case TOP:
					snap_view = mResizingView->findSnapEdge(scaled_rect.mTop, mouse_dir, SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, snap_margin);
					break;
				case RIGHT:
					snap_view = mResizingView->findSnapEdge(scaled_rect.mRight, mouse_dir, SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, snap_margin);
					break;
				case BOTTOM:
					snap_view = mResizingView->findSnapEdge(scaled_rect.mBottom, mouse_dir, SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, snap_margin);
					break;
				}
			}

			// register "snap" behavior with snapped view
			mResizingView->setSnappedTo(snap_view);

			// restore original rectangle so the appropriate changes are detected
			mResizingView->setRect(orig_rect);
			// change view shape as user operation
			mResizingView->setShape(scaled_rect, true);

			// update last valid mouse cursor position based on resized view's actual size
			LLRect new_rect = mResizingView->getRect();
			switch(mSide)
			{
			case LEFT:
				mDragLastScreenX += new_rect.mLeft - orig_rect.mLeft;
				break;
			case RIGHT:
				mDragLastScreenX += new_rect.mRight - orig_rect.mRight;
				break;
			case TOP:
				mDragLastScreenY += new_rect.mTop - orig_rect.mTop;
				break;
			case BOTTOM:
				mDragLastScreenY += new_rect.mBottom- orig_rect.mBottom;
				break;
			default:
				break;
			}
		}

		handled = TRUE;
	}
	else
	{
		handled = TRUE;
	}

	if( handled && canResize() )
	{
		switch( mSide )
		{
		case LEFT:
		case RIGHT:
			getWindow()->setCursor(UI_CURSOR_SIZEWE);
			break;

		case TOP:
		case BOTTOM:
			getWindow()->setCursor(UI_CURSOR_SIZENS);
			break;
		}
	}

	return handled;
} // end LLResizeBar::handleHover
Пример #17
0
static void onKey(
    HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags )
{
    long start = getStart( hwnd );
    long end   = getEnd( hwnd );

    const BOOL controlKey = GetAsyncKeyState( VK_CONTROL ) < 0;

    if ( VK_ESCAPE == vk ) {
        if ( htNone != getHTCode( hwnd ) ) {
            setHTCode( hwnd, htNone );
            const LONG oldStart = getSaveStart( hwnd );
            const LONG oldEnd   = getSaveEnd  ( hwnd );
            setStart( hwnd, oldStart );
            setEnd  ( hwnd, oldEnd   );
            invalidateRect( hwnd );
            //onLButtonUp( hwnd, 0, 0, 0 ); // TODO retain capture anyway?
            // TODO notify parent
            return; //** FUNCTION EXIT POINT
        }
    }

    const UINT left_key  = isVertical( hwnd ) ? VK_UP   : VK_LEFT ;
    const UINT right_key = isVertical( hwnd ) ? VK_DOWN : VK_RIGHT;

    long granularity = getGranularity( hwnd );
    if ( granularity <= 0 ) {
        granularity = 1;
    }

    if ( left_key == vk ) {
        if ( controlKey ) {
            if ( getMinRange( hwnd ) < end - start ) {
                end -= granularity;
            }
        } else if ( getLower( hwnd ) < start ) {
            start -= granularity;
            end   -= granularity;
        }
    } else if ( right_key == vk ) {
        if ( end < getUpper( hwnd ) ) {
            end += granularity;
            if ( !controlKey ) {
                start += granularity;
            }
        }
    } else if ( VK_PRIOR == vk ) {
        scroll( hwnd, -1, 0 );
        return; //*** FUNCTION EXIT POINT
    } else if ( VK_NEXT == vk ) {
        scroll( hwnd, 1, 0 );
        return; //*** FUNCTION EXIT POINT
    } else if ( VK_HOME == vk ) {
        const long range = abs( getLower( hwnd ) - start );
        start -= range;
        end   -= range;
    } else if ( VK_END == vk ) {
        const long range = abs( getUpper( hwnd ) - end );
        start += range;
        end   += range;
    }

    start = adjust( hwnd, start );
    end   = adjust( hwnd, end   );
    if ( start != getStart( hwnd ) || end != getEnd( hwnd ) ) {
        setStart( hwnd, start );
        setEnd  ( hwnd, end );
        invalidateRect( hwnd );
        invalidateCursor();
        notifyParent( hwnd );
    }
}
Пример #18
0
void GroupToggleButton::grouptoggle_onLeftPush() {
  notifyParent(ChildNotify::GROUPCLICKTGBUTTON_CLICKED);
  if (!wantAutoToggle()) return;
  if (status == STATUS_ON && !off_id.isempty() || status == STATUS_OFF && !on_id.isempty())
    toggle();
}
// [SL:KB] - Patch: UI-AvatarListDndShare | Checked: 2011-06-19 (Catznip-2.6.0c) | Added: Catznip-2.6.0c
BOOL LLAvatarListItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
        EAcceptance *accept, std::string& tooltip_msg)
{
    notifyParent(LLSD().with("select", mAvatarId));
    return LLToolDragAndDrop::handleGiveDragAndDrop(mAvatarId, LLUUID::null, drop, cargo_type, cargo_data, accept, getAvatarName());
}
Пример #20
0
void LLAccordionCtrlTab::handleVisibilityChange(BOOL new_visibility)
{
	LLUICtrl::handleVisibilityChange(new_visibility);

	notifyParent(LLSD().with("child_visibility_change", new_visibility));
}