Example #1
0
void LLIMFloater::updateMessages()
{
	bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory");

	std::list<LLSD> messages;

	// we shouldn't reset unread message counters if IM floater doesn't have focus
	if (hasFocus())
	{
		LLIMModel::instance().getMessages(mSessionID, messages, mLastMessageIndex+1);
	}
	else
	{
		LLIMModel::instance().getMessagesSilently(mSessionID, messages, mLastMessageIndex+1);
	}

	if (messages.size())
	{
		LLSD chat_args;
		chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history;

		std::ostringstream message;
		std::list<LLSD>::const_reverse_iterator iter = messages.rbegin();
		std::list<LLSD>::const_reverse_iterator iter_end = messages.rend();
		for (; iter != iter_end; ++iter)
		{
			LLSD msg = *iter;

			std::string time = msg["time"].asString();
			LLUUID from_id = msg["from_id"].asUUID();
			std::string from = msg["from"].asString();
			std::string message = msg["message"].asString();
			bool is_history = msg["is_history"].asBoolean();

			LLChat chat;
			chat.mFromID = from_id;
			chat.mSessionID = mSessionID;
			chat.mFromName = from;
			chat.mTimeStr = time;
			chat.mChatStyle = is_history ? CHAT_STYLE_HISTORY : chat.mChatStyle;

			// process offer notification
			if (msg.has("notification_id"))
			{
				chat.mNotifId = msg["notification_id"].asUUID();
				// if notification exists - embed it
				if (LLNotificationsUtil::find(chat.mNotifId) != NULL)
				{
					// remove embedded notification from channel
					LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
							(LLNotificationsUI::LLChannelManager::getInstance()->
																findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
					if (getVisible())
					{
						// toast will be automatically closed since it is not storable toast
						channel->hideToast(chat.mNotifId);
					}
				}
				// if notification doesn't exist - try to use next message which should be log entry
				else
				{
					continue;
				}
			}
			//process text message
			else
			{
				chat.mText = message;
			}
			
			mChatHistory->appendMessage(chat, chat_args);
			mLastMessageIndex = msg["index"].asInteger();

			// if it is a notification - next message is a notification history log, so skip it
			if (chat.mNotifId.notNull() && LLNotificationsUtil::find(chat.mNotifId) != NULL)
			{
				if (++iter == iter_end)
				{
					break;
				}
				else
				{
					mLastMessageIndex++;
				}
			}
		}
	}
}
BOOL LLPanelEmerald::postBuild()
{
	refresh();

	LLComboBox* tagcombo = getChild<LLComboBox>("TagCombo");
	tagcombo->setCommitCallback(onTagComboBoxCommit);
	for(LLSD::map_iterator itr = ModularSystemsLink::emerald_tags.beginMap(); itr != ModularSystemsLink::emerald_tags.endMap(); ++itr) 
	{
		tagcombo->add(itr->first,itr->second, ADD_BOTTOM, TRUE);
	}
	tagcombo->setSimple(gSavedSettings.getString("EmeraldTagColor"));

	getChild<LLComboBox>("material")->setSimple(gSavedSettings.getString("EmeraldBuildPrefs_Material"));
	getChild<LLComboBox>("combobox shininess")->setSimple(gSavedSettings.getString("EmeraldBuildPrefs_Shiny"));
	

	LLSliderCtrl* mShapeScaleSlider = getChild<LLSliderCtrl>("EmeraldBeamShapeScale",TRUE,FALSE);
	mShapeScaleSlider->setCommitCallback(&LLPanelEmerald::beamUpdateCall);
	mShapeScaleSlider->setCallbackUserData(this);

	LLSliderCtrl* mBeamsPerSecondSlider = getChild<LLSliderCtrl>("EmeraldMaxBeamsPerSecond",TRUE,FALSE);
	mBeamsPerSecondSlider->setCommitCallback(&LLPanelEmerald::beamUpdateCall);
	mBeamsPerSecondSlider->setCallbackUserData(this);

	getChild<LLComboBox>("material")->setCommitCallback(onComboBoxCommit);
	getChild<LLComboBox>("combobox shininess")->setCommitCallback(onComboBoxCommit);
	getChild<LLComboBox>("EmeraldBeamShape_combo")->setCommitCallback(onComboBoxCommit);
	getChild<LLComboBox>("BeamColor_combo")->setCommitCallback(onComboBoxCommit);
	getChild<LLTextureCtrl>("texture control")->setDefaultImageAssetID(LLUUID("89556747-24cb-43ed-920b-47caed15465f"));
	getChild<LLTextureCtrl>("texture control")->setCommitCallback(onTexturePickerCommit);

	getChild<LLComboBox>("EmeraldSpellBase")->setCommitCallback(onSpellBaseComboBoxCommit);

		
	//childSetCommitCallback("material",onComboBoxCommit);
	//childSetCommitCallback("combobox shininess",onComboBoxCommit);


	getChild<LLButton>("keyword_allert")->setClickedCallback(onKeywordAllertButton,this);
	getChild<LLButton>("ac_button")->setClickedCallback(onAutoCorrectButton,this);
	
	
	getChild<LLButton>("EmSpell_EditCustom")->setClickedCallback(onSpellEditCustom, this);
	getChild<LLButton>("EmSpell_GetMore")->setClickedCallback(onSpellGetMore, this);
	getChild<LLButton>("EmSpell_Add")->setClickedCallback(onSpellAdd, this);
	getChild<LLButton>("EmSpell_Remove")->setClickedCallback(onSpellRemove, this);
	

	getChild<LLButton>("BeamColor_new")->setClickedCallback(onCustomBeamColor, this);
	getChild<LLButton>("BeamColor_refresh")->setClickedCallback(onRefresh,this);
	getChild<LLButton>("BeamColor_delete")->setClickedCallback(onBeamColorDelete,this);
			
	getChild<LLButton>("custom_beam_btn")->setClickedCallback(onCustomBeam, this);
	getChild<LLButton>("refresh_beams")->setClickedCallback(onRefresh,this);
	getChild<LLButton>("delete_beam")->setClickedCallback(onBeamDelete,this);

	getChild<LLButton>("revert_production_voice_btn")->setClickedCallback(onClickVoiceRevertProd, this);
	getChild<LLButton>("revert_debug_voice_btn")->setClickedCallback(onClickVoiceRevertDebug, this);

	getChild<LLButton>("EmeraldBreastReset")->setClickedCallback(onClickBoobReset, this);
	

	childSetCommitCallback("production_voice_field", onCommitApplyControl);//onCommitVoiceProductionServerName);
	childSetCommitCallback("debug_voice_field", onCommitApplyControl);//onCommitVoiceDebugServerName);

	childSetCommitCallback("EmeraldCmdLinePos", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineGround", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineHeight", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineTeleportHome", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineRezPlatform", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineMapTo", onCommitApplyControl);	
	childSetCommitCallback("EmeraldCmdLineCalc", onCommitApplyControl);

	childSetCommitCallback("EmeraldCmdLineDrawDistance", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdTeleportToCam", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineKeyToName", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineOfferTp", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineTP2", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineAO", onCommitApplyControl);
	childSetCommitCallback("EmeraldCmdLineClearChat", onCommitApplyControl);

	childSetCommitCallback("X Modifier", onCommitAvatarModifier);
	childSetCommitCallback("Y Modifier", onCommitAvatarModifier);
	childSetCommitCallback("Z Modifier", onCommitAvatarModifier);
	if(gAgent.getID() != LLUUID::null)
	{
		getChild<LLSpinCtrl>("X Modifier")->set(gSavedPerAccountSettings.getF32("EmeraldAvatarXModifier"));
		getChild<LLSpinCtrl>("Y Modifier")->set(gSavedPerAccountSettings.getF32("EmeraldAvatarYModifier"));
		getChild<LLSpinCtrl>("Z Modifier")->set(gSavedPerAccountSettings.getF32("EmeraldAvatarZModifier"));
	}else
	{
		getChild<LLSpinCtrl>("X Modifier")->setEnabled(FALSE);
		getChild<LLSpinCtrl>("Y Modifier")->setEnabled(FALSE);
		getChild<LLSpinCtrl>("Z Modifier")->setEnabled(FALSE);
	}


	childSetValue("EmeraldUseOTR", LLSD((S32)gSavedSettings.getU32("EmeraldUseOTR"))); // [$PLOTR$]
	getChild<LLButton>("otr_help_btn")->setClickedCallback(onClickOtrHelp, this);      // [/$PLOTR$]

	initHelpBtn("EmeraldHelp_TeleportLogin",	"EmeraldHelp_TeleportLogin");
	initHelpBtn("EmeraldHelp_Voice",			"EmeraldHelp_Voice");
	initHelpBtn("EmeraldHelp_Shields",			"EmeraldHelp_Shields");
	initHelpBtn("EmeraldHelp_IM",				"EmeraldHelp_IM");
	initHelpBtn("EmeraldHelp_Chat",				"EmeraldHelp_Chat");
	initHelpBtn("EmeraldHelp_Misc",				"EmeraldHelp_Misc");
	initHelpBtn("EmeraldHelp_CmdLine",			"EmeraldHelp_CmdLine");
	initHelpBtn("EmeraldHelp_Avatar",			"EmeraldHelp_Avatar");
	initHelpBtn("EmeraldHelp_Build",			"EmeraldHelp_Build");
	initHelpBtn("EmeraldHelp_IRC",				"EmeraldHelp_IRC");
	initHelpBtn("EmeraldHelp_UtilityStream",	"EmeraldHelp_UtilityStream");
	initHelpBtn("EmeraldHelp_Inventory",		"EmeraldHelp_Inventory");
	initHelpBtn("EmeraldHelp_Effects",			"EmeraldHelp_Effects");
	initHelpBtn("EmeraldHelp_SpellCheck",		"EmeraldHelp_SpellCheck");

	LLView *target_view = getChild<LLView>("im_give_drop_target_rect");
	if(target_view)
	{
		if (mObjectDropTarget)//shouldn't happen
		{
			delete mObjectDropTarget;
		}
		mObjectDropTarget = new JCInvDropTarget("drop target", target_view->getRect(), IMAutoResponseItemDrop);//, mAvatarID);
		addChild(mObjectDropTarget);
	}
	target_view = getChild<LLView>("build_item_add_disp_rect");
	if(target_view)
	{
		if (mBuildObjectDropTarget) delete mBuildObjectDropTarget;
		mBuildObjectDropTarget = new JCInvDropTarget("build drop target", target_view->getRect(),BuildAutoResponseItemDrop);
		addChild(mBuildObjectDropTarget);
	}

	if(LLStartUp::getStartupState() == STATE_STARTED)
	{
		LLUUID itemid = (LLUUID)gSavedPerAccountSettings.getString("EmeraldInstantMessageResponseItemData");
		LLViewerInventoryItem* item = gInventory.getItem(itemid);
		if(item)
		{
			childSetValue("im_give_disp_rect_txt","Currently set to: "+item->getName());
		}else if(itemid.isNull())
		{
			childSetValue("im_give_disp_rect_txt","Currently not set");
		}else
		{
			childSetValue("im_give_disp_rect_txt","Currently set to a item not on this account");
		}
		itemid = (LLUUID)gSavedSettings.getString("EmeraldBuildPrefs_Item");
		item = gInventory.getItem(itemid);
		if(item)
		{
			childSetValue("build_item_add_disp_rect_txt","Currently set to: "+item->getName());
		}else if(itemid.isNull())
		{
			childSetValue("build_item_add_disp_rect_txt","Currently not set");
		}else
		{
			childSetValue("build_item_add_disp_rect_txt","Currently set to a item not on this account");
		}
	}else
	{
		childSetValue("im_give_disp_rect_txt","Not logged in");
		childSetValue("build_item_add_disp_rect_txt","Not logged in");
	}

	LLWString auto_response = utf8str_to_wstring( gSavedPerAccountSettings.getString("EmeraldInstantMessageResponse") );
	LLWStringUtil::replaceChar(auto_response, '^', '\n');
	LLWStringUtil::replaceChar(auto_response, '%', ' ');
	childSetText("im_response", wstring_to_utf8str(auto_response));
	childSetValue("EmeraldInstantMessageResponseFriends", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseFriends"));
	childSetValue("EmeraldInstantMessageResponseMuted", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseMuted"));
	childSetValue("EmeraldInstantMessageResponseAnyone", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseAnyone"));
	childSetValue("EmeraldInstantMessageShowResponded", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageShowResponded"));
	childSetValue("EmeraldInstantMessageShowOnTyping", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageShowOnTyping"));
	childSetValue("EmeraldInstantMessageResponseRepeat", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseRepeat" ));
	childSetValue("EmeraldInstantMessageResponseItem", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseItem"));
	childSetValue("EmeraldInstantMessageAnnounceIncoming", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageAnnounceIncoming"));
	childSetValue("EmeraldInstantMessageAnnounceStealFocus", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageAnnounceStealFocus"));
	childSetValue("EmeraldShadowsON", gSavedSettings.getBOOL("EmeraldShadowsToggle"));

	childSetAction("set_mirror", onClickSetMirror, this);
	childSetCommitCallback("mirror_location", onCommitApplyControl);

	childSetAction("set_includeHDD", onClickSetHDDInclude, this);
	childSetCommitCallback("include_location", onCommitApplyControl);

	//EmeraldLSLExternalEditor
	childSetAction("set_xed", onClickSetXed, this);
	childSetCommitCallback("xed_location", onCommitApplyControl);
	childSetValue("xed_location", gSavedSettings.getString("EmeraldLSLExternalEditor"));

	getChild<LLCheckBoxCtrl>("telerequest_toggle")->setCommitCallback(onConditionalPreferencesChanged);
	getChild<LLCheckBoxCtrl>("mldct_toggle")->setCommitCallback(onConditionalPreferencesChanged);

	refresh();
	return TRUE;
}
bool LLNotifications::loadTemplates()
{
	const std::string xml_filename = "notifications.xml";
	LLXMLNodePtr root;
	
	BOOL success  = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
	
	if (!success || root.isNull() || !root->hasName( "notifications" ))
	{
		llerrs << "Problem reading UI Notifications file: " << xml_filename << llendl;
		return false;
	}
	
	clearTemplates();
	
	for (LLXMLNodePtr item = root->getFirstChild();
		 item.notNull(); item = item->getNextSibling())
	{
		// we do this FIRST so that item can be changed if we 
		// encounter a usetemplate -- we just replace the
		// current xml node and keep processing
		item = checkForXMLTemplate(item);
		
		if (item->hasName("global"))
		{
			std::string global_name;
			if (item->getAttributeString("name", global_name))
			{
				mGlobalStrings[global_name] = item->getTextContents();
			}
			continue;
		}
		
		if (item->hasName("template"))
		{
			// store an xml template; templates must have a single node (can contain
			// other nodes)
			std::string name;
			item->getAttributeString("name", name);
			LLXMLNodePtr ptr = item->getFirstChild();
			mXmlTemplates[name] = ptr;
			continue;
		}
		
		if (!item->hasName("notification"))
		{
            llwarns << "Unexpected entity " << item->getName()->mString << 
                       " found in " << xml_filename << llendl;
			continue;
		}
		
		// now we know we have a notification entry, so let's build it
		LLNotificationTemplatePtr pTemplate(new LLNotificationTemplate());

		if (!item->getAttributeString("name", pTemplate->mName))
		{
			llwarns << "Unable to parse notification with no name" << llendl;
			continue;
		}
		
		//llinfos << "Parsing " << pTemplate->mName << llendl;
		
		pTemplate->mMessage = item->getTextContents();
		pTemplate->mDefaultFunctor = pTemplate->mName;
		item->getAttributeString("type", pTemplate->mType);
		item->getAttributeString("icon", pTemplate->mIcon);
		item->getAttributeString("label", pTemplate->mLabel);
		item->getAttributeU32("duration", pTemplate->mExpireSeconds);
		item->getAttributeU32("expireOption", pTemplate->mExpireOption);

		std::string priority;
		item->getAttributeString("priority", priority);
		pTemplate->mPriority = NOTIFICATION_PRIORITY_NORMAL;
		if (!priority.empty())
		{
			if (priority == "low")      pTemplate->mPriority = NOTIFICATION_PRIORITY_LOW;
			if (priority == "normal")   pTemplate->mPriority = NOTIFICATION_PRIORITY_NORMAL;
			if (priority == "high")     pTemplate->mPriority = NOTIFICATION_PRIORITY_HIGH;
			if (priority == "critical") pTemplate->mPriority = NOTIFICATION_PRIORITY_CRITICAL;
		}
		
		item->getAttributeString("functor", pTemplate->mDefaultFunctor);

		BOOL persist = false;
		item->getAttributeBOOL("persist", persist);
		pTemplate->mPersist = persist;
		
		std::string sound;
		item->getAttributeString("sound", sound);
		if (!sound.empty())
		{
			// TODO: test for bad sound effect name / missing effect
			pTemplate->mSoundEffect = LLUUID(LLUI::sConfigGroup->getString(sound.c_str()));
		}

		for (LLXMLNodePtr child = item->getFirstChild();
			 !child.isNull(); child = child->getNextSibling())
		{
			child = checkForXMLTemplate(child);
			
			// <url>
			if (child->hasName("url"))
			{
				pTemplate->mURL = child->getTextContents();
				child->getAttributeU32("option", pTemplate->mURLOption);
			}
			
            if (child->hasName("unique"))
            {
                pTemplate->mUnique = true;
                for (LLXMLNodePtr formitem = child->getFirstChild();
                     !formitem.isNull(); formitem = formitem->getNextSibling())
                {
                    if (formitem->hasName("context"))
                    {
                        std::string key;
                        formitem->getAttributeString("key", key);
                        pTemplate->mUniqueContext.push_back(key);
                        //llwarns << "adding " << key << " to unique context" << llendl;
                    }
                    else
                    {
                        llwarns << "'unique' has unrecognized subelement " 
                        << formitem->getName()->mString << llendl;
                    }
                }
            }
            
			// <form>
			if (child->hasName("form"))
			{
                pTemplate->mForm = LLNotificationFormPtr(new LLNotificationForm(pTemplate->mName, child));
			}
		}
		addTemplate(pTemplate->mName, pTemplate);
	}
	
	//std::ostringstream ostream;
	//root->writeToOstream(ostream, "\n  ");
	//llwarns << ostream.str() << llendl;
	
	return true;
}
#include "llvieweraudio.h"
#include "lluictrlfactory.h"

#include "llfloaterpreference.h" // for the gear icon
#include "lltabcontainer.h"

#include <stringize.h>

#include "lloverlaybar.h"
#include "llmediaremotectrl.h"
#include "llchatbar.h"
#include "lltoolbar.h"

extern LLControlGroup gSavedSettings;

static const LLUUID PARCEL_MEDIA_LIST_ITEM_UUID = LLUUID("CAB5920F-E484-4233-8621-384CF373A321");
static const LLUUID PARCEL_AUDIO_LIST_ITEM_UUID = LLUUID("DF4B020D-8A24-4B95-AB5D-CA970D694822");

//
// LLPanelNearByMedia
//


LLPanelNearByMedia::LLPanelNearByMedia(bool standalone_panel)
:	mMediaList(NULL),
	  mEnableAllCtrl(NULL),
	  mAllMediaDisabled(false),
	  mDebugInfoVisible(false),
	  mParcelMediaItem(NULL),
	  mParcelAudioItem(NULL),
	  mStandalonePanel(standalone_panel)
void init_audio() 
{
	if (!gAudiop) 
	{
		llwarns << "Failed to create an appropriate Audio Engine" << llendl;
		return;
	}
	LLVector3d lpos_global = gAgentCamera.getCameraPositionGlobal();
	LLVector3 lpos_global_f;

	lpos_global_f.setVec(lpos_global);
					
	gAudiop->setListener(lpos_global_f,
						  LLVector3::zero,	// LLViewerCamera::getInstance()->getVelocity(),    // !!! BUG need to replace this with smoothed velocity!
						  LLViewerCamera::getInstance()->getUpAxis(),
						  LLViewerCamera::getInstance()->getAtAxis());

// load up our initial set of sounds we'll want so they're in memory and ready to be played

	BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");

	if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload"))
	{
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndAlert")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndBadKeystroke")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndChatFromObject")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClick")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClickRelease")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionF")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionM")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingChat")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingIM")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvApplyToObject")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvalidOp")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInventoryCopyToInv")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeDown")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeUp")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCopyToInv")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCreate")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectDelete")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezIn")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezOut")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndRegionRestart")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndSnapshot")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartAutopilot")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartFollowpilot")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartIM")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStopAutopilot")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTeleportOut")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureApplyToObject")));
		//gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureCopyToInv")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTyping")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowClose")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowOpen")));
		// ## Zi: Pie menu
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuAppear")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuHide")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight0")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight1")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight2")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight3")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight4")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight5")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight6")));
		gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight7")));
		// ## Zi: Pie menu
	}

	audio_update_volume(true);
}
void FSFloaterNearbyChat::removeScreenChat()
{
	LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID")));
	if (chat_channel)
	{
		chat_channel->removeToastsFromChannel();
	}
}
void LLMaterialTable::initBasicTable()
{
	// *TODO: Translate
	add(LL_MCODE_STONE,std::string("Stone"), LL_DEFAULT_STONE_UUID);	
	add(LL_MCODE_METAL,std::string("Metal"), LL_DEFAULT_METAL_UUID);
	add(LL_MCODE_GLASS,std::string("Glass"), LL_DEFAULT_GLASS_UUID);
	add(LL_MCODE_WOOD,std::string("Wood"), LL_DEFAULT_WOOD_UUID);
	add(LL_MCODE_FLESH,std::string("Flesh"), LL_DEFAULT_FLESH_UUID);
	add(LL_MCODE_PLASTIC,std::string("Plastic"), LL_DEFAULT_PLASTIC_UUID);
	add(LL_MCODE_RUBBER,std::string("Rubber"), LL_DEFAULT_RUBBER_UUID);
	add(LL_MCODE_LIGHT,std::string("Light"), LL_DEFAULT_LIGHT_UUID);

	// specify densities for these materials. . . 
    // these were taken from http://www.mcelwee.net/html/densities_of_various_materials.html

	addDensity(LL_MCODE_STONE,30.f);
	addDensity(LL_MCODE_METAL,50.f);
	addDensity(LL_MCODE_GLASS,20.f);
	addDensity(LL_MCODE_WOOD,10.f); 
	addDensity(LL_MCODE_FLESH,10.f);
	addDensity(LL_MCODE_PLASTIC,5.f);
	addDensity(LL_MCODE_RUBBER,0.5f); //
	addDensity(LL_MCODE_LIGHT,20.f); //

	// add damage and energy values
	addDamageAndEnergy(LL_MCODE_STONE, 1.f, 1.f, 1.f);	// concrete
	addDamageAndEnergy(LL_MCODE_METAL, 1.f, 1.f, 1.f);  // steel
	addDamageAndEnergy(LL_MCODE_GLASS, 1.f, 1.f, 1.f);  // borosilicate glass
	addDamageAndEnergy(LL_MCODE_WOOD, 1.f, 1.f, 1.f);    // southern pine
	addDamageAndEnergy(LL_MCODE_FLESH, 1.f, 1.f, 1.f);  // saltwater
	addDamageAndEnergy(LL_MCODE_PLASTIC, 1.f, 1.f, 1.f); // HDPE
	addDamageAndEnergy(LL_MCODE_RUBBER, 1.f, 1.f, 1.f); //
	addDamageAndEnergy(LL_MCODE_LIGHT, 1.f, 1.f, 1.f); //

	addFriction(LL_MCODE_STONE,0.8f);	// concrete
	addFriction(LL_MCODE_METAL,0.3f);  // steel
	addFriction(LL_MCODE_GLASS,0.2f);  // borosilicate glass
	addFriction(LL_MCODE_WOOD,0.6f);    // southern pine
	addFriction(LL_MCODE_FLESH,0.9f);  // saltwater
	addFriction(LL_MCODE_PLASTIC,0.4f); // HDPE
	addFriction(LL_MCODE_RUBBER,0.9f); //
	addFriction(LL_MCODE_LIGHT,0.2f); //

	addRestitution(LL_MCODE_STONE,0.4f);	// concrete
	addRestitution(LL_MCODE_METAL,0.4f);  // steel
	addRestitution(LL_MCODE_GLASS,0.7f);  // borosilicate glass
	addRestitution(LL_MCODE_WOOD,0.5f);    // southern pine
	addRestitution(LL_MCODE_FLESH,0.3f);  // saltwater
	addRestitution(LL_MCODE_PLASTIC,0.7f); // HDPE
	addRestitution(LL_MCODE_RUBBER,0.9f); //
	addRestitution(LL_MCODE_LIGHT,0.7f); //

	addShatterSound(LL_MCODE_STONE,LLUUID("ea296329-0f09-4993-af1b-e6784bab1dc9"));
	addShatterSound(LL_MCODE_METAL,LLUUID("d1375446-1c4d-470b-9135-30132433b678"));
	addShatterSound(LL_MCODE_GLASS,LLUUID("85cda060-b393-48e6-81c8-2cfdfb275351"));
	addShatterSound(LL_MCODE_WOOD,LLUUID("6f00669f-15e0-4793-a63e-c03f62fee43a"));
	addShatterSound(LL_MCODE_FLESH,LLUUID("2d8c6f51-149e-4e23-8413-93a379b42b67"));
	addShatterSound(LL_MCODE_PLASTIC,LLUUID("d55c7f3c-e1c3-4ddc-9eff-9ef805d9190e"));
	addShatterSound(LL_MCODE_RUBBER,LLUUID("212b6d1e-8d9c-4986-b3aa-f3c6df8d987d"));
	addShatterSound(LL_MCODE_LIGHT,LLUUID("d55c7f3c-e1c3-4ddc-9eff-9ef805d9190e"));

	//  CollisionSounds
	mCollisionSoundMatrix = new LLUUID[LL_MCODE_END*LL_MCODE_END];
	if (mCollisionSoundMatrix)
	{
		addCollisionSound(LL_MCODE_STONE, LL_MCODE_STONE, SND_STONE_STONE);
		addCollisionSound(LL_MCODE_STONE, LL_MCODE_METAL, SND_STONE_METAL);
		addCollisionSound(LL_MCODE_STONE, LL_MCODE_GLASS, SND_STONE_GLASS);
		addCollisionSound(LL_MCODE_STONE, LL_MCODE_WOOD, SND_STONE_WOOD);
		addCollisionSound(LL_MCODE_STONE, LL_MCODE_FLESH, SND_STONE_FLESH);
		addCollisionSound(LL_MCODE_STONE, LL_MCODE_PLASTIC, SND_STONE_PLASTIC);
		addCollisionSound(LL_MCODE_STONE, LL_MCODE_RUBBER, SND_STONE_RUBBER);
		addCollisionSound(LL_MCODE_STONE, LL_MCODE_LIGHT, SND_STONE_PLASTIC);

		addCollisionSound(LL_MCODE_METAL, LL_MCODE_METAL, SND_METAL_METAL);
		addCollisionSound(LL_MCODE_METAL, LL_MCODE_GLASS, SND_METAL_GLASS);
		addCollisionSound(LL_MCODE_METAL, LL_MCODE_WOOD, SND_METAL_WOOD);
		addCollisionSound(LL_MCODE_METAL, LL_MCODE_FLESH, SND_METAL_FLESH);
		addCollisionSound(LL_MCODE_METAL, LL_MCODE_PLASTIC, SND_METAL_PLASTIC);
		addCollisionSound(LL_MCODE_METAL, LL_MCODE_LIGHT, SND_METAL_PLASTIC);
		addCollisionSound(LL_MCODE_METAL, LL_MCODE_RUBBER, SND_METAL_RUBBER);

		addCollisionSound(LL_MCODE_GLASS, LL_MCODE_GLASS, SND_GLASS_GLASS);
		addCollisionSound(LL_MCODE_GLASS, LL_MCODE_WOOD, SND_GLASS_WOOD);
		addCollisionSound(LL_MCODE_GLASS, LL_MCODE_FLESH, SND_GLASS_FLESH);
		addCollisionSound(LL_MCODE_GLASS, LL_MCODE_PLASTIC, SND_GLASS_PLASTIC);
		addCollisionSound(LL_MCODE_GLASS, LL_MCODE_RUBBER, SND_GLASS_RUBBER);
		addCollisionSound(LL_MCODE_GLASS, LL_MCODE_LIGHT, SND_GLASS_PLASTIC);

		addCollisionSound(LL_MCODE_WOOD, LL_MCODE_WOOD, SND_WOOD_WOOD);
		addCollisionSound(LL_MCODE_WOOD, LL_MCODE_FLESH, SND_WOOD_FLESH);
		addCollisionSound(LL_MCODE_WOOD, LL_MCODE_PLASTIC, SND_WOOD_PLASTIC);
		addCollisionSound(LL_MCODE_WOOD, LL_MCODE_RUBBER, SND_WOOD_RUBBER);
		addCollisionSound(LL_MCODE_WOOD, LL_MCODE_LIGHT, SND_WOOD_PLASTIC);

		addCollisionSound(LL_MCODE_FLESH, LL_MCODE_FLESH, SND_FLESH_FLESH);
		addCollisionSound(LL_MCODE_FLESH, LL_MCODE_PLASTIC, SND_FLESH_PLASTIC);
		addCollisionSound(LL_MCODE_FLESH, LL_MCODE_RUBBER, SND_FLESH_RUBBER);
		addCollisionSound(LL_MCODE_FLESH, LL_MCODE_LIGHT, SND_FLESH_PLASTIC);

		addCollisionSound(LL_MCODE_RUBBER, LL_MCODE_RUBBER, SND_RUBBER_RUBBER);
		addCollisionSound(LL_MCODE_RUBBER, LL_MCODE_PLASTIC, SND_RUBBER_PLASTIC);
		addCollisionSound(LL_MCODE_RUBBER, LL_MCODE_LIGHT, SND_RUBBER_PLASTIC);

		addCollisionSound(LL_MCODE_PLASTIC, LL_MCODE_PLASTIC, SND_PLASTIC_PLASTIC);
		addCollisionSound(LL_MCODE_PLASTIC, LL_MCODE_LIGHT, SND_PLASTIC_PLASTIC);

		addCollisionSound(LL_MCODE_LIGHT, LL_MCODE_LIGHT, SND_PLASTIC_PLASTIC);
	}
	
	//  Sliding Sounds
	mSlidingSoundMatrix = new LLUUID[LL_MCODE_END*LL_MCODE_END];
	if (mSlidingSoundMatrix)
	{
		addSlidingSound(LL_MCODE_STONE, LL_MCODE_STONE, SND_SLIDE_STONE_STONE);
		addSlidingSound(LL_MCODE_STONE, LL_MCODE_METAL, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_STONE, LL_MCODE_GLASS, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_STONE, LL_MCODE_WOOD, SND_SLIDE_STONE_WOOD);
		addSlidingSound(LL_MCODE_STONE, LL_MCODE_FLESH, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_STONE, LL_MCODE_PLASTIC, SND_SLIDE_STONE_PLASTIC);
		addSlidingSound(LL_MCODE_STONE, LL_MCODE_RUBBER, SND_SLIDE_STONE_RUBBER);
		addSlidingSound(LL_MCODE_STONE, LL_MCODE_LIGHT, SND_SLIDE_STONE_PLASTIC);

		addSlidingSound(LL_MCODE_METAL, LL_MCODE_METAL, SND_SLIDE_METAL_METAL);
		addSlidingSound(LL_MCODE_METAL, LL_MCODE_GLASS, SND_SLIDE_METAL_GLASS);
		addSlidingSound(LL_MCODE_METAL, LL_MCODE_WOOD, SND_SLIDE_METAL_WOOD);
		addSlidingSound(LL_MCODE_METAL, LL_MCODE_FLESH, SND_SLIDE_METAL_FLESH);
		addSlidingSound(LL_MCODE_METAL, LL_MCODE_PLASTIC, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_METAL, LL_MCODE_RUBBER, SND_SLIDE_METAL_RUBBER);
		addSlidingSound(LL_MCODE_METAL, LL_MCODE_LIGHT, SND_SLIDE_STONE_STONE_01);

		addSlidingSound(LL_MCODE_GLASS, LL_MCODE_GLASS, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_GLASS, LL_MCODE_WOOD, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_GLASS, LL_MCODE_FLESH, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_GLASS, LL_MCODE_PLASTIC, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_GLASS, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_GLASS, LL_MCODE_LIGHT, SND_SLIDE_STONE_STONE_01);

		addSlidingSound(LL_MCODE_WOOD, LL_MCODE_WOOD, SND_SLIDE_WOOD_WOOD);
		addSlidingSound(LL_MCODE_WOOD, LL_MCODE_FLESH, SND_SLIDE_WOOD_FLESH);
		addSlidingSound(LL_MCODE_WOOD, LL_MCODE_PLASTIC, SND_SLIDE_WOOD_PLASTIC);
		addSlidingSound(LL_MCODE_WOOD, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_WOOD, LL_MCODE_LIGHT, SND_SLIDE_WOOD_PLASTIC);

		addSlidingSound(LL_MCODE_FLESH, LL_MCODE_FLESH, SND_SLIDE_FLESH_FLESH);
		addSlidingSound(LL_MCODE_FLESH, LL_MCODE_PLASTIC, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_FLESH, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_FLESH, LL_MCODE_LIGHT, SND_SLIDE_STONE_STONE_01);

		addSlidingSound(LL_MCODE_RUBBER, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_RUBBER, LL_MCODE_PLASTIC, SND_SLIDE_RUBBER_PLASTIC);
		addSlidingSound(LL_MCODE_RUBBER, LL_MCODE_LIGHT, SND_SLIDE_RUBBER_PLASTIC);

		addSlidingSound(LL_MCODE_PLASTIC, LL_MCODE_PLASTIC, SND_SLIDE_STONE_STONE_01);
		addSlidingSound(LL_MCODE_PLASTIC, LL_MCODE_LIGHT, SND_SLIDE_STONE_STONE_01);

		addSlidingSound(LL_MCODE_LIGHT, LL_MCODE_LIGHT, SND_SLIDE_STONE_STONE_01);
	}

	//  Rolling Sounds
	mRollingSoundMatrix = new LLUUID[LL_MCODE_END*LL_MCODE_END];
	if (mRollingSoundMatrix)
	{
		addRollingSound(LL_MCODE_STONE, LL_MCODE_STONE, SND_ROLL_STONE_STONE);
		addRollingSound(LL_MCODE_STONE, LL_MCODE_METAL, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_STONE, LL_MCODE_GLASS, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_STONE, LL_MCODE_WOOD, SND_ROLL_STONE_WOOD);
		addRollingSound(LL_MCODE_STONE, LL_MCODE_FLESH, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_STONE, LL_MCODE_PLASTIC, SND_ROLL_STONE_PLASTIC);
		addRollingSound(LL_MCODE_STONE, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_STONE, LL_MCODE_LIGHT, SND_ROLL_STONE_PLASTIC);

		addRollingSound(LL_MCODE_METAL, LL_MCODE_METAL, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_METAL, LL_MCODE_GLASS, SND_ROLL_METAL_GLASS);
		addRollingSound(LL_MCODE_METAL, LL_MCODE_WOOD, SND_ROLL_METAL_WOOD);
		addRollingSound(LL_MCODE_METAL, LL_MCODE_FLESH, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_METAL, LL_MCODE_PLASTIC, SND_ROLL_METAL_WOOD);
		addRollingSound(LL_MCODE_METAL, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_METAL, LL_MCODE_LIGHT, SND_ROLL_METAL_WOOD);

		addRollingSound(LL_MCODE_GLASS, LL_MCODE_GLASS, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_GLASS, LL_MCODE_WOOD, SND_ROLL_GLASS_WOOD);
		addRollingSound(LL_MCODE_GLASS, LL_MCODE_FLESH, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_GLASS, LL_MCODE_PLASTIC, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_GLASS, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_GLASS, LL_MCODE_LIGHT, SND_SLIDE_STONE_STONE_01);

		addRollingSound(LL_MCODE_WOOD, LL_MCODE_WOOD, SND_ROLL_WOOD_WOOD);
		addRollingSound(LL_MCODE_WOOD, LL_MCODE_FLESH, SND_ROLL_WOOD_FLESH);
		addRollingSound(LL_MCODE_WOOD, LL_MCODE_PLASTIC, SND_ROLL_WOOD_PLASTIC);
		addRollingSound(LL_MCODE_WOOD, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_WOOD, LL_MCODE_LIGHT, SND_ROLL_WOOD_PLASTIC);

		addRollingSound(LL_MCODE_FLESH, LL_MCODE_FLESH, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_FLESH, LL_MCODE_PLASTIC, SND_ROLL_FLESH_PLASTIC);
		addRollingSound(LL_MCODE_FLESH, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_FLESH, LL_MCODE_LIGHT, SND_ROLL_FLESH_PLASTIC);

		addRollingSound(LL_MCODE_RUBBER, LL_MCODE_RUBBER, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_RUBBER, LL_MCODE_PLASTIC, SND_SLIDE_STONE_STONE_01);
		addRollingSound(LL_MCODE_RUBBER, LL_MCODE_LIGHT, SND_SLIDE_STONE_STONE_01);

		addRollingSound(LL_MCODE_PLASTIC, LL_MCODE_PLASTIC, SND_ROLL_PLASTIC_PLASTIC);
		addRollingSound(LL_MCODE_PLASTIC, LL_MCODE_LIGHT, SND_ROLL_PLASTIC_PLASTIC);

		addRollingSound(LL_MCODE_LIGHT, LL_MCODE_LIGHT, SND_ROLL_PLASTIC_PLASTIC);
	}
}
void LLPreviewTexture::draw()
{
	updateDimensions();

	LLPreview::draw();

	if (!isMinimized())
	{
		LLGLSUIDefault gls_ui;
		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
		
		const LLRect& border = mClientRect;
		LLRect interior = mClientRect;
		interior.stretch(-PREVIEW_BORDER_WIDTH );

		// ...border
		gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f));
		gl_rect_2d_checkerboard(interior);

		if (mImage.notNull())
		{
			// Draw the texture
			glColor3f( 1.f, 1.f, 1.f );
			gl_draw_scaled_image(interior.mLeft,
								interior.mBottom,
								interior.getWidth(),
								interior.getHeight(),
								mImage);

			// Pump the texture priority
			F32 pixel_area = mLoadingFullImage ? (F32)MAX_IMAGE_AREA  : (F32)(interior.getWidth() * interior.getHeight());
			mImage->addTextureStats(pixel_area);
			if (pixel_area > 0.f)
			{
				//boost the previewed image priority to the highest to make it to get loaded first.
				mImage->setAdditionalDecodePriority(1.0f);
			}


			std::string assetid(mImageID.asString());
			if (mIsCopyable) childSetText("uuid", assetid);

			if (uploaderkey.isNull()&&(mImage->mDecodedComment.find("a")!=mImage->mDecodedComment.end()))
			{
				uploaderkey = LLUUID(mImage->mDecodedComment["a"]);
				childSetText("uploader", mImage->mDecodedComment["a"]);

				// Ansariel: Changed to boost::bind callback
				//gCacheName->get(uploaderkey, FALSE, callbackLoadAvatarName);
				gCacheName->get(uploaderkey, false, boost::bind(&callbackLoadAvatarName, _1, _2, _3, this));
			}
			if (color.empty()&&(mImage->mDecodedComment.find("c")!=mImage->mDecodedComment.end()))
			{
				color = mImage->mDecodedComment["c"];
			}
			if (time.empty()&&(mImage->mDecodedComment.find("z")!=mImage->mDecodedComment.end()))
			{
				time=mImage->mDecodedComment["z"];
				std::string year = time.substr(0,4);
				std::string month = time.substr(4,2);
				std::string day = time.substr(6,2);
				std::string hour = time.substr(8,2);
				std::string minute = time.substr(10,2);
				std::string second = time.substr(12,2);

				time = llformat("%s/%s/%s - %s:%s:%s",year.c_str(),month.c_str(),day.c_str(),hour.c_str(),minute.c_str(),second.c_str());

				childSetText("uploadtime", time);
			}

			// Don't bother decoding more than we can display, unless
			// we're loading the full image.
			if (!mLoadingFullImage)
			{
				S32 int_width = interior.getWidth();
				S32 int_height = interior.getHeight();
				mImage->setKnownDrawSize(int_width, int_height);
			}
			else
			{
				// Don't use this feature
				mImage->setKnownDrawSize(0, 0);
			}

			if (mLoadingFullImage)
			{
				// *TODO: Translate
				LLFontGL::getFontSansSerif()->renderUTF8(std::string("Receiving:"), 0,
					interior.mLeft + 4, 
					interior.mBottom + 4,
					LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
					LLFontGL::DROP_SHADOW);

				F32 data_progress = mImage->getDownloadProgress();

				// Draw the progress bar.
				const S32 BAR_HEIGHT = 12;
				const S32 BAR_LEFT_PAD = 80;
				S32 left = interior.mLeft + 4 + BAR_LEFT_PAD;
				S32 bar_width = getRect().getWidth() - left - RESIZE_HANDLE_WIDTH - 2;
				S32 top = interior.mBottom + 4 + BAR_HEIGHT;
				S32 right = left + bar_width;
				S32 bottom = top - BAR_HEIGHT;

				LLColor4 background_color(0.f, 0.f, 0.f, 0.75f);
				LLColor4 decoded_color(0.f, 1.f, 0.f, 1.0f);
				LLColor4 downloaded_color(0.f, 0.5f, 0.f, 1.0f);

				gl_rect_2d(left, top, right, bottom, background_color);

				if (data_progress > 0.0f)
				{
					// Downloaded bytes
					right = left + llfloor(data_progress * (F32)bar_width);
					if (right > left)
					{
						gl_rect_2d(left, top, right, bottom, downloaded_color);
					}
				}
			}
			else
			if (!mSavedFileTimer.hasExpired())
			{
				// *TODO: Translate
				LLFontGL::getFontSansSerif()->renderUTF8(std::string("File Saved"), 0,
					interior.mLeft + 4,
					interior.mBottom + 4,
					LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
					LLFontGL::DROP_SHADOW);
			}
		}
	} 
}
Example #9
0
void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incolor, bool log_to_file, const LLUUID& source, const std::string& name)
{
	static const LLCachedControl<bool> mKeywordsChangeColor(gSavedPerAccountSettings, "KeywordsChangeColor", false);
	static const LLCachedControl<LLColor4> mKeywordsColor(gSavedPerAccountSettings, "KeywordsColor", LLColor4(1.f, 1.f, 1.f, 1.f));

	if (gAgentID != source)
	{
		if (mKeywordsChangeColor)
		{
			if (AscentKeyword::hasKeyword(utf8msg, 2))
			{
				incolor = mKeywordsColor;
			}
		}

		if (mDing && (!hasFocus() || !gFocusMgr.getAppHasFocus()))
		{
			static const LLCachedControl<std::string> ding("LiruNewMessageSound");
			static const LLCachedControl<std::string> dong("LiruNewMessageSoundForSystemMessages");
			LLUI::sAudioCallback(LLUUID(source.notNull() ? ding : dong));
		}
	}

	const LLColor4& color = incolor;
	// start tab flashing when receiving im for background session from user
	if (source.notNull())
	{
		LLMultiFloater* hostp = getHost();
		if( !isInVisibleChain() 
			&& hostp 
			&& source != gAgentID)
		{
			hostp->setFloaterFlashing(this, TRUE);
		}
	}

	// Now we're adding the actual line of text, so erase the 
	// "Foo is typing..." text segment, and the optional timestamp
	// if it was present. JC
	removeTypingIndicator(NULL);

	// Actually add the line
	bool prepend_newline = true;
	if (gSavedSettings.getBOOL("IMShowTimestamps"))
	{
		mHistoryEditor->appendTime(prepend_newline);
		prepend_newline = false;
	}

	std::string show_name = name;
	bool is_irc = false;
	// 'name' is a sender name that we want to hotlink so that clicking on it opens a profile.
	if (!name.empty()) // If name exists, then add it to the front of the message.
	{
		// Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
		if (name == SYSTEM_FROM)
		{
			mHistoryEditor->appendColoredText(name,false,prepend_newline,color);
		}
		else
		{
			// IRC style text starts with a colon here; empty names and system messages aren't irc style.
			static const LLCachedControl<bool> italicize("LiruItalicizeActions");
			is_irc = italicize && utf8msg[0] != ':';
			if (source.notNull())
				LLAvatarNameCache::getPNSName(source, show_name);
			// Convert the name to a hotlink and add to message.
			LLStyleSP source_style = LLStyleMap::instance().lookupAgent(source);
			source_style->mItalic = is_irc;
			mHistoryEditor->appendStyledText(show_name,false,prepend_newline,source_style);
		}
		prepend_newline = false;
	}

	// Append the chat message in style
	{
		LLStyleSP style(new LLStyle);
		style->setColor(color);
		style->mItalic = is_irc;
		style->mBold = gSavedSettings.getBOOL("SingularityBoldGroupModerator") && isModerator(source);
		mHistoryEditor->appendStyledText(utf8msg, false, prepend_newline, style);
	}

	if (log_to_file
		&& gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) 
	{
		std::string histstr;
		if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp"))
			histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + show_name + utf8msg;
		else
			histstr = show_name + utf8msg;

		// [Ansariel: Display name support]
		// Floater title contains display name -> bad idea to use that as filename
		// mLogLabel, however, is the old legacy name
		//LLLogChat::saveHistory(getTitle(),histstr);
		LLLogChat::saveHistory(mLogLabel, histstr);
		// [/Ansariel: Display name support]
	}

	if (source.notNull())
	{
		if (!isInVisibleChain() || (!hasFocus() && getParent() == gFloaterView))
		{
			mNumUnreadMessages++;
		}

		mSpeakers->speakerChatted(source);
		mSpeakers->setSpeakerTyping(source, FALSE);
	}
}
Example #10
0
void LLFloaterAO::refresh()
{
	childSetText("line_walking", idstr(LLAO::mOverrides[LLUUID("6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0")]));
	childSetText("line_running", idstr(LLAO::mOverrides[LLUUID("05ddbff8-aaa9-92a1-2b74-8fe77a29b445")]));
	childSetText("line_crouchwalk", idstr(LLAO::mOverrides[LLUUID("47f5f6fb-22e5-ae44-f871-73aaaf4a6022")]));
	childSetText("line_flying", idstr(LLAO::mOverrides[LLUUID("aec4610c-757f-bc4e-c092-c6e9caf18daf")]));
	childSetText("line_turn_left", idstr(LLAO::mOverrides[LLUUID("56e0ba0d-4a9f-7f27-6117-32f2ebbf6135")]));
	childSetText("line_turn_right", idstr(LLAO::mOverrides[LLUUID("2d6daa51-3192-6794-8e2e-a15f8338ec30")]));
	childSetText("line_jumping", idstr(LLAO::mOverrides[LLUUID("2305bd75-1ca9-b03b-1faa-b176b8a8c49e")]));
	childSetText("line_fly_up", idstr(LLAO::mOverrides[LLUUID("62c5de58-cb33-5743-3d07-9e4cd4352864")]));
	childSetText("line_crouching", idstr(LLAO::mOverrides[LLUUID("201f3fdf-cb1f-dbec-201f-7333e328ae7c")]));
	childSetText("line_fly_down", idstr(LLAO::mOverrides[LLUUID("20f063ea-8306-2562-0b07-5c853b37b31e")]));
	mStandsCombo->clearRows();
	for(std::list<LLUUID>::iterator itr = LLAO::mStandOverrides.begin();itr != LLAO::mStandOverrides.end();
		itr++)
	{
		mStandsCombo->add((*itr).asString());
	}
	mStandsCombo->setSimple(LLStringExplicit(LLAO::mStandOverrides.back().asString()));
	childSetText("line_hover", idstr(LLAO::mOverrides[LLUUID("4ae8016b-31b9-03bb-c401-b1ea941db41d")]));
	childSetText("line_sitting", idstr(LLAO::mOverrides[LLUUID("1a5fe8ac-a804-8a5d-7cbd-56bd83184568")]));
	childSetText("line_prejump", idstr(LLAO::mOverrides[LLUUID("7a4e87fe-de39-6fcb-6223-024b00893244")]));
	childSetText("line_falling", idstr(LLAO::mOverrides[LLUUID("666307d9-a860-572d-6fd4-c3ab8865c094")]));
	childSetText("line_stride", idstr(LLAO::mOverrides[LLUUID("1cb562b0-ba21-2202-efb3-30f82cdf9595")]));
	childSetText("line_soft_landing", idstr(LLAO::mOverrides[LLUUID("7a17b059-12b2-41b1-570a-186368b6aa6f")]));
	childSetText("line_medium_landing", idstr(LLAO::mOverrides[LLUUID("f4f00d6e-b9fe-9292-f4cb-0ae06ea58d57")]));
	childSetText("line_hard_landing", idstr(LLAO::mOverrides[LLUUID("3da1d753-028a-5446-24f3-9c9b856d9422")]));
	childSetText("line_flying_slow", idstr(LLAO::mOverrides[LLUUID("2b5a38b2-5e00-3a97-a495-4c826bc443e6")]));
	childSetText("line_sitting_on_ground", idstr(LLAO::mOverrides[LLUUID("1a2bd58e-87ff-0df8-0b4c-53e047b0bb6e")]));
}
Example #11
0
// static
void LLFloaterAO::onCommitAnim(LLUICtrl* ctrl, void* user_data)
{
	LLFloaterAO* floater = (LLFloaterAO*)user_data;

	LLSD overrides;
	LLUUID id;
	id = LLUUID(floater->childGetValue("line_walking").asString());
	if(id.notNull()) overrides["6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0"] = id;
	id = LLUUID(floater->childGetValue("line_running").asString());
	if(id.notNull()) overrides["05ddbff8-aaa9-92a1-2b74-8fe77a29b445"] = id;
	id = LLUUID(floater->childGetValue("line_crouchwalk").asString());
	if(id.notNull()) overrides["47f5f6fb-22e5-ae44-f871-73aaaf4a6022"] = id;
	id = LLUUID(floater->childGetValue("line_flying").asString());
	if(id.notNull()) overrides["aec4610c-757f-bc4e-c092-c6e9caf18daf"] = id;
	id = LLUUID(floater->childGetValue("line_turn_left").asString());
	if(id.notNull()) overrides["56e0ba0d-4a9f-7f27-6117-32f2ebbf6135"] = id;
	id = LLUUID(floater->childGetValue("line_turn_right").asString());
	if(id.notNull()) overrides["2d6daa51-3192-6794-8e2e-a15f8338ec30"] = id;
	id = LLUUID(floater->childGetValue("line_jumping").asString());
	if(id.notNull()) overrides["2305bd75-1ca9-b03b-1faa-b176b8a8c49e"] = id;
	id = LLUUID(floater->childGetValue("line_fly_up").asString());
	if(id.notNull()) overrides["62c5de58-cb33-5743-3d07-9e4cd4352864"] = id;
	id = LLUUID(floater->childGetValue("line_crouching").asString());
	if(id.notNull()) overrides["201f3fdf-cb1f-dbec-201f-7333e328ae7c"] = id;
	id = LLUUID(floater->childGetValue("line_fly_down").asString());
	if(id.notNull()) overrides["20f063ea-8306-2562-0b07-5c853b37b31e"] = id;
	id = LLUUID(floater->childGetValue("line_hover").asString());
	if(id.notNull()) overrides["4ae8016b-31b9-03bb-c401-b1ea941db41d"] = id;
	id = LLUUID(floater->childGetValue("line_sitting").asString());
	if(id.notNull()) overrides["1a5fe8ac-a804-8a5d-7cbd-56bd83184568"] = id;
	id = LLUUID(floater->childGetValue("line_prejump").asString());
	if(id.notNull()) overrides["7a4e87fe-de39-6fcb-6223-024b00893244"] = id;
	id = LLUUID(floater->childGetValue("line_falling").asString());
	if(id.notNull()) overrides["666307d9-a860-572d-6fd4-c3ab8865c094"] = id;
	id = LLUUID(floater->childGetValue("line_stride").asString());
	if(id.notNull()) overrides["1cb562b0-ba21-2202-efb3-30f82cdf9595"] = id;
	id = LLUUID(floater->childGetValue("line_soft_landing").asString());
	if(id.notNull()) overrides["7a17b059-12b2-41b1-570a-186368b6aa6f"] = id;
	id = LLUUID(floater->childGetValue("line_medium_landing").asString());
	if(id.notNull()) overrides["f4f00d6e-b9fe-9292-f4cb-0ae06ea58d57"] = id;
	id = LLUUID(floater->childGetValue("line_hard_landing").asString());
	if(id.notNull()) overrides["3da1d753-028a-5446-24f3-9c9b856d9422"] = id;
	id = LLUUID(floater->childGetValue("line_flying_slow").asString());
	if(id.notNull()) overrides["2b5a38b2-5e00-3a97-a495-4c826bc443e6"] = id;
	id = LLUUID(floater->childGetValue("line_sitting_on_ground").asString());
	if(id.notNull()) overrides["1a2bd58e-87ff-0df8-0b4c-53e047b0bb6e"] = id;
	for(std::list<LLUUID>::iterator itr = LLAO::mStandOverrides.begin();itr != LLAO::mStandOverrides.end();
		itr++)
	{
		overrides["stands"].append((*itr));
	}
	LLSD settings;
	settings["version"] = 2;
	settings["overrides"] = overrides;
	gSavedPerAccountSettings.setLLSD("AO.Settings", settings);
	LLAO::refresh();
	floater->refresh();
}
// static
void LLFloaterNewLocalInventory::onClickOK(void* user_data)
{
	LLFloaterNewLocalInventory* floater = (LLFloaterNewLocalInventory*)user_data;

	LLUUID item_id;
	item_id.generate();

	std::string name = floater->getChild<LLLineEditor>("name_line")->getText();
	std::string desc = floater->getChild<LLLineEditor>("desc_line")->getText();
	LLUUID asset_id = LLUUID(floater->getChild<LLLineEditor>("asset_id_line")->getText());
	LLUUID creator_id = LLUUID(floater->getChild<LLLineEditor>("creator_id_line")->getText());
	LLUUID owner_id = LLUUID(floater->getChild<LLLineEditor>("owner_id_line")->getText());

	LLAssetType::EType type = LLAssetType::lookup(floater->getChild<LLComboBox>("type_combo")->getValue().asString());
	LLInventoryType::EType inv_type = LLInventoryType::IT_CALLINGCARD;
	switch(type)
	{
	case LLAssetType::AT_TEXTURE:
	case LLAssetType::AT_TEXTURE_TGA:
	case LLAssetType::AT_IMAGE_TGA:
	case LLAssetType::AT_IMAGE_JPEG:
		inv_type = LLInventoryType::IT_TEXTURE;
		break;
	case LLAssetType::AT_SOUND:
	case LLAssetType::AT_SOUND_WAV:
		inv_type = LLInventoryType::IT_SOUND;
		break;
	case LLAssetType::AT_CALLINGCARD:
		inv_type = LLInventoryType::IT_CALLINGCARD;
		break;
	case LLAssetType::AT_LANDMARK:
		inv_type = LLInventoryType::IT_LANDMARK;
		break;
	case LLAssetType::AT_SCRIPT:
		inv_type = LLInventoryType::IT_LSL;
		break;
	case LLAssetType::AT_CLOTHING:
		inv_type = LLInventoryType::IT_WEARABLE;
		break;
	case LLAssetType::AT_OBJECT:
		inv_type = LLInventoryType::IT_OBJECT;
		break;
	case LLAssetType::AT_NOTECARD:
		inv_type = LLInventoryType::IT_NOTECARD;
		break;
	case LLAssetType::AT_CATEGORY:
		inv_type = LLInventoryType::IT_CATEGORY;
		break;
	case LLAssetType::AT_ROOT_CATEGORY:
	case LLAssetType::AT_TRASH:
	case LLAssetType::AT_SNAPSHOT_CATEGORY:
	case LLAssetType::AT_LOST_AND_FOUND:
		inv_type = LLInventoryType::IT_ROOT_CATEGORY;
		break;
	case LLAssetType::AT_LSL_TEXT:
	case LLAssetType::AT_LSL_BYTECODE:
		inv_type = LLInventoryType::IT_LSL;
		break;
	case LLAssetType::AT_BODYPART:
		inv_type = LLInventoryType::IT_WEARABLE;
		break;
	case LLAssetType::AT_ANIMATION:
		inv_type = LLInventoryType::IT_ANIMATION;
		break;
	case LLAssetType::AT_GESTURE:
		inv_type = LLInventoryType::IT_GESTURE;
		break;
	case LLAssetType::AT_SIMSTATE:
	default:
		inv_type = LLInventoryType::IT_CALLINGCARD;
		break;
	}


	LLPermissions* perms = new LLPermissions();
	perms->init(creator_id, owner_id, LLUUID::null, LLUUID::null);

	LLViewerInventoryItem* item = new LLViewerInventoryItem(
			item_id,
			gSystemFolderRoot,
			*perms,
			asset_id,
			type,
			inv_type,
			name,
			desc,
			LLSaleInfo::DEFAULT,
			0,
			0);

	LLLocalInventory::addItem(item);
	if(floater->childGetValue("chk_open"))
	{
		LLLocalInventory::open(item_id);
	}

	LLFloaterNewLocalInventory::sLastCreatorId = creator_id;
//	floater->close();
}
Example #13
0
//////////////////////////////////////////////////////////////////////////////////////////
// static
void LLViewerParcelMedia::update(LLParcel* parcel)
{
	if (/*LLViewerMedia::hasMedia()*/ true)
	{
		// we have a player
		if (parcel)
		{
			if(!gAgent.getRegion())
			{
				sMediaRegionID = LLUUID() ;
				stop() ;
				return ;				
			}

			// we're in a parcel
			bool new_parcel = false;
			S32 parcelid = parcel->getLocalID();						

			LLUUID regionid = gAgent.getRegion()->getRegionID();
			if (parcelid != sMediaParcelLocalID || regionid != sMediaRegionID)
			{
				sMediaParcelLocalID = parcelid;
				sMediaRegionID = regionid;
				new_parcel = true;
			}

			std::string mediaUrl = std::string ( parcel->getMediaURL () );
			LLStringUtil::trim(mediaUrl);

			// has something changed?
			if (  ( LLViewerMedia::getMediaURL() != mediaUrl )
				|| ( LLViewerMedia::getMediaTextureID() != parcel->getMediaID () ) )
			{
				bool video_was_playing = FALSE;
				bool same_media_id = LLViewerMedia::getMediaTextureID() == parcel->getMediaID ();

				if (LLViewerMedia::isMediaPlaying())
				{
					video_was_playing = TRUE;
				}

				if ( !mediaUrl.empty() && same_media_id && ! new_parcel)
				{
					// Someone has "changed the channel", changing the URL of a video
					// you were already watching.  Automatically play provided the texture ID is the same
					if (video_was_playing)
					{
						// Poke the mime type in before calling play.
						// This is necessary because in this instance we are not waiting
						// for the results of a header curl.  In order to change the channel
						// a mime type MUST be provided.
						LLViewerMedia::setMimeType(parcel->getMediaType());
						play(parcel);
					}
				}
				else
				{
					stop();
				}

				// Discover the MIME type
				// Disabled for the time being.  Get the mime type from the parcel.
				if(gSavedSettings.getBOOL("AutoMimeDiscovery"))
				{
					LLHTTPClient::getHeaderOnly( mediaUrl, new LLMimeDiscoveryResponder());
				}
				else
				{
					LLViewerMedia::setMimeType(parcel->getMediaType());
				}

				// First use warning
				if(	gSavedSettings.getWarning("FirstStreamingVideo") )
				{
					gViewerWindow->alertXml("ParcelCanPlayMedia",
						callback_play_media, (void*)parcel);

				}

			}
		}
		else
		{
			stop();
		}
	}
	/*
	else
	{
		// no audio player, do a first use dialog if their is media here
		if (parcel)
		{
			std::string mediaUrl = std::string ( parcel->getMediaURL () );
			if (!mediaUrl.empty ())
			{
				if (gSavedSettings.getWarning("QuickTimeInstalled"))
				{
					gSavedSettings.setWarning("QuickTimeInstalled", FALSE);

					LLNotifyBox::showXml("NoQuickTime" );
				};
			}
		}
	}
	*/
}
bool FSExport::exportTexture(const LLUUID& texture_id)
{
	if(texture_id.isNull())
	{
		LL_WARNS("export") << "Attempted to export NULL texture." << LL_ENDL;
		return false;
	}
	
	if (mTextureChecked.count(texture_id) != 0)
	{
		return mTextureChecked[texture_id];
	}
	
	if (gAssetStorage->mStaticVFS->getExists(texture_id, LLAssetType::AT_TEXTURE))
	{
		LL_DEBUGS("export") << "Texture " << texture_id.asString() << " is local static." << LL_ENDL;
		// no need to save the texture data as the viewer allready has it in a local file.
		mTextureChecked[texture_id] = true;
		return true;
	}
	
	//TODO: check for local file static texture. The above will only get the static texture in the static db, not indevitial texture files.

	LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(texture_id);
	bool texture_export = false;
	std::string name;
	std::string description;
	
	if (LLGridManager::getInstance()->isInSecondLife())
	{
		if (imagep->mComment.find("a") != imagep->mComment.end())
		{
			if (LLUUID(imagep->mComment["a"]) == gAgentID)
			{
				texture_export = true;
				LL_DEBUGS("export") << texture_id <<  " pass texture export comment check." << LL_ENDL;
			}
		}
	}

	if (texture_export)
	{
		assetCheck(texture_id, name, description);
	}
	else
	{
		texture_export = assetCheck(texture_id, name, description);
	}

	mTextureChecked[texture_id] = texture_export;
	
	if (!texture_export)
	{
		LL_DEBUGS("export") << "Texture " << texture_id << " failed export check." << LL_ENDL;
		return false;
	}

	LL_DEBUGS("export") << "Loading image texture " << texture_id << LL_ENDL;
	mRequestedTexture[texture_id].name = name;
	mRequestedTexture[texture_id].description = description;
	LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(texture_id, FTT_DEFAULT, MIPMAP_TRUE);
	image->setBoostLevel(LLViewerTexture::BOOST_MAX_LEVEL);
	image->forceToSaveRawImage(0);
	image->setLoadedCallback(FSExport::onImageLoaded, 0, TRUE, FALSE, this, &mCallbackTextureList);

	return true;
}
#include "lluictrlfactory.h"
#include "llscrolllistctrl.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "llviewerwindow.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "llfloaterchat.h"
#include "llfloaterblacklist.h"

#include "lllocalinventory.h"

static const size_t num_collision_sounds = 29;
const LLUUID collision_sounds[num_collision_sounds] =
{
	LLUUID("dce5fdd4-afe4-4ea1-822f-dd52cac46b08"),
	LLUUID("51011582-fbca-4580-ae9e-1a5593f094ec"),
	LLUUID("68d62208-e257-4d0c-bbe2-20c9ea9760bb"),
	LLUUID("75872e8c-bc39-451b-9b0b-042d7ba36cba"),
	LLUUID("6a45ba0b-5775-4ea8-8513-26008a17f873"),
	LLUUID("992a6d1b-8c77-40e0-9495-4098ce539694"),
	LLUUID("2de4da5a-faf8-46be-bac6-c4d74f1e5767"),
	LLUUID("6e3fb0f7-6d9c-42ca-b86b-1122ff562d7d"),
	LLUUID("14209133-4961-4acc-9649-53fc38ee1667"),
	LLUUID("bc4a4348-cfcc-4e5e-908e-8a52a8915fe6"),
	LLUUID("9e5c1297-6eed-40c0-825a-d9bcd86e3193"),
	LLUUID("e534761c-1894-4b61-b20c-658a6fb68157"),
	LLUUID("8761f73f-6cf9-4186-8aaa-0948ed002db1"),
	LLUUID("874a26fd-142f-4173-8c5b-890cd846c74d"),
	LLUUID("0e24a717-b97e-4b77-9c94-b59a5a88b2da"),
	LLUUID("75cf3ade-9a5b-4c4d-bb35-f9799bda7fb2"),
Example #16
0
BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
{
	LLVector3 ray_start_region;
	LLVector3 ray_end_region;
	LLViewerRegion* regionp = NULL;
	BOOL b_hit_land = FALSE;
	S32 hit_face = -1;
	LLViewerObject* hit_obj = NULL;
	U8 state = 0;
	BOOL success = raycastForNewObjPos( x, y, &hit_obj, &hit_face, &b_hit_land, &ray_start_region, &ray_end_region, &regionp );
	if( !success )
	{
		return FALSE;
	}

	if( hit_obj && (hit_obj->isAvatar() || hit_obj->isAttachment()) )
	{
		// Can't create objects on avatars or attachments
		return FALSE;
	}

	if (NULL == regionp)
	{
		llwarns << "regionp was NULL; aborting function." << llendl;
		return FALSE;
	}

	if (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX)
	{
		LLFirstUse::useSandbox();
	}

	// Set params for new object based on its PCode.
	LLQuaternion	rotation;
	LLVector3		scale = LLVector3(
		gSavedSettings.getF32("AscentBuildPrefs_Xsize"),
		gSavedSettings.getF32("AscentBuildPrefs_Ysize"),
		gSavedSettings.getF32("AscentBuildPrefs_Zsize"));
	
	U8				material = LL_MCODE_WOOD;
	if(gSavedSettings.getString("AscentBuildPrefs_Material")== "Stone") material = LL_MCODE_STONE;
	if(gSavedSettings.getString("AscentBuildPrefs_Material")== "Metal") material = LL_MCODE_METAL;
	if(gSavedSettings.getString("AscentBuildPrefs_Material")== "Wood") material = LL_MCODE_WOOD;
	if(gSavedSettings.getString("AscentBuildPrefs_Material")== "Flesh") material = LL_MCODE_FLESH;
	if(gSavedSettings.getString("AscentBuildPrefs_Material")== "Rubber") material = LL_MCODE_RUBBER;
	if(gSavedSettings.getString("AscentBuildPrefs_Material")== "Plastic") material = LL_MCODE_PLASTIC;
		

	

	BOOL			create_selected = FALSE;
	LLVolumeParams	volume_params;
	
	switch (pcode) 
	{
	case LL_PCODE_LEGACY_GRASS:
		//  Randomize size of grass patch 
		scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f),  1.f + ll_frand(2.f));
		state = rand() % LLVOGrass::sMaxGrassSpecies;
		break;


	case LL_PCODE_LEGACY_TREE:
	case LL_PCODE_TREE_NEW:
		state = rand() % LLVOTree::sMaxTreeSpecies;
		break;

	case LL_PCODE_SPHERE:
	case LL_PCODE_CONE:
	case LL_PCODE_CUBE:
	case LL_PCODE_CYLINDER:
	case LL_PCODE_TORUS:
	case LLViewerObject::LL_VO_SQUARE_TORUS:
	case LLViewerObject::LL_VO_TRIANGLE_TORUS:
	default:
		create_selected = TRUE;
		break;
	}

	// Play creation sound
	if (gAudiop)
	{
		gAudiop->triggerSound( LLUUID(gSavedSettings.getString("UISndObjectCreate")),
							   gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
	}

	gMessageSystem->newMessageFast(_PREHASH_ObjectAdd);
	gMessageSystem->nextBlockFast(_PREHASH_AgentData);
	gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
	gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());

	// Alway rez objects as land group if available.
	if (gSavedSettings.getBOOL("AscentAlwaysRezInGroup"))
	{
		LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
		if(gAgent.isInGroup(parcel->getGroupID()))
			gMessageSystem->addUUIDFast(_PREHASH_GroupID, parcel->getGroupID());
		else if(gAgent.isInGroup(parcel->getOwnerID()))
			gMessageSystem->addUUIDFast(_PREHASH_GroupID, parcel->getOwnerID());
		else gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
	} else gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());

	gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
	gMessageSystem->addU8Fast(_PREHASH_Material,	material);

	U32 flags = 0;		// not selected
	if (use_physics || gSavedSettings.getBOOL("AscentBuildPrefs_Physical"))
	{
		flags |= FLAGS_USE_PHYSICS;
	}
	if (create_selected)
	{
		flags |= FLAGS_CREATE_SELECTED;
	}
	gMessageSystem->addU32Fast(_PREHASH_AddFlags, flags );

	LLPCode volume_pcode;	// ...PCODE_VOLUME, or the original on error
	switch (pcode)
	{
	case LL_PCODE_SPHERE:
		rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);

		volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 1, 1 );
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_TORUS:
		rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);

		volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 1.f, 0.25f );	// "top size"
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LLViewerObject::LL_VO_SQUARE_TORUS:
		rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);

		volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_CIRCLE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 1.f, 0.25f );	// "top size"
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LLViewerObject::LL_VO_TRIANGLE_TORUS:
		rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);

		volume_params.setType( LL_PCODE_PROFILE_EQUALTRI, LL_PCODE_PATH_CIRCLE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 1.f, 0.25f );	// "top size"
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_SPHERE_HEMI:
		volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE );
		//volume_params.setBeginAndEndS( 0.5f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 0.5f );
		volume_params.setRatio	( 1, 1 );
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_CUBE:
		volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 1, 1 );
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_PRISM:
		volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 0, 1 );
		volume_params.setShear	( -0.5f, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_PYRAMID:
		volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 0, 0 );
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_TETRAHEDRON:
		volume_params.setType( LL_PCODE_PROFILE_EQUALTRI, LL_PCODE_PATH_LINE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 0, 0 );
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_CYLINDER:
		volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 1, 1 );
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_CYLINDER_HEMI:
		volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
		volume_params.setBeginAndEndS( 0.25f, 0.75f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 1, 1 );
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_CONE:
		volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
		volume_params.setBeginAndEndS( 0.f, 1.f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 0, 0 );
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	case LL_PCODE_CONE_HEMI:
		volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
		volume_params.setBeginAndEndS( 0.25f, 0.75f );
		volume_params.setBeginAndEndT( 0.f, 1.f );
		volume_params.setRatio	( 0, 0 );
		volume_params.setShear	( 0, 0 );
		LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
		volume_pcode = LL_PCODE_VOLUME;
		break;

	default:
		LLVolumeMessage::packVolumeParams(0, gMessageSystem);
		volume_pcode = pcode;
		break;
	}
	gMessageSystem->addU8Fast(_PREHASH_PCode, volume_pcode);

	gMessageSystem->addVector3Fast(_PREHASH_Scale,			scale );
	gMessageSystem->addQuatFast(_PREHASH_Rotation,			rotation );
	gMessageSystem->addVector3Fast(_PREHASH_RayStart,		ray_start_region );
	gMessageSystem->addVector3Fast(_PREHASH_RayEnd,			ray_end_region );
	gMessageSystem->addU8Fast(_PREHASH_BypassRaycast,		(U8)b_hit_land );
	gMessageSystem->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
	gMessageSystem->addU8Fast(_PREHASH_State, state);

	// Limit raycast to a single object.  
	// Speeds up server raycast + avoid problems with server ray hitting objects
	// that were clipped by the near plane or culled on the viewer.
	LLUUID ray_target_id;
	if( hit_obj )
	{
		ray_target_id = hit_obj->getID();
	}
	else
	{
		ray_target_id.setNull();
	}
	gMessageSystem->addUUIDFast(_PREHASH_RayTargetID,			ray_target_id );
	
	// Pack in name value pairs
	gMessageSystem->sendReliable(regionp->getHost());
	//FUCKlgg set flag to set texture here
	//gImportTracker.expectRez();
	// Spawns a message, so must be after above send
	if (create_selected)
	{
		LLSelectMgr::getInstance()->deselectAll();
		gViewerWindow->getWindow()->incBusyCount();
	}

	// VEFFECT: AddObject
	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
	effectp->setSourceObject((LLViewerObject*)gAgent.getAvatarObject());
	effectp->setPositionGlobal(regionp->getPosGlobalFromRegion(ray_end_region));
	effectp->setDuration(LL_HUD_DUR_SHORT);
	effectp->setColor(LLColor4U(gAgent.getEffectColor()));

	LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CREATE_COUNT);

	return TRUE;
}
// This is called when user presses enter in the location input
// or selects a location from the typed locations dropdown.
void LLNavigationBar::onLocationSelection()
{
	std::string typed_location = mCmbLocation->getSimple();
	LLStringUtil::trim(typed_location);

	// Will not teleport to empty location.
	if (typed_location.empty())
		return;
	//get selected item from combobox item
	LLSD value = mCmbLocation->getSelectedValue();
	if(value.isUndefined() && !mCmbLocation->getTextEntry()->isDirty())
	{
		// At this point we know that: there is no selected item in list and text field has NOT been changed
		// So there is no sense to try to change the location
		return;
	}
	/* since navbar list support autocompletion it contains several types of item: landmark, teleport hystory item,
	 * typed by user slurl or region name. Let's find out which type of item the user has selected 
	 * to make decision about adding this location into typed history. see mSaveToLocationHistory
	 * Note:
	 * Only TYPED_REGION_SLURL item will be added into LLLocationHistory 
	 */  
	
	if(value.has("item_type"))
	{

		switch(value["item_type"].asInteger())
		{
		case LANDMARK:
			
			if(value.has("AssetUUID"))
			{
				
				gAgent.teleportViaLandmark( LLUUID(value["AssetUUID"].asString()));
				return;
			}
			else
			{
				LLInventoryModel::item_array_t landmark_items =
						LLLandmarkActions::fetchLandmarksByName(typed_location,
								FALSE);
				if (!landmark_items.empty())
				{
					gAgent.teleportViaLandmark( landmark_items[0]->getAssetUUID());
					return; 
				}
			}
			break;
			
		case TELEPORT_HISTORY:
			//in case of teleport item was selected, teleport by position too.
		case TYPED_REGION_SLURL:
			if(value.has("global_pos"))
			{
				gAgent.teleportViaLocation(LLVector3d(value["global_pos"]));
				return;
			}
			break;
			
		default:
			break;		
		}
	}
	//Let's parse slurl or region name
	
	std::string region_name;
	LLVector3 local_coords(128, 128, 0);
	// Is the typed location a SLURL?
	LLSLURL slurl = LLSLURL(typed_location);
	if (slurl.getType() == LLSLURL::LOCATION)
	{
	  LL_DEBUGS( "SLURL") << "LLSLURL::LOCATION" << LL_ENDL;
	  region_name = slurl.getRegion();
	  local_coords = slurl.getPosition();
	}
	else if(!slurl.isValid())
	{
	  LL_DEBUGS( "SLURL") << "!slurl.isValid()" << LL_ENDL;
	  // we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too  
	  // but we need to know whether typed_location is a simple http url.
	  if (LLUrlRegistry::instance().isUrl(typed_location)) 
	    {
			LL_DEBUGS( "SLURL") << "isUrl" << LL_ENDL;
			// display http:// URLs in the media browser, or
			// anything else is sent to the search floater
			LLWeb::loadURL(typed_location);
		return;
	  }
	  else
	  {
	      LL_DEBUGS( "SLURL") << "assume user has typed region name" << LL_ENDL;
		  // assume that an user has typed the {region name} or possible {region_name, parcel}
	      region_name  = typed_location.substr(0,typed_location.find(','));
	    }
	}
	else
	{
	  LL_DEBUGS( "SLURL") << "was an app slurl, home, whatever.  Bail" << LL_ENDL;
	  // was an app slurl, home, whatever.  Bail
	  return;
	}
	
	std::string grid = slurl.getGrid();
	if(!slurl.getHypergrid() 
		&& (grid != LLGridManager::getInstance()->getGrid()))
	{
 		std::string dest = slurl.getSLURLString();
		if (!dest.empty())
		{
			FloaterHop::Params p;
			p.url(dest).target(LLStringUtil::null).id(LLStringUtil::null);
			LLFloaterReg::showInstance("grid_hop", p);
			return;
		}
	}
	
	// Resolve the region name to its global coordinates.
	// If resolution succeeds we'll teleport.
	LLWorldMapMessage::url_callback_t cb = boost::bind(
			&LLNavigationBar::onRegionNameResponse, this,
			typed_location, region_name, local_coords, _1, _2, _3, _4);
	mSaveToLocationHistory = true;
	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name, cb, std::string("unused"), false);
}
void LLViewerTextureList::doPreloadImages()
{
	LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL;
	
	llassert_always(mInitialized) ;
	llassert_always(mImageList.empty()) ;
	llassert_always(mUUIDMap.empty()) ;

	// Set the "missing asset" image
	LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI);
	
	// Set the "white" image
	LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI);
	
	LLUIImageList* image_list = LLUIImageList::getInstance();

	image_list->initFromFile();
	
	// turn off clamping and bilinear filtering for uv picking images
	//LLViewerFetchedTexture* uv_test = preloadUIImage("uv_test1.tga", LLUUID::null, FALSE);
	//uv_test->setClamp(FALSE, FALSE);
	//uv_test->setMipFilterNearest(TRUE, TRUE);
	//uv_test = preloadUIImage("uv_test2.tga", LLUUID::null, FALSE);
	//uv_test->setClamp(FALSE, FALSE);
	//uv_test->setMipFilterNearest(TRUE, TRUE);

	// prefetch specific UUIDs
	LLViewerTextureManager::getFetchedTexture(IMG_SHOT, TRUE);
	LLViewerTextureManager::getFetchedTexture(IMG_SMOKE_POOF, TRUE);
	LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
	if (image) 
	{
		image->setAddressMode(LLTexUnit::TAM_WRAP);
		mImagePreloads.insert(image);
	}
	image = LLViewerTextureManager::getFetchedTextureFromFile("noentrylines.j2c"/*"world/NoEntryLines.png"*/, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
	if (image) 
	{
		image->setAddressMode(LLTexUnit::TAM_WRAP);	
		mImagePreloads.insert(image);
	}
	image = LLViewerTextureManager::getFetchedTextureFromFile("noentrypasslines.j2c"/*"world/NoEntryPassLines.png"*/, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
	if (image) 
	{
		image->setAddressMode(LLTexUnit::TAM_WRAP);
		mImagePreloads.insert(image);
	}
	image = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
	if (image) 
	{
		image->setAddressMode(LLTexUnit::TAM_WRAP);	
		mImagePreloads.insert(image);
	}
	image = LLViewerTextureManager::getFetchedTextureFromFile("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903.j2c"/*"transparent.j2c"*/, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
		0,0,LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"));
	if (image) 
	{
		image->setAddressMode(LLTexUnit::TAM_WRAP);
		mImagePreloads.insert(image);
	}
	
}
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;
}
Example #20
0
void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected)
{
	switch (state)
	{
		//lgg crap to change remaining prim parameters from the ascent system build preferences subtab
		case WAND:
			if(justCreated && createSelected)
			{
				numberExpected--;
				if(numberExpected<=0)
					state=IDLE;
				LLMessageSystem* msg = gMessageSystem;
				msg->newMessageFast(_PREHASH_ObjectImage);
				msg->nextBlockFast(_PREHASH_AgentData);
				msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
				msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());	
				msg->nextBlockFast(_PREHASH_ObjectData);				
				msg->addU32Fast(_PREHASH_ObjectLocalID,  (U32)newid);
				msg->addStringFast(_PREHASH_MediaURL, NULL);
//sets texture stuff
				LLPrimitive obj;
				obj.setNumTEs(U8(10));	
				S32 shinnyLevel = 0;
				static LLCachedControl<std::string> sshinystr(gSavedSettings, "EmeraldBuildPrefs_Shiny");
				std::string shinystr = sshinystr;
				//if(shinystr == "None") shinnyLevel = 0; //We're already 0.
				if(shinystr == "Low") shinnyLevel = 1;
				else if(shinystr == "Medium") shinnyLevel = 2;
				else if(shinystr == "High") shinnyLevel = 3;
				
				for (int i = 0; i < 10; i++)
				{
					LLTextureEntry tex =  LLTextureEntry(LLUUID(gSavedSettings.getString("EmeraldBuildPrefs_Texture")));
					tex.setColor(gSavedSettings.getColor4("EmeraldBuildPrefs_Color"));
					tex.setAlpha(1.0 - ((gSavedSettings.getF32("EmeraldBuildPrefs_Alpha")) / 100.0));
					tex.setGlow(gSavedSettings.getF32("EmeraldBuildPrefs_Glow"));
					if(gSavedSettings.getBOOL("EmeraldBuildPrefs_FullBright"))
					{
						tex.setFullbright(TEM_FULLBRIGHT_MASK);
					}
									
					tex.setShiny((U8) shinnyLevel & TEM_SHINY_MASK);
					
					obj.setTE(U8(i), tex);
				}
	
				obj.packTEMessage(gMessageSystem);
	
				msg->sendReliable(gAgent.getRegion()->getHost());
//sets some object parameters
				msg->newMessage("ObjectFlagUpdate");
				msg->nextBlockFast(_PREHASH_AgentData);
				msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
				msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
				msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid );
				msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical"));
				msg->addBOOLFast(_PREHASH_IsTemporary, gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary"));
				msg->addBOOLFast(_PREHASH_IsPhantom, gSavedSettings.getBOOL("EmeraldBuildPrefs_Phantom") );
				msg->addBOOL("CastsShadows", true );
				msg->sendReliable(gAgent.getRegion()->getHost());

				if(gSavedSettings.getBOOL("EmeraldBuildPrefs_EmbedItem"))
				{
					LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem((LLUUID)gSavedPerAccountSettings.getString("EmeraldBuildPrefs_Item"));
					LLViewerObject* objectp = find((U32)newid);
					if(objectp)
						if(item)
						{
							if(item->getType()==LLAssetType::AT_LSL_TEXT)
							{
								LLToolDragAndDrop::dropScript(objectp,
									item,
									TRUE,
									LLToolDragAndDrop::SOURCE_AGENT,
									gAgent.getID());
							}else
							{
								LLToolDragAndDrop::dropInventory(objectp,item,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID());
							}
						}
				}
				
				msg->newMessageFast(_PREHASH_ObjectPermissions);
				msg->nextBlockFast(_PREHASH_AgentData);
				msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
				msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
				msg->nextBlockFast(_PREHASH_HeaderData);
				msg->addBOOLFast(_PREHASH_Override, FALSE);
				msg->nextBlockFast(_PREHASH_ObjectData);
				msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid);
				msg->addU8Fast(_PREHASH_Field,	PERM_NEXT_OWNER);
				msg->addBOOLFast(_PREHASH_Set,		PERM_ITEM_UNRESTRICTED);
				U32 flags = 0;
				if ( gSavedSettings.getBOOL("NextOwnerCopy") )
				{
					flags |= PERM_COPY;
				}
				if ( gSavedSettings.getBOOL("NextOwnerModify") )
				{
					flags |= PERM_MODIFY;
				}
				if ( gSavedSettings.getBOOL("NextOwnerTransfer") )
				{
					flags |= PERM_TRANSFER;
				}
				msg->addU32Fast(_PREHASH_Mask, flags);
				msg->sendReliable(gAgent.getRegion()->getHost());
				//llinfos << "LGG SENDING CUBE TEXTURE.." << llendl;
			}
		break;
