void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& name ) { LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); if (!iface) return; buildAvatarIDList(); if(iface->setCurrentByID(avatar_id) || gAgent.isGodlike()) { // *HACK: Adjust Z values automatically for liaisons & gods so // they swoop down when they click on the map. Requested // convenience. if(gAgent.isGodlike()) { childSetValue("spin z", LLSD(200.f)); } // Don't re-request info if we already have it or we won't have it in time to teleport if (mTrackedStatus != LLTracker::TRACKING_AVATAR || name != mTrackedAvatarName) { mTrackedStatus = LLTracker::TRACKING_AVATAR; mTrackedAvatarName = name; LLTracker::trackAvatar(avatar_id, name); } } else { LLTracker::stopTracking(NULL); } setDefaultBtn("Teleport"); }
// static void LLFloaterClothing::show(void*) { if (sInstance) { sInstance->setVisibleAndFrontmost(); } else { LLFloaterClothing *self = new LLFloaterClothing(); self->buildClothingList(); if (self->mAllowSelection) { LLCtrlSelectionInterface* iface = self->childGetSelectionInterface("clothing_list"); if (iface) iface->selectFirstItem(); } self->childSetFocus("clothing_list"); self->mSelectedID = LLUUID::null; // Update button labels onCommitList(NULL, self); } gSavedSettings.setBOOL("ClothingBtnState", TRUE); }
//----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- BOOL LLFloaterImagePreview::postBuild() { if (!LLFloaterNameDesc::postBuild()) { return FALSE; } LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface) { iface->selectFirstItem(); } childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this); mPreviewRect.set(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD, getRect().getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); getChildView("bad_image_text")->setVisible(FALSE); if (mRawImagep.notNull() && gAgent.getRegion() != NULL) { mAvatarPreview = new LLImagePreviewAvatar(256, 256); mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE); mSculptedPreview = new LLImagePreviewSculpted(256, 256); mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f); if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF) getChildView("lossless_check")->setEnabled(TRUE); // <FS:CR> Temporary texture uploads if (LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() == 0 || gAgent.getRegion()->getCentralBakeVersion() > 0) { gSavedSettings.setBOOL("TemporaryUpload", FALSE); getChild<LLCheckBoxCtrl>("temp_check")->setVisible(FALSE); } // </FS:CR> } else { mAvatarPreview = NULL; mSculptedPreview = NULL; getChildView("bad_image_text")->setVisible(TRUE); getChildView("clothing_type_combo")->setEnabled(FALSE); getChildView("ok_btn")->setEnabled(FALSE); if(!mImageLoadError.empty()) { getChild<LLUICtrl>("bad_image_text")->setValue(mImageLoadError.c_str()); } } getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); return TRUE; }
//static //----------------------------------------------------------------------------- // onPreviewTypeCommit() //----------------------------------------------------------------------------- void LLFloaterImagePreview::onPreviewTypeCommit(LLUICtrl* ctrl, void* userdata) { LLFloaterImagePreview *fp =(LLFloaterImagePreview *)userdata; if (!fp->mAvatarPreview || !fp->mSculptedPreview) { return; } S32 which_mode = 0; LLCtrlSelectionInterface* iface = fp->childGetSelectionInterface("clothing_type_combo"); if (iface) { which_mode = iface->getFirstSelectedIndex(); } switch(which_mode) { case 0: break; case 1: fp->mAvatarPreview->setPreviewTarget("mSkull", "mHairMesh0", fp->mRawImagep, 0.4f, FALSE); break; case 2: fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, FALSE); break; case 3: fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.0f, FALSE); break; case 4: fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, FALSE); break; case 5: fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, TRUE); break; case 6: fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.2f, TRUE); break; case 7: fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, TRUE); break; case 8: fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mSkirtMesh0", fp->mRawImagep, 1.3f, FALSE); break; case 9: fp->mSculptedPreview->setPreviewTarget(fp->mRawImagep, 2.0f); break; default: break; } fp->mAvatarPreview->refresh(); fp->mSculptedPreview->refresh(); }
// static void LLFloaterLandHoldings::onGrantList(void* data) { LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data; LLCtrlSelectionInterface *list = self->childGetSelectionInterface("grant list"); if (!list) return; LLUUID group_id = list->getCurrentID(); if (group_id.notNull()) { LLFloaterGroupInfo::showFromUUID(group_id); } }
//----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- BOOL LLFloaterImagePreview::postBuild() { if (!LLFloaterNameDesc::postBuild()) { return FALSE; } childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee()); childSetAction("ok_btn", onBtnOK, this); LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface) { iface->selectFirstItem(); } childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this); mPreviewRect.set(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT, getRect().getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); childHide("bad_image_text"); if (mRawImagep.notNull() && gAgent.getRegion() != NULL) { mAvatarPreview = new LLImagePreviewAvatar(256, 256); mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE); mSculptedPreview = new LLImagePreviewSculpted(256, 256); mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f); if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF) childEnable("lossless_check"); // <edit> gSavedSettings.setBOOL("TemporaryUpload",FALSE); childSetValue("temp_check",FALSE); // </edit> } else { mAvatarPreview = NULL; mSculptedPreview = NULL; childShow("bad_image_text"); childDisable("clothing_type_combo"); childDisable("ok_btn"); } return TRUE; }
// public void LLFloaterLandHoldings::refresh() { LLCtrlSelectionInterface *list = childGetSelectionInterface("parcel list"); BOOL enable_btns = FALSE; if (list && list->getFirstSelectedIndex()> -1) { enable_btns = TRUE; } childSetEnabled("Teleport", enable_btns); childSetEnabled("Show on Map", enable_btns); refreshAggregates(); }
void LLFloaterWorldMap::friendsChanged() { LLAvatarTracker& t = LLAvatarTracker::instance(); const LLUUID& avatar_id = t.getAvatarID(); buildAvatarIDList(); if(avatar_id.notNull()) { LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); if(!iface || !iface->setCurrentByID(avatar_id) || !t.getBuddyInfo(avatar_id)->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION) || gAgent.isGodlike()) { LLTracker::stopTracking(NULL); } } }
void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) { LLCtrlSelectionInterface *iface = childGetSelectionInterface("landmark combo"); if (!iface) return; buildLandmarkIDLists(); BOOL found = FALSE; S32 idx; for (idx = 0; idx < mLandmarkItemIDList.count(); idx++) { if ( mLandmarkItemIDList.get(idx) == landmark_item_id) { found = TRUE; break; } } if (found && iface->setCurrentByID( landmark_item_id ) ) { LLUUID asset_id = mLandmarkAssetIDList.get( idx ); std::string name; LLComboBox* combo = getChild<LLComboBox>( "landmark combo"); if (combo) name = combo->getSimple(); mTrackedStatus = LLTracker::TRACKING_LANDMARK; LLTracker::trackLandmark(mLandmarkAssetIDList.get( idx ), // assetID mLandmarkItemIDList.get( idx ), // itemID name); // name if( asset_id != sHomeID ) { // start the download process gLandmarkList.getAsset( asset_id); } // We have to download both region info and landmark data, so set busy. JC // getWindow()->incBusyCount(); } else { LLTracker::stopTracking(NULL); } setDefaultBtn("Teleport"); }
//----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- BOOL LLFloaterSculptPreview::postBuild() { childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d",sUploadAmount)); LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface) { iface->selectFirstItem(); } childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this); mPreviewRect.set(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT, getRect().getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); childHide("bad_image_text"); if (mRawImagep.notNull() && gAgent.getRegion() != NULL) { mAvatarPreview = new LLPreviewAvatar(256, 256); mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE); mSculptedPreview = new LLPreviewSculpted(256, 256); mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f); if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF) childEnable("lossless_check"); childSetValue("temp_check",FALSE); } else { mAvatarPreview = NULL; mSculptedPreview = NULL; childShow("bad_image_text"); childDisable("clothing_type_combo"); childDisable("ok_btn"); } return TRUE; }
//----------------------------------------------------------------------------- // handleHover() //----------------------------------------------------------------------------- BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask) { MASK local_mask = mask & ~MASK_ALT; if (mAvatarPreview && hasMouseCapture()) { if (local_mask == MASK_PAN) { // pan here LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface && iface->getFirstSelectedIndex() <= 0) { mPreviewImageRect.translate((F32)(x - mLastMouseX) * -0.005f * mPreviewImageRect.getWidth(), (F32)(y - mLastMouseY) * -0.005f * mPreviewImageRect.getHeight()); } else { mAvatarPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f); mSculptedPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f); } } else if (local_mask == MASK_ORBIT) { F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f; F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f; mAvatarPreview->rotate(yaw_radians, pitch_radians); mSculptedPreview->rotate(yaw_radians, pitch_radians); } else { LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface && iface->getFirstSelectedIndex() <= 0) { F32 zoom_amt = (F32)(y - mLastMouseY) * -0.002f; mPreviewImageRect.stretch(zoom_amt); } else { F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f; F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f; mAvatarPreview->rotate(yaw_radians, 0.f); mAvatarPreview->zoom(zoom_amt); mSculptedPreview->rotate(yaw_radians, 0.f); mSculptedPreview->zoom(zoom_amt); } } LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface && iface->getFirstSelectedIndex() <= 0) { if (mPreviewImageRect.getWidth() > 1.f) { mPreviewImageRect.stretch((1.f - mPreviewImageRect.getWidth()) * 0.5f); } else if (mPreviewImageRect.getWidth() < 0.1f) { mPreviewImageRect.stretch((0.1f - mPreviewImageRect.getWidth()) * 0.5f); } if (mPreviewImageRect.getHeight() > 1.f) { mPreviewImageRect.stretch((1.f - mPreviewImageRect.getHeight()) * 0.5f); } else if (mPreviewImageRect.getHeight() < 0.1f) { mPreviewImageRect.stretch((0.1f - mPreviewImageRect.getHeight()) * 0.5f); } if (mPreviewImageRect.mLeft < 0.f) { mPreviewImageRect.translate(-mPreviewImageRect.mLeft, 0.f); } else if (mPreviewImageRect.mRight > 1.f) { mPreviewImageRect.translate(1.f - mPreviewImageRect.mRight, 0.f); } if (mPreviewImageRect.mBottom < 0.f) { mPreviewImageRect.translate(0.f, -mPreviewImageRect.mBottom); } else if (mPreviewImageRect.mTop > 1.f) { mPreviewImageRect.translate(0.f, 1.f - mPreviewImageRect.mTop); } } else { mAvatarPreview->refresh(); mSculptedPreview->refresh(); } LLUI::setCursorPositionLocal(this, mLastMouseX, mLastMouseY); } if (!mPreviewRect.pointInRect(x, y) || !mAvatarPreview || !mSculptedPreview) { return LLFloater::handleHover(x, y, mask); } else if (local_mask == MASK_ORBIT) { gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA); } else if (local_mask == MASK_PAN) { gViewerWindow->setCursor(UI_CURSOR_TOOLPAN); } else { gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN); } return TRUE; }
//----------------------------------------------------------------------------- // draw() //----------------------------------------------------------------------------- void LLFloaterImagePreview::draw() { LLFloater::draw(); LLRect r = getRect(); if (mRawImagep.notNull()) { LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); U32 selected = 0; if (iface) selected = iface->getFirstSelectedIndex(); if (selected <= 0) { gl_rect_2d_checkerboard(mPreviewRect); LLGLDisable gls_alpha(GL_ALPHA_TEST); if(mImagep.notNull()) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName()); } else { mImagep = new LLImageGL(mRawImagep, FALSE) ; gGL.getTexUnit(0)->unbind(mImagep->getTarget()) ; gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName()); stop_glerror(); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); if (mAvatarPreview) { mAvatarPreview->setTexture(mImagep->getTexName()); mSculptedPreview->setTexture(mImagep->getTexName()); } } gGL.color3f(1.f, 1.f, 1.f); gGL.begin( LLRender::QUADS ); { gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mBottom); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mBottom); gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mTop); gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); } gGL.end(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); stop_glerror(); } else { if ((mAvatarPreview) && (mSculptedPreview)) { gGL.color3f(1.f, 1.f, 1.f); if (selected == 9) { gGL.getTexUnit(0)->bind(mSculptedPreview->getTexture()); } else { gGL.getTexUnit(0)->bind(mAvatarPreview->getTexture()); } gGL.begin( LLRender::QUADS ); { gGL.texCoord2f(0.f, 1.f); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); gGL.texCoord2f(0.f, 0.f); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); gGL.texCoord2f(1.f, 0.f); gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); gGL.texCoord2f(1.f, 1.f); gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); } gGL.end(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } } }