Example #1
0
void LLPanelClassifiedEdit::onOpen(const LLSD& key)
{
	mIsNew = key.isUndefined();
	
	scrollToTop();

	// classified is not created yet
	bool is_new = isNew() || isNewWithErrors();

	if(is_new)
	{
		resetData();
		resetControls();

		fillIn(key);

		if(isNew())
		{
			LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this);
		}
	}
	else
	{
		LLPanelClassifiedInfo::onOpen(key);
	}

	std::string save_btn_label = is_new ? getString("publish_label") : getString("save_label");
	getChild<LLUICtrl>("save_changes_btn")->setLabelArg("[LABEL]", save_btn_label);

	enableVerbs(is_new);
	enableEditing(is_new);
	showEditing(!is_new);
	resetDirty();
	setInfoLoaded(false);
}
// invoked from callbackConfirmPublish
bool LLPanelClassified::confirmPublish(const LLSD& notification, const LLSD& response)
{
	S32 option = LLNotification::getSelectedOption(notification, response);
	// Option 0 = publish
	if (option != 0) return false;

	sendClassifiedInfoUpdate();

	// Big hack - assume that top picks are always in a browser,
	// and non-finder-classifieds are always in a tab container.
	if (mInFinder)
	{
		// TODO: enable this
		//LLPanelDirClassifieds* panel = (LLPanelDirClassifieds*)getParent();
		//panel->renameClassified(mClassifiedID, mNameEditor->getText());
	}
	else
	{
		LLTabContainer* tab = (LLTabContainer*)getParent();
		tab->setCurrentTabName(mNameEditor->getText());
	}

	resetDirty();
	return false;
}
Example #3
0
void LLPanelClassifiedEdit::doSave()
{
	mCanClose = true;
	sendUpdate();
	resetDirty();

	mSaveButtonClickedSignal(this, LLSD());
}
void FSPanelClassifieds::processProperties(void* data, EAvatarProcessorType type)
{
	if(APT_CLASSIFIEDS == type)
	{
		LLAvatarClassifieds* c_info = static_cast<LLAvatarClassifieds*>(data);
		if(c_info && getAvatarId() == c_info->target_id)
		{
			// do not clear classified list in case we will receive two or more data packets.
			// list has been cleared in updateData(). (fix for EXT-6436)

			LLAvatarClassifieds::classifieds_list_t::const_iterator it = c_info->classifieds_list.begin();
			for(; c_info->classifieds_list.end() != it; ++it)
			{
				LLAvatarClassifieds::classified_data c_data = *it;

				FSClassifiedItem* c_item = new FSClassifiedItem(getAvatarId(), c_data.classified_id);
				c_item->childSetAction("info_chevron", boost::bind(&FSPanelClassifieds::onClickInfo, this));
				c_item->setClassifiedName(c_data.name);

				LLSD pick_value = LLSD();
				pick_value.insert(CLASSIFIED_ID, c_data.classified_id);
				pick_value.insert(CLASSIFIED_NAME, c_data.name);

				if (!findClassifiedById(c_data.classified_id))
				{
					mClassifiedsList->addItem(c_item, pick_value);
				}

				c_item->setDoubleClickCallback(boost::bind(&FSPanelClassifieds::onDoubleClickClassifiedItem, this, _1));
				c_item->setRightMouseUpCallback(boost::bind(&FSPanelClassifieds::onRightMouseUpItem, this, _1, _2, _3, _4));
				c_item->setMouseUpCallback(boost::bind(&FSPanelClassifieds::updateButtons, this));
			}

			resetDirty();
			updateButtons();
		}
		
		mNoClassifieds = !mClassifiedsList->size();

        bool no_data = mNoClassifieds;
        mNoItemsLabel->setVisible(no_data);
        if (no_data)
        {
            if(getAvatarId() == gAgentID)
            {
                mNoItemsLabel->setValue(LLTrans::getString("NoClassifiedsText"));
            }
            else
            {
                mNoItemsLabel->setValue(LLTrans::getString("NoAvatarClassifiedsText"));
            }
        }

        enableControls();
	}
}
Example #5
0
void LLPanelPickEdit::onOpen(const LLSD& key)
{
	LLUUID pick_id = key["pick_id"];
	mNeedData = true;

	// creating new Pick
	if(pick_id.isNull())
	{
		mNewPick = true;

		setAvatarId(gAgent.getID());

		resetData();
		resetControls();

		setPosGlobal(gAgent.getPositionGlobal());

		LLUUID parcel_id = LLUUID::null, snapshot_id = LLUUID::null;
		std::string pick_name, pick_desc, region_name;

		LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
		if(parcel)
		{
			parcel_id = parcel->getID();
			pick_name = parcel->getName();
			pick_desc = parcel->getDesc();
			snapshot_id = parcel->getSnapshotID();
		}

		LLViewerRegion* region = gAgent.getRegion();
		if(region)
		{
			region_name = region->getName();
		}

		setParcelID(parcel_id);
		childSetValue("pick_name", pick_name.empty() ? region_name : pick_name);
		childSetValue("pick_desc", pick_desc);
		setSnapshotId(snapshot_id);
		setPickLocation(createLocationText(getLocationNotice(), pick_name, region_name, getPosGlobal()));

		enableSaveButton(true);
	}
	// editing existing pick
	else
	{
		mNewPick = false;
		LLPanelPickInfo::onOpen(key);

		enableSaveButton(false);
	}

	resetDirty();
}
void LLPanelClassified::reset()
{
	mClassifiedID.setNull();
	mCreatorID.setNull();
	mParcelID.setNull();

	// Don't request data, this isn't valid
	mDataRequested = TRUE;

	mDirty = false;
	mPaidFor = FALSE;

	mPosGlobal.clearVec();

	clearCtrls();
	resetDirty();
}
void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
{
	LLPanelGroupTab::setGroupID(id);

	if(id == LLUUID::null)
	{
		reset();
		return;
	}

	BOOL accept_notices = FALSE;
	BOOL list_in_profile = FALSE;
	LLGroupData data;
	if(gAgent.getGroupData(mGroupID,data))
	{
		accept_notices = data.mAcceptNotices;
		list_in_profile = data.mListInProfile;
	}
	mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices");
	if (mCtrlReceiveNotices)
	{
		mCtrlReceiveNotices->set(accept_notices);
		mCtrlReceiveNotices->setEnabled(data.mID.notNull());
	}
	
	mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile");
	if (mCtrlListGroup)
	{
		mCtrlListGroup->set(list_in_profile);
		mCtrlListGroup->setEnabled(data.mID.notNull());
	}

	mCtrlShowInGroupList->setEnabled(data.mID.notNull());

	mActiveTitleLabel = getChild<LLTextBox>("active_title_label");
	
	mComboActiveTitle = getChild<LLComboBox>("active_title");

	mFounderName->setVisible(true);

	mInsignia->setImageAssetID(LLUUID::null);

	resetDirty();

	activate();
}
Example #8
0
bool GfxCanvas::event(QEvent *)
{
    GfxTimeLine::lock()->lock();
    _timer = 0;
    QRegion r = resetDirty();

    _frameTimer.start();
    GfxTimeLine::lock()->unlock();
    if(r.isEmpty() || gfxFullRepaint)
        _w->repaint();
    else 
        _w->repaint(r);

    GfxTimeLine::lock()->lock();
    addFrameTime(_frameTimer.elapsed(), r);
    GfxTimeLine::lock()->unlock();
    return true;
}
Example #9
0
void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType type)
{
	if(APT_CLASSIFIED_INFO == type)
	{
		LLAvatarClassifiedInfo* c_info = static_cast<LLAvatarClassifiedInfo*>(data);
		if(c_info && getClassifiedId() == c_info->classified_id)
		{
			// see LLPanelClassifiedEdit::sendUpdate() for notes
			mIsNewWithErrors = false;
			// for just created classified - panel will probably be closed when we get here.
			if(!getVisible())
			{
				return;
			}

			enableEditing(true);

			setClassifiedName(c_info->name);
			setDescription(c_info->description);
			setSnapshotId(c_info->snapshot_id);
			setPosGlobal(c_info->pos_global);

			setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global));
			// *HACK see LLPanelClassifiedEdit::sendUpdate()
			setCategory(c_info->category - 1);

			bool mature = is_cf_mature(c_info->flags);
			bool auto_renew = is_cf_auto_renew(c_info->flags);

			setContentType(mature ? CB_ITEM_MATURE : CB_ITEM_PG);
			getChild<LLUICtrl>("auto_renew")->setValue(auto_renew);
			getChild<LLUICtrl>("price_for_listing")->setValue(c_info->price_for_listing);
			getChildView("price_for_listing")->setEnabled(isNew());

			resetDirty();
			setInfoLoaded(true);
			enableVerbs(false);

			// for just created classified - in case user opened edit panel before processProperties() callback 
			getChild<LLUICtrl>("save_changes_btn")->setLabelArg("[LABEL]", getString("save_label"));
		}
	}
}
Example #10
0
void MeshBase::upload() {

    // Generate vertex buffer, if needed
    if (m_glVertexBuffer == 0) {
        glGenBuffers(1, &m_glVertexBuffer);
    }

    // Buffer vertex data
    int vertexBytes = m_nVertices * m_vertexLayout->getStride();

    RenderState::vertexBuffer(m_glVertexBuffer);
    glBufferData(GL_ARRAY_BUFFER, vertexBytes, m_glVertexData, m_hint);

    // Clear vertex data that is not supposed to be updated.
    if (m_hint == GL_STATIC_DRAW && !m_keepMemoryData) {
        delete[] m_glVertexData;
        m_glVertexData = nullptr;
    }

    if (m_glIndexData) {

        if (m_glIndexBuffer == 0) {
            glGenBuffers(1, &m_glIndexBuffer);
        }

        // Buffer element index data
        RenderState::indexBuffer(m_glIndexBuffer);

        glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_nIndices * sizeof(GLushort), m_glIndexData, m_hint);

        if (!m_keepMemoryData) {
            delete[] m_glIndexData;
            m_glIndexData = nullptr;
        }
    }

    m_generation = RenderState::generation();

    m_isUploaded = true;

    resetDirty();
}
void vmsAppSettingsStore::LoadSettingsFromFile(LPCSTR pszFile)
{
	m_bUseRegistry = false;

	HANDLE hFile = CreateFile (pszFile, GENERIC_READ, FILE_SHARE_READ, NULL,
		OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL);
	if (hFile == INVALID_HANDLE_VALUE)
		return;

	try {

		DWORD dwRequiredSize = ::GetFileSize(hFile, NULL);
		DWORD dw = 0;
		if (dwRequiredSize <= 0) {
			CloseHandle (hFile);
			return;
		}

		std::auto_ptr<BYTE> pbtBufferGuard( new BYTE[dwRequiredSize] );
		LPBYTE pbtBuffer = pbtBufferGuard.get();
		if (pbtBuffer == 0) {
			CloseHandle (hFile);
			return;
		}
		memset(pbtBuffer, 0, dwRequiredSize);

		if (!ReadFile (hFile, pbtBuffer, dwRequiredSize, &dw, NULL) || dw != dwRequiredSize) {
			CloseHandle (hFile);
			return;
		}

		if (!loadFromStateBuffer(pbtBuffer, &dwRequiredSize, 0)) {
			CloseHandle (hFile);
			return;
		}

		CloseHandle (hFile);
		resetDirty();

	} catch (...) {
	}
}
void LLPanelClassified::reset()
{
	if(mCreatorID.notNull())
	{
		LLAvatarPropertiesProcessor::getInstance()->removeObserver(mCreatorID, this);
	}

	mClassifiedID.setNull();
	mCreatorID.setNull();
	mParcelID.setNull();

	// Don't request data, this isn't valid
	mDataRequested = TRUE;

	mDirty = false;
	mPaidFor = FALSE;

	mPosGlobal.clearVec();

	clearCtrls();
	resetDirty();
}
Example #13
0
void MeshBase::subDataUpload() {
    if (!m_dirty) {
        return;
    }

    if (m_hint == GL_STATIC_DRAW) {
        LOGW("Wrong usage hint provided to the Vbo");
        assert(false);
    }

    RenderState::vertexBuffer(m_glVertexBuffer);

    long vertexBytes = m_nVertices * m_vertexLayout->getStride();

    if (Hardware::supportsMapBuffer) {
        // invalidate/orphane the data store on the driver
        glBufferData(GL_ARRAY_BUFFER, vertexBytes, NULL, m_hint);
        GLvoid* dataStore = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);

        // write memory client side
        std::memcpy(dataStore, m_glVertexData, vertexBytes);

        glUnmapBuffer(GL_ARRAY_BUFFER);
    } else {
        // when all vertices are modified, it's better to update the entire mesh
        if (vertexBytes - m_dirtySize < m_vertexLayout->getStride()) {
            // invalidate/orphane the data store on the driver
            glBufferData(GL_ARRAY_BUFFER, vertexBytes, NULL, m_hint);
            // if this buffer is still used by gpu on current frame this call will not wait
            // for the frame to finish using the vbo but "directly" send command to upload the data
            glBufferData(GL_ARRAY_BUFFER, vertexBytes, m_glVertexData, m_hint);
        } else {
            // perform simple sub data upload for part of the buffer
            glBufferSubData(GL_ARRAY_BUFFER, m_dirtyOffset, m_dirtySize, m_glVertexData + m_dirtyOffset);
        }
    }

    resetDirty();
}
void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
{
	LLPanelGroupTab::setGroupID(id);
	// <FS> Get group key display and copy URI/name button pointers
	LLTextEditor* groupKeyEditor = getChild<LLTextEditor>("group_key");
	LLButton* copyURIButton = getChild<LLButton>("copy_uri");
	LLButton* copyNameButton = getChild<LLButton>("copy_name");
	// happens when a new group is created
	// </FS>
	if(id == LLUUID::null)
	{
		// <FS>
		if (groupKeyEditor)
			groupKeyEditor->setValue(LLSD());

		if (copyURIButton)
			copyURIButton->setEnabled(FALSE);

		if (copyNameButton)
			copyNameButton->setEnabled(FALSE);
		// </FS>

		reset();
		return;
	}
	// <FS>
	// fill in group key
	if (groupKeyEditor)
		groupKeyEditor->setValue(id.asString());

	// activate copy URI button
	if (copyURIButton)
		copyURIButton->setEnabled(TRUE);
	// </FS>

	BOOL accept_notices = FALSE;
	BOOL list_in_profile = FALSE;
	LLGroupData data;
	if(gAgent.getGroupData(mGroupID,data))
	{
		accept_notices = data.mAcceptNotices;
		list_in_profile = data.mListInProfile;
	}
	mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices");
	if (mCtrlReceiveNotices)
	{
		mCtrlReceiveNotices->set(accept_notices);
		mCtrlReceiveNotices->setEnabled(data.mID.notNull());
	}
	
	mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile");
	if (mCtrlListGroup)
	{
		mCtrlListGroup->set(list_in_profile);
		mCtrlListGroup->setEnabled(data.mID.notNull());
	}

	// <exodus>
	mCtrlReceiveGroupChat = getChild<LLCheckBoxCtrl>("receive_chat");
	if (mCtrlReceiveGroupChat)
	{
		if(data.mID.notNull())
		{
			mCtrlReceiveGroupChat->set(!exoGroupMuteList::instance().isMuted(data.mID));
		}
		mCtrlReceiveGroupChat->setEnabled(data.mID.notNull());
	}
	// </exodus>

	mCtrlShowInGroupList->setEnabled(data.mID.notNull());

	mActiveTitleLabel = getChild<LLTextBox>("active_title_label");
	
	mComboActiveTitle = getChild<LLComboBox>("active_title");

	mFounderName->setVisible(true);

	mInsignia->setImageAssetID(LLUUID::null);

	resetDirty();

	activate();
}
Example #15
0
void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type)
{
	if(APT_PICKS == type)
	{
		LLAvatarPicks* avatar_picks = static_cast<LLAvatarPicks*>(data);
		if(avatar_picks && getAvatarId() == avatar_picks->target_id)
		{
			std::string full_name;
			gCacheName->getFullName(getAvatarId(), full_name);
			getChild<LLUICtrl>("pick_title")->setTextArg("[NAME]", full_name);
			
			// Save selection, to be able to edit same item after saving changes. See EXT-3023.
			LLUUID selected_id = mPicksList->getSelectedValue()[PICK_ID];

			mPicksList->clear();

			LLAvatarPicks::picks_list_t::const_iterator it = avatar_picks->picks_list.begin();
			for(; avatar_picks->picks_list.end() != it; ++it)
			{
				LLUUID pick_id = it->first;
				std::string pick_name = it->second;

				LLPickItem* picture = LLPickItem::create();
				picture->childSetAction("info_chevron", boost::bind(&LLPanelPicks::onClickInfo, this));
				picture->setPickName(pick_name);
				picture->setPickId(pick_id);
				picture->setCreatorId(getAvatarId());

				LLAvatarPropertiesProcessor::instance().addObserver(getAvatarId(), picture);
				picture->update();

				LLSD pick_value = LLSD();
				pick_value.insert(PICK_ID, pick_id);
				pick_value.insert(PICK_NAME, pick_name);
				pick_value.insert(PICK_CREATOR_ID, getAvatarId());

				mPicksList->addItem(picture, pick_value);

				// Restore selection by item id. 
				if ( pick_id == selected_id )
					mPicksList->selectItemByValue(pick_value);

				picture->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickPickItem, this, _1));
				picture->setRightMouseUpCallback(boost::bind(&LLPanelPicks::onRightMouseUpItem, this, _1, _2, _3, _4));
				picture->setMouseUpCallback(boost::bind(&LLPanelPicks::updateButtons, this));
			}

			showAccordion("tab_picks", mPicksList->size());

			resetDirty();
			updateButtons();
		}
		
		mNoPicks = !mPicksList->size();
	}
	else if((APT_CLASSIFIEDS == type) || (APT_CLASSIFIED_INFO == type))
	{
		LLAvatarClassifieds* c_info = static_cast<LLAvatarClassifieds*>(data);
		if(c_info && getAvatarId() == c_info->target_id)
		{
			// do not clear classified list in case we will receive two or more data packets.
			// list has been cleared in updateData(). (fix for EXT-6436)

			LLAvatarClassifieds::classifieds_list_t::const_iterator it = c_info->classifieds_list.begin();
			for(; c_info->classifieds_list.end() != it; ++it)
			{
				LLAvatarClassifieds::classified_data c_data = *it;

				LLClassifiedItem* c_item = new LLClassifiedItem(getAvatarId(), c_data.classified_id);
				c_item->childSetAction("info_chevron", boost::bind(&LLPanelPicks::onClickInfo, this));
				c_item->setClassifiedName(c_data.name);

				LLSD pick_value = LLSD();
				pick_value.insert(CLASSIFIED_ID, c_data.classified_id);
				pick_value.insert(CLASSIFIED_NAME, c_data.name);

				if (!findClassifiedById(c_data.classified_id))
				{
					mClassifiedsList->addItem(c_item, pick_value);
				}

				c_item->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickClassifiedItem, this, _1));
				c_item->setRightMouseUpCallback(boost::bind(&LLPanelPicks::onRightMouseUpItem, this, _1, _2, _3, _4));
				c_item->setMouseUpCallback(boost::bind(&LLPanelPicks::updateButtons, this));
			}

			showAccordion("tab_classifieds", mClassifiedsList->size());

			resetDirty();
			updateButtons();
		}
		
		mNoClassifieds = !mClassifiedsList->size();
	}

	bool no_data = mNoPicks && mNoClassifieds;
	mNoItemsLabel->setVisible(no_data);
	if (no_data)
	{
		if(getAvatarId() == gAgentID)
		{
			mNoItemsLabel->setValue(LLTrans::getString("NoPicksClassifiedsText"));
		}
		else
		{
			mNoItemsLabel->setValue(LLTrans::getString("NoAvatarPicksClassifiedsText"));
		}
	}
}
void vmsAppSettingsStore::LoadSettingsFromFile(LPCTSTR pszFile)
{
	m_bUseRegistry = false;

	HANDLE hFile = CreateFile (pszFile, GENERIC_READ, FILE_SHARE_READ, NULL,
		OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL);
	if (hFile == INVALID_HANDLE_VALUE)
		return;

	try 
	{
		DWORD dwRequiredSize = ::GetFileSize(hFile, NULL);
		DWORD dw = 0;
		if (dwRequiredSize <= 0) {
			CloseHandle (hFile);
			return;
		}

		vmsAppSettingsFileHdr hdr;
		bool bIsOldVer = false;
		if (dwRequiredSize < sizeof(hdr))
			bIsOldVer = true;

		if (!bIsOldVer) {
			if (!ReadFile (hFile, &hdr, sizeof(hdr), &dw, NULL) || dw != sizeof(hdr)) {
				CloseHandle (hFile);
				return;
			}

			if (strcmp(hdr.szSig, APPSETTINGS_FILE_SIG))
				bIsOldVer = true;
		}

		if (bIsOldVer) {
			::SetFilePointer(hFile, 0, 0, FILE_BEGIN);
			m_file.LoadFromFile_old(hFile);
			CloseHandle (hFile);
			return;
		}

		if (hdr.wVer > APPSETTINGS_FILE_CURRENT_VERSION)
			return;

		dwRequiredSize -= sizeof(hdr);

		std::auto_ptr<BYTE> pbtBufferGuard( new BYTE[dwRequiredSize] );
		LPBYTE pbtBuffer = pbtBufferGuard.get();
		if (pbtBuffer == 0) {
			CloseHandle (hFile);
			return;
		}
		memset(pbtBuffer, 0, dwRequiredSize);

		if (!ReadFile (hFile, pbtBuffer, dwRequiredSize, &dw, NULL) || dw != dwRequiredSize) {
			CloseHandle (hFile);
			return;
		}

		if (!loadFromStateBuffer(pbtBuffer, &dwRequiredSize, 0)) {
			CloseHandle (hFile);
			return;
		}

		CloseHandle (hFile);
		resetDirty();
	} 
	catch (const std::exception& ex)
	{
		ASSERT (FALSE);
		vmsLogger::WriteLog(_T ("vmsAppSettingsStore::LoadSettingsFromFile ") + tstringFromString(ex.what()));
	}
	catch (...)
	{
		ASSERT (FALSE);
		vmsLogger::WriteLog(_T("vmsAppSettingsStore::LoadSettingsFromFile unknown exception"));
	}
}
/* virtual */ 
void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
{
	std::string message_class = message.getClass();
	
	if (message_class == LLPLUGIN_MESSAGE_CLASS_BASIC)
	{
		LLPluginClassBasic::receivePluginMessage(message);
	}
	else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA)
	{
		std::string message_name = message.getName();
		if(message_name == "texture_params")
		{
			mRequestedTextureDepth = message.getValueS32("depth");
			mRequestedTextureInternalFormat = message.getValueU32("internalformat");
			mRequestedTextureFormat = message.getValueU32("format");
			mRequestedTextureType = message.getValueU32("type");
			mRequestedTextureSwapBytes = message.getValueBoolean("swap_bytes");
			mRequestedTextureCoordsOpenGL = message.getValueBoolean("coords_opengl");			
			
			// These two are optional, and will default to 0 if they're not specified.
			mDefaultMediaWidth = message.getValueS32("default_width");
			mDefaultMediaHeight = message.getValueS32("default_height");
			
			mAllowDownsample = message.getValueBoolean("allow_downsample");
			mPadding = message.getValueS32("padding");

			setSizeInternal();
			
			mTextureParamsReceived = true;
		}
		else if(message_name == "updated")
		{			
			if(message.hasValue("left"))
			{
				LLRect newDirtyRect;
				newDirtyRect.mLeft = message.getValueS32("left");
				newDirtyRect.mTop = message.getValueS32("top");
				newDirtyRect.mRight = message.getValueS32("right");
				newDirtyRect.mBottom = message.getValueS32("bottom");
							
				// The plugin is likely to have top and bottom switched, due to vertical flip and OpenGL coordinate confusion.
				// If they're backwards, swap them.
				if(newDirtyRect.mTop < newDirtyRect.mBottom)
				{
					S32 temp = newDirtyRect.mTop;
					newDirtyRect.mTop = newDirtyRect.mBottom;
					newDirtyRect.mBottom = temp;
				}
				
				if(mDirtyRect.isEmpty())
				{
					mDirtyRect = newDirtyRect;
				}
				else
				{
					mDirtyRect.unionWith(newDirtyRect);
				}

				LL_DEBUGS("PluginUpdated") << "adjusted incoming rect is: (" 
					<< newDirtyRect.mLeft << ", "
					<< newDirtyRect.mTop << ", "
					<< newDirtyRect.mRight << ", "
					<< newDirtyRect.mBottom << "), new dirty rect is: ("
					<< mDirtyRect.mLeft << ", "
					<< mDirtyRect.mTop << ", "
					<< mDirtyRect.mRight << ", "
					<< mDirtyRect.mBottom << ")"
					<< LL_ENDL;
				
				mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CONTENT_UPDATED);
			}			
			

			bool time_duration_updated = false;
			int previous_percent = mProgressPercent;

			if(message.hasValue("current_time"))
			{
				mCurrentTime = message.getValueReal("current_time");
				time_duration_updated = true;
			}
			if(message.hasValue("duration"))
			{
				mDuration = message.getValueReal("duration");
				time_duration_updated = true;
			}

			if(message.hasValue("current_rate"))
			{
				mCurrentRate = message.getValueReal("current_rate");
			}
			
			if(message.hasValue("loaded_duration"))
			{
				mLoadedDuration = message.getValueReal("loaded_duration");
				time_duration_updated = true;
			}
			else
			{
				// If the message doesn't contain a loaded_duration param, assume it's equal to duration
				mLoadedDuration = mDuration;
			}
			
			// Calculate a percentage based on the loaded duration and total duration.
			if(mDuration != 0.0f)	// Don't divide by zero.
			{
				mProgressPercent = (int)((mLoadedDuration * 100.0f)/mDuration);
			}

			if(time_duration_updated)
			{
				mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_TIME_DURATION_UPDATED);
			}
			
			if(previous_percent != mProgressPercent)
			{
				mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PROGRESS_UPDATED);
			}
		}
		else if(message_name == "media_status")
		{
			std::string status = message.getValue("status");
			
			LL_DEBUGS("Plugin") << "Status changed to: " << status << LL_ENDL;
			
			if(status == "loading")
			{
				mStatus = LLPluginClassMediaOwner::MEDIA_LOADING;
			}
			else if(status == "loaded")
			{
				mStatus = LLPluginClassMediaOwner::MEDIA_LOADED;
			}
			else if(status == "error")
			{
				mStatus = LLPluginClassMediaOwner::MEDIA_ERROR;
			}
			else if(status == "playing")
			{
				mStatus = LLPluginClassMediaOwner::MEDIA_PLAYING;
			}
			else if(status == "paused")
			{
				mStatus = LLPluginClassMediaOwner::MEDIA_PAUSED;
			}
			else if(status == "done")
			{
				mStatus = LLPluginClassMediaOwner::MEDIA_DONE;
			}
			else
			{
				// empty string or any unknown string
				mStatus = LLPluginClassMediaOwner::MEDIA_NONE;
			}
		}
		else if(message_name == "size_change_request")
		{
			S32 width = message.getValueS32("width");
			S32 height = message.getValueS32("height");
			std::string name = message.getValue("name");

			// TODO: check that name matches?
			mNaturalMediaWidth = width;
			mNaturalMediaHeight = height;
			
			setSizeInternal();
		}
		else if(message_name == "size_change_response")
		{
			std::string name = message.getValue("name");
			
			// TODO: check that name matches?
			
			mTextureWidth = message.getValueS32("texture_width");
			mTextureHeight = message.getValueS32("texture_height");
			mMediaWidth = message.getValueS32("width");
			mMediaHeight = message.getValueS32("height");
			
			// This invalidates any existing dirty rect.
			resetDirty();
			
			// TODO: should we verify that the plugin sent back the right values?  
			// Two size changes in a row may cause them to not match, due to queueing, etc.

			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_SIZE_CHANGED);
		}
		else if(message_name == "cursor_changed")
		{
			mCursorName = message.getValue("name");

			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CURSOR_CHANGED);
		}
		else if(message_name == "edit_state")
		{
			if(message.hasValue("cut"))
			{
				mCanCut = message.getValueBoolean("cut");
			}
			if(message.hasValue("copy"))
			{
				mCanCopy = message.getValueBoolean("copy");
			}
			if(message.hasValue("paste"))
			{
				mCanPaste = message.getValueBoolean("paste");
			}
		}
		else if(message_name == "name_text")
		{
			mMediaName = message.getValue("name");
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAME_CHANGED);
		}
		else if(message_name == "pick_file")
		{
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PICK_FILE_REQUEST);
		}
		else if(message_name == "auth_request")
		{
			mAuthURL = message.getValue("url");
			mAuthRealm = message.getValue("realm");
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_AUTH_REQUEST);
		}		
		else if(message_name == "debug_message")
		{
			mDebugMessageText = message.getValue("message_text");
			mDebugMessageLevel = message.getValue("message_level");
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_DEBUG_MESSAGE);
		}
		else
		{
			LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
		}
	}
	else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER)
	{
		std::string message_name = message.getName();
		if(message_name == "navigate_begin")
		{
			mNavigateURI = message.getValue("uri");
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_BEGIN);
		}
		else if(message_name == "navigate_complete")
		{
			mNavigateURI = message.getValue("uri");
			mNavigateResultCode = message.getValueS32("result_code");
			mNavigateResultString = message.getValue("result_string");
			mHistoryBackAvailable = message.getValueBoolean("history_back_available");
			mHistoryForwardAvailable = message.getValueBoolean("history_forward_available");
			
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_COMPLETE);
		}
		else if(message_name == "progress")
		{
			mProgressPercent = message.getValueS32("percent");
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PROGRESS_UPDATED);
		}
		else if(message_name == "status_text")
		{
			mStatusText = message.getValue("status");
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_STATUS_TEXT_CHANGED);
		}
		else if(message_name == "location_changed")
		{
			mLocation = message.getValue("uri");
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_LOCATION_CHANGED);
		}
		else if(message_name == "click_href")
		{
			mClickURL = message.getValue("uri");
			mClickTarget = message.getValue("target");
			mClickUUID = message.getValue("uuid");
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_HREF);
		}
		else if(message_name == "click_nofollow")
		{
			mClickURL = message.getValue("uri");
			mClickNavType = message.getValue("nav_type");
			mClickTarget.clear();
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW);
		}
		else if(message_name == "navigate_error_page")
		{
			mStatusCode = message.getValueS32("status_code");
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_ERROR_PAGE);
		}
		else if(message_name == "cookie_set")
		{
			if(mOwner)
			{
				mOwner->handleCookieSet(this, message.getValue("cookie"));
			}
		}
		else if(message_name == "close_request")
		{
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLOSE_REQUEST);
		}
		else if(message_name == "geometry_change")
		{
			mClickUUID = message.getValue("uuid");
			mGeometryX = message.getValueS32("x");
			mGeometryY = message.getValueS32("y");
			mGeometryWidth = message.getValueS32("width");
			mGeometryHeight = message.getValueS32("height");
				
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_GEOMETRY_CHANGE);
		}
		else if(message_name == "link_hovered")
		{
			// text is not currently used -- the tooltip hover text is taken from the "title".
			mHoverLink = message.getValue("link");
			mHoverText = message.getValue("title");
			// message.getValue("text");
				
			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_LINK_HOVERED);
		}
		else
		{
			LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
		}
	}
	else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME)
	{
		std::string message_name = message.getName();

		// This class hasn't defined any incoming messages yet.
//		if(message_name == "message_name")
//		{
//		}
//		else 
		{
			LL_WARNS("Plugin") << "Unknown " << message_class << " class message: " << message_name << LL_ENDL;
		}
	}
}
void LLPluginClassMedia::idle_impl(void)
{
	if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == NULL) || (mPlugin->isBlocked()) || (mOwner == NULL))
	{
		// Can't process a size change at this time
	}
	else if((mRequestedMediaWidth != mMediaWidth) || (mRequestedMediaHeight != mMediaHeight))
	{
		// Calculate the correct size for the media texture
		mRequestedTextureHeight = mRequestedMediaHeight;
		if(mPadding < 0)
		{
			// negative values indicate the plugin wants a power of 2
			mRequestedTextureWidth = nextPowerOf2(mRequestedMediaWidth);
		}
		else
		{
			mRequestedTextureWidth = mRequestedMediaWidth;
			
			if(mPadding > 1)
			{
				// Pad up to a multiple of the specified number of bytes per row
				int rowbytes = mRequestedTextureWidth * mRequestedTextureDepth;
				int pad = rowbytes % mPadding;
				if(pad != 0)
				{
					rowbytes += mPadding - pad;
				}
				
				if(rowbytes % mRequestedTextureDepth == 0)
				{
					mRequestedTextureWidth = rowbytes / mRequestedTextureDepth;
				}
				else
				{
					LL_WARNS("Plugin") << "Unable to pad texture width, padding size " << mPadding << "is not a multiple of pixel size " << mRequestedTextureDepth << LL_ENDL;
				}
			}
		}

		
		// Size change has been requested but not initiated yet.
		size_t newsize = mRequestedTextureWidth * mRequestedTextureHeight * mRequestedTextureDepth;

		// Add an extra line for padding, just in case.
		newsize += mRequestedTextureWidth * mRequestedTextureDepth;

		if(newsize != mTextureSharedMemorySize)
		{
			if(!mTextureSharedMemoryName.empty())
			{
				// Tell the plugin to remove the old memory segment
				mPlugin->removeSharedMemory(mTextureSharedMemoryName);
				mTextureSharedMemoryName.clear();
			}
			
			mTextureSharedMemorySize = newsize;
			mTextureSharedMemoryName = mPlugin->addSharedMemory(mTextureSharedMemorySize);
			if(!mTextureSharedMemoryName.empty())
			{
				void *addr = mPlugin->getSharedMemoryAddress(mTextureSharedMemoryName);
				
				// clear texture memory to avoid random screen visual fuzz from uninitialized texture data
				memset( addr, 0x00, newsize );
				
				// We could do this to force an update, but textureValid() will still be returning false until the first roundtrip to the plugin,
				// so it may not be worthwhile.
				// mDirtyRect.setOriginAndSize(0, 0, mRequestedMediaWidth, mRequestedMediaHeight);
			}
		}
		
		// This is our local indicator that a change is in progress.
		mTextureWidth = -1;
		mTextureHeight = -1;
		mMediaWidth = -1;
		mMediaHeight = -1;

		// This invalidates any existing dirty rect.
		resetDirty();
		
		// Send a size change message to the plugin
		{
			LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change");
			message.setValue("name", mTextureSharedMemoryName);
			message.setValueS32("width", mRequestedMediaWidth);
			message.setValueS32("height", mRequestedMediaHeight);
			message.setValueS32("texture_width", mRequestedTextureWidth);
			message.setValueS32("texture_height", mRequestedTextureHeight);
			message.setValueReal("background_r", mBackgroundColor.mV[VX]);
			message.setValueReal("background_g", mBackgroundColor.mV[VY]);
			message.setValueReal("background_b", mBackgroundColor.mV[VZ]);
			message.setValueReal("background_a", mBackgroundColor.mV[VW]);
			mPlugin->sendMessage(message);	// DO NOT just use sendMessage() here -- we want this to jump ahead of the queue.
			
			LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL;
		}
	}
}
bool LLPanelGroupGeneral::apply(std::string& mesg)
{
	if (!mGroupID.isNull() && mAllowEdit && mComboActiveTitle && mComboActiveTitle->isDirty())
	{
		LLGroupMgr::getInstance()->sendGroupTitleUpdate(mGroupID,mComboActiveTitle->getCurrentID());
		update(GC_TITLES);
		mComboActiveTitle->resetDirty();
	}

	BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);

	if (has_power_in_group || mGroupID.isNull())
	{
		llinfos << "LLPanelGroupGeneral::apply" << llendl;

		// Check to make sure mature has been set
		if(mComboMature &&
		   mComboMature->getCurrentIndex() == DECLINE_TO_STATE)
		{
			LLNotificationsUtil::add("SetGroupMature", LLSD(), LLSD(), 
											boost::bind(&LLPanelGroupGeneral::confirmMatureApply, this, _1, _2));
			return false;
		}

		if (mGroupID.isNull())
		{
			// Validate the group name length.
			S32 group_name_len = mGroupNameEditor->getText().size();
			if ( group_name_len < DB_GROUP_NAME_MIN_LEN 
				|| group_name_len > DB_GROUP_NAME_STR_LEN)
			{
				std::ostringstream temp_error;
				temp_error << "A group name must be between " << DB_GROUP_NAME_MIN_LEN
					<< " and " << DB_GROUP_NAME_STR_LEN << " characters.";
				mesg = temp_error.str();
				return false;
			}

			LLNotificationsUtil::add("CreateGroupCost",  LLSD(), LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2));

			return false;
		}

		LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
		if (!gdatap)
		{
			mesg = LLTrans::getString("NoGroupDataFound");
			mesg.append(mGroupID.asString());
			return false;
		}
		bool can_change_ident = false;
		bool can_change_member_opts = false;
		can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
		can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);

		if (can_change_ident)
		{
			if (mEditCharter) gdatap->mCharter = mEditCharter->getText();
			if (mInsignia) gdatap->mInsigniaID = mInsignia->getImageAssetID();
			if (mComboMature)
			{
				if (!gAgent.isTeen())
				{
					gdatap->mMaturePublish = 
						mComboMature->getCurrentIndex() == MATURE_CONTENT;
				}
				else
				{
					gdatap->mMaturePublish = FALSE;
				}
			}
			if (mCtrlShowInGroupList) gdatap->mShowInList = mCtrlShowInGroupList->get();
		}

		if (can_change_member_opts)
		{
			if (mCtrlOpenEnrollment) gdatap->mOpenEnrollment = mCtrlOpenEnrollment->get();
			if (mCtrlEnrollmentFee && mSpinEnrollmentFee)
			{
				gdatap->mMembershipFee = (mCtrlEnrollmentFee->get()) ? 
					(S32) mSpinEnrollmentFee->get() : 0;
				// Set to the used value, and reset initial value used for isdirty check
				mSpinEnrollmentFee->set( (F32)gdatap->mMembershipFee );
			}
		}

		if (can_change_ident || can_change_member_opts)
		{
			LLGroupMgr::getInstance()->sendUpdateGroupInfo(mGroupID);
		}
	}

	BOOL receive_notices = false;
	BOOL list_in_profile = false;
	if (mCtrlReceiveNotices)
		receive_notices = mCtrlReceiveNotices->get();
	if (mCtrlListGroup) 
		list_in_profile = mCtrlListGroup->get();

	gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);

	resetDirty();

	mChanged = FALSE;

	return true;
}
BOOL LLPanelClassified::postBuild()
{
    mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl");
	mSnapshotCtrl->setCommitCallback(onCommitAny);
	mSnapshotCtrl->setCallbackUserData(this);
	mSnapshotSize = mSnapshotCtrl->getRect();

    mNameEditor = getChild<LLLineEditor>("given_name_editor");
	mNameEditor->setMaxTextLength(DB_PARCEL_NAME_LEN);
	mNameEditor->setCommitOnFocusLost(TRUE);
	mNameEditor->setFocusReceivedCallback(focusReceived, this);
	mNameEditor->setCommitCallback(onCommitAny);
	mNameEditor->setCallbackUserData(this);
	mNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII );

    mDescEditor = getChild<LLTextEditor>("desc_editor");
	mDescEditor->setCommitOnFocusLost(TRUE);
	mDescEditor->setFocusReceivedCallback(focusReceived, this);
	mDescEditor->setCommitCallback(onCommitAny);
	mDescEditor->setCallbackUserData(this);
	mDescEditor->setTabsToNextField(TRUE);

    mLocationEditor = getChild<LLLineEditor>("location_editor");

    mSetBtn = getChild<LLButton>( "set_location_btn");
    mSetBtn->setClickedCallback(onClickSet);
    mSetBtn->setCallbackUserData(this);

    mTeleportBtn = getChild<LLButton>( "classified_teleport_btn");
    mTeleportBtn->setClickedCallback(onClickTeleport);
    mTeleportBtn->setCallbackUserData(this);

    mMapBtn = getChild<LLButton>( "classified_map_btn");
    mMapBtn->setClickedCallback(onClickMap);
    mMapBtn->setCallbackUserData(this);

	if(mInFinder)
	{
		mProfileBtn  = getChild<LLButton>( "classified_profile_btn");
		mProfileBtn->setClickedCallback(onClickProfile);
		mProfileBtn->setCallbackUserData(this);
	}

	mCategoryCombo = getChild<LLComboBox>( "classified_category_combo");
	LLClassifiedInfo::cat_map::iterator iter;
	for (iter = LLClassifiedInfo::sCategories.begin();
		iter != LLClassifiedInfo::sCategories.end();
		iter++)
	{
		mCategoryCombo->add(iter->second, (void *)((intptr_t)iter->first), ADD_BOTTOM);
	}
	mCategoryCombo->setCurrentByIndex(0);
	mCategoryCombo->setCommitCallback(onCommitAny);
	mCategoryCombo->setCallbackUserData(this);

	mMatureCombo = getChild<LLComboBox>( "classified_mature_check");
	mMatureCombo->setCurrentByIndex(0);
	mMatureCombo->setCommitCallback(onCommitAny);
	mMatureCombo->setCallbackUserData(this);
	if (gAgent.wantsPGOnly())
	{
		// Teens don't get to set mature flag. JC
		mMatureCombo->setVisible(FALSE);
		mMatureCombo->setCurrentByIndex(PG_CONTENT);
	}

	if (!mInFinder)
	{
		mAutoRenewCheck = getChild<LLCheckBoxCtrl>( "auto_renew_check");
		mAutoRenewCheck->setCommitCallback(onCommitAny);
		mAutoRenewCheck->setCallbackUserData(this);
	}

	mUpdateBtn = getChild<LLButton>("classified_update_btn");
    mUpdateBtn->setClickedCallback(onClickUpdate);
    mUpdateBtn->setCallbackUserData(this);

	if (!mInFinder)
	{
		mClickThroughText = getChild<LLTextBox>("click_through_text");
	}
	
	resetDirty();
    return TRUE;
}
bool FractalConfiguration::open(string filename)
{
	if(invalidID())
		return true;

	m_dirty = false;

	XMLDocument doc;

	// Parse file
	doc.LoadFile(filename.c_str());

	if(doc.Error())
	{
		m_last_error = doc.GetErrorStr1();
		return true;
	}

	// Get data
	XMLElement *root = doc.RootElement();

	string name = string(root->Name());

	if(name != "fractal")
	{
		m_last_error = "Configuration file is invalid!";
		return true;
	}

	if(root->Attribute("id", m_id.c_str()))
	{
		XMLNode *node = root->FirstChild();

		// Loop over all properties
		while(node != NULL)
		{
			XMLElement *element = node->ToElement();

			if(element == NULL)
			{
				m_last_error = "Configuration file is invalid!";
				return true;
			}

			// Get name and type (attributes)
			const char* tmp_name = element->Attribute("name");
			const char* tmp_type = element->Attribute("type");

			if(tmp_name == NULL || tmp_type == NULL)
			{
				m_last_error = "Configuration file is invalid!";
				return true;
			}

			string name(tmp_name);
			string type(tmp_type);

			// Get text
			const char* tmp_text = element->GetText();
			string text = "";

			if(tmp_text != NULL)
				text = tmp_text;

			// Set property
			if(type == "string")
			{
				if(setStringProperty(name, text))
					return true;
			}
			else if(type == "int")
			{
				int value;
				if(stringToInt(text, &value))
				{
					m_last_error = "Error in configuration: " + text + " should be an integer";
					return true;
				}

				if(setIntProperty(name, value))
					return true;
			}
			else if(type == "double")
			{
				double value;
				if(stringToDouble(text, &value))
				{
					m_last_error = "Error in configuration: " + text + " should be a double";
					return true;
				}

				if(setDoubleProperty(name, value))
					return true;
			}
			else if(type == "bool")
			{
				bool value;
				if(text == "1")
					value = true;
				else if(text == "0")
					value = false;
				else
				{
					m_last_error = "Error in configuration: " + text + " should be boolean (0 or 1)";
					return true;
				}

				if(setBoolProperty(name, value))
					return true;
			}
			else
			{
				m_last_error = "Error in configuration: " + type + " is not a valid type";
				return true;
			}

			// Next node
			node = node->NextSibling();
		}
	}
	else
	{
		m_last_error = "File contains not the configuration of a fractal with ID " + m_id;
		return true;
	}

	resetDirty();

	return false;
}
void LLPanelGroupGeneral::reset()
{
	mFounderName->setVisible(false);

	
	mCtrlReceiveNotices->set(false);
	
	
	mCtrlListGroup->set(true);
	
	mCtrlReceiveNotices->setEnabled(false);
	mCtrlReceiveNotices->setVisible(true);

	mCtrlListGroup->setEnabled(false);

	mGroupNameEditor->setEnabled(TRUE);
	mEditCharter->setEnabled(TRUE);

	mCtrlShowInGroupList->setEnabled(false);
	mComboMature->setEnabled(TRUE);
	
	mCtrlOpenEnrollment->setEnabled(TRUE);
	
	mCtrlEnrollmentFee->setEnabled(TRUE);
	
	mSpinEnrollmentFee->setEnabled(TRUE);
	mSpinEnrollmentFee->set((F32)0);

	mGroupNameEditor->setVisible(true);

	mComboActiveTitle->setVisible(false);

	mInsignia->setImageAssetID(LLUUID::null);
	
	mInsignia->setEnabled(true);

	mInsignia->setImageAssetName(mInsignia->getDefaultImageName());

	{
		std::string empty_str = "";
		mEditCharter->setText(empty_str);
		mGroupNameEditor->setText(empty_str);
	}
	
	{
		LLSD row;
		row["columns"][0]["value"] = "no members yet";
		row["columns"][0]["column"] = "name";

		mListVisibleMembers->deleteAllItems();
		mListVisibleMembers->setEnabled(FALSE);
		mListVisibleMembers->addElement(row);
	}


	{
		mComboMature->setEnabled(true);
		mComboMature->setVisible( !gAgent.isTeen() );
		mComboMature->selectFirstItem();
	}


	resetDirty();
}
// virtual
void LLPanelGroupGeneral::update(LLGroupChange gc)
{
	if (mGroupID.isNull()) return;

	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);

	if (!gdatap) return;

	LLGroupData agent_gdatap;
	bool is_member = false;
	if (gAgent.getGroupData(mGroupID,agent_gdatap)) is_member = true;

	if (mComboActiveTitle)
	{
		mComboActiveTitle->setVisible(is_member);
		mComboActiveTitle->setEnabled(mAllowEdit);
		
		if ( mActiveTitleLabel) mActiveTitleLabel->setVisible(is_member);

		if (is_member)
		{
			LLUUID current_title_role;

			mComboActiveTitle->clear();
			mComboActiveTitle->removeall();
			bool has_selected_title = false;

			if (1 == gdatap->mTitles.size())
			{
				// Only the everyone title.  Don't bother letting them try changing this.
				mComboActiveTitle->setEnabled(FALSE);
			}
			else
			{
				mComboActiveTitle->setEnabled(TRUE);
			}

			std::vector<LLGroupTitle>::const_iterator citer = gdatap->mTitles.begin();
			std::vector<LLGroupTitle>::const_iterator end = gdatap->mTitles.end();
			
			for ( ; citer != end; ++citer)
			{
				mComboActiveTitle->add(citer->mTitle,citer->mRoleID, (citer->mSelected ? ADD_TOP : ADD_BOTTOM));
				if (citer->mSelected)
				{
					mComboActiveTitle->setCurrentByID(citer->mRoleID);
					has_selected_title = true;
				}
			}
			
			if (!has_selected_title)
			{
				mComboActiveTitle->setCurrentByID(LLUUID::null);
			}
		}

	}

	// If this was just a titles update, we are done.
	if (gc == GC_TITLES) return;

	bool can_change_ident = false;
	bool can_change_member_opts = false;
	can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
	can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);

	if (mCtrlShowInGroupList) 
	{
		mCtrlShowInGroupList->set(gdatap->mShowInList);
		mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident);
	}
	if (mComboMature)
	{
		if(gdatap->mMaturePublish)
		{
			mComboMature->setCurrentByIndex(MATURE_CONTENT);
		}
		else
		{
			mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
		}
		mComboMature->setEnabled(mAllowEdit && can_change_ident);
		mComboMature->setVisible( !gAgent.isTeen() );
	}
	if (mCtrlOpenEnrollment) 
	{
		mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment);
		mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts);
	}
	if (mCtrlEnrollmentFee) 
	{	
		mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0);
		mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts);
	}
	
	if (mSpinEnrollmentFee)
	{
		S32 fee = gdatap->mMembershipFee;
		mSpinEnrollmentFee->set((F32)fee);
		mSpinEnrollmentFee->setEnabled( mAllowEdit &&
						(fee > 0) &&
						can_change_member_opts);
	}
	if (mCtrlReceiveNotices)
	{
		mCtrlReceiveNotices->setVisible(is_member);
		if (is_member)
		{
			mCtrlReceiveNotices->setEnabled(mAllowEdit);
		}
	}


	if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
	if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
	
	if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE);
	if (mFounderName) mFounderName->setText(LLSLURL("agent", gdatap->mFounderID, "inspect").getSLURLString());
	if (mInsignia)
	{
		if (gdatap->mInsigniaID.notNull())
		{
			mInsignia->setImageAssetID(gdatap->mInsigniaID);
		}
		else
		{
			mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
		}
	}

	if (mEditCharter)
	{
		mEditCharter->setText(gdatap->mCharter);
	}
	
	if (mListVisibleMembers)
	{
		mListVisibleMembers->deleteAllItems();

		if (gdatap->isMemberDataComplete())
		{
			mMemberProgress = gdatap->mMembers.begin();
			mPendingMemberUpdate = TRUE;

			sSDTime = 0.0f;
			sElementTime = 0.0f;
			sAllTime = 0.0f;
		}
		else
		{
			std::stringstream pending;
			pending << "Retrieving member list (" << gdatap->mMembers.size() << "\\" << gdatap->mMemberCount  << ")";

			LLSD row;
			row["columns"][0]["value"] = pending.str();
			row["columns"][0]["column"] = "name";

			mListVisibleMembers->setEnabled(FALSE);
			mListVisibleMembers->addElement(row);
		}
	}

	resetDirty();
}
BOOL fsWebPageDownloadsMgr::Load()
{
	m_vWPDs.clear ();

	HANDLE hFile = CreateFile (fsGetDataFilePath (_T("spider.sav")), GENERIC_READ, FILE_SHARE_READ, NULL,
		OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL);

	if (hFile == INVALID_HANDLE_VALUE)
		return FALSE;

	if (GetLastError () != ERROR_ALREADY_EXISTS)
	{
		CloseHandle (hFile);
		return TRUE;
	}

	int cWPD = 0;
	DWORD dw;
	fsSpiderFileHdr hdr;
	WORD wVer = SPIDERFILE_CURRENT_VERSION;
	DWORD dwRequiredSize = ::GetFileSize(hFile, NULL);

	if (FALSE == ReadFile (hFile, &hdr, sizeof (hdr), &dw, NULL))
	{
		wVer = 1;
	}
	else
	{
		if (dw < sizeof(hdr) || strcmp (hdr.szSig, SPIDERFILE_SIG))
		{
			wVer = 1;
			SetFilePointer (hFile, 0, NULL, FILE_BEGIN);
		}
		else
		{
			wVer = hdr.wVer;
			dwRequiredSize -= sizeof (hdr);
		}
	}

	if (wVer == 1) {

		if (FALSE == ReadFile (hFile, &cWPD, sizeof (cWPD), &dw, NULL))
		{
			CloseHandle (hFile);
			return FALSE;
		}

		for (int i = 0; i < cWPD; i++)
		{
			fsWebPageDownloaderPtr wpd; wpd.CreateInstance ();
			if (FALSE == wpd->Load (hFile, wVer))
			{
				CloseHandle (hFile);
				return FALSE;
			}
			Add (wpd);
		}

		resetDirty();

		CloseHandle (hFile);
		return TRUE;

	}

	if (dwRequiredSize == 0) {
		CloseHandle (hFile);
		return TRUE;
	}

	std::auto_ptr<BYTE> pbtBufferGuard( new BYTE[dwRequiredSize] );
	LPBYTE pbtBuffer = pbtBufferGuard.get();
	if (pbtBuffer == 0) {
		CloseHandle (hFile);
		return FALSE;
	}
	memset(pbtBuffer, 0, dwRequiredSize);

	if (!ReadFile (hFile, pbtBuffer, dwRequiredSize, &dw, NULL) || dw != dwRequiredSize) {
		CloseHandle (hFile);
		return FALSE;
	}

	if (!loadFromStateBuffer(pbtBuffer, &dwRequiredSize, hdr.wVer)) {
		getPersistObjectChildren ()->removeAllPersistObjects ();
		m_vWPDs.clear ();
		CloseHandle (hFile);
		return FALSE;
	}

	resetDirty();

	CloseHandle (hFile);
	return TRUE;
}
void LLPanelClassified::processProperties(void* data, EAvatarProcessorType type)
{
	if(APT_CLASSIFIED_INFO == type)
	{
		lldebugs << "processClassifiedInfoReply()" << llendl;
		
		LLAvatarClassifiedInfo* c_info = static_cast<LLAvatarClassifiedInfo*>(data);
		if(c_info && mClassifiedID == c_info->classified_id)
		{
			LLAvatarPropertiesProcessor::getInstance()->removeObserver(LLUUID::null, this);

		    // "Location text" is actually the original
		    // name that owner gave the parcel, and the location.
			std::string location_text = c_info->parcel_name;
			
			if (!location_text.empty())
				location_text.append(", ");

		    S32 region_x = llround((F32)c_info->pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
		    S32 region_y = llround((F32)c_info->pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
			S32 region_z = llround((F32)c_info->pos_global.mdV[VZ]);

			std::string buffer = llformat("%s (%d, %d, %d)", c_info->sim_name.c_str(), region_x, region_y, region_z);
		    location_text.append(buffer);

			//BOOL enabled = is_cf_enabled(flags);

			time_t tim = c_info->creation_date;
			tm *now=localtime(&tim);


	        // Found the panel, now fill in the information
			mClassifiedID = c_info->classified_id;
			mCreatorID = c_info->creator_id;
			mParcelID = c_info->parcel_id;
			mPriceForListing = c_info->price_for_listing;
			mSimName = c_info->sim_name;
			mPosGlobal = c_info->pos_global;

			// Update UI controls
	        mNameEditor->setText(c_info->name);
	        mDescEditor->setText(c_info->description);
	        mSnapshotCtrl->setImageAssetID(c_info->snapshot_id);
	        mLocationEditor->setText(location_text);
			mLocationChanged = false;

			mCategoryCombo->setCurrentByIndex(c_info->category - 1);

			mMatureCombo->setCurrentByIndex(is_cf_mature(c_info->flags) ? MATURE_CONTENT : PG_CONTENT);

			if (mAutoRenewCheck)
			{
				mAutoRenewCheck->set(is_cf_auto_renew(c_info->flags));
			}

			std::string datestr;
			timeStructToFormattedString(now, gSavedSettings.getString("ShortDateFormat"), datestr);
			LLStringUtil::format_map_t string_args;
			string_args["[DATE]"] = datestr;
			string_args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();
			string_args["[AMT]"] = llformat("%d", c_info->price_for_listing);
			childSetText("classified_info_text", getString("ad_placed_paid", string_args));

			// If we got data from the database, we know the listing is paid for.
			mPaidFor = TRUE;

			mUpdateBtn->setLabel(getString("update_txt"));

			resetDirty();

			// I don't know if a second call is deliberate or a bad merge, so I'm leaving it here. 
			resetDirty();
		}
    }
}
bool FractalConfiguration::save(string filename)
{
	if(invalidID())
		return true;

	// Check filename and append .xml
	if(!endsWith(filename, ".xml"))
		filename += ".xml";

	// Create document
	XMLDocument doc;

	// Root element
	XMLElement *root = doc.NewElement("fractal");
	root->SetAttribute("id", m_id.c_str());
	doc.InsertEndChild(root);

	// Add properties
	iterate();

	while(true)
	{
		if(!next())
			break;
		
		XMLElement *prop = doc.NewElement("property");
		prop->SetAttribute("name", getName().c_str());

		XMLText *text = doc.NewText("");

		if(isString())
		{
			prop->SetAttribute("type", "string");

			text->SetValue(getString().c_str());
		}
		else if(isInt())
		{
			prop->SetAttribute("type", "int");

			stringstream ss;
			ss << getInt();
			text->SetValue(ss.str().c_str());
		}
		else if(isDouble())
		{
			prop->SetAttribute("type", "double");

			stringstream ss;
			ss << getDouble();
			text->SetValue(ss.str().c_str());
		}
		else if(isBool())
		{
			prop->SetAttribute("type", "bool");

			if(getBool())
				text->SetValue("1");
			else
				text->SetValue("0");
		}

		prop->InsertEndChild(text);
		root->InsertEndChild(prop);
	}

	// Save to file
	if(doc.SaveFile(filename.c_str()) != XML_NO_ERROR)
	{
		m_last_error = doc.GetErrorStr1();
		return true;
	}

	resetDirty();

	return false;
}