示例#1
0
	virtual bool apply(LLViewerObject* object, S32 te)
	{
		BOOL valid;
		F32 value;
		LLSpinCtrl*	ctrlTexScaleS = mPanel->getChild<LLSpinCtrl>("TexScaleU");
		LLSpinCtrl*	ctrlTexScaleT = mPanel->getChild<LLSpinCtrl>("TexScaleV");
		LLSpinCtrl*	ctrlTexOffsetS = mPanel->getChild<LLSpinCtrl>("TexOffsetU");
		LLSpinCtrl*	ctrlTexOffsetT = mPanel->getChild<LLSpinCtrl>("TexOffsetV");
		LLSpinCtrl*	ctrlTexRotation = mPanel->getChild<LLSpinCtrl>("TexRot");
		LLCheckBoxCtrl*	checkFlipScaleS = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip s");
		LLCheckBoxCtrl*	checkFlipScaleT = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip t");
		LLComboBox*		comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen");
		if (ctrlTexScaleS)
		{
			valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative();
			if (valid)
			{
				value = ctrlTexScaleS->get();
				if( checkFlipScaleS->get() )
				{
					value = -value;
				}
				if (comboTexGen->getCurrentIndex() == 1)
				{
					value *= 0.5f;
				}
				object->setTEScaleS( te, value );
			}
		}

		if (ctrlTexScaleT)
		{
			valid = !ctrlTexScaleT->getTentative() || !checkFlipScaleT->getTentative();
			if (valid)
			{
				value = ctrlTexScaleT->get();
				if( checkFlipScaleT->get() )
				{
					value = -value;
				}
				if (comboTexGen->getCurrentIndex() == 1)
				{
					value *= 0.5f;
				}
				object->setTEScaleT( te, value );
			}
		}

		if (ctrlTexOffsetS)
		{
			valid = !ctrlTexOffsetS->getTentative();
			if (valid)
			{
				value = ctrlTexOffsetS->get();
				object->setTEOffsetS( te, value );
			}
		}

		if (ctrlTexOffsetT)
		{
			valid = !ctrlTexOffsetT->getTentative();
			if (valid)
			{
				value = ctrlTexOffsetT->get();
				object->setTEOffsetT( te, value );
			}
		}

		if (ctrlTexRotation)
		{
			valid = !ctrlTexRotation->getTentative();
			if (valid)
			{
				value = ctrlTexRotation->get() * DEG_TO_RAD;
				object->setTERotation( te, value );
			}
		}
		return true;
	}
