BOOL lggBeamColorMapFloater::postBuild(void)
{
	setCanMinimize(false);
	childSetAction("BeamColor_Save",onClickSave,this);
	childSetAction("BeamColor_Load",onClickLoad,this);
	childSetAction("BeamColor_Cancel",onClickCancel,this);
	mColorSlider = getChild<LLSliderCtrl>("BeamColor_Speed",TRUE,FALSE);
	mColorSlider->setCommitCallback(&lggBeamColorMapFloater::onClickSlider);
	mColorSlider->setCallbackUserData(this);

	fixOrder();

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

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

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