/*		case BUILDING:
			
			if (justCreated && (int)localids.size() < linkset.size())
			{
				localids.push_back(newid);
				localids.sort();
				localids.unique();

				linkset[localids.size() -1]["LocalID"] = newid;
				LLSD prim = linkset[localids.size() -1];

				//MAKERIGHT
				if (!(prim).has("Updated"))
				{
					++updated;
					send_shape(prim);
					send_image(prim);
					send_extras(prim);
					send_namedesc(prim);
					send_vectors(prim,updated);
					send_properties(prim, updated);
					send_inventory(prim);
					(prim)["Updated"] = true;
				}
				if ((int)localids.size() < linkset.size())
				{
					plywood_above_head();
					return;
				}
				else
				{
					if (updated >= linkset.size())
					{
						updated=0;
						llinfos << "FINISHED BUILDING, LINKING.." << llendl;
						state = LINKING;
						link();
					}
				}
			}
		break;
		case LINKING:
			link();
		break;*/
	}
}
Example #21
0
void LLPanelFriends::onClickImport(void* user_data)
//THIS CODE IS DESIGNED SO THAT EXP/IMP BETWEEN GRIDS WILL FAIL
//because assuming someone having the same name on another grid is the same person is generally a bad idea
//i might add the option to query the user as to intelligently detecting matching names on a alternative grid
// jcool410
{
	//LLPanelFriends* panelp = (LLPanelFriends*)user_data;
	//is_agent_friend(

	const std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_ALL);
		
	if (filename.empty())
		return;

	llifstream importer(filename);
	LLSD data;
	LLSDSerialize::fromXMLDocument(data, importer);
	if(data.has("GRID"))
	{
		std::string grid = gHippoGridManager->getConnectedGrid()->getLoginUri();
		if(grid != data["GRID"])return;
		data.erase("GRID");
	}