示例#2
0
BOOL	LLPanelFace::postBuild()
{
	LLRect	rect = this->getRect();
	LLTextureCtrl*	mTextureCtrl;
	LLColorSwatchCtrl*	mColorSwatch;

	LLComboBox*		mComboTexGen;

	LLCheckBoxCtrl	*mCheckFullbright;
	
	LLTextBox*		mLabelColorTransp;
	LLSpinCtrl*		mCtrlColorTransp;		// transparency = 1 - alpha

	LLSpinCtrl*     mCtrlGlow;

	setMouseOpaque(FALSE);
	mTextureCtrl = getChild<LLTextureCtrl>("texture control");
	if(mTextureCtrl)
	{
		mTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" )));
		mTextureCtrl->setCommitCallback( LLPanelFace::onCommitTexture );
		mTextureCtrl->setOnCancelCallback( LLPanelFace::onCancelTexture );
		mTextureCtrl->setOnSelectCallback( LLPanelFace::onSelectTexture );
		mTextureCtrl->setDragCallback(LLPanelFace::onDragTexture);
		mTextureCtrl->setCallbackUserData( this );
		mTextureCtrl->setFollowsTop();
		mTextureCtrl->setFollowsLeft();
		// Don't allow (no copy) or (no transfer) textures to be selected during immediate mode
		mTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
		// Allow any texture to be used during non-immediate mode.
		mTextureCtrl->setNonImmediateFilterPermMask(PERM_NONE);
		LLAggregatePermissions texture_perms;
		if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms))
		{
			BOOL can_copy = 
				texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY || 
				texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL;
			BOOL can_transfer = 
				texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY || 
				texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL;
			mTextureCtrl->setCanApplyImmediately(can_copy && can_transfer);
		}
		else
		{
			mTextureCtrl->setCanApplyImmediately(FALSE);
		}
	}

	mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
	if(mColorSwatch)
	{
		mColorSwatch->setCommitCallback(LLPanelFace::onCommitColor);
		mColorSwatch->setOnCancelCallback(LLPanelFace::onCancelColor);
		mColorSwatch->setOnSelectCallback(LLPanelFace::onSelectColor);
		mColorSwatch->setCallbackUserData( this );
		mColorSwatch->setFollowsTop();
		mColorSwatch->setFollowsLeft();
		mColorSwatch->setCanApplyImmediately(TRUE);
	}

	mLabelColorTransp = getChild<LLTextBox>("color trans");
	if(mLabelColorTransp)
	{
		mLabelColorTransp->setFollowsTop();
		mLabelColorTransp->setFollowsLeft();
	}

	mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans");
	if(mCtrlColorTransp)
	{
		mCtrlColorTransp->setCommitCallback(LLPanelFace::onCommitAlpha);
		mCtrlColorTransp->setCallbackUserData(this);
		mCtrlColorTransp->setPrecision(0);
		mCtrlColorTransp->setFollowsTop();
		mCtrlColorTransp->setFollowsLeft();
	}

	mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright");
	if (mCheckFullbright)
	{
		mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright);
		mCheckFullbright->setCallbackUserData( this );
	}

	mComboTexGen = getChild<LLComboBox>("combobox texgen");
	if(mComboTexGen)
	{
		mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen);
		mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);	
		mComboTexGen->setCallbackUserData( this );
	}

	mCtrlGlow = getChild<LLSpinCtrl>("glow");
	if(mCtrlGlow)
	{
		mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow);
		mCtrlGlow->setCallbackUserData(this);
	}
	
	childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this);
	childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this);
	childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this);
	childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this);
	childSetCommitCallback("checkbox flip s",&LLPanelFace::onCommitTextureInfo, this);
	childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this);
	childSetCommitCallback("checkbox flip t",&LLPanelFace::onCommitTextureInfo, this);
	childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureInfo, this);
	childSetAction("button apply",&onClickApply,this);
	childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureInfo, this);
	childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this);
	childSetAction("button align",onClickAutoFix,this);
	childSetAction("copytextures",onClickCopy,this);
	childSetAction("pastetextures",onClickPaste,this);

	clearCtrls();

	return TRUE;
}
LLFloaterEditUI::LLFloaterEditUI()
    :	LLFloater(std::string("floater_ui_editor"), LLRect(0, 200, 200, 0), std::string("Edit User Interface")),
      mLastView(NULL),
      mLabelLine(NULL),
      mWidthSpin(NULL),
      mHeightSpin(NULL)
{
    LLView::sEditingUI = TRUE;

    S32 x = HPAD;
    S32 y = getRect().getHeight() - LINE - LINE - VPAD;
    const S32 R1 = HPAD + 40;

    LLLineEditor* line = NULL;
    LLSpinCtrl* spin = NULL;
    LLTextBox* text = NULL;

    LLButton*	button = NULL;


    text = new LLTextBox(std::string("Selected UI Widget:"), LLRect(x, y+16, x+100, y));
    addChild(text);
    y -= VPAD + 16;

    text = new LLTextBox(std::string("Label:"), LLRect(x, y+16, x+40, y));
    addChild(text);
    x = R1;

    line = new LLLineEditor(std::string("label_line"), LLRect(x, y+20, x+100, y),
                            LLStringUtil::null,
                            NULL,
                            254,
                            onCommitLabel,
                            NULL,
                            NULL,
                            this);
    addChild(line);
    mLabelLine = line;

    x = HPAD;
    y -= VPAD + 20;

    spin = new LLSpinCtrl(std::string("height_spin"), LLRect(x, y+20, x+100, y),
                          std::string("Height:"), LLFontGL::getFontSansSerifSmall(),
                          onCommitHeight,
                          this,
                          0.f,
                          2.f,
                          1000.f,
                          1.f);
    spin->setPrecision(0);
    addChild(spin);
    mHeightSpin = spin;

    y -= VPAD + 20;

    spin = new LLSpinCtrl(std::string("width_spin"), LLRect(x, y+20, x+100, y),
                          std::string("Width:"), LLFontGL::getFontSansSerifSmall(),
                          onCommitWidth,
                          this,
                          0.f,
                          2.f,
                          1000.f,
                          1.f);
    spin->setPrecision(0);
    addChild(spin);
    mWidthSpin = spin;

    y -= VPAD + 20;

    text = new LLTextBox(std::string("XML Name:"), LLRect(x, y+16, x+60, y));
    addChild(text);
    x+=60;
    text = new LLTextBox(std::string("xml_name"), LLRect(x, y+16, x+100, y));
    addChild(text);
    x-=50;

    y -= VPAD + 20;

    x += 40;
    button = new LLButton(std::string("up"),LLRect(x, y+16, x+32, y));
    addChild(button);
    x -= 40;
    y -= VPAD + 20;
    button = new LLButton(std::string("<<"),LLRect(x, y+16, x+32, y));
    addChild(button);
    x += 40;
    button = new LLButton(std::string("rfrsh"),LLRect(x, y+16, x+32, y));
    addChild(button);
    x += 40;
    button = new LLButton(std::string(">>"),LLRect(x, y+16, x+32, y));
    addChild(button);
    x -= 40;
    y -= VPAD + 20;
    button = new LLButton(std::string("dn"),LLRect(x, y+16, x+32, y));
    addChild(button);

    childSetAction("up",navigateHierarchyButtonPressed,(void*)0);
    childSetAction("dn",navigateHierarchyButtonPressed,(void*)1);
    childSetAction("<<",navigateHierarchyButtonPressed,(void*)2);
    childSetAction(">>",navigateHierarchyButtonPressed,(void*)3);
    childSetAction("rfrsh",navigateHierarchyButtonPressed,(void*)4);
    sInstance = this;
}
void LLFloaterInventoryFinder::draw()
{
	LLMemType mt(LLMemType::MTYPE_INVENTORY_DRAW);
	U32 filter = 0xffffffff;
	BOOL filtered_by_all_types = TRUE;

	if (!childGetValue("check_animation"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_ANIMATION);
		filtered_by_all_types = FALSE;
	}


	if (!childGetValue("check_calling_card"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD);
		filtered_by_all_types = FALSE;
	}

	if (!childGetValue("check_clothing"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_WEARABLE);
		filtered_by_all_types = FALSE;
	}

	if (!childGetValue("check_gesture"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_GESTURE);
		filtered_by_all_types = FALSE;
	}

	if (!childGetValue("check_landmark"))


	{
		filter &= ~(0x1 << LLInventoryType::IT_LANDMARK);
		filtered_by_all_types = FALSE;
	}

	if (!childGetValue("check_notecard"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_NOTECARD);
		filtered_by_all_types = FALSE;
	}

	if (!childGetValue("check_object"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_OBJECT);
		filter &= ~(0x1 << LLInventoryType::IT_ATTACHMENT);
		filtered_by_all_types = FALSE;
	}

	if (!childGetValue("check_script"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_LSL);
		filtered_by_all_types = FALSE;
	}

	if (!childGetValue("check_sound"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_SOUND);
		filtered_by_all_types = FALSE;
	}

	if (!childGetValue("check_texture"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_TEXTURE);
		filtered_by_all_types = FALSE;
	}

	if (!childGetValue("check_snapshot"))
	{
		filter &= ~(0x1 << LLInventoryType::IT_SNAPSHOT);
		filtered_by_all_types = FALSE;
	}

	if (!filtered_by_all_types)
	{
		// don't include folders in filter, unless I've selected everything
		filter &= ~(0x1 << LLInventoryType::IT_CATEGORY);
	}

	// update the panel, panel will update the filter
	mPanelMainInventory->getPanel()->setShowFolderState(getCheckShowEmpty() ?
		LLInventoryFilter::SHOW_ALL_FOLDERS : LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
	mPanelMainInventory->getPanel()->setFilterTypes(filter);
	if (getCheckSinceLogoff())
	{
		mSpinSinceDays->set(0);
		mSpinSinceHours->set(0);
	}
	U32 days = (U32)mSpinSinceDays->get();
	U32 hours = (U32)mSpinSinceHours->get();
	if (hours > 24)
	{
		days += hours / 24;
		hours = (U32)hours % 24;
		mSpinSinceDays->set((F32)days);
		mSpinSinceHours->set((F32)hours);
	}
	hours += days * 24;
	mPanelMainInventory->getPanel()->setHoursAgo(hours);
	mPanelMainInventory->getPanel()->setSinceLogoff(getCheckSinceLogoff());
	mPanelMainInventory->setFilterTextFromFilter();

	LLPanel::draw();
}
示例#5
0
// static
void LLSpinCtrl::onDownBtn( void *userdata )
{
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;

	if( self->getEnabled() )
	{
		F32 val = (F32)self->getValue().asReal() - self->mIncrement;
		val = clamp_precision(val, self->mPrecision);
		val = llmax( val, self->mMinValue );

		if( self->mValidateCallback )
		{
			F32 saved_val = (F32)self->getValue().asReal();
			self->setValue(val);
			if( !self->mValidateCallback( self, self->mCallbackUserData ) )
			{
				self->setValue( saved_val );
				self->reportInvalidData();
				self->updateEditor();
				return;
			}
		}
		else
		{
			self->setValue(val);
		}
		
		self->updateEditor();
		self->onCommit();
	}
}
示例#6
0
// static
void LLSpinCtrl::onUpBtn( void *userdata )
{
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;
	if( self->getEnabled() )
	{
		// use getValue()/setValue() to force reload from/to control
		F32 val = (F32)self->getValue().asReal() + self->mIncrement;
		val = clamp_precision(val, self->mPrecision);
		val = llmin( val, self->mMaxValue );
		
		if( self->mValidateCallback )
		{
			F32 saved_val = (F32)self->getValue().asReal();
			self->setValue(val);
			if( !self->mValidateCallback( self, self->mCallbackUserData ) )
			{
				self->setValue( saved_val );
				self->reportInvalidData();
				self->updateEditor();
				return;
			}
		}
		else
		{
			self->setValue(val);
		}

		self->updateEditor();
		self->onCommit();
	}
}
示例#7
0
LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
	std::string name("spinner");
	node->getAttributeString("name", name);

	std::string label;
	node->getAttributeString("label", label);

	LLRect rect;
	createRect(node, rect, parent, LLRect());

	LLFontGL* font = LLView::selectFont(node);

	F32 initial_value = 0.f;
	node->getAttributeF32("initial_val", initial_value);

	F32 min_value = 0.f;
	node->getAttributeF32("min_val", min_value);

	F32 max_value = 1.f; 
	node->getAttributeF32("max_val", max_value);

	F32 increment = 0.1f;
	node->getAttributeF32("increment", increment);

	U32 precision = 3;
	node->getAttributeU32("decimal_digits", precision);
	
	S32 label_width = llmin(40, rect.getWidth() - 40);
	node->getAttributeS32("label_width", label_width);

	BOOL allow_text_entry = TRUE;
	node->getAttributeBOOL("allow_text_entry", allow_text_entry);

	LLUICtrlCallback callback = NULL;

	if(label.empty())
	{
		label.assign( node->getValue() );
	}

	LLSpinCtrl* spinner = new LLSpinCtrl(name,
							rect,
							label,
							font,
							callback,
							NULL,
							initial_value, 
							min_value, 
							max_value, 
							increment,
							LLStringUtil::null,
							label_width);

	spinner->setPrecision(precision);

	spinner->initFromXML(node, parent);
	spinner->setAllowEdit(allow_text_entry);

	return spinner;
}
示例#8
0
// static
void LLSpinCtrl::onDownBtn( void *userdata )
{
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;

	if( self->getEnabled() )
	{
		F32 inc = self->mIncrement;
		if(gKeyboard->getKeyDown(KEY_CONTROL))inc = inc * 0.10;
		else if(gKeyboard->getKeyDown(KEY_SHIFT))inc = inc * 0.01;
		F32 val = (F32)self->getValue().asReal() - inc;
		val = clamp_precision(val, self->mPrecision);
		val = llmax( val, self->mMinValue );

		if( self->mValidateCallback )
		{
			F32 saved_val = (F32)self->getValue().asReal();
			self->setValue(val);
			if( !self->mValidateCallback( self, self->mCallbackUserData ) )
			{
				self->setValue( saved_val );
				self->reportInvalidData();
				self->updateEditor();
				return;
			}
		}
		else
		{
			self->setValue(val);
		}
		
		self->updateEditor();
		self->onCommit();
	}
}
// static
void LLSpinCtrl::onDownBtn( void *userdata )
{
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;

	if( self->getEnabled() )
	{
		F32 val = (F32)self->getValue().asReal() - get_increment(self->mIncrement, self->mPrecision);
		val = clamp_precision(val, self->mPrecision);
		val = llmax( val, self->mMinValue );


		if (val < self->mMinValue) val = self->mMinValue;
		if (val > self->mMaxValue) val = self->mMaxValue;

		F32 saved_val = (F32)self->getValue().asReal();
		self->setValue(val);
		if( (self->mValidateCallback 	&& !self->mValidateCallback( self, self->mCallbackUserData ) ) ||
			(self->mValidateSignal		&& !(*(self->mValidateSignal))( self, val ) ))
		{
			self->setValue( saved_val );
			self->reportInvalidData();
			self->updateEditor();
			return;
		}
		
		self->updateEditor();
		self->onCommit();
	}
}