#if LL_WINDOWS
	std::string file = filename.substr(filename.find_last_of("\\")+1);
#else
	std::string file = filename.substr(filename.find_last_of("/")+1);
#endif

	std::string importstate = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "friendimportstate.dat");
	
	llifstream stateload(importstate);
	LLSD importstatellsd;
	LLSDSerialize::fromXMLDocument(importstatellsd, stateload);


	//LLMessageSystem* msg = gMessageSystem;
	LLSD newdata;

	LLSD::map_const_iterator iter;
	for(iter = data.beginMap(); iter != data.endMap(); ++iter)
	{//first= var second = val
		LLSD content = iter->second;
		if(!content.has("name"))continue;
		if(!content.has("see_online"))continue;
		if(!content.has("can_map"))continue;
		if(!content.has("can_mod"))continue;

		LLUUID agent_id = LLUUID(iter->first);
		if(merging && importstatellsd.has(agent_id.asString()))continue;//dont need to request what weve already requested from another list import and have not got a reply yet

		std::string agent_name = content["name"];
		if(!is_agent_friend(agent_id))//dont need to request what we have
		{
			if(merging)importstatellsd[agent_id.asString()] = content;//MERGEEEE
			requestFriendship(agent_id, agent_name, "Imported from "+file);
			newdata[iter->first] = iter->second;
		}else 
		{
			//data.erase(iter->first);
			//--iter;//god help us all
		}
	}
	data = newdata;
	newdata = LLSD();

	if(!merging)
	{
		merging = true;//this hack is to support importing multiple account lists without spamming users but considering LLs fail in forcing silent declines
		importstatellsd = data;
	}

	llofstream export_file;
	export_file.open(importstate);
	LLSDSerialize::toPrettyXML(importstatellsd, export_file);
	export_file.close();
}
Example #22
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();

	mSpeakerMgr->update();

	const LLString icon_image_0 = gViewerArt.getString("icn_active-speakers-dot-lvl0.tga");
	const LLString icon_image_1 = gViewerArt.getString("icn_active-speakers-dot-lvl1.tga");
	const LLString icon_image_2 = gViewerArt.getString("icn_active-speakers-dot-lvl2.tga");


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

	LLUUID mute_icon_image = LLUUID(gViewerArt.getString("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
		LLString speaking_order_sort_string = llformat("%010d", speakerp->mSortIndex);

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

			LLString 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(LLColor4::black);
			}

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

			if (speakerp->mIsModerator)
			{
				speaker_name += LLString(" ") + getFormattedUIString("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);
	
	if (gMuteListp)
	{
		// update UI for selected participant
		if (mMuteVoiceCtrl)
		{
			mMuteVoiceCtrl->setValue(gMuteListp->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));
		}
		if (mMuteTextCtrl)
		{
			mMuteTextCtrl->setValue(gMuteListp->isMuted(selected_id, LLMute::flagTextChat));
			mMuteTextCtrl->setEnabled(selected_id.notNull() 
									&& selected_id != gAgent.getID() 
									&& selected_speakerp.notNull() 
									&& !gMuteListp->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));

	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());
	}

	// show selected user name in large font
	if (mNameText)
	{
		if (selected_speakerp)
		{
			mNameText->setValue(selected_speakerp->mDisplayName);
		}
		else
		{
			mNameText->setValue(LLString::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);
}
//THIS CODE IS DESIGNED SO THAT EXP/IMP BETWEEN GRIDS WILL FAIL
//because assuming someone having the same name on another grid is the same person is generally a bad idea
//i might add the option to query the user as to intelligently detecting matching names on a alternative grid
// jcool410
void LLPanelFriends::onClickImport_filepicker_continued(AIFilePicker* filepicker)
{
	if (!filepicker->hasFilename())
		return;

	std::string filename = filepicker->getFilename();
	llifstream importer(filename);
	LLSD data;
	LLSDSerialize::fromXMLDocument(data, importer);
	if(data.has("GRID"))
	{
		std::string grid = gHippoGridManager->getConnectedGrid()->getLoginUri();
		if(grid != data["GRID"])return;
		data.erase("GRID");
	}

#if LL_WINDOWS
	std::string file = filename.substr(filename.find_last_of("\\")+1);
#else
	std::string file = filename.substr(filename.find_last_of("/")+1);
#endif

	std::string importstate = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "friendimportstate.dat");
	
	llifstream stateload(importstate);
	LLSD importstatellsd;
	LLSDSerialize::fromXMLDocument(importstatellsd, stateload);


	//LLMessageSystem* msg = gMessageSystem;
	LLSD newdata;

	LLSD::map_const_iterator iter;
	for(iter = data.beginMap(); iter != data.endMap(); ++iter)
	{//first= var second = val
		LLSD content = iter->second;
		if(!content.has("name"))continue;
		if(!content.has("see_online"))continue;
		if(!content.has("can_map"))continue;
		if(!content.has("can_mod"))continue;

		LLUUID agent_id = LLUUID(iter->first);
		if(merging && importstatellsd.has(agent_id.asString()))continue;//dont need to request what weve already requested from another list import and have not got a reply yet

		std::string agent_name = content["name"];
		if(!is_agent_friend(agent_id))//dont need to request what we have
		{
			if(merging)importstatellsd[agent_id.asString()] = content;//MERGEEEE
			requestFriendship(agent_id, agent_name, "Imported from "+file);
			newdata[iter->first] = iter->second;
		}else 
		{
			//data.erase(iter->first);
			//--iter;//god help us all
		}
	}
	data = newdata;
	newdata = LLSD();

	if(!merging)
	{
		merging = true;//this hack is to support importing multiple account lists without spamming users but considering LLs fail in forcing silent declines
		importstatellsd = data;
	}

	llofstream export_file;
	export_file.open(importstate);
	LLSDSerialize::toPrettyXML(importstatellsd, export_file);
	export_file.close();
}
Example #24
0
namespace omvtk
{
	/// static zero uuid instance
	LLUUID const LLUUID::Zero = LLUUID();

	/// Default constructor initializes Zero LLUUID
	LLUUID::LLUUID()
		: m_data()
	{		
	}


	/// Initialize from Poco::UUID
	LLUUID::LLUUID(value_type const & val)
		: m_data(val)
	{
	}


	/// Initialize from string representation
	LLUUID::LLUUID(String const & str)
		: m_data(str)
	{
	}

	/// Initialize the LLUUID from a byte sub range (avoids copies)
	LLUUID::LLUUID(byte_sub_range const & sr)
		: m_data(fromSubRange(sr))
	{

	}

	/// Initialize from Buffer
	LLUUID::LLUUID(ByteBuffer const & buf)
		: m_data(fromSubRange(byte_sub_range(buf.begin(), buf.end())))
	{
	}


	/// Copy constructor
	LLUUID::LLUUID(LLUUID const & other)
		: m_data(other.m_data)
	{
	}


	/// Destructor
	LLUUID::~LLUUID()
	{
	}


	/// Assignment operator
	LLUUID & LLUUID::operator=(LLUUID other)
	{
		swap(other);
		return *this;
	}


	/// equal compare operator
	bool LLUUID::operator == (const LLUUID& uuid) const
	{
		return m_data == uuid.m_data;
	}


	/// not equal compare operator 
	bool LLUUID::operator != (const LLUUID& uuid) const
	{
		return m_data != uuid.m_data;
	}


	/// less than compare operator
	bool LLUUID::operator <  (const LLUUID& uuid) const
	{
		return m_data < uuid.m_data;
	}


	/// less than or equal compare operator
	bool LLUUID::operator <= (const LLUUID& uuid) const
	{
		return m_data <= uuid.m_data;
	}


	/// greater than compare operator
	bool LLUUID::operator >  (const LLUUID& uuid) const
	{
		return m_data > uuid.m_data;
	}


	/// greater than or equal compare operator
	bool LLUUID::operator >= (const LLUUID& uuid) const
	{
		return m_data >= uuid.m_data;
	}

	void LLUUID::swap(LLUUID & other)
	{
		m_data.swap(other.m_data);
	}

	/// Whether the current instance is a zero uuid
	bool LLUUID::is_zero() const
	{
		return m_data.isNil();
	}


	/// Converts to string representation
	String LLUUID::to_string() const
	{
		return m_data.toString();
	}


	/// Converts to binary buffer
	ByteBuffer LLUUID::to_binary() const
	{
		ByteBuffer buffer(16,0);
		m_data.copyTo(reinterpret_cast<char*>(&buffer[0]));
		return buffer;
	}


	/// returns internal Poco::UUID instance
	LLUUID::value_type & LLUUID::get()
	{
		return m_data;
	}


	/// returns internal Poco::UUID instance
	LLUUID::value_type const & LLUUID::get() const
	{
		return m_data;
	}

}
// virtual
void LLPanelLandmarkInfo::setInfoType(EInfoType type)
{
	LLPanel* landmark_info_panel = getChild<LLPanel>("landmark_info_panel");

	bool is_info_type_create_landmark = type == CREATE_LANDMARK;

	landmark_info_panel->setVisible(type == LANDMARK);

	getChild<LLTextBox>("folder_label")->setVisible(is_info_type_create_landmark);
	mFolderCombo->setVisible(is_info_type_create_landmark);

	switch(type)
	{
		case CREATE_LANDMARK:
		{
			mCurrentTitle = getString("title_create_landmark");

			mLandmarkTitle->setVisible(FALSE);
			mLandmarkTitleEditor->setVisible(TRUE);
			mNotesEditor->setEnabled(TRUE);

			LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
			std::string name = parcel_mgr->getAgentParcelName();
			LLVector3 agent_pos = gAgent.getPositionAgent();

			if (name.empty())
			{
				S32 region_x = llround(agent_pos.mV[VX]);
				S32 region_y = llround(agent_pos.mV[VY]);
				S32 region_z = llround(agent_pos.mV[VZ]);

				std::string region_name;
				LLViewerRegion* region = parcel_mgr->getSelectionRegion();
				if (region)
				{
					region_name = region->getName();
				}
				else
				{
					region_name = getString("unknown");
				}

				mLandmarkTitleEditor->setText(llformat("%s (%d, %d, %d)",
									  region_name.c_str(), region_x, region_y, region_z));
			}
			else
			{
				mLandmarkTitleEditor->setText(name);
			}

			std::string desc;
			LLAgentUI::buildLocationString(desc, LLAgentUI::LOCATION_FORMAT_FULL, agent_pos);
			mNotesEditor->setText(desc);

			// Moved landmark creation here from LLPanelLandmarkInfo::processParcelInfo()
			// because we use only agent's current coordinates instead of waiting for
			// remote parcel request to complete.
			if (!LLLandmarkActions::landmarkAlreadyExists())
			{
				createLandmark(LLUUID());
			}
		}
		break;

		case LANDMARK:
		default:
			mCurrentTitle = getString("title_landmark");

			mLandmarkTitle->setVisible(TRUE);
			mLandmarkTitleEditor->setVisible(FALSE);
			mNotesEditor->setEnabled(FALSE);
		break;
	}

	populateFoldersList();

	// Prevent the floater from losing focus (if the sidepanel is undocked).
	setFocus(TRUE);

	LLPanelPlaceInfo::setInfoType(type);
}
Example #26
0
BOOL LLWearable::importFile( LLFILE* file )
{
	// *NOTE: changing the type or size of this buffer will require
	// changes in the fscanf() code below. You would be better off
	// rewriting this to use streams and not require an open FILE.
	char text_buffer[2048];		/* Flawfinder: ignore */
	S32 fields_read = 0;

	// read header and version 
	fields_read = fscanf( file, "LLWearable version %d\n", &mDefinitionVersion );
	if( fields_read != 1 )
	{
		// Shouldn't really log the asset id for security reasons, but
		// we need it in this case.
		llwarns << "Bad Wearable asset header: " << mAssetID << llendl;
		//gVFS->dumpMap();
		return FALSE;
	}

	if( mDefinitionVersion > LLWearable::sCurrentDefinitionVersion )
	{
		llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl;
		return FALSE;
	}

	// name
	char next_char = fgetc( file );		/* Flawfinder: ignore */
	if( '\n' == next_char )
	{
		// no name
		mName = "";
	}
	else
	{
		ungetc( next_char, file );
		fields_read = fscanf(	/* Flawfinder: ignore */
			file,
			"%2047[^\n]",
			text_buffer);
		if( (1 != fields_read) || (fgetc( file ) != '\n') )		/* Flawfinder: ignore */
		{
			llwarns << "Bad Wearable asset: early end of file" << llendl;
			return FALSE;
		}
		mName = text_buffer;
		LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN );
	}

	// description
	next_char = fgetc( file );		/* Flawfinder: ignore */
	if( '\n' == next_char )
	{
		// no description
		mDescription = "";
	}
	else
	{
		ungetc( next_char, file );
		fields_read = fscanf(	/* Flawfinder: ignore */
			file,
			"%2047[^\n]",
			text_buffer );
		if( (1 != fields_read) || (fgetc( file ) != '\n') )		/* Flawfinder: ignore */
		{
			llwarns << "Bad Wearable asset: early end of file" << llendl;
			return FALSE;
		}
		mDescription = text_buffer;
		LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN );
	}

	// permissions
	S32 perm_version;
	fields_read = fscanf( file, " permissions %d\n", &perm_version );
	if( (fields_read != 1) || (perm_version != 0) )
	{
		llwarns << "Bad Wearable asset: missing permissions" << llendl;
		return FALSE;
	}
	if( !mPermissions.importFile( file ) )
	{
		return FALSE;
	}

	// sale info
	S32 sale_info_version;
	fields_read = fscanf( file, " sale_info %d\n", &sale_info_version );
	if( (fields_read != 1) || (sale_info_version != 0) )
	{
		llwarns << "Bad Wearable asset: missing sale_info" << llendl;
		return FALSE;
	}
	// Sale info used to contain next owner perm. It is now in the
	// permissions. Thus, we read that out, and fix legacy
	// objects. It's possible this op would fail, but it should pick
	// up the vast majority of the tasks.
	BOOL has_perm_mask = FALSE;
	U32 perm_mask = 0;
	if( !mSaleInfo.importFile(file, has_perm_mask, perm_mask) )
	{
		return FALSE;
	}
	if(has_perm_mask)
	{
		// fair use fix.
		if(!(perm_mask & PERM_COPY))
		{
			perm_mask |= PERM_TRANSFER;
		}
		mPermissions.setMaskNext(perm_mask);
	}

	// wearable type
	S32 type = -1;
	fields_read = fscanf( file, "type %d\n", &type );
	if( fields_read != 1 )
	{
		llwarns << "Bad Wearable asset: bad type" << llendl;
		return FALSE;
	}
	if( 0 <= type && type < WT_COUNT )
	{
		mType = (EWearableType)type;
	}
	else
	{
		llwarns << "Bad Wearable asset: bad type #" << type <<  llendl;
		return FALSE;
	}


	// parameters header
	S32 num_parameters = 0;
	fields_read = fscanf( file, "parameters %d\n", &num_parameters );
	if( fields_read != 1 )
	{
		llwarns << "Bad Wearable asset: missing parameters block" << llendl;
		return FALSE;
	}

	// parameters
	S32 i;
	for( i = 0; i < num_parameters; i++ )
	{
		S32 param_id = 0;
		F32 param_weight = 0.f;
		fields_read = fscanf( file, "%d %f\n", &param_id, &param_weight );
		if( fields_read != 2 )
		{
			llwarns << "Bad Wearable asset: bad parameter, #" << i << llendl;
			return FALSE;
		}
		mVisualParamMap[param_id] = param_weight;
	}

	// textures header
	S32 num_textures = 0;
	fields_read = fscanf( file, "textures %d\n", &num_textures);
	if( fields_read != 1 )
	{
		llwarns << "Bad Wearable asset: missing textures block" << llendl;
		return FALSE;
	}

	// textures
	for( i = 0; i < num_textures; i++ )
	{
		S32 te = 0;
		fields_read = fscanf(	/* Flawfinder: ignore */
			file,
			"%d %2047s\n",
			&te, text_buffer);
		if( fields_read != 2 )
		{
			llwarns << "Bad Wearable asset: bad texture, #" << i << llendl;
			return FALSE;
		}

		if( !LLUUID::validate( text_buffer ) )
		{
			llwarns << "Bad Wearable asset: bad texture uuid: " << text_buffer << llendl;
			return FALSE;
		}

		mTEMap[te] = LLUUID(text_buffer );
	}

	return TRUE;
}
Example #27
0
// static
void LLStandardBumpmap::addstandard()
{
	if(!gTextureList.isInitialized())
	{
		//Note: loading pre-configuration sometimes triggers this call.
		//But it is safe to return here because bump images will be reloaded during initialization later.
		return ;
	}

	// can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup.  Sigh.  So clear the list every time before we (re-)add the standard bumpmaps.
	//llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 );
	clear();
	llinfos << "Adding standard bumpmaps." << llendl;
	gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None");		// BE_NO_BUMP
	gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness");	// BE_BRIGHTNESS
	gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness");	// BE_DARKNESS

	std::string file_name = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "std_bump.ini" );
	LLFILE* file = LLFile::fopen( file_name, "rt" );	 /*Flawfinder: ignore*/
	if( !file )
	{
		llwarns << "Could not open std_bump <" << file_name << ">" << llendl;
		return;
	}

	S32 file_version = 0;

	S32 fields_read = fscanf( file, "LLStandardBumpmap version %d", &file_version );
	if( fields_read != 1 )
	{
		llwarns << "Bad LLStandardBumpmap header" << llendl;
		return;
	}

	if( file_version > STD_BUMP_LATEST_FILE_VERSION )
	{
		llwarns << "LLStandardBumpmap has newer version (" << file_version << ") than viewer (" << STD_BUMP_LATEST_FILE_VERSION << ")" << llendl;
		return;
	}

	while( !feof(file) && (LLStandardBumpmap::sStandardBumpmapCount < (U32)TEM_BUMPMAP_COUNT) )
	{
		// *NOTE: This buffer size is hard coded into scanf() below.
		char label[2048] = "";	/* Flawfinder: ignore */
		char bump_image_id[2048] = "";	/* Flawfinder: ignore */
		fields_read = fscanf(	/* Flawfinder: ignore */
			file, "\n%2047s %2047s", label, bump_image_id);
		if( EOF == fields_read )
		{
			break;
		}
		if( fields_read != 2 )
		{
			llwarns << "Bad LLStandardBumpmap entry" << llendl;
			return;
		}
		if(strlen(bump_image_id) == (UUID_STR_LENGTH - 1) + 4 && !stricmp(&(bump_image_id[UUID_STR_LENGTH-1]),".j2c"))
			bump_image_id[UUID_STR_LENGTH-1] = 0; // truncate to a valid uuid (hopefully)
// 		llinfos << "Loading bumpmap: " << bump_file << " from viewerart" << llendl;
		gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label;
		gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = 
			LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id));	
		gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::BOOST_BUMP) ;
		gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL );
		gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ;
		LLStandardBumpmap::sStandardBumpmapCount++;
	}

	fclose( file );
}
void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected)
{
	switch (state)
	{
		//lgg crap
		case WAND:
			if(justCreated && createSelected)
			{
				numberExpected--;
				if(numberExpected<=0)
					state=IDLE;
				LLMessageSystem* msg = gMessageSystem;
				msg->newMessageFast(_PREHASH_ObjectImage);
				msg->nextBlockFast(_PREHASH_AgentData);
				msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
				msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());	
				msg->nextBlockFast(_PREHASH_ObjectData);				
				msg->addU32Fast(_PREHASH_ObjectLocalID,  (U32)newid);
				msg->addStringFast(_PREHASH_MediaURL, NULL);
	
				LLPrimitive obj;
				obj.setNumTEs(U8(10));	
				S32 shinnyLevel = 0;
				static std::string* shinystr = rebind_llcontrol<std::string>("EmeraldBuildPrefs_Shiny", &gSavedSettings, true);
				if(*shinystr == "None") shinnyLevel = 0;
				if(*shinystr == "Low") shinnyLevel = 1;
				if(*shinystr == "Medium") shinnyLevel = 2;
				if(*shinystr == "High") shinnyLevel = 3;
				
				for (int i = 0; i < 10; i++)
				{
					static std::string* buildpreftex = rebind_llcontrol<std::string>("EmeraldBuildPrefs_Texture", &gSavedSettings, true);

					LLTextureEntry tex =  LLTextureEntry(LLUUID(*buildpreftex));
					tex.setColor(gSavedSettings.getColor4("EmeraldBuildPrefs_Color"));
					tex.setAlpha(1.0 - ((gSavedSettings.getF32("EmeraldBuildPrefs_Alpha")) / 100.0));
					tex.setGlow(gSavedSettings.getF32("EmeraldBuildPrefs_Glow"));
					if(gSavedSettings.getBOOL("EmeraldBuildPrefs_FullBright"))
					{
						tex.setFullbright(TEM_FULLBRIGHT_MASK);
					}
									
					tex.setShiny((U8) shinnyLevel & TEM_SHINY_MASK);
					
					obj.setTE(U8(i), tex);
				}
	
				obj.packTEMessage(gMessageSystem);
	
				msg->sendReliable(gAgent.getRegion()->getHost());
				
				msg->newMessage("ObjectFlagUpdate");
				msg->nextBlockFast(_PREHASH_AgentData);
				msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
				msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
				msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid );
				msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical"));
				msg->addBOOL("IsTemporary", gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary"));
				msg->addBOOL("IsPhantom", gSavedSettings.getBOOL("EmeraldBuildPrefs_Phantom") );
				msg->addBOOL("CastsShadows", true );
				msg->sendReliable(gAgent.getRegion()->getHost());

				if(gSavedSettings.getBOOL("EmeraldBuildPrefs_EmbedItem"))
				{
					LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem((LLUUID)gSavedSettings.getString("EmeraldBuildPrefs_Item"));
					LLViewerObject* objectp = find((U32)newid);
					if(objectp)
						if(item)
						{
							if(item->getType()==LLAssetType::AT_LSL_TEXT)
							{
								LLToolDragAndDrop::dropScript(objectp,
									item,
									TRUE,
									LLToolDragAndDrop::SOURCE_AGENT,
									gAgent.getID());
							}else
							{
								LLToolDragAndDrop::dropInventory(objectp,item,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID());
							}
						}
				}
				
				//llinfos << "LGG SENDING CUBE TEXTURE.." << llendl;
			}
		break;
		case BUILDING:
			
			if (justCreated && (int)localids.size() < linkset.size())
			{
				localids.push_back(newid);
				localids.sort();
				localids.unique();

				linkset[localids.size() -1]["LocalID"] = newid;
				LLSD prim = linkset[localids.size() -1];

				//MAKERIGHT
				if (!(prim).has("Updated"))
				{
					++updated;
					send_shape(prim);
					send_image(prim);
					send_extras(prim);
					send_namedesc(prim);
					send_vectors(prim,updated);
					send_properties(prim, updated);
					send_inventory(prim);
					(prim)["Updated"] = true;
				}
				if ((int)localids.size() < linkset.size())
				{
					plywood_above_head();
					return;
				}
				else
				{
					if (updated >= linkset.size())
					{
						updated=0;
						llinfos << "FINISHED BUILDING, LINKING.." << llendl;
						state = LINKING;
						link();
					}
				}
			}
		break;
		case LINKING:
			link();
		break;
	}
}
//////////////////////////////////////////////////////////////////////////////////////////
// static
void LLViewerParcelMedia::update(LLParcel* parcel)
{
	if (/*LLViewerMedia::hasMedia()*/ true)
	{
		// we have a player
		if (parcel)
		{
			if(!gAgent.getRegion())
			{
				sMediaRegionID = LLUUID() ;
				stop() ;
				LL_DEBUGS("Media") << "no agent region, bailing out." << LL_ENDL;
				return ;				
			}

			// we're in a parcel
			S32 parcelid = parcel->getLocalID();						

			LLUUID regionid = gAgent.getRegion()->getRegionID();
			if (parcelid != sMediaParcelLocalID || regionid != sMediaRegionID)
			{
				LL_DEBUGS("Media") << "New parcel, parcel id = " << parcelid << ", region id = " << regionid << LL_ENDL;
				sMediaParcelLocalID = parcelid;
				sMediaRegionID = regionid;
			}

			std::string mediaUrl = std::string ( parcel->getMediaURL () );
			std::string mediaCurrentUrl = std::string( parcel->getMediaCurrentURL());

			// First use warning
			if(	! mediaUrl.empty() && gSavedSettings.getWarning("FirstStreamingVideo") )
			{
				LLNotificationsUtil::add("ParcelCanPlayMedia", LLSD(), LLSD(),
					boost::bind(&callback_play_media, _1, _2, parcel));
				return;

			}

			// if we have a current (link sharing) url, use it instead
			if (mediaCurrentUrl != "" && parcel->getMediaType() == "text/html")
			{
				mediaUrl = mediaCurrentUrl;
			}
			
			LLStringUtil::trim(mediaUrl);
			
			// If no parcel media is playing, nothing left to do
			if(sMediaImpl.isNull())

			{
				return;
			}

			// Media is playing...has something changed?
			else if (( sMediaImpl->getMediaURL() != mediaUrl )
				|| ( sMediaImpl->getMediaTextureID() != parcel->getMediaID() )
				|| ( sMediaImpl->getMimeType() != parcel->getMediaType() ))
			{
				// Only play if the media types are the same.
				if(sMediaImpl->getMimeType() == parcel->getMediaType())
				{
					if (gSavedSettings.getU32("MediaFilterEnable"))
					{
						LL_DEBUGS("MediaFilter") << "Filtering media URL: " << parcel->getMediaURL() << LL_ENDL;
						LLMediaFilter::getInstance()->filterMediaUrl(parcel);
					}
					else
					{
						play(parcel);
					}
				}

				else
				{
					stop();
				}
			}
		}
		else
		{
			stop();
		}
	}
	/*
	else
	{
		// no audio player, do a first use dialog if there is media here
		if (parcel)
		{
			std::string mediaUrl = std::string ( parcel->getMediaURL () );
			if (!mediaUrl.empty ())
			{
				if (gSavedSettings.getWarning("QuickTimeInstalled"))
				{
					gSavedSettings.setWarning("QuickTimeInstalled", FALSE);

					LLNotificationsUtil::add("NoQuickTime" );
				};
			}
		}
	}
	*/
}
void FSWSAssetBlacklist::loadBlacklist()
{
	if (gDirUtilp->fileExists(mBlacklistFileName))
	{
		llifstream blacklist_data_stream(mBlacklistFileName);
		if (blacklist_data_stream.is_open())
		{
			LLSD data;
			if (LLSDSerialize::fromXML(data, blacklist_data_stream) >= 1)
			{
				for (LLSD::map_const_iterator itr = data.beginMap(); itr != data.endMap(); ++itr)
				{
					LLUUID uid = LLUUID(itr->first);
					LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
					cipher.decrypt(uid.mData, UUID_BYTES);
					LLSD data = itr->second;
					if (uid.isNull())
					{
						continue;
					}

					LLAssetType::EType type = S32toAssetType(data["asset_type"].asInteger());
					if (type == LLAssetType::AT_NONE)
					{
						continue;
					}
					
					addNewItemToBlacklistData(uid, data, false);
				}
			}
		}
		blacklist_data_stream.close();
	}
	else
	{
		// Try to import old blacklist data from Phoenix
		std::string old_file = gDirUtilp->getOSUserDir() + gDirUtilp->getDirDelimiter() + "SecondLife" + gDirUtilp->getDirDelimiter() + "user_settings" + gDirUtilp->getDirDelimiter() + "floater_blist_settings.xml";
		if (gDirUtilp->fileExists(old_file))
		{
			LLSD datallsd;
			llifstream oldfile;
			oldfile.open(old_file.c_str());
			if (oldfile.is_open())
			{
				LLSDSerialize::fromXMLDocument(datallsd, oldfile);
				for (LLSD::map_const_iterator itr = datallsd.beginMap(); itr != datallsd.endMap(); ++itr)
				{
					LLUUID uid = LLUUID(itr->first);
					LLSD data = itr->second;
					if (uid.isNull() || !data.has("entry_name") || !data.has("entry_type") || !data.has("entry_date"))
					{
						continue;
					}
					LLAssetType::EType type = S32toAssetType(data["entry_type"].asInteger());
					
					LLSD newdata;
					newdata["asset_name"] = "[PHOENIX] " + data["entry_name"].asString();
					newdata["asset_type"] = type;
					newdata["asset_date"] = data["entry_date"].asString();

					//if (!data["ID_hashed"].asBoolean())
					//{
					//	uid = LLUUID::generateNewID(uid.asString() + "hash");
					//}
					
					addNewItemToBlacklistData(uid, newdata, false);
				}
			}
			oldfile.close();
			saveBlacklist();
			LL_INFOS("AssetBlacklist") << "Using old Phoenix file: " << old_file << LL_ENDL;
		}
		else
		{
			LL_INFOS("AssetBlacklist") << "No Settings file found." << old_file << LL_ENDL;
		}
	}
}