diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-02-19 21:42:32 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-02-19 21:42:32 +0000 |
commit | 2e32d44e7165775936beae5d9ef636ff9d3f2bd2 (patch) | |
tree | 8153bc399994aabf6e1c41c2d8332e4e8c4ddb78 /indra/newview | |
parent | db0f5847ea8b96b3c1ac08e7aeb43d83daacb8e4 (diff) |
merge svn+ssh://svn.lindenlab.com/svn/linden/qa/combo-merge-ui-2008-02-13 -r 79986 : 80178 -> release.
QAR-290 = QAR-271 + QAR-191
Diffstat (limited to 'indra/newview')
153 files changed, 1715 insertions, 1951 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 51ab279e16..bd885f955c 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -969,12 +969,12 @@ void LLAgent::sendReliableMessage() { if (gDisconnected) { - llwarns << "Trying to send message when disconnected!" << llendl; + lldebugs << "Trying to send message when disconnected!" << llendl; return; } if (!mRegionp) { - llwarns << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << llendl; + lldebugs << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << llendl; return; } gMessageSystem->sendReliable(mRegionp->getHost()); diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 5e5a58cffb..1b21a71212 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -117,6 +117,8 @@ inline bool operator==(const LLGroupData &a, const LLGroupData &b) class LLAgent : public LLObservable { + LOG_CLASS(LLAgent); + public: // When the agent hasn't typed anything for this duration, it leaves the // typing state (for both chat and IM). diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 6d0244e55e..108e2cafe0 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -266,9 +266,8 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds) { using namespace std; - U32 new_buddy_count = 0; - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + U32 new_buddy_count = 0; + std::string first,last; LLUUID agent_id; for(buddy_map_t::const_iterator itr = buds.begin(); itr != buds.end(); ++itr) { @@ -588,8 +587,7 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg) { if((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MODIFY_OBJECTS) { - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string first, last; LLStringBase<char>::format_map_t args; if(gCacheName->getName(agent_id, first, last)) { @@ -646,8 +644,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) setBuddyOnline(agent_id,online); if(chat_notify) { - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string first, last; if(gCacheName->getName(agent_id, first, last)) { notify = TRUE; @@ -801,8 +798,6 @@ bool LLCollectProxyBuddies::operator()(const LLUUID& buddy_id, LLRelationship* b bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy) { - mFirst[0] = '\0'; - mLast[0] = '\0'; gCacheName->getName(buddy_id, mFirst, mLast); std::ostringstream fullname; fullname << mFirst << " " << mLast; @@ -816,8 +811,6 @@ bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy) { - mFirst[0] = '\0'; - mLast[0] = '\0'; gCacheName->getName(buddy_id, mFirst, mLast); std::ostringstream fullname; fullname << mFirst << " " << mLast; @@ -831,8 +824,6 @@ bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship* bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy) { - mFirst[0] = '\0'; - mLast[0] = '\0'; gCacheName->getName(buddy_id, mFirst, mLast); std::ostringstream fullname; fullname << mFirst << " " << mLast; diff --git a/indra/newview/llcallingcard.h b/indra/newview/llcallingcard.h index f713af389f..c00fe5295d 100644 --- a/indra/newview/llcallingcard.h +++ b/indra/newview/llcallingcard.h @@ -212,8 +212,8 @@ public: virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy); typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t; buddy_map_t mMappable; - char mFirst[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char mLast[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ + std::string mFirst; + std::string mLast; }; // collect dictionary sorted map of name -> agent_id for every online buddy @@ -225,8 +225,8 @@ public: virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy); typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t; buddy_map_t mOnline; - char mFirst[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mLast[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string mFirst; + std::string mLast; }; // collect dictionary sorted map of name -> agent_id for every buddy, @@ -240,8 +240,8 @@ public: typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t; buddy_map_t mOnline; buddy_map_t mOffline; - char mFirst[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mLast[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string mFirst; + std::string mLast; }; #endif // LL_LLCALLINGCARD_H diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 1798aea122..2ea9bf6e5e 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -125,6 +125,12 @@ BOOL LLChatBar::postBuild() // attempt to bind to an existing combo box named gesture setGestureCombo(LLUICtrlFactory::getComboBoxByName(this, "Gesture")); + LLButton * sayp = getChild<LLButton>("Say"); + if(sayp) + { + setDefaultBtn(sayp); + } + mInputEditor = LLUICtrlFactory::getLineEditorByName(this, "Chat Editor"); if (mInputEditor) { diff --git a/indra/newview/llclassifiedstatsresponder.cpp b/indra/newview/llclassifiedstatsresponder.cpp index 0b33ce707e..a605d08448 100644 --- a/indra/newview/llclassifiedstatsresponder.cpp +++ b/indra/newview/llclassifiedstatsresponder.cpp @@ -43,7 +43,7 @@ #include "llview.h" #include "message.h" -LLClassifiedStatsResponder::LLClassifiedStatsResponder(LLViewHandle classified_panel_handle, LLUUID classified_id) +LLClassifiedStatsResponder::LLClassifiedStatsResponder(LLHandle<LLView> classified_panel_handle, LLUUID classified_id) : mClassifiedPanelHandle(classified_panel_handle), mClassifiedID(classified_id) { @@ -58,7 +58,7 @@ void LLClassifiedStatsResponder::result(const LLSD& content) S32 search_map = content["search_map_clicks"].asInteger(); S32 search_profile = content["search_profile_clicks"].asInteger(); - LLPanelClassified* classified_panelp = (LLPanelClassified*)LLPanel::getPanelByHandle(mClassifiedPanelHandle); + LLPanelClassified* classified_panelp = (LLPanelClassified*)mClassifiedPanelHandle.get(); if(classified_panelp) { diff --git a/indra/newview/llclassifiedstatsresponder.h b/indra/newview/llclassifiedstatsresponder.h index 45d6ec38cf..a2b1daa8da 100644 --- a/indra/newview/llclassifiedstatsresponder.h +++ b/indra/newview/llclassifiedstatsresponder.h @@ -39,14 +39,14 @@ class LLClassifiedStatsResponder : public LLHTTPClient::Responder { public: - LLClassifiedStatsResponder(LLViewHandle classified_panel_handle, LLUUID classified_id); + LLClassifiedStatsResponder(LLHandle<LLView> classified_panel_handle, LLUUID classified_id); //If we get back a normal response, handle it here virtual void result(const LLSD& content); //If we get back an error (not found, etc...), handle it here virtual void error(U32 status, const std::string& reason); protected: - LLViewHandle mClassifiedPanelHandle; + LLHandle<LLView> mClassifiedPanelHandle; LLUUID mClassifiedID; }; diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index b814f0d63f..b2b29ffc9f 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -61,14 +61,14 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect mOnSelectCallback(NULL) { mCaption = new LLTextBox( name, - LLRect( 0, BTN_HEIGHT_SMALL, mRect.getWidth(), 0 ), - LLString::null, + LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ), + name, LLFontGL::sSansSerifSmall ); mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); addChild( mCaption ); // Scalable UI made this off-by-one, I don't know why. JC - LLRect border_rect(0, mRect.getHeight()-1, mRect.getWidth()-1, 0); + LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); border_rect.mBottom += BTN_HEIGHT_SMALL; mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); addChild(mBorder); @@ -89,14 +89,14 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect mOnSelectCallback(NULL) { mCaption = new LLTextBox( label, - LLRect( 0, BTN_HEIGHT_SMALL, mRect.getWidth(), 0 ), - LLString::null, + LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ), + label, LLFontGL::sSansSerifSmall ); mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); addChild( mCaption ); // Scalable UI made this off-by-one, I don't know why. JC - LLRect border_rect(0, mRect.getHeight()-1, mRect.getWidth()-1, 0); + LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); border_rect.mBottom += BTN_HEIGHT_SMALL; mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); addChild(mBorder); @@ -108,7 +108,7 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect LLColorSwatchCtrl::~LLColorSwatchCtrl () { // parent dialog is destroyed so we are too and we need to cancel selection - LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle); + LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get(); if (pickerp) { pickerp->cancelSelection(); @@ -130,7 +130,7 @@ BOOL LLColorSwatchCtrl::handleHover(S32 x, S32 y, MASK mask) BOOL LLColorSwatchCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) { - if( getVisible() && mEnabled && !called_from_parent && ' ' == uni_char ) + if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char ) { showPicker(TRUE); } @@ -141,7 +141,7 @@ BOOL LLColorSwatchCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from void LLColorSwatchCtrl::setOriginal(const LLColor4& color) { mColor = color; - LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle); + LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get(); if (pickerp) { pickerp->setOrigRgb(mColor.mV[VRED], mColor.mV[VGREEN], mColor.mV[VBLUE]); @@ -151,7 +151,7 @@ void LLColorSwatchCtrl::setOriginal(const LLColor4& color) void LLColorSwatchCtrl::set(const LLColor4& color, BOOL update_picker, BOOL from_event) { mColor = color; - LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle); + LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get(); if (pickerp && update_picker) { pickerp->setCurRgb(mColor.mV[VRED], mColor.mV[VGREEN], mColor.mV[VBLUE]); @@ -188,7 +188,7 @@ BOOL LLColorSwatchCtrl::handleMouseUp(S32 x, S32 y, MASK mask) // If mouseup in the widget, it's been clicked if ( pointInView(x, y) ) { - llassert(mEnabled); + llassert(getEnabled()); llassert(getVisible()); showPicker(FALSE); @@ -206,7 +206,7 @@ void LLColorSwatchCtrl::draw() { mBorder->setKeyboardFocusHighlight(hasFocus()); // Draw border - LLRect border( 0, mRect.getHeight(), mRect.getWidth(), BTN_HEIGHT_SMALL ); + LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); gl_rect_2d( border, mBorderColor, FALSE ); LLRect interior = border; @@ -253,7 +253,7 @@ void LLColorSwatchCtrl::setEnabled( BOOL enabled ) if (!enabled) { - LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle); + LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get(); if (pickerp) { pickerp->cancelSelection(); @@ -275,7 +275,7 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op ) LLColorSwatchCtrl* subject = ( LLColorSwatchCtrl* )data; if ( subject ) { - LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(subject->mPickerHandle); + LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)subject->mPickerHandle.get(); if (pickerp) { // move color across from selector to internal widget storage @@ -300,14 +300,14 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op ) subject->onCommit (); } } - }; + } } void LLColorSwatchCtrl::setValid(BOOL valid ) { mValid = valid; - LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle); + LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get(); if (pickerp) { pickerp->setActive(valid); @@ -316,7 +316,7 @@ void LLColorSwatchCtrl::setValid(BOOL valid ) void LLColorSwatchCtrl::showPicker(BOOL take_focus) { - LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle); + LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get(); if (!pickerp) { pickerp = new LLFloaterColorPicker(this, mCanApplyImmediately); @@ -324,7 +324,7 @@ void LLColorSwatchCtrl::showPicker(BOOL take_focus) mPickerHandle = pickerp->getHandle(); } - // initialize picker singleton with current color + // initialize picker with current color pickerp->initUI ( mColor.mV [ VRED ], mColor.mV [ VGREEN ], mColor.mV [ VBLUE ] ); // display it diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h index 05b2dc434c..cc9b9ad017 100644 --- a/indra/newview/llcolorswatch.h +++ b/indra/newview/llcolorswatch.h @@ -98,7 +98,7 @@ protected: LLColor4 mColor; LLColor4 mBorderColor; LLTextBox* mCaption; - LLViewHandle mPickerHandle; + LLHandle<LLFloater> mPickerHandle; LLViewBorder* mBorder; BOOL mCanApplyImmediately; LLUICtrlCallback mOnCancelCallback; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index ee9177c18d..654c33bb93 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -286,7 +286,7 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) S32 LLFastTimerView::getLegendIndex(S32 y) { - S32 idx = (mRect.getHeight() - y) / ((S32) LLFontGL::sMonospace->getLineHeight()+2) - 5; + S32 idx = (getRect().getHeight() - y) / ((S32) LLFontGL::sMonospace->getLineHeight()+2) - 5; if (idx >= 0 && idx < FTV_DISPLAY_NUM) { return ft_display_idx[idx]; @@ -415,7 +415,8 @@ void LLFastTimerView::draw() S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f); S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f); - mRect.setLeftTopAndSize(mRect.mLeft, mRect.mTop, width, height); + // HACK: casting away const. Should use setRect or some helper function instead. + const_cast<LLRect&>(getRect()).setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); S32 left, top, right, bottom; S32 x, y, barw, barh, dx, dy; @@ -461,7 +462,7 @@ void LLFastTimerView::draw() // Draw the window background { LLGLSNoTexture gls_ui_no_texture; - gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); } S32 xleft = margin; @@ -642,7 +643,7 @@ void LLFastTimerView::draw() // update rectangle that includes timer bars mBarRect.mLeft = xleft; - mBarRect.mRight = mRect.mRight - xleft; + mBarRect.mRight = getRect().mRight - xleft; mBarRect.mTop = ytop - ((S32)LLFontGL::sMonospace->getLineHeight() + 4); mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT; @@ -760,29 +761,29 @@ void LLFastTimerView::draw() y -= ((S32)LLFontGL::sMonospace->getLineHeight() + 4); //heading - gl_rect_2d(xleft-5, by, mRect.getWidth()-5, y+5, FALSE); + gl_rect_2d(xleft-5, by, getRect().getWidth()-5, y+5, FALSE); //tree view gl_rect_2d(5, by, xleft-10, 5, FALSE); by = y + 5; //average bar - gl_rect_2d(xleft-5, by, mRect.getWidth()-5, by-barh-dy-5, FALSE); + gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-5, FALSE); by -= barh*2+dy; //current frame bar - gl_rect_2d(xleft-5, by, mRect.getWidth()-5, by-barh-dy-2, FALSE); + gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-2, FALSE); by -= barh+dy+1; //history bars - gl_rect_2d(xleft-5, by, mRect.getWidth()-5, LINE_GRAPH_HEIGHT-barh-dy-2, FALSE); + gl_rect_2d(xleft-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-barh-dy-2, FALSE); by = LINE_GRAPH_HEIGHT-barh-dy-7; //line graph - graph_rect = LLRect(xleft-5, by, mRect.getWidth()-5, 5); + graph_rect = LLRect(xleft-5, by, getRect().getWidth()-5, 5); gl_rect_2d(graph_rect, FALSE); } diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index c73b3315cc..5fd0c4ca06 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -216,6 +216,8 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter) mCurrentFile = mFiles; LLString tstr = utf16str_to_utf8str(llutf16string(mFilesW)); memcpy(mFiles, tstr.c_str(), tstr.size()+1); /*Flawfinder: ignore*/ + + mCurrentFile = &mFiles[mOFN.nFileOffset]; } else { diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 7da2ac79b1..4edf6f3652 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -93,7 +93,7 @@ LLFloaterAbout::LLFloaterAbout() if (region) { const LLVector3d &pos = gAgent.getPositionGlobal(); - LLUIString pos_text = childGetText("you_are_at"); + LLUIString pos_text = getUIString("you_are_at"); pos_text.setArg("[POSITION]", llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ])); support.append(pos_text); @@ -177,7 +177,7 @@ LLFloaterAbout::LLFloaterAbout() // Fix views childDisable("credits_editor"); - LLTextEditor * support_widget = (LLTextEditor *) getChildByName("support_editor", true); + LLTextEditor * support_widget = getChild<LLTextEditor>("support_editor", true); if (support_widget) { support_widget->setEnabled( FALSE ); diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 18c3983b9a..2eddb45f23 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -280,7 +280,7 @@ BOOL LLFloaterAnimPreview::postBuild() childSetValue("hand_pose_combo", LLHandMotion::getHandPoseName(motionp->getHandPose())); childSetValue("ease_in_time", LLSD(motionp->getEaseInDuration())); childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration())); - mEnabled = TRUE; + setEnabled(TRUE); char seconds_string[128]; /*Flawfinder: ignore*/ snprintf(seconds_string, sizeof(seconds_string), " - %.2f seconds", motionp->getDuration()); /* Flawfinder: ignore */ @@ -291,8 +291,8 @@ BOOL LLFloaterAnimPreview::postBuild() delete mAnimPreview; mAnimPreview = NULL; mMotionID.setNull(); - childSetValue("bad_animation_text", childGetText("failed_to_initialize")); - mEnabled = FALSE; + childSetValue("bad_animation_text", getString("failed_to_initialize")); + setEnabled(FALSE); } } else @@ -301,20 +301,20 @@ BOOL LLFloaterAnimPreview::postBuild() { if (loaderp->getDuration() > MAX_ANIM_DURATION) { - LLUIString out_str = childGetText("anim_too_long"); + LLUIString out_str = getString("anim_too_long"); out_str.setArg("[LENGTH]", llformat("%.1f", loaderp->getDuration())); out_str.setArg("[MAX_LENGTH]", llformat("%.1f", MAX_ANIM_DURATION)); childSetValue("bad_animation_text", out_str.getString()); } else { - LLUIString out_str = childGetText("failed_file_read"); + LLUIString out_str = getString("failed_file_read"); out_str.setArg("[STATUS]", loaderp->getStatus()); // *TODO:Translate childSetValue("bad_animation_text", out_str.getString()); } } - mEnabled = FALSE; + setEnabled(FALSE); mMotionID.setNull(); mAnimPreview = NULL; } @@ -334,7 +334,7 @@ LLFloaterAnimPreview::~LLFloaterAnimPreview() delete mAnimPreview; mAnimPreview = NULL; - mEnabled = FALSE; + setEnabled(FALSE); } //----------------------------------------------------------------------------- @@ -507,7 +507,7 @@ void LLFloaterAnimPreview::onMouseCaptureLost() void LLFloaterAnimPreview::onBtnPlay(void* user_data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; if (previewp->mMotionID.notNull() && previewp->mAnimPreview) { @@ -538,7 +538,7 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data) void LLFloaterAnimPreview::onBtnStop(void* user_data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; if (previewp->mMotionID.notNull() && previewp->mAnimPreview) { @@ -563,7 +563,7 @@ void LLFloaterAnimPreview::onBtnStop(void* user_data) void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; if (previewp->mAnimPreview) { @@ -609,7 +609,7 @@ void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; if (previewp->mAnimPreview) { @@ -639,7 +639,7 @@ void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -657,7 +657,7 @@ void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -677,7 +677,7 @@ void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -697,7 +697,7 @@ void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -716,7 +716,7 @@ void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -731,7 +731,7 @@ void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -746,7 +746,7 @@ void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -760,7 +760,7 @@ void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -775,7 +775,7 @@ void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -791,7 +791,7 @@ BOOL LLFloaterAnimPreview::validateEaseIn(LLUICtrl* spin, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return FALSE; + if (!previewp->getEnabled()) return FALSE; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -812,7 +812,7 @@ BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return FALSE; + if (!previewp->getEnabled()) return FALSE; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -833,7 +833,7 @@ BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return FALSE; + if (!previewp->getEnabled()) return FALSE; F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); @@ -862,7 +862,7 @@ BOOL LLFloaterAnimPreview::validateLoopOut(LLUICtrl* spin, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return FALSE; + if (!previewp->getEnabled()) return FALSE; F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); @@ -947,7 +947,7 @@ void LLFloaterAnimPreview::refresh() void LLFloaterAnimPreview::onBtnOK(void* userdata) { LLFloaterAnimPreview* floaterp = (LLFloaterAnimPreview*)userdata; - if (!floaterp->mEnabled) return; + if (!floaterp->getEnabled()) return; if (floaterp->mAnimPreview) { @@ -1153,3 +1153,4 @@ void LLPreviewAnimation::pan(F32 right, F32 up) } + diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index e044ead818..094cbb6c33 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -123,7 +123,7 @@ void LLFloaterAuction::initialize() mParcelHost.invalidate(); if(parcelp && parcelp->getForSale()) { - childSetText("parcel_text", childGetText("already for sale")); + childSetText("parcel_text", getString("already for sale")); } else { diff --git a/indra/newview/llfloaterauction.h b/indra/newview/llfloaterauction.h index 135c9fa26b..10e08c14b1 100644 --- a/indra/newview/llfloaterauction.h +++ b/indra/newview/llfloaterauction.h @@ -69,7 +69,7 @@ private: LLTransactionID mTransactionID; LLAssetID mImageID; LLPointer<LLImageGL> mImage; - LLHandle<LLParcelSelection> mParcelp; + LLSafeHandle<LLParcelSelection> mParcelp; S32 mParcelID; LLHost mParcelHost; }; diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 2cfcc47af3..a44b3b3755 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -347,8 +347,9 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* LLString avatar_name; if (avatar_id.isNull()) { - self->childSetTextArg("NotFound", "[TEXT]", self->childGetText("Edit")); - avatar_name = self->childGetValue("NotFound").asString(); + LLString::format_map_t map; + map["[TEXT]"] = self->childGetText("Edit"); + avatar_name = self->getString("NotFound", map); self->mListNames->setEnabled(FALSE); } else diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 64dc96807c..f05f9a7b52 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -67,26 +67,26 @@ LLFloaterAvatarTextures* LLFloaterAvatarTextures::show(const LLUUID &id) BOOL LLFloaterAvatarTextures::postBuild() { - mBakedHead = (LLTextureCtrl*)getChildByName("baked_head"); - mBakedEyes = (LLTextureCtrl*)getChildByName("baked_eyes"); - mBakedUpper = (LLTextureCtrl*)getChildByName("baked_upper_body"); - mBakedLower = (LLTextureCtrl*)getChildByName("baked_lower_body"); - mBakedSkirt = (LLTextureCtrl*)getChildByName("baked_skirt"); - mHair = (LLTextureCtrl*)getChildByName("hair"); - mMakeup = (LLTextureCtrl*)getChildByName("head_bodypaint"); - mEye = (LLTextureCtrl*)getChildByName("eye_texture"); - mShirt = (LLTextureCtrl*)getChildByName("shirt"); - mUpperTattoo = (LLTextureCtrl*)getChildByName("upper_bodypaint"); - mUpperJacket = (LLTextureCtrl*)getChildByName("upper_jacket"); - mGloves = (LLTextureCtrl*)getChildByName("gloves"); - mUndershirt = (LLTextureCtrl*)getChildByName("undershirt"); - mPants = (LLTextureCtrl*)getChildByName("pants"); - mLowerTattoo = (LLTextureCtrl*)getChildByName("lower_bodypaint"); - mShoes = (LLTextureCtrl*)getChildByName("shoes"); - mSocks = (LLTextureCtrl*)getChildByName("socks"); - mJacket = (LLTextureCtrl*)getChildByName("jacket"); - mUnderpants = (LLTextureCtrl*)getChildByName("underpants"); - mSkirt = (LLTextureCtrl*)getChildByName("skirt_texture"); + mBakedHead = getChild<LLTextureCtrl>("baked_head"); + mBakedEyes = getChild<LLTextureCtrl>("baked_eyes"); + mBakedUpper = getChild<LLTextureCtrl>("baked_upper_body"); + mBakedLower = getChild<LLTextureCtrl>("baked_lower_body"); + mBakedSkirt = getChild<LLTextureCtrl>("baked_skirt"); + mHair = getChild<LLTextureCtrl>("hair"); + mMakeup = getChild<LLTextureCtrl>("head_bodypaint"); + mEye = getChild<LLTextureCtrl>("eye_texture"); + mShirt = getChild<LLTextureCtrl>("shirt"); + mUpperTattoo = getChild<LLTextureCtrl>("upper_bodypaint"); + mUpperJacket = getChild<LLTextureCtrl>("upper_jacket"); + mGloves = getChild<LLTextureCtrl>("gloves"); + mUndershirt = getChild<LLTextureCtrl>("undershirt"); + mPants = getChild<LLTextureCtrl>("pants"); + mLowerTattoo = getChild<LLTextureCtrl>("lower_bodypaint"); + mShoes = getChild<LLTextureCtrl>("shoes"); + mSocks = getChild<LLTextureCtrl>("socks"); + mJacket = getChild<LLTextureCtrl>("jacket"); + mUnderpants = getChild<LLTextureCtrl>("underpants"); + mSkirt = getChild<LLTextureCtrl>("skirt_texture"); mTitle = getTitle(); childSetAction("Dump", onClickDump, this); @@ -142,16 +142,10 @@ void LLFloaterAvatarTextures::refresh() LLVOAvatar *avatarp = find_avatar(mID); if (avatarp) { - char firstname[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char lastname[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - if (gCacheName->getName(avatarp->getID(), firstname, lastname)) + std::string fullname; + if (gCacheName->getFullName(avatarp->getID(), fullname)) { - LLString name; - name.assign( firstname ); - name.append( " " ); - name.append( lastname ); - - setTitle(mTitle + ": " + name); + setTitle(mTitle + ": " + fullname); } update_texture_ctrl(avatarp, mBakedHead, LLVOAvatar::TEX_HEAD_BAKED); update_texture_ctrl(avatarp, mBakedEyes, LLVOAvatar::TEX_EYES_BAKED); diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index abae92a854..3f6ed92868 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -85,7 +85,7 @@ void LLFloaterBump::show(void *contents) if (gMeanCollisionList.isEmpty()) { - LLString none_detected = sInstance->childGetText("none_detected"); + LLString none_detected = sInstance->getString("none_detected"); LLSD row; row["columns"][0]["value"] = none_detected; row["columns"][0]["font"] = "SansSerifBold"; @@ -151,7 +151,7 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) } // All above action strings are in XML file - LLUIString text = sInstance->childGetText(action); + LLUIString text = sInstance->getUIString(action); text.setArg("[TIME]", time); text.setArg("[FIRST]", mcd->mFirstName); text.setArg("[LAST]", mcd->mLastName); diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 707ec0e852..5ce5d8616b 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -121,11 +121,11 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) switch (sale_info.getSaleType()) { case LLSaleInfo::FS_ORIGINAL: - title = sInstance->childGetText("title_buy_text"); + title = sInstance->getString("title_buy_text"); break; case LLSaleInfo::FS_COPY: default: - title = sInstance->childGetText("title_buy_copy_text"); + title = sInstance->getString("title_buy_copy_text"); break; } title.setArg("[NAME]", node->mName); @@ -165,15 +165,15 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) LLString text = node->mName; if (!(next_owner_mask & PERM_COPY)) { - text.append(sInstance->childGetText("no_copy_text")); + text.append(sInstance->getString("no_copy_text")); } if (!(next_owner_mask & PERM_MODIFY)) { - text.append(sInstance->childGetText("no_modify_text")); + text.append(sInstance->getString("no_modify_text")); } if (!(next_owner_mask & PERM_TRANSFER)) { - text.append(sInstance->childGetText("no_transfer_text")); + text.append(sInstance->getString("no_transfer_text")); } row["columns"][1]["column"] = "text"; diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h index cdf79da954..7f18a894e7 100644 --- a/indra/newview/llfloaterbuy.h +++ b/indra/newview/llfloaterbuy.h @@ -71,7 +71,7 @@ protected: private: static LLFloaterBuy* sInstance; - LLHandle<LLObjectSelection> mObjectSelection; + LLSafeHandle<LLObjectSelection> mObjectSelection; LLSaleInfo mSaleInfo; }; diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index 38266797cf..b133a1e88b 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -124,9 +124,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) if (!node) return; if(node->mPermissions->isGroupOwned()) { - char group_name[MAX_STRING]; /*Flawfinder: ignore*/ - gCacheName->getGroupName(owner_id, group_name); - owner_name.assign(group_name); + gCacheName->getGroupName(owner_id, owner_name); } sInstance->childSetTextArg("contains_text", "[NAME]", node->mName); @@ -240,15 +238,15 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, if (!(next_owner_mask & PERM_COPY)) { - text.append(childGetText("no_copy_text")); + text.append(getString("no_copy_text")); } if (!(next_owner_mask & PERM_MODIFY)) { - text.append(childGetText("no_modify_text")); + text.append(getString("no_modify_text")); } if (!(next_owner_mask & PERM_TRANSFER)) { - text.append(childGetText("no_transfer_text")); + text.append(getString("no_transfer_text")); } row["columns"][1]["column"] = "text"; diff --git a/indra/newview/llfloaterbuycontents.h b/indra/newview/llfloaterbuycontents.h index 8231174579..6b08bb4ad7 100644 --- a/indra/newview/llfloaterbuycontents.h +++ b/indra/newview/llfloaterbuycontents.h @@ -67,7 +67,7 @@ protected: protected: static LLFloaterBuyContents* sInstance; - LLHandle<LLObjectSelection> mObjectSelection; + LLSafeHandle<LLObjectSelection> mObjectSelection; LLSaleInfo mSaleInfo; }; diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index 4b5bb3548b..8866ad7ed1 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -316,7 +316,7 @@ void LLFloaterBuyCurrencyUI::onClickBuy(void* data) LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false); if (self) { - self->mManager.buy(self->childGetText("buy_currency")); + self->mManager.buy(self->getString("buy_currency")); self->updateUI(); // JC: updateUI() doesn't get called again until progress is made // with transaction processing, so the "Purchase" button would be diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 12722b6d95..52736c8c60 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -390,13 +390,13 @@ void LLFloaterBuyLandUI::updateParcelInfo() if (!mParcelValid) { - mCannotBuyReason= childGetText("no_land_selected"); + mCannotBuyReason = getString("no_land_selected"); return; } if (mParcel->getMultipleOwners()) { - mCannotBuyReason = childGetText("multiple_parcels_selected"); + mCannotBuyReason = getString("multiple_parcels_selected"); return; } @@ -454,13 +454,13 @@ void LLFloaterBuyLandUI::updateParcelInfo() bool haveEnoughCash = mParcelPrice <= mAgentCashBalance; S32 cashBuy = haveEnoughCash ? 0 : (mParcelPrice - mAgentCashBalance); mCurrency.setAmount(cashBuy, true); - mCurrency.setZeroMessage(haveEnoughCash ? childGetText("none_needed") : ""); + mCurrency.setZeroMessage(haveEnoughCash ? getString("none_needed") : ""); // checks that we can buy the land if(mIsForGroup && !gAgent.hasPowerInActiveGroup(GP_LAND_DEED)) { - mCannotBuyReason = childGetText("cant_buy_for_group"); + mCannotBuyReason = getString("cant_buy_for_group"); return; } @@ -474,7 +474,7 @@ void LLFloaterBuyLandUI::updateParcelInfo() || (mParcelPrice == 0 && authorizedBuyer.isNull())) { - mCannotBuyReason = childGetText("parcel_not_for_sale"); + mCannotBuyReason = getString("parcel_not_for_sale"); return; } @@ -482,18 +482,18 @@ void LLFloaterBuyLandUI::updateParcelInfo() { if (mIsForGroup) { - mCannotBuyReason = childGetText("group_already_owns"); + mCannotBuyReason = getString("group_already_owns"); } else { - mCannotBuyReason = childGetText("you_already_own"); + mCannotBuyReason = getString("you_already_own"); } return; } if (!authorizedBuyer.isNull() && buyer != authorizedBuyer) { - mCannotBuyReason = childGetText("set_to_sell_to_other"); + mCannotBuyReason = getString("set_to_sell_to_other"); return; } } @@ -501,14 +501,14 @@ void LLFloaterBuyLandUI::updateParcelInfo() { if (mParcelActualArea == 0) { - mCannotBuyReason = childGetText("no_public_land"); + mCannotBuyReason = getString("no_public_land"); return; } if (mParcel->hasOthersSelected()) { // Policy: Must not have someone else's land selected - mCannotBuyReason = childGetText("not_owned_by_you"); + mCannotBuyReason = getString("not_owned_by_you"); return; } } @@ -521,39 +521,39 @@ void LLFloaterBuyLandUI::updateCovenantInfo() LLViewerRegion* region = gParcelMgr->getSelectionRegion(); if(!region) return; - LLTextBox* region_name = (LLTextBox*)getChildByName("region_name_text"); + LLTextBox* region_name = getChild<LLTextBox>("region_name_text"); if (region_name) { region_name->setText(region->getName()); } - LLTextBox* resellable_clause = (LLTextBox*)getChildByName("resellable_clause"); + LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause"); if (resellable_clause) { if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) { - resellable_clause->setText(childGetText("can_not_resell")); + resellable_clause->setText(getString("can_not_resell")); } else { - resellable_clause->setText(childGetText("can_resell")); + resellable_clause->setText(getString("can_resell")); } } - LLTextBox* changeable_clause = (LLTextBox*)getChildByName("changeable_clause"); + LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause"); if (changeable_clause) { if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) { - changeable_clause->setText(childGetText("can_change")); + changeable_clause->setText(getString("can_change")); } else { - changeable_clause->setText(childGetText("can_not_change")); + changeable_clause->setText(getString("can_not_change")); } } - LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)getChildByName("agree_covenant"); + LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant"); if(check) { check->set(false); @@ -562,7 +562,7 @@ void LLFloaterBuyLandUI::updateCovenantInfo() check->setCommitCallback(onChangeAgreeCovenant); } - LLTextBox* box = (LLTextBox*)getChildByName("covenant_text"); + LLTextBox* box = getChild<LLTextBox>("covenant_text"); if(box) { box->setVisible(FALSE); @@ -589,14 +589,14 @@ void LLFloaterBuyLandUI::onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data) void LLFloaterBuyLandUI::updateCovenantText(const std::string &string, const LLUUID& asset_id) { - LLViewerTextEditor* editor = (LLViewerTextEditor*)getChildByName("covenant_editor"); + LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor"); if (editor) { editor->setHandleEditKeysDirectly(FALSE); editor->setText(string); - LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)getChildByName("agree_covenant"); - LLTextBox* box = (LLTextBox*)getChildByName("covenant_text"); + LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant"); + LLTextBox* box = getChild<LLTextBox>("covenant_text"); if(check && box) { if (asset_id.isNull()) @@ -621,19 +621,19 @@ void LLFloaterBuyLandUI::updateCovenantText(const std::string &string, const LLU void LLFloaterBuyLandUI::updateEstateName(const std::string& name) { - LLTextBox* box = (LLTextBox*)getChildByName("estate_name_text"); + LLTextBox* box = getChild<LLTextBox>("estate_name_text"); if (box) box->setText(name); } void LLFloaterBuyLandUI::updateLastModified(const std::string& text) { - LLTextBox* editor = (LLTextBox*)getChildByName("covenant_timestamp_text"); + LLTextBox* editor = getChild<LLTextBox>("covenant_timestamp_text"); if (editor) editor->setText(text); } void LLFloaterBuyLandUI::updateEstateOwnerName(const std::string& name) { - LLTextBox* box = (LLTextBox*)getChildByName("estate_owner_text"); + LLTextBox* box = getChild<LLTextBox>("estate_owner_text"); if (box) box->setText(name); } @@ -819,18 +819,11 @@ void LLFloaterBuyLandUI::updateNames() } else if (parcelp->getIsGroupOwned()) { - char groupName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - - gCacheName->getGroupName(parcelp->getGroupID(), &groupName[0]); - mParcelSellerName = groupName; + gCacheName->getGroupName(parcelp->getGroupID(), mParcelSellerName); } else { - char firstName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char lastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - - gCacheName->getName(parcelp->getOwnerID(), firstName, lastName); - mParcelSellerName = llformat("%s %s", firstName, lastName); + gCacheName->getFullName(parcelp->getOwnerID(), mParcelSellerName); } } @@ -908,7 +901,7 @@ void LLFloaterBuyLandUI::tellUserError( { mCanBuy = false; mCannotBuyIsError = true; - mCannotBuyReason = childGetText("fetching_error"); + mCannotBuyReason = getString("fetching_error"); mCannotBuyReason += message; mCannotBuyURI = uri; } @@ -998,17 +991,15 @@ void LLFloaterBuyLandUI::refreshUI() mParcelValid ? mParcelSnapshot : LLUUID::null); } - - if (mParcelValid) { childSetText("info_parcel", mParcelLocation); - - childSetTextArg("meters_supports_object", "[AMOUNT]", llformat("%d", mParcelActualArea)); - childSetTextArg("meters_supports_object", "[AMOUNT2]", llformat("%d", mParcelSupportedObjects)); - - childSetText("info_size", childGetText("meters_supports_object")); + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea); + string_args["[AMOUNT2]"] = llformat("%d", mParcelSupportedObjects); + + childSetText("info_size", getString("meters_supports_object", string_args)); childSetText("info_price", @@ -1022,7 +1013,7 @@ void LLFloaterBuyLandUI::refreshUI() } else { - childSetText("info_parcel", childGetText("no_parcel_selected")); + childSetText("info_parcel", getString("no_parcel_selected")); childSetText("info_size", LLString::null); childSetText("info_price", LLString::null); } @@ -1031,12 +1022,12 @@ void LLFloaterBuyLandUI::refreshUI() mCanBuy ? mIsForGroup - ? childGetText("buying_for_group")//"Buying land for group:" - : childGetText("buying_will")//"Buying this land will:" + ? getString("buying_for_group")//"Buying land for group:" + : getString("buying_will")//"Buying this land will:" : mCannotBuyIsError - ? childGetText("cannot_buy_now")//"Cannot buy now:" - : childGetText("not_for_sale")//"Not for sale:" + ? getString("cannot_buy_now")//"Cannot buy now:" + : getString("not_for_sale")//"Not for sale:" ); } @@ -1081,8 +1072,8 @@ void LLFloaterBuyLandUI::refreshUI() childSetText("account_action", mSiteMembershipAction); childSetText("account_reason", mSiteMembershipUpgrade - ? childGetText("must_upgrade") - : childGetText("cant_own_land") + ? getString("must_upgrade") + : getString("cant_own_land") ); LLComboBox* levels = LLUICtrlFactory::getComboBoxByName(this, "account_level"); @@ -1127,18 +1118,17 @@ void LLFloaterBuyLandUI::refreshUI() if (mIsForGroup) { - childSetTextArg("insufficient_land_credits", "[GROUP]", LLString(gAgent.mGroupName)); + LLString::format_map_t string_args; + string_args["[GROUP]"] = LLString(gAgent.mGroupName); - - message += childGetText("insufficient_land_credits"); + message += getString("insufficient_land_credits", string_args); } else { - - childSetTextArg("land_holdings", "[BUYER]", llformat("%d", mAgentCommittedTier)); - message += childGetText("land_holdings"); - + LLString::format_map_t string_args; + string_args["[BUYER]"] = llformat("%d", mAgentCommittedTier); + message += getString("land_holdings", string_args); } if (!mParcelValid) @@ -1147,21 +1137,24 @@ void LLFloaterBuyLandUI::refreshUI() } else if (mParcelBillableArea == mParcelActualArea) { - childSetTextArg("parcel_meters", "[AMOUNT]", llformat("%d", mParcelActualArea)); - message += childGetText("parcel_meters"); + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea); + message += getString("parcel_meters", string_args); } else { if (mParcelBillableArea > mParcelActualArea) { - childSetTextArg("premium_land", "[AMOUNT]", llformat("%d", mParcelBillableArea) ); - message += childGetText("premium_land"); + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mParcelBillableArea); + message += getString("premium_land", string_args); } else { - childSetTextArg("discounted_land", "[AMOUNT]", llformat("%d", mParcelBillableArea) ); - message += childGetText("discounted_land"); + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mParcelBillableArea); + message += getString("discounted_land", string_args); } } @@ -1208,35 +1201,36 @@ void LLFloaterBuyLandUI::refreshUI() if (haveEnough) { - - childSetTextArg("have_enough_lindens", "[AMOUNT]", llformat("%d", mAgentCashBalance)); - childSetText("currency_reason", childGetText("have_enough_lindens")); + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance); + + childSetText("currency_reason", getString("have_enough_lindens", string_args)); } else { - childSetTextArg("not_enough_lindens", "[AMOUNT]", llformat("%d", mAgentCashBalance)); - childSetTextArg("not_enough_lindens", "[AMOUNT2]", llformat("%d", mParcelPrice - mAgentCashBalance)); + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance); + string_args["[AMOUNT2]"] = llformat("%d", mParcelPrice - mAgentCashBalance); - childSetText("currency_reason", childGetText("not_enough_lindens")); + childSetText("currency_reason", getString("not_enough_lindens", string_args)); childSetTextArg("currency_est", "[AMOUNT2]", llformat("%#.2f", mCurrency.getEstimate() / 100.0)); - } if (willHaveEnough) { + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", finalBalance); - childSetTextArg("balance_left", "[AMOUNT]", llformat("%d", finalBalance)); - - childSetText("currency_balance", childGetText("balance_left")); + childSetText("currency_balance", getString("balance_left", string_args)); } else { + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mParcelPrice - mAgentCashBalance); - childSetTextArg("balance_needed", "[AMOUNT]", llformat("%d", mParcelPrice - mAgentCashBalance)); - - childSetText("currency_balance", childGetText("balance_needed")); + childSetText("currency_balance", getString("balance_needed", string_args)); } @@ -1264,7 +1258,7 @@ void LLFloaterBuyLandUI::refreshUI() bool agrees_to_covenant = false; - LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)getChildByName("agree_covenant"); + LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant"); if (check) { agrees_to_covenant = check->get(); @@ -1298,17 +1292,17 @@ void LLFloaterBuyLandUI::startBuyPreConfirm() } if (mCurrency.getAmount() > 0) { + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mCurrency.getAmount()); + string_args["[AMOUNT2]"] = llformat("%#.2f", mCurrency.getEstimate() / 100.0); - childSetTextArg("buy_for_US", "[AMOUNT]", llformat("%d", mCurrency.getAmount())); - childSetTextArg("buy_for_US", "[AMOUNT2]", llformat("%#.2f", mCurrency.getEstimate() / 100.0)); - - action += childGetText("buy_for_US"); + action += getString("buy_for_US", string_args); } - childSetTextArg("pay_to_for_land", "[AMOUNT]", llformat("%d", mParcelPrice)); - childSetTextArg("pay_to_for_land", "[SELLER]", mParcelSellerName); - - action += childGetText("pay_to_for_land"); + LLString::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mParcelPrice); + string_args["[SELLER]"] = mParcelSellerName; + action += getString("pay_to_for_land", string_args); LLConfirmationManager::confirm(mSiteConfirm, @@ -1322,7 +1316,7 @@ void LLFloaterBuyLandUI::startBuyPostConfirm(const std::string& password) runWebSitePrep(password); mCanBuy = false; - mCannotBuyReason = childGetText("processing"); + mCannotBuyReason = getString("processing"); refreshUI(); } diff --git a/indra/newview/llfloaterbuyland.h b/indra/newview/llfloaterbuyland.h index dd7cb393ca..19ad83bb27 100644 --- a/indra/newview/llfloaterbuyland.h +++ b/indra/newview/llfloaterbuyland.h @@ -40,7 +40,7 @@ class LLFloaterBuyLand { public: static void buyLand(LLViewerRegion* region, - LLHandle<LLParcelSelection> parcel, + LLSafeHandle<LLParcelSelection> parcel, bool is_for_group); static void updateCovenantText(const std::string& string, const LLUUID& asset_id); static void updateEstateName(const std::string& name); diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 82fe16172b..851d81f349 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -128,7 +128,7 @@ void LLFloaterChat::draw() childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel")); - LLChatBar* chat_barp = (LLChatBar*)getChildByName("chat_panel", TRUE); + LLChatBar* chat_barp = getChild<LLChatBar>("chat_panel", TRUE); if (chat_barp) { chat_barp->refresh(); @@ -142,7 +142,7 @@ BOOL LLFloaterChat::postBuild() { mPanel = (LLPanelActiveSpeakers*)LLUICtrlFactory::getPanelByName(this, "active_speakers_panel"); - LLChatBar* chat_barp = (LLChatBar*)getChildByName("chat_panel", TRUE); + LLChatBar* chat_barp = getChild<LLChatBar>("chat_panel", TRUE); if (chat_barp) { chat_barp->setGestureCombo(LLUICtrlFactory::getComboBoxByName(this, "Gesture")); @@ -221,8 +221,8 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) // could flash the chat button in the status bar here. JC LLFloaterChat* chat_floater = LLFloaterChat::getInstance(LLSD()); - LLViewerTextEditor* history_editor = (LLViewerTextEditor*)chat_floater->getChildByName("Chat History Editor", TRUE); - LLViewerTextEditor* history_editor_with_mute = (LLViewerTextEditor*)chat_floater->getChildByName("Chat History Editor with mute", TRUE); + LLViewerTextEditor* history_editor = chat_floater->getChild<LLViewerTextEditor>("Chat History Editor"); + LLViewerTextEditor* history_editor_with_mute = chat_floater->getChild<LLViewerTextEditor>("Chat History Editor with mute"); history_editor->setParseHTML(TRUE); history_editor_with_mute->setParseHTML(TRUE); @@ -255,8 +255,8 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) // static void LLFloaterChat::setHistoryCursorAndScrollToEnd() { - LLViewerTextEditor* history_editor = (LLViewerTextEditor*)LLFloaterChat::getInstance(LLSD())->getChildByName("Chat History Editor", TRUE); - LLViewerTextEditor* history_editor_with_mute = (LLViewerTextEditor*)LLFloaterChat::getInstance(LLSD())->getChildByName("Chat History Editor with mute", TRUE); + LLViewerTextEditor* history_editor = LLFloaterChat::getInstance(LLSD())->getChild<LLViewerTextEditor>("Chat History Editor"); + LLViewerTextEditor* history_editor_with_mute = LLFloaterChat::getInstance(LLSD())->getChild<LLViewerTextEditor>("Chat History Editor with mute"); if (history_editor) { @@ -299,8 +299,8 @@ void LLFloaterChat::onClickToggleShowMute(LLUICtrl* caller, void *data) //LLCheckBoxCtrl* BOOL show_mute = LLUICtrlFactory::getCheckBoxByName(floater,"show mutes")->get(); - LLViewerTextEditor* history_editor = (LLViewerTextEditor*)floater->getChildByName("Chat History Editor", TRUE); - LLViewerTextEditor* history_editor_with_mute = (LLViewerTextEditor*)floater->getChildByName("Chat History Editor with mute", TRUE); + LLViewerTextEditor* history_editor = floater->getChild<LLViewerTextEditor>("Chat History Editor"); + LLViewerTextEditor* history_editor_with_mute = floater->getChild<LLViewerTextEditor>("Chat History Editor with mute"); if (!history_editor || !history_editor_with_mute) return; @@ -455,26 +455,35 @@ void* LLFloaterChat::createChatPanel(void* data) return chatp; } +// static +void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata) +{ + LLFloaterChat* self = (LLFloaterChat*)userdata; + + self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel")); +} + +//static +bool LLFloaterChat::visible(LLFloater* instance, const LLSD& key) +{ + return VisibilityPolicy<LLFloater>::visible(instance, key); +} + //static -void LLFloaterChat::hideInstance(const LLSD& id) +void LLFloaterChat::show(LLFloater* instance, const LLSD& key) { - LLFloaterChat* floaterp = LLFloaterChat::getInstance(LLSD()); + VisibilityPolicy<LLFloater>::show(instance, key); +} - if(floaterp->getHost()) +//static +void LLFloaterChat::hide(LLFloater* instance, const LLSD& key) +{ + if(instance->getHost()) { - LLFloaterChatterBox::hideInstance(LLSD()); + LLFloaterChatterBox::hideInstance(); } else { - LLUISingleton<LLFloaterChat>::hideInstance(id); + VisibilityPolicy<LLFloater>::hide(instance, key); } } - -// static -void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata) -{ - LLFloaterChat* self = (LLFloaterChat*)userdata; - - self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel")); -} - diff --git a/indra/newview/llfloaterchat.h b/indra/newview/llfloaterchat.h index 58fa607b38..c8ce7c0b55 100644 --- a/indra/newview/llfloaterchat.h +++ b/indra/newview/llfloaterchat.h @@ -50,7 +50,7 @@ class LLCheckBoxCtrl; class LLPanelActiveSpeakers; class LLFloaterChat -: public LLFloater, public LLUISingleton<LLFloaterChat> + : public LLFloater, public LLUISingleton<LLFloaterChat, LLFloaterChat> { public: LLFloaterChat(const LLSD& seed); @@ -78,9 +78,12 @@ public: static void loadHistory(); static void* createSpeakersPanel(void* data); static void* createChatPanel(void* data); - static void hideInstance(const LLSD& id); -protected: + // visibility policy for LLUISingleton + static bool visible(LLFloater* instance, const LLSD& key); + static void show(LLFloater* instance, const LLSD& key); + static void hide(LLFloater* instance, const LLSD& key); + LLPanelActiveSpeakers* mPanel; BOOL mScrolledToEnd; }; diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp index 85bc8182a5..f18c31baf9 100644 --- a/indra/newview/llfloaterchatterbox.cpp +++ b/indra/newview/llfloaterchatterbox.cpp @@ -73,42 +73,6 @@ void LLFloaterMyFriends::onClose(bool app_quitting) setVisible(FALSE); } -//static -LLFloaterMyFriends* LLFloaterMyFriends::showInstance(const LLSD& id) -{ - LLFloaterMyFriends* floaterp = LLUIInstanceMgr<LLFloaterMyFriends>::showInstance(id); - // garbage values in id will be interpreted as 0, or the friends tab - floaterp->mTabs->selectTab(id); - - return floaterp; -} - -//static -void LLFloaterMyFriends::hideInstance(const LLSD& id) -{ - LLFloaterMyFriends* floaterp = LLFloaterMyFriends::getInstance(); - - if(floaterp->getHost()) - { - LLFloaterChatterBox::hideInstance(); - } - else - { - LLUISingleton<LLFloaterMyFriends>::hideInstance(id); - } -} - -// is the specified panel currently visible -//static -BOOL LLFloaterMyFriends::instanceVisible(const LLSD& id) -{ - // if singleton not created yet, trivially return false - if (!findInstance(id)) return FALSE; - - LLFloaterMyFriends* floaterp = getInstance(id); - return floaterp->isInVisibleChain() && floaterp->mTabs->getCurrentPanelIndex() == id.asInteger(); -} - //static void* LLFloaterMyFriends::createFriendsPanel(void* data) { @@ -271,7 +235,7 @@ void LLFloaterChatterBox::removeFloater(LLFloater* floaterp) void LLFloaterChatterBox::addFloater(LLFloater* floaterp, BOOL select_added_floater, - LLTabContainerCommon::eInsertionPoint insertion_point) + LLTabContainer::eInsertionPoint insertion_point) { S32 num_locked_tabs = mTabContainer->getNumLockedTabs(); @@ -322,48 +286,6 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp, } } - -//static -LLFloaterChatterBox* LLFloaterChatterBox::showInstance(const LLSD& seed) -{ - LLFloaterChatterBox* chatterbox_floater = LLUISingleton<LLFloaterChatterBox>::showInstance(seed); - - // if TRUE, show tab for active voice channel, otherwise, just show last tab - LLFloater* floater_to_show = NULL; - LLUUID session_id = seed.asUUID(); - if (session_id.notNull()) - { - floater_to_show = gIMMgr->findFloaterBySession(session_id); - } - - if (floater_to_show) - { - floater_to_show->open(); - } - else - { - // just open chatterbox to the last selected tab - chatterbox_floater->open(); - } - - return chatterbox_floater; -} - -//static -BOOL LLFloaterChatterBox::instanceVisible(const LLSD &seed) -{ - if (seed.asBoolean()) - { - LLFloater* floater_to_show = getCurrentVoiceFloater(); - if (floater_to_show) - { - return floater_to_show->isInVisibleChain(); - } - } - - return LLUISingleton<LLFloaterChatterBox>::instanceVisible(seed); -} - //static LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater() { diff --git a/indra/newview/llfloaterchatterbox.h b/indra/newview/llfloaterchatterbox.h index bf06ee9d38..4b1da9c9bc 100644 --- a/indra/newview/llfloaterchatterbox.h +++ b/indra/newview/llfloaterchatterbox.h @@ -36,32 +36,12 @@ #include "llfloater.h" #include "llstring.h" +#include "llimview.h" +#include "llimpanel.h" -class LLTabContainerCommon; +class LLTabContainer; -class LLFloaterMyFriends : public LLFloater, public LLUISingleton<LLFloaterMyFriends> -{ -public: - LLFloaterMyFriends(const LLSD& seed); - virtual ~LLFloaterMyFriends(); - - virtual BOOL postBuild(); - - void onClose(bool app_quitting); - - // override LLUISingleton behavior - static LLFloaterMyFriends* showInstance(const LLSD& id = LLSD()); - static void hideInstance(const LLSD& id); - static BOOL instanceVisible(const LLSD& id); - - static void* createFriendsPanel(void* data); - static void* createGroupsPanel(void* data); - -protected: - LLTabContainerCommon* mTabs; -}; - -class LLFloaterChatterBox : public LLMultiFloater, public LLUISingleton<LLFloaterChatterBox> +class LLFloaterChatterBox : public LLMultiFloater, public LLUISingleton<LLFloaterChatterBox, LLFloaterChatterBox> { public: LLFloaterChatterBox(const LLSD& seed); @@ -75,16 +55,103 @@ public: /*virtual*/ void removeFloater(LLFloater* floaterp); /*virtual*/ void addFloater(LLFloater* floaterp, BOOL select_added_floater, - LLTabContainerCommon::eInsertionPoint insertion_point = LLTabContainerCommon::END); - - static LLFloaterChatterBox* showInstance(const LLSD& seed = LLSD()); - static BOOL instanceVisible(const LLSD& seed); + LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); static LLFloater* getCurrentVoiceFloater(); + + // visibility policy for LLUISingleton + static bool visible(LLFloater* instance, const LLSD& key) + { + LLFloater* floater_to_check = ((LLFloaterChatterBox*)instance)->getFloater(key); + + if (floater_to_check) + { + return floater_to_check->isInVisibleChain(); + } + + // otherwise use default visibility rule for chatterbox + return VisibilityPolicy<LLFloater>::visible(instance, key); + } + + static void show(LLFloater* instance, const LLSD& key) + { + LLFloater* floater_to_show = ((LLFloaterChatterBox*)instance)->getFloater(key); + VisibilityPolicy<LLFloater>::show(instance, key); + + if (floater_to_show) + { + floater_to_show->open(); + } + } + + static void hide(LLFloater* instance, const LLSD& key) + { + VisibilityPolicy<LLFloater>::hide(instance, key); + } + +private: + LLFloater* getFloater(const LLSD& key) + { + LLFloater* floater = NULL; + + //try to show requested session + LLUUID session_id = key.asUUID(); + if (session_id.notNull()) + { + floater = LLIMMgr::getInstance()->findFloaterBySession(session_id); + } + + // if TRUE, show tab for active voice channel, otherwise, just show last tab + if (key.asBoolean()) + { + floater = getCurrentVoiceFloater(); + } + + return floater; + } protected: LLFloater* mActiveVoiceFloater; }; +class LLFloaterMyFriends : public LLFloater, public LLUISingleton<LLFloaterMyFriends, LLFloaterMyFriends> +{ +public: + LLFloaterMyFriends(const LLSD& seed); + virtual ~LLFloaterMyFriends(); + + virtual BOOL postBuild(); + + void onClose(bool app_quitting); + + static void* createFriendsPanel(void* data); + static void* createGroupsPanel(void* data); + + // visibility policy for LLUISingleton + static bool visible(LLFloater* instance, const LLSD& key) + { + LLFloaterMyFriends* floaterp = (LLFloaterMyFriends*)instance; + return floaterp->isInVisibleChain() && floaterp->mTabs->getCurrentPanelIndex() == key.asInteger(); + } + + static void show(LLFloater* instance, const LLSD& key) + { + VisibilityPolicy<LLFloater>::show(instance, key); + // garbage values in id will be interpreted as 0, or the friends tab + ((LLFloaterMyFriends*)instance)->mTabs->selectTab(key); + } + + static void hide(LLFloater* instance, const LLSD& key) + { + if (visible(instance, key)) + { + LLFloaterChatterBox::hideInstance(); + } + } + +protected: + LLTabContainer* mTabs; +}; + #endif // LL_LLFLOATERCHATTERBOX_H diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 324da688f8..137b35c3ee 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -577,7 +577,7 @@ void LLFloaterColorPicker::draw() glEnd(); } - if (gFocusMgr.childHasMouseCapture(mDragHandle)) + if (gFocusMgr.childHasMouseCapture(getDragHandle())) { mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); } @@ -902,104 +902,103 @@ BOOL LLFloaterColorPicker:: handleMouseDown ( S32 x, S32 y, MASK mask ) { - // if this window is in the foreground - if ( mForeground ) - { + BOOL ret = LLFloater::handleMouseDown ( x, y, mask ); + // make it the frontmost - gFloaterView->bringToFront(this); + gFloaterView->bringToFront(this); - // rect containing RGB area - LLRect rgbAreaRect ( mRGBViewerImageLeft, - mRGBViewerImageTop, - mRGBViewerImageLeft + mRGBViewerImageWidth, - mRGBViewerImageTop - mRGBViewerImageHeight ); + // rect containing RGB area + LLRect rgbAreaRect ( mRGBViewerImageLeft, + mRGBViewerImageTop, + mRGBViewerImageLeft + mRGBViewerImageWidth, + mRGBViewerImageTop - mRGBViewerImageHeight ); - if ( rgbAreaRect.pointInRect ( x, y ) ) - { - gViewerWindow->setMouseCapture(this); - // mouse button down - setMouseDownInHueRegion ( TRUE ); + if ( rgbAreaRect.pointInRect ( x, y ) ) + { + gViewerWindow->setMouseCapture(this); + // mouse button down + setMouseDownInHueRegion ( TRUE ); - // update all values based on initial click - updateRgbHslFromPoint ( x, y ); + // update all values based on initial click + updateRgbHslFromPoint ( x, y ); - // required by base class - return TRUE; - } + // required by base class + return TRUE; + } - // rect containing RGB area - LLRect lumAreaRect ( mLumRegionLeft, - mLumRegionTop, - mLumRegionLeft + mLumRegionWidth + mLumMarkerSize, - mLumRegionTop - mLumRegionHeight ); + // rect containing RGB area + LLRect lumAreaRect ( mLumRegionLeft, + mLumRegionTop, + mLumRegionLeft + mLumRegionWidth + mLumMarkerSize, + mLumRegionTop - mLumRegionHeight ); - if ( lumAreaRect.pointInRect ( x, y ) ) - { - gViewerWindow->setMouseCapture(this); - // mouse button down - setMouseDownInLumRegion ( TRUE ); + if ( lumAreaRect.pointInRect ( x, y ) ) + { + gViewerWindow->setMouseCapture(this); + // mouse button down + setMouseDownInLumRegion ( TRUE ); - // required by base class - return TRUE; - } + // required by base class + return TRUE; + } - // rect containing swatch area - LLRect swatchRect ( mSwatchRegionLeft, - mSwatchRegionTop, - mSwatchRegionLeft + mSwatchRegionWidth, - mSwatchRegionTop - mSwatchRegionHeight ); + // rect containing swatch area + LLRect swatchRect ( mSwatchRegionLeft, + mSwatchRegionTop, + mSwatchRegionLeft + mSwatchRegionWidth, + mSwatchRegionTop - mSwatchRegionHeight ); - setMouseDownInSwatch( FALSE ); - if ( swatchRect.pointInRect ( x, y ) ) - { - setMouseDownInSwatch( TRUE ); + setMouseDownInSwatch( FALSE ); + if ( swatchRect.pointInRect ( x, y ) ) + { + setMouseDownInSwatch( TRUE ); - // required - dont drag windows here. - return TRUE; - } + // required - dont drag windows here. + return TRUE; + } - // rect containing palette area - LLRect paletteRect ( mPaletteRegionLeft, - mPaletteRegionTop, - mPaletteRegionLeft + mPaletteRegionWidth, - mPaletteRegionTop - mPaletteRegionHeight ); + // rect containing palette area + LLRect paletteRect ( mPaletteRegionLeft, + mPaletteRegionTop, + mPaletteRegionLeft + mPaletteRegionWidth, + mPaletteRegionTop - mPaletteRegionHeight ); - if ( paletteRect.pointInRect ( x, y ) ) + if ( paletteRect.pointInRect ( x, y ) ) + { + // release keyboard focus so we can change text values + if (gFocusMgr.childHasKeyboardFocus(this)) { - // release keyboard focus so we can change text values - if (gFocusMgr.childHasKeyboardFocus(this)) - { - mSelectBtn->setFocus(TRUE); - } - - // calculate which palette index we selected - S32 c = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth; - S32 r = ( ( y - ( mPaletteRegionTop - mPaletteRegionHeight ) ) * numPaletteRows ) / mPaletteRegionHeight; + mSelectBtn->setFocus(TRUE); + } - U32 index = ( numPaletteRows - r - 1 ) * numPaletteColumns + c; + // calculate which palette index we selected + S32 c = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth; + S32 r = ( ( y - ( mPaletteRegionTop - mPaletteRegionHeight ) ) * numPaletteRows ) / mPaletteRegionHeight; - if ( index <= mPalette.size () ) - { - LLColor4 selected = *mPalette [ index ]; + U32 index = ( numPaletteRows - r - 1 ) * numPaletteColumns + c; - setCurRgb ( selected [ 0 ], selected [ 1 ], selected [ 2 ] ); + if ( index <= mPalette.size () ) + { + LLColor4 selected = *mPalette [ index ]; - if (mApplyImmediateCheck->get()) - { - LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); - } + setCurRgb ( selected [ 0 ], selected [ 1 ], selected [ 2 ] ); - // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion - enableTextCallbacks ( FALSE ); - updateTextEntry (); - enableTextCallbacks ( TRUE ); + if (mApplyImmediateCheck->get()) + { + LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); } - return TRUE; + // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion + enableTextCallbacks ( FALSE ); + updateTextEntry (); + enableTextCallbacks ( TRUE ); } + + return TRUE; } + // dispatch to base class for the rest of things - return LLFloater::handleMouseDown ( x, y, mask ); + return ret; } ////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 9d52107a20..30326dc496 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -60,6 +60,7 @@ //Maximum number of people you can select to do an operation on at once. #define MAX_FRIEND_SELECT 20 +#define DEFAULT_PERIOD 5.0 #define RIGHTS_CHANGE_TIMEOUT 5.0 #define OBSERVER_TIMEOUT 0.5 @@ -80,7 +81,6 @@ public: // events can arrive quickly in bulk - we need not process EVERY one of them - // so we wait a short while to let others pile-in, and process them in aggregate. mEventTimer.start(); - mEventTimer.reset(); // save-up all the mask-bits which have come-in mMask |= mask; @@ -102,7 +102,7 @@ protected: LLPanelFriends::LLPanelFriends() : LLPanel(), - LLEventTimer(1000000), + LLEventTimer(DEFAULT_PERIOD), mObserver(NULL), mShowMaxSelectWarning(TRUE), mAllowRightsChange(TRUE), @@ -122,7 +122,7 @@ LLPanelFriends::~LLPanelFriends() BOOL LLPanelFriends::tick() { mEventTimer.stop(); - mPeriod = 1000000; + mPeriod = DEFAULT_PERIOD; mAllowRightsChange = TRUE; updateFriends(LLFriendObserver::ADD); return FALSE; @@ -152,7 +152,6 @@ void LLPanelFriends::updateFriends(U32 changed_mask) { mPeriod = RIGHTS_CHANGE_TIMEOUT; mEventTimer.start(); - mEventTimer.reset(); mAllowRightsChange = FALSE; } else @@ -208,17 +207,20 @@ BOOL LLPanelFriends::postBuild() } -void LLPanelFriends::addFriend(const std::string& name, const LLUUID& agent_id) +BOOL LLPanelFriends::addFriend(const LLUUID& agent_id) { LLAvatarTracker& at = LLAvatarTracker::instance(); const LLRelationship* relationInfo = at.getBuddyInfo(agent_id); - if(!relationInfo) return; + if(!relationInfo) return FALSE; BOOL online = relationInfo->isOnline(); + std::string fullname; + BOOL have_name = gCacheName->getFullName(agent_id, fullname); + LLSD element; element["id"] = agent_id; element["columns"][LIST_FRIEND_NAME]["column"] = "friend_name"; - element["columns"][LIST_FRIEND_NAME]["value"] = name.c_str(); + element["columns"][LIST_FRIEND_NAME]["value"] = fullname; element["columns"][LIST_FRIEND_NAME]["font"] = "SANSSERIF"; element["columns"][LIST_FRIEND_NAME]["font-style"] = "NORMAL"; element["columns"][LIST_ONLINE_STATUS]["column"] = "icon_online_status"; @@ -247,30 +249,39 @@ void LLPanelFriends::addFriend(const std::string& name, const LLUUID& agent_id) element["columns"][LIST_EDIT_THEIRS]["value"] = relationInfo->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS); element["columns"][LIST_FRIEND_UPDATE_GEN]["column"] = "friend_last_update_generation"; - element["columns"][LIST_FRIEND_UPDATE_GEN]["value"] = relationInfo->getChangeSerialNum(); + element["columns"][LIST_FRIEND_UPDATE_GEN]["value"] = have_name ? relationInfo->getChangeSerialNum() : -1; mFriendsList->addElement(element, ADD_BOTTOM); + return have_name; } // propagate actual relationship to UI -void LLPanelFriends::updateFriendItem(LLScrollListItem* itemp, const LLRelationship* info) +BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationship* info) { - if (!itemp) return; - if (!info) return; + if (!info) return FALSE; + LLScrollListItem* itemp = mFriendsList->getItem(agent_id); + if (!itemp) return FALSE; + + std::string fullname; + BOOL have_name = gCacheName->getFullName(agent_id, fullname); itemp->getColumn(LIST_ONLINE_STATUS)->setValue(info->isOnline() ? gViewerArt.getString("icon_avatar_online.tga") : LLString()); + itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname); // render name of online friends in bold text ((LLScrollListText*)itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle(info->isOnline() ? LLFontGL::BOLD : LLFontGL::NORMAL); itemp->getColumn(LIST_VISIBLE_ONLINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS)); itemp->getColumn(LIST_VISIBLE_MAP)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION)); itemp->getColumn(LIST_EDIT_MINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)); - itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(info->getChangeSerialNum()); + S32 change_generation = have_name ? info->getChangeSerialNum() : -1; + itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(change_generation); // enable this item, in case it was disabled after user input itemp->setEnabled(TRUE); // changed item in place, need to request sort mFriendsList->sortItems(); + + return have_name; } void LLPanelFriends::refreshRightsChangeList() @@ -354,7 +365,8 @@ void LLPanelFriends::refreshNames() std::vector<LLScrollListItem*>::iterator item_it = items.begin(); std::vector<LLScrollListItem*>::iterator item_end = items.end(); - + + BOOL have_names = TRUE; LLAvatarTracker::buddy_map_t::iterator buddy_it; for (buddy_it = all_buddies.begin() ; buddy_it != all_buddies.end(); ++buddy_it) { @@ -379,24 +391,24 @@ void LLPanelFriends::refreshNames() if (last_change_generation < info->getChangeSerialNum()) { // update existing item in UI - updateFriendItem(mFriendsList->getItem(buddy_it->first), info); + have_names &= updateFriendItem(buddy_it->first, info); } ++item_it; } // add new friend to list else { - const LLUUID& buddy_id = buddy_it->first; - char first_name[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last_name[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - - gCacheName->getName(buddy_id, first_name, last_name); - std::ostringstream fullname; - fullname << first_name << " " << last_name; - addFriend(fullname.str(), buddy_id); + have_names &= addFriend(buddy_it->first); } } + if (!have_names) + { + mEventTimer.start(); + } + // changed item in place, need to request sort and update columns + mFriendsList->sortItems(); + // re-select items mFriendsList->selectMultiple(selected_ids); mFriendsList->setScrollPos(pos); } @@ -412,7 +424,7 @@ void LLPanelFriends::refreshUI() single_selected = TRUE; if(num_selected > 1) { - childSetText("friend_name_label", childGetText("Multiple")); + childSetText("friend_name_label", getString("Multiple")); multiple_selected = TRUE; } else @@ -501,26 +513,17 @@ void LLPanelFriends::onClickIM(void* user_data) { LLUUID agent_id = ids[0]; const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(agent_id); - char first[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char last[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - if(info && gCacheName->getName(agent_id, first, last)) + std::string fullname; + if(info && gCacheName->getFullName(agent_id, fullname)) { - char buffer[MAX_STRING]; /* Flawfinder: ignore */ - snprintf(buffer, MAX_STRING, "%s %s", first, last); /* Flawfinder: ignore */ gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession( - buffer, - IM_NOTHING_SPECIAL, - agent_id); + gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id); } } else { gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession("Friends Conference", - IM_SESSION_CONFERENCE_START, - ids[0], - ids); + gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); } make_ui_sound("UISndStartIM"); } @@ -612,8 +615,7 @@ void LLPanelFriends::onClickRemove(void* user_data) if(ids.size() == 1) { LLUUID agent_id = ids[0]; - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string first, last; if(gCacheName->getName(agent_id, first, last)) { args["[FIRST_NAME]"] = first; @@ -671,8 +673,7 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command if(ids.size() == 1) { LLUUID agent_id = ids.begin()->first; - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string first, last; if(gCacheName->getName(agent_id, first, last)) { args["[FIRST_NAME]"] = first; @@ -720,9 +721,8 @@ void LLPanelFriends::modifyRightsConfirmation(S32 option, void* user_data) rights_map_t::iterator rights_it; for (rights_it = rights->begin(); rights_it != rights->end(); ++rights_it) { - LLScrollListItem* itemp = panelp->mFriendsList->getItem(rights_it->first); const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(rights_it->first); - panelp->updateFriendItem(itemp, info); + panelp->updateFriendItem(rights_it->first, info); } } panelp->refreshUI(); diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h index 46e4eaaf79..2e87688f8e 100644 --- a/indra/newview/llfloaterfriends.h +++ b/indra/newview/llfloaterfriends.h @@ -41,7 +41,8 @@ class LLFriendObserver; class LLRelationship; - +class LLScrollListItem; +class LLScrollListCtrl; /** * @class LLPanelFriends @@ -100,8 +101,8 @@ private: void refreshUI(); void refreshRightsChangeList(); void applyRightsToFriends(); - void addFriend(const std::string& name, const LLUUID& agent_id); - void updateFriendItem(LLScrollListItem* itemp, const LLRelationship* relationship); + BOOL addFriend(const LLUUID& agent_id); + BOOL updateFriendItem(const LLUUID& agent_id, const LLRelationship* relationship); typedef enum { @@ -138,7 +139,7 @@ private: LLFriendObserver* mObserver; LLUUID mAddFriendID; LLString mAddFriendName; - LLScrollListCtrl* mFriendsList; + LLScrollListCtrl* mFriendsList; BOOL mShowMaxSelectWarning; BOOL mAllowRightsChange; S32 mNumRightsChanged; diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 3bc7f5a28c..44d158d2e3 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -99,7 +99,7 @@ LLFloaterGesture::~LLFloaterGesture() // Custom saving rectangle, since load must be done // after postBuild. - gSavedSettings.setRect("FloaterGestureRect", mRect); + gSavedSettings.setRect("FloaterGestureRect", getRect()); } // virtual diff --git a/indra/newview/llfloatergroupinvite.cpp b/indra/newview/llfloatergroupinvite.cpp index 6d76f7685a..a82e6e914e 100644 --- a/indra/newview/llfloatergroupinvite.cpp +++ b/indra/newview/llfloatergroupinvite.cpp @@ -83,7 +83,7 @@ LLFloaterGroupInvite::LLFloaterGroupInvite(const std::string& name, const LLUUID& group_id) : LLFloater(name, rect, title) { - LLRect contents(mRect); + LLRect contents(getRect()); contents.mTop -= LLFLOATER_HEADER_SIZE; mImpl = new impl(group_id); diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index 63b9096e77..a1740861d5 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -53,9 +53,9 @@ class LLScrollListCtrl; class LLButton; class LLFloaterGroupPicker; -class LLFloaterGroupPicker : public LLFloater, public LLUIInstanceMgr<LLFloaterGroupPicker> +class LLFloaterGroupPicker : public LLFloater, public LLUIFactory<LLFloaterGroupPicker, LLFloaterGroupPicker, VisibilityPolicy<LLFloater> > { - friend class LLUIInstanceMgr<LLFloaterGroupPicker>; + friend class LLUIFactory<LLFloaterGroupPicker>; public: ~LLFloaterGroupPicker(); void setSelectCallback( void (*callback)(LLUUID, void*), @@ -63,11 +63,13 @@ public: void setPowersMask(U64 powers_mask); BOOL postBuild(); + // implementation of factory policy + static LLFloaterGroupPicker* findInstance(const LLSD& seed); + static LLFloaterGroupPicker* createInstance(const LLSD& seed); + protected: LLFloaterGroupPicker(const LLSD& seed); void ok(); - static LLFloaterGroupPicker* findInstance(const LLSD& seed); - static LLFloaterGroupPicker* createInstance(const LLSD& seed); static void onBtnOK(void* userdata); static void onBtnCancel(void* userdata); diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 9f1624d20c..4280e250d7 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -211,18 +211,13 @@ void LLFloaterInspect::refresh() { LLSelectNode* obj = *iter; LLSD row; - char owner_first_name[MAX_STRING], owner_last_name[MAX_STRING]; - char creator_first_name[MAX_STRING], creator_last_name[MAX_STRING]; char time[MAX_STRING]; - std::ostringstream owner_name, creator_name, date; + std::string owner_name, creator_name; time_t timestamp = (time_t) (obj->mCreationDate/1000000); LLString::copy(time, ctime(×tamp), MAX_STRING); time[24] = '\0'; - date << obj->mCreationDate; - gCacheName->getName(obj->mPermissions->getOwner(), owner_first_name, owner_last_name); - owner_name << owner_first_name << " " << owner_last_name; - gCacheName->getName(obj->mPermissions->getCreator(), creator_first_name, creator_last_name); - creator_name << creator_first_name << " " << creator_last_name; + gCacheName->getFullName(obj->mPermissions->getOwner(), owner_name); + gCacheName->getFullName(obj->mPermissions->getCreator(), creator_name); row["id"] = obj->getObject()->getID(); row["columns"][0]["column"] = "object_name"; row["columns"][0]["type"] = "text"; @@ -238,10 +233,10 @@ void LLFloaterInspect::refresh() } row["columns"][1]["column"] = "owner_name"; row["columns"][1]["type"] = "text"; - row["columns"][1]["value"] = owner_name.str().c_str(); + row["columns"][1]["value"] = owner_name; row["columns"][2]["column"] = "creator_name"; row["columns"][2]["type"] = "text"; - row["columns"][2]["value"] = creator_name.str().c_str(); + row["columns"][2]["value"] = creator_name; row["columns"][3]["column"] = "creation_date"; row["columns"][3]["type"] = "text"; row["columns"][3]["value"] = time; diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index 8656f13124..befb133f68 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -67,7 +67,7 @@ private: // static data static LLFloaterInspect* sInstance; - LLHandle<LLObjectSelection> mObjectSelection; + LLSafeHandle<LLObjectSelection> mObjectSelection; }; #endif //LL_LLFLOATERINSPECT_H diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp index 04a5cf6a24..9f1bef5be7 100644 --- a/indra/newview/llfloaterlagmeter.cpp +++ b/indra/newview/llfloaterlagmeter.cpp @@ -72,49 +72,49 @@ LLFloaterLagMeter::LLFloaterLagMeter() mServerText = LLUICtrlFactory::getTextBoxByName(this, "server_text"); mServerCause = LLUICtrlFactory::getTextBoxByName(this, "server_lag_cause"); - LLString config_string = childGetText("client_frame_rate_critical_fps"); + LLString config_string = getString("client_frame_rate_critical_fps", mStringArgs); mClientFrameTimeCritical = 1.0f / (float)atof( config_string.c_str() ); - config_string = childGetText("client_frame_rate_warning_fps"); + config_string = getString("client_frame_rate_warning_fps", mStringArgs); mClientFrameTimeWarning = 1.0f / (float)atof( config_string.c_str() ); - config_string = childGetText("network_packet_loss_critical_pct"); + config_string = getString("network_packet_loss_critical_pct", mStringArgs); mNetworkPacketLossCritical = (float)atof( config_string.c_str() ); - config_string = childGetText("network_packet_loss_warning_pct"); + config_string = getString("network_packet_loss_warning_pct", mStringArgs); mNetworkPacketLossWarning = (float)atof( config_string.c_str() ); - config_string = childGetText("network_ping_critical_ms"); + config_string = getString("network_ping_critical_ms", mStringArgs); mNetworkPingCritical = (float)atof( config_string.c_str() ); - config_string = childGetText("network_ping_warning_ms"); + config_string = getString("network_ping_warning_ms", mStringArgs); mNetworkPingWarning = (float)atof( config_string.c_str() ); - config_string = childGetText("server_frame_rate_critical_fps"); + config_string = getString("server_frame_rate_critical_fps", mStringArgs); mServerFrameTimeCritical = 1000.0f / (float)atof( config_string.c_str() ); - config_string = childGetText("server_frame_rate_warning_fps"); + config_string = getString("server_frame_rate_warning_fps", mStringArgs); mServerFrameTimeWarning = 1000.0f / (float)atof( config_string.c_str() ); - config_string = childGetText("server_single_process_max_time_ms"); + config_string = getString("server_single_process_max_time_ms", mStringArgs); mServerSingleProcessMaxTime = (float)atof( config_string.c_str() ); mShrunk = false; - config_string = childGetText("max_width_px"); + config_string = getString("max_width_px", mStringArgs); mMaxWidth = atoi( config_string.c_str() ); - config_string = childGetText("min_width_px"); + config_string = getString("min_width_px", mStringArgs); mMinWidth = atoi( config_string.c_str() ); - childSetTextArg("client_frame_time_critical_msg", "[CLIENT_FRAME_RATE_CRITICAL]", childGetText("client_frame_rate_critical_fps")); - childSetTextArg("client_frame_time_warning_msg", "[CLIENT_FRAME_RATE_CRITICAL]", childGetText("client_frame_rate_critical_fps")); - childSetTextArg("client_frame_time_warning_msg", "[CLIENT_FRAME_RATE_WARNING]", childGetText("client_frame_rate_warning_fps")); + mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps"); + mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps"); + mStringArgs["[CLIENT_FRAME_RATE_WARNING]"] = getString("client_frame_rate_warning_fps"); - childSetTextArg("network_packet_loss_critical_msg", "[NETWORK_PACKET_LOSS_CRITICAL]", childGetText("network_packet_loss_critical_pct")); - childSetTextArg("network_packet_loss_warning_msg", "[NETWORK_PACKET_LOSS_CRITICAL]", childGetText("network_packet_loss_critical_pct")); - childSetTextArg("network_packet_loss_warning_msg", "[NETWORK_PACKET_LOSS_WARNING]", childGetText("network_packet_loss_warning_pct")); + mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct"); + mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct"); + mStringArgs["[NETWORK_PACKET_LOSS_WARNING]"] = getString("network_packet_loss_warning_pct"); - childSetTextArg("network_ping_critical_msg", "[NETWORK_PING_CRITICAL]", childGetText("network_ping_critical_ms")); - childSetTextArg("network_ping_warning_msg", "[NETWORK_PING_CRITICAL]", childGetText("network_ping_critical_ms")); - childSetTextArg("network_ping_warning_msg", "[NETWORK_PING_WARNING]", childGetText("network_ping_warning_ms")); + mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms"); + mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms"); + mStringArgs["[NETWORK_PING_WARNING]"] = getString("network_ping_warning_ms"); - childSetTextArg("server_frame_time_critical_msg", "[SERVER_FRAME_RATE_CRITICAL]", childGetText("server_frame_rate_critical_fps")); - childSetTextArg("server_frame_time_warning_msg", "[SERVER_FRAME_RATE_CRITICAL]", childGetText("server_frame_rate_critical_fps")); - childSetTextArg("server_frame_time_warning_msg", "[SERVER_FRAME_RATE_WARNING]", childGetText("server_frame_rate_warning_fps")); + mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps"); + mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps"); + mStringArgs["[SERVER_FRAME_RATE_WARNING]"] = getString("server_frame_rate_warning_fps"); childSetAction("minimize", onClickShrink, this); @@ -162,25 +162,25 @@ void LLFloaterLagMeter::determineClient() if (!gFocusMgr.getAppHasFocus()) { mClientButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); - mClientText->setText( childGetText("client_frame_time_window_bg_msg") ); + mClientText->setText( getString("client_frame_time_window_bg_msg", mStringArgs) ); mClientCause->setText( LLString::null ); } else if(client_frame_time >= mClientFrameTimeCritical) { mClientButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME); - mClientText->setText( childGetText("client_frame_time_critical_msg") ); + mClientText->setText( getString("client_frame_time_critical_msg", mStringArgs) ); find_cause = true; } else if(client_frame_time >= mClientFrameTimeWarning) { mClientButton->setImageUnselected(LAG_WARNING_IMAGE_NAME); - mClientText->setText( childGetText("client_frame_time_warning_msg") ); + mClientText->setText( getString("client_frame_time_warning_msg", mStringArgs) ); find_cause = true; } else { mClientButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); - mClientText->setText( childGetText("client_frame_time_normal_msg") ); + mClientText->setText( getString("client_frame_time_normal_msg", mStringArgs) ); mClientCause->setText( LLString::null ); } @@ -188,19 +188,19 @@ void LLFloaterLagMeter::determineClient() { if(gSavedSettings.getF32("RenderFarClip") > 128) { - mClientCause->setText( childGetText("client_draw_distance_cause_msg") ); + mClientCause->setText( getString("client_draw_distance_cause_msg", mStringArgs) ); } else if(LLAppViewer::instance()->getTextureFetch()->getNumRequests() > 2) { - mClientCause->setText( childGetText("client_texture_loading_cause_msg") ); + mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) ); } else if(LLViewerImage::sBoundTextureMemory > LLViewerImage::sMaxBoundTextureMem) { - mClientCause->setText( childGetText("client_texture_memory_cause_msg") ); + mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) ); } else { - mClientCause->setText( childGetText("client_complex_objects_cause_msg") ); + mClientCause->setText( getString("client_complex_objects_cause_msg", mStringArgs) ); } } } @@ -215,40 +215,40 @@ void LLFloaterLagMeter::determineNetwork() if(packet_loss >= mNetworkPacketLossCritical) { mNetworkButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME); - mNetworkText->setText( childGetText("network_packet_loss_critical_msg") ); + mNetworkText->setText( getString("network_packet_loss_critical_msg", mStringArgs) ); find_cause_loss = true; } else if(ping_time >= mNetworkPingCritical) { mNetworkButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME); - mNetworkText->setText( childGetText("network_ping_critical_msg") ); + mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) ); find_cause_ping = true; } else if(packet_loss >= mNetworkPacketLossWarning) { mNetworkButton->setImageUnselected(LAG_WARNING_IMAGE_NAME); - mNetworkText->setText( childGetText("network_packet_loss_warning_msg") ); + mNetworkText->setText( getString("network_packet_loss_warning_msg", mStringArgs) ); find_cause_loss = true; } else if(ping_time >= mNetworkPingWarning) { mNetworkButton->setImageUnselected(LAG_WARNING_IMAGE_NAME); - mNetworkText->setText( childGetText("network_ping_warning_msg") ); + mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) ); find_cause_ping = true; } else { mNetworkButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); - mNetworkText->setText( childGetText("network_performance_normal_msg") ); + mNetworkText->setText( getString("network_performance_normal_msg", mStringArgs) ); } if(find_cause_loss) { - mNetworkCause->setText( childGetText("network_packet_loss_cause_msg") ); + mNetworkCause->setText( getString("network_packet_loss_cause_msg", mStringArgs) ); } else if(find_cause_ping) { - mNetworkCause->setText( childGetText("network_ping_cause_msg") ); + mNetworkCause->setText( getString("network_ping_cause_msg", mStringArgs) ); } else { @@ -264,19 +264,19 @@ void LLFloaterLagMeter::determineServer() if(sim_frame_time >= mServerFrameTimeCritical) { mServerButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME); - mServerText->setText( childGetText("server_frame_time_critical_msg") ); + mServerText->setText( getString("server_frame_time_critical_msg", mStringArgs) ); find_cause = true; } else if(sim_frame_time >= mServerFrameTimeWarning) { mServerButton->setImageUnselected(LAG_WARNING_IMAGE_NAME); - mServerText->setText( childGetText("server_frame_time_warning_msg") ); + mServerText->setText( getString("server_frame_time_warning_msg", mStringArgs) ); find_cause = true; } else { mServerButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); - mServerText->setText( childGetText("server_frame_time_normal_msg") ); + mServerText->setText( getString("server_frame_time_normal_msg", mStringArgs) ); mServerCause->setText( LLString::null ); } @@ -284,27 +284,27 @@ void LLFloaterLagMeter::determineServer() { if(gViewerStats->mSimSimPhysicsMsec.getCurrent() > mServerSingleProcessMaxTime) { - mServerCause->setText( childGetText("server_physics_cause_msg") ); + mServerCause->setText( getString("server_physics_cause_msg", mStringArgs) ); } else if(gViewerStats->mSimScriptMsec.getCurrent() > mServerSingleProcessMaxTime) { - mServerCause->setText( childGetText("server_scripts_cause_msg") ); + mServerCause->setText( getString("server_scripts_cause_msg", mStringArgs) ); } else if(gViewerStats->mSimNetMsec.getCurrent() > mServerSingleProcessMaxTime) { - mServerCause->setText( childGetText("server_net_cause_msg") ); + mServerCause->setText( getString("server_net_cause_msg", mStringArgs) ); } else if(gViewerStats->mSimAgentMsec.getCurrent() > mServerSingleProcessMaxTime) { - mServerCause->setText( childGetText("server_agent_cause_msg") ); + mServerCause->setText( getString("server_agent_cause_msg", mStringArgs) ); } else if(gViewerStats->mSimImagesMsec.getCurrent() > mServerSingleProcessMaxTime) { - mServerCause->setText( childGetText("server_images_cause_msg") ); + mServerCause->setText( getString("server_images_cause_msg", mStringArgs) ); } else { - mServerCause->setText( childGetText("server_generic_cause_msg") ); + mServerCause->setText( getString("server_generic_cause_msg", mStringArgs) ); } } } @@ -314,38 +314,38 @@ void LLFloaterLagMeter::onClickShrink(void * data) { LLFloaterLagMeter * self = (LLFloaterLagMeter*)data; - LLButton * button = (LLButton*)self->getChildByName("minimize"); + LLButton * button = self->getChild<LLButton>("minimize"); S32 delta_width = self->mMaxWidth - self->mMinWidth; LLRect r = self->getRect(); if(self->mShrunk) { - self->setTitle( self->childGetText("max_title_msg") ); + self->setTitle( self->getString("max_title_msg", self->mStringArgs) ); // make left edge appear to expand r.translate(-delta_width, 0); self->setRect(r); self->reshape(self->mMaxWidth, self->getRect().getHeight()); - self->childSetText("client", self->childGetText("client_text_msg") + ":"); - self->childSetText("network", self->childGetText("network_text_msg") + ":"); - self->childSetText("server", self->childGetText("server_text_msg") + ":"); + self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) + ":"); + self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) + ":"); + self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) + ":"); // usually "<<" - button->setLabel( self->childGetText("smaller_label") ); + button->setLabel( self->getString("smaller_label", self->mStringArgs) ); } else { - self->setTitle( self->childGetText("min_title_msg") ); + self->setTitle( self->getString("min_title_msg", self->mStringArgs) ); // make left edge appear to collapse r.translate(delta_width, 0); self->setRect(r); self->reshape(self->mMinWidth, self->getRect().getHeight()); - self->childSetText("client", self->childGetText("client_text_msg") ); - self->childSetText("network", self->childGetText("network_text_msg") ); - self->childSetText("server", self->childGetText("server_text_msg") ); + self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) ); + self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) ); + self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) ); // usually ">>" - button->setLabel( self->childGetText("bigger_label") ); + button->setLabel( self->getString("bigger_label", self->mStringArgs) ); } // Don't put keyboard focus on the button button->setFocus(FALSE); diff --git a/indra/newview/llfloaterlagmeter.h b/indra/newview/llfloaterlagmeter.h index 0309f199f7..83603826c4 100644 --- a/indra/newview/llfloaterlagmeter.h +++ b/indra/newview/llfloaterlagmeter.h @@ -74,6 +74,8 @@ private: LLTextBox * mServerText; LLTextBox * mServerCause; + LLString::format_map_t mStringArgs; + static LLFloaterLagMeter * sInstance; }; diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index f340ff2569..aafd5d7cb4 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -112,7 +112,7 @@ static const BOOL BUY_PERSONAL_LAND = FALSE; LLParcelSelectionObserver* LLFloaterLand::sObserver = NULL; S32 LLFloaterLand::sLastTab = 0; -LLViewHandle LLPanelLandGeneral::sBuyPassDialogHandle; +LLHandle<LLFloater> LLPanelLandGeneral::sBuyPassDialogHandle; // Local classes class LLParcelSelectionObserver : public LLParcelObserver @@ -189,10 +189,6 @@ void LLFloaterLand::refreshAll() void LLFloaterLand::onOpen() { - // Select tab from last view - mTabLand->selectTab(sLastTab); - - // Done automatically when the selected parcel's properties arrive // (and hence we have the local id). // gParcelMgr->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER); @@ -237,7 +233,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed) factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); - gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map); + gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map, false); sObserver = new LLParcelSelectionObserver(); gParcelMgr->addObserver( sObserver ); @@ -245,7 +241,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed) BOOL LLFloaterLand::postBuild() { - LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(this, "landtab"); + LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(this, "landtab"); mTabLand = (LLTabContainer*) tab; @@ -483,7 +479,7 @@ void LLPanelLandGeneral::refresh() mCheckContributeWithDeed->setEnabled(FALSE); mTextOwner->setText(LLString::null); - mBtnProfile->setLabel(childGetText("profile_text")); + mBtnProfile->setLabel(getString("profile_text")); mBtnProfile->setEnabled(FALSE); mTextClaimDate->setText(LLString::null); @@ -537,12 +533,12 @@ void LLPanelLandGeneral::refresh() { mTextSalePending->setText(LLString::null); mTextSalePending->setEnabled(FALSE); - mTextOwner->setText(childGetText("public_text")); + mTextOwner->setText(getString("public_text")); mTextOwner->setEnabled(FALSE); mBtnProfile->setEnabled(FALSE); mTextClaimDate->setText(LLString::null); mTextClaimDate->setEnabled(FALSE); - mTextGroup->setText(childGetText("none_text")); + mTextGroup->setText(getString("none_text")); mTextGroup->setEnabled(FALSE); mBtnStartAuction->setEnabled(FALSE); } @@ -550,12 +546,12 @@ void LLPanelLandGeneral::refresh() { if(!is_leased && (owner_id == gAgent.getID())) { - mTextSalePending->setText(childGetText("need_tier_to_modify")); + mTextSalePending->setText(getString("need_tier_to_modify")); mTextSalePending->setEnabled(TRUE); } else if(parcel->getAuctionID()) { - mTextSalePending->setText(childGetText("auction_id_text")); + mTextSalePending->setText(getString("auction_id_text")); mTextSalePending->setTextArg("[ID]", llformat("%u", parcel->getAuctionID())); mTextSalePending->setEnabled(TRUE); } @@ -574,15 +570,15 @@ void LLPanelLandGeneral::refresh() if (parcel->getGroupID().isNull()) { // Not group owned, so "Profile" - mBtnProfile->setLabel(childGetText("profile_text")); + mBtnProfile->setLabel(getString("profile_text")); - mTextGroup->setText(childGetText("none_text")); + mTextGroup->setText(getString("none_text")); mTextGroup->setEnabled(FALSE); } else { // Group owned, so "Info" - mBtnProfile->setLabel(childGetText("info_text")); + mBtnProfile->setLabel(getString("info_text")); //mTextGroup->setText("HIPPOS!");//parcel->getGroupName()); mTextGroup->setEnabled(TRUE); @@ -692,9 +688,9 @@ void LLPanelLandGeneral::refresh() &dwell); // Area - LLUIString price = childGetText("area_size_text"); + LLUIString price = getString("area_size_text"); price.setArg("[AREA]", llformat("%d",area)); - mTextPriceLabel->setText(childGetText("area_text")); + mTextPriceLabel->setText(getString("area_text")); mTextPrice->setText(price.getString()); mTextDwell->setText(llformat("%.0f", dwell)); @@ -732,29 +728,24 @@ void LLPanelLandGeneral::refreshNames() LLString owner; if (parcel->getIsGroupOwned()) { - owner = childGetText("group_owned_text"); + owner = getString("group_owned_text"); } else { // Figure out the owner's name - char owner_first[MAX_STRING]; /*Flawfinder: ignore*/ - char owner_last[MAX_STRING]; /*Flawfinder: ignore*/ - gCacheName->getName(parcel->getOwnerID(), owner_first, owner_last); - owner = llformat("%s %s", owner_first, owner_last); + gCacheName->getFullName(parcel->getOwnerID(), owner); } if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus()) { - owner += childGetText("sale_pending_text"); + owner += getString("sale_pending_text"); } mTextOwner->setText(owner); LLString group; if(!parcel->getGroupID().isNull()) { - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - gCacheName->getGroupName(parcel->getGroupID(), buffer); - group = buffer; + gCacheName->getGroupName(parcel->getGroupID(), group); } mTextGroup->setText(group); @@ -762,18 +753,12 @@ void LLPanelLandGeneral::refreshNames() if(auth_buyer_id.notNull()) { LLString name; - char firstname[MAX_STRING]; /*Flawfinder: ignore*/ - char lastname[MAX_STRING]; /*Flawfinder: ignore*/ - gCacheName->getName(auth_buyer_id, firstname, lastname); - name.assign(firstname); - name.append(" "); - name.append(lastname); - + gCacheName->getFullName(auth_buyer_id, name); mSaleInfoForSale2->setTextArg("[BUYER]", name); } else { - mSaleInfoForSale2->setTextArg("[BUYER]", childGetText("anyone")); + mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone")); } } @@ -949,7 +934,7 @@ void LLPanelLandGeneral::cbBuyPass(S32 option, void* data) //static BOOL LLPanelLandGeneral::buyPassDialogVisible() { - return LLFloater::getFloaterByHandle(sBuyPassDialogHandle) != NULL; + return sBuyPassDialogHandle.get() != NULL; } // static @@ -1071,7 +1056,7 @@ BOOL LLPanelLandObjects::postBuild() image_id.set( gViewerArt.getString("icon_group.tga") ); mIconGroup = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - mOwnerList = LLUICtrlFactory::getNameListByName(this, "owner list"); + mOwnerList = getChild<LLNameListCtrl>("owner list"); mOwnerList->sortByColumn(3, FALSE); childSetCommitCallback("owner list", onCommitList, this); mOwnerList->setDoubleClickCallback(onDoubleClickOwner); @@ -1181,12 +1166,12 @@ void LLPanelLandObjects::refresh() if (sw_total > sw_max) { - mSWTotalObjects->setText(childGetText("objects_deleted_text")); + mSWTotalObjects->setText(getString("objects_deleted_text")); mSWTotalObjects->setTextArg("[DELETED]", llformat("%d", sw_total - sw_max)); } else { - mSWTotalObjects->setText(childGetText("objects_available_text")); + mSWTotalObjects->setText(getString("objects_available_text")); mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", sw_max - sw_total)); } mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", sw_total)); @@ -1311,8 +1296,7 @@ void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata) } else { - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string first, last; gCacheName->getName(owner_id, first, last); args["[FIRST]"] = first; args["[LAST]"] = last; @@ -1336,7 +1320,7 @@ void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata) { if (parcel) { - char group_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); LLString::format_map_t args; args["[GROUPNAME]"] = group_name; @@ -1639,12 +1623,8 @@ void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata) } else { - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - gCacheName->getName(owner_id, first, last); - std::string name = first; - name += " "; - name += last; + std::string name; + gCacheName->getFullName(owner_id, name); args["[NAME]"] = name; gViewerWindow->alertXml("ReturnObjectsOwnedByUser", args, callbackReturnOwnerObjects, userdata); } @@ -1659,7 +1639,7 @@ void LLPanelLandObjects::onClickReturnGroupObjects(void* userdata) send_parcel_select_objects(parcel->getLocalID(), RT_GROUP); - char group_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); LLStringBase<char>::format_map_t args; @@ -1688,7 +1668,7 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata) if (parcel->getIsGroupOwned()) { - char group_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); args["[NAME]"] = group_name; @@ -1704,13 +1684,8 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata) } else { - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - gCacheName->getName(owner_id, first, last); std::string name; - name += first; - name += " "; - name += last; + gCacheName->getFullName(owner_id, name); args["[NAME]"] = name; gViewerWindow->alertXml("ReturnObjectsNotOwnedByUser", args, callbackReturnOtherObjects, userdata); @@ -1857,7 +1832,7 @@ BOOL LLPanelLandOptions::postBuild() }*/ - mSnapshotCtrl = LLUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl"); + mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl"); if (mSnapshotCtrl) { mSnapshotCtrl->setCommitCallback( onCommitAny ); @@ -1948,7 +1923,7 @@ void LLPanelLandOptions::refresh() mSnapshotCtrl->setImageAssetID(LLUUID::null); mSnapshotCtrl->setEnabled(FALSE); - mLocationText->setTextArg("[LANDING]", childGetText("landing_point_none")); + mLocationText->setTextArg("[LANDING]", getString("landing_point_none")); mSetBtn->setEnabled(FALSE); mClearBtn->setEnabled(FALSE); @@ -1995,13 +1970,13 @@ void LLPanelLandOptions::refresh() mPushRestrictionCtrl->set( parcel->getRestrictPushObject() ); if(parcel->getRegionPushOverride()) { - mPushRestrictionCtrl->setLabel(childGetText("push_restrict_region_text")); + mPushRestrictionCtrl->setLabel(getString("push_restrict_region_text")); mPushRestrictionCtrl->setEnabled(false); mPushRestrictionCtrl->set(TRUE); } else { - mPushRestrictionCtrl->setLabel(childGetText("push_restrict_text")); + mPushRestrictionCtrl->setLabel(getString("push_restrict_text")); mPushRestrictionCtrl->setEnabled(can_change_options); } @@ -2025,7 +2000,7 @@ void LLPanelLandOptions::refresh() LLVector3 pos = parcel->getUserLocation(); if (pos.isExactlyZero()) { - mLocationText->setTextArg("[LANDING]", childGetText("landing_point_none")); + mLocationText->setTextArg("[LANDING]", getString("landing_point_none")); } else { @@ -2245,11 +2220,11 @@ BOOL LLPanelLandAccess::postBuild() childSetAction("add_banned", onClickAddBanned, this); childSetAction("remove_banned", onClickRemoveBanned, this); - mListAccess = LLUICtrlFactory::getNameListByName(this, "AccessList"); + mListAccess = getChild<LLNameListCtrl>("AccessList"); if (mListAccess) mListAccess->sortByColumn(0, TRUE); // ascending - mListBanned = LLUICtrlFactory::getNameListByName(this, "BannedList"); + mListBanned = getChild<LLNameListCtrl>("BannedList"); if (mListBanned) mListBanned->sortByColumn(0, TRUE); // ascending @@ -2280,9 +2255,9 @@ void LLPanelLandAccess::refresh() childSetValue("public_access", public_access ); childSetValue("GroupCheck", use_group ); - char group_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); - childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name) ); + childSetLabelArg("GroupCheck", "[GROUP]", group_name ); // Allow list { @@ -2503,13 +2478,12 @@ void LLPanelLandAccess::refresh_ui() void LLPanelLandAccess::refreshNames() { LLParcel* parcel = mParcel->getParcel(); - char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - group_name[0] = '\0'; + std::string group_name; if(parcel) { gCacheName->getGroupName(parcel->getGroupID(), group_name); } - childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name)); + childSetLabelArg("GroupCheck", "[GROUP]", group_name); } @@ -2561,7 +2535,7 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) BOOL use_access_group = self->childGetValue("GroupCheck").asBoolean(); if (use_access_group) { - char group_name[MAX_STRING]; /*Flawfinder: ignore*/ + std::string group_name; if (!gCacheName->getGroupName(parcel->getGroupID(), group_name)) { use_access_group = FALSE; @@ -2738,35 +2712,35 @@ void LLPanelLandCovenant::refresh() LLViewerRegion* region = gParcelMgr->getSelectionRegion(); if(!region) return; - LLTextBox* region_name = (LLTextBox*)getChildByName("region_name_text"); + LLTextBox* region_name = getChild<LLTextBox>("region_name_text"); if (region_name) { region_name->setText(region->getName()); } - LLTextBox* resellable_clause = (LLTextBox*)getChildByName("resellable_clause"); + LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause"); if (resellable_clause) { if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) { - resellable_clause->setText(childGetText("can_not_resell")); + resellable_clause->setText(getString("can_not_resell")); } else { - resellable_clause->setText(childGetText("can_resell")); + resellable_clause->setText(getString("can_resell")); } } - LLTextBox* changeable_clause = (LLTextBox*)getChildByName("changeable_clause"); + LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause"); if (changeable_clause) { if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) { - changeable_clause->setText(childGetText("can_change")); + changeable_clause->setText(getString("can_change")); } else { - changeable_clause->setText(childGetText("can_not_change")); + changeable_clause->setText(getString("can_not_change")); } } @@ -2785,7 +2759,7 @@ void LLPanelLandCovenant::updateCovenantText(const std::string &string) LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); if (self) { - LLViewerTextEditor* editor = (LLViewerTextEditor*)self->getChildByName("covenant_editor"); + LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("covenant_editor"); if (editor) { editor->setHandleEditKeysDirectly(TRUE); @@ -2800,7 +2774,7 @@ void LLPanelLandCovenant::updateEstateName(const std::string& name) LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); if (self) { - LLTextBox* editor = (LLTextBox*)self->getChildByName("estate_name_text"); + LLTextBox* editor = self->getChild<LLTextBox>("estate_name_text"); if (editor) editor->setText(name); } } @@ -2811,7 +2785,7 @@ void LLPanelLandCovenant::updateLastModified(const std::string& text) LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); if (self) { - LLTextBox* editor = (LLTextBox*)self->getChildByName("covenant_timestamp_text"); + LLTextBox* editor = self->getChild<LLTextBox>("covenant_timestamp_text"); if (editor) editor->setText(text); } } @@ -2822,7 +2796,7 @@ void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name) LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); if (self) { - LLTextBox* editor = (LLTextBox*)self->getChildByName("estate_owner_text"); + LLTextBox* editor = self->getChild<LLTextBox>("estate_owner_text"); if (editor) editor->setText(name); } } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index e504e27f21..38d58fabfe 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -68,8 +68,9 @@ class LLPanelLandRenters; class LLPanelLandCovenant; class LLFloaterLand -: public LLFloater, public LLUISingleton<LLFloaterLand> +: public LLFloater, public LLUISingleton<LLFloaterLand, VisibilityPolicy<LLFloater> > { + friend class LLUISingleton<LLFloaterLand, VisibilityPolicy<LLFloater> >; public: static void refreshAll(); @@ -82,7 +83,6 @@ public: virtual BOOL postBuild(); protected: - friend class LLUISingleton<LLFloaterLand>; // Does its own instance management, so clients not allowed // to allocate or destroy. @@ -113,7 +113,7 @@ protected: LLPanelLandAccess* mPanelAccess; LLPanelLandCovenant* mPanelCovenant; - LLHandle<LLParcelSelection> mParcel; + LLSafeHandle<LLParcelSelection> mParcel; public: // When closing the dialog, we want to deselect the land. But when @@ -128,7 +128,7 @@ class LLPanelLandGeneral : public LLPanel { public: - LLPanelLandGeneral(LLHandle<LLParcelSelection>& parcelp); + LLPanelLandGeneral(LLSafeHandle<LLParcelSelection>& parcelp); virtual ~LLPanelLandGeneral(); void refresh(); void refreshNames(); @@ -220,16 +220,16 @@ protected: LLButton* mBtnBuyPass; LLButton* mBtnStartAuction; - LLHandle<LLParcelSelection>& mParcel; + LLSafeHandle<LLParcelSelection>& mParcel; - static LLViewHandle sBuyPassDialogHandle; + static LLHandle<LLFloater> sBuyPassDialogHandle; }; class LLPanelLandObjects : public LLPanel { public: - LLPanelLandObjects(LLHandle<LLParcelSelection>& parcelp); + LLPanelLandObjects(LLSafeHandle<LLParcelSelection>& parcelp); virtual ~LLPanelLandObjects(); void refresh(); virtual void draw(); @@ -292,7 +292,7 @@ protected: S32 mSelectedCount; BOOL mSelectedIsGroup; - LLHandle<LLParcelSelection>& mParcel; + LLSafeHandle<LLParcelSelection>& mParcel; }; @@ -300,7 +300,7 @@ class LLPanelLandOptions : public LLPanel { public: - LLPanelLandOptions(LLHandle<LLParcelSelection>& parcelp); + LLPanelLandOptions(LLSafeHandle<LLParcelSelection>& parcelp); virtual ~LLPanelLandOptions(); void refresh(); @@ -339,7 +339,7 @@ protected: LLCheckBoxCtrl *mPushRestrictionCtrl; LLButton *mPublishHelpButton; - LLHandle<LLParcelSelection>& mParcel; + LLSafeHandle<LLParcelSelection>& mParcel; }; @@ -347,7 +347,7 @@ class LLPanelLandAccess : public LLPanel { public: - LLPanelLandAccess(LLHandle<LLParcelSelection>& parcelp); + LLPanelLandAccess(LLSafeHandle<LLParcelSelection>& parcelp); virtual ~LLPanelLandAccess(); void refresh(); void refresh_ui(); @@ -369,7 +369,7 @@ protected: LLNameListCtrl* mListAccess; LLNameListCtrl* mListBanned; - LLHandle<LLParcelSelection>& mParcel; + LLSafeHandle<LLParcelSelection>& mParcel; }; @@ -377,7 +377,7 @@ class LLPanelLandCovenant : public LLPanel { public: - LLPanelLandCovenant(LLHandle<LLParcelSelection>& parcelp); + LLPanelLandCovenant(LLSafeHandle<LLParcelSelection>& parcelp); virtual ~LLPanelLandCovenant(); virtual BOOL postBuild(); void refresh(); @@ -387,7 +387,7 @@ public: static void updateEstateOwnerName(const std::string& name); protected: - LLHandle<LLParcelSelection>& mParcel; + LLSafeHandle<LLParcelSelection>& mParcel; }; #endif diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index ef628be471..4097abc22d 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -128,7 +128,7 @@ LLFloaterMap::LLFloaterMap(const std::string& name) TRUE) // close button { const S32 LEFT = LLPANEL_BORDER_WIDTH; - const S32 TOP = mRect.getHeight(); + const S32 TOP = getRect().getHeight(); S32 y = 0; @@ -136,7 +136,7 @@ LLFloaterMap::LLFloaterMap(const std::string& name) LLRect map_rect( LEFT, TOP - LLPANEL_BORDER_WIDTH, - mRect.getWidth() - LLPANEL_BORDER_WIDTH, + getRect().getWidth() - LLPANEL_BORDER_WIDTH, y ); LLColor4 bg_color = gColors.getColor( "NetMapBackgroundColor" ); mMap = new LLNetMap("Net Map", map_rect, bg_color); @@ -144,8 +144,7 @@ LLFloaterMap::LLFloaterMap(const std::string& name) addChildAtEnd(mMap); // Get the drag handle all the way in back - removeChild(mDragHandle); - addChildAtEnd(mDragHandle); + sendChildToBack(getDragHandle()); setIsChrome(TRUE); } @@ -191,14 +190,14 @@ void LLFloaterMap::draw() if( gAgent.cameraMouselook()) { setMouseOpaque(FALSE); - mDragHandle->setMouseOpaque(FALSE); + getDragHandle()->setMouseOpaque(FALSE); drawChild(mMap); } else { setMouseOpaque(TRUE); - mDragHandle->setMouseOpaque(TRUE); + getDragHandle()->setMouseOpaque(TRUE); LLFloater::draw(); } diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index d4c9478fdf..1cac8fd4c5 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -106,10 +106,10 @@ BOOL LLFloaterNameDesc::postBuild() setTitle(mFilename); - centerWindow(); + centerWithin(gViewerWindow->getRootView()->getRect()); - S32 line_width = mRect.getWidth() - 2 * PREVIEW_HPAD; - S32 y = mRect.getHeight() - PREVIEW_LINE_HEIGHT; + S32 line_width = getRect().getWidth() - 2 * PREVIEW_HPAD; + S32 y = getRect().getHeight() - PREVIEW_LINE_HEIGHT; r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT ); y -= PREVIEW_LINE_HEIGHT; @@ -158,19 +158,6 @@ LLFloaterNameDesc::~LLFloaterNameDesc() gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() } -//----------------------------------------------------------------------------- -// centerWindow() -//----------------------------------------------------------------------------- -void LLFloaterNameDesc::centerWindow() -{ - LLRect window_rect = gViewerWindow->getRootView()->getRect(); - - S32 dialog_left = window_rect.mLeft + (window_rect.getWidth() - mRect.getWidth()) / 2; - S32 dialog_bottom = window_rect.mBottom + (window_rect.getHeight() - mRect.getHeight()) / 2; - - translate( dialog_left - mRect.mLeft, dialog_bottom - mRect.mBottom ); -} - // Sub-classes should override this function if they allow editing //----------------------------------------------------------------------------- // onCommit() diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index 2b0ec9b78a..8c968329c2 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -50,7 +50,6 @@ public: static void doCommit(class LLUICtrl *, void* userdata); protected: virtual void onCommit(); - virtual void centerWindow(); protected: BOOL mIsAudio; diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h index cd656bccaa..76d9291d47 100644 --- a/indra/newview/llfloateropenobject.h +++ b/indra/newview/llfloateropenobject.h @@ -73,7 +73,7 @@ protected: static LLFloaterOpenObject* sInstance; LLPanelInventory* mPanelInventory; - LLHandle<LLObjectSelection> mObjectSelection; + LLSafeHandle<LLObjectSelection> mObjectSelection; BOOL mDirty; }; diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index 1f5ebec684..044c8c9d90 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -157,9 +157,9 @@ void LLFloaterPostcard::draw() LLGLSUIDefault gls_ui; LLFloater::draw(); - if(getVisible() && !mMinimized && mViewerImage.notNull() && mJPEGImage.notNull()) + if(getVisible() && !isMinimized() && mViewerImage.notNull() && mJPEGImage.notNull()) { - LLRect rect(mRect); + LLRect rect(getRect()); // first set the max extents of our preview rect.translate(-rect.mLeft, -rect.mBottom); @@ -352,14 +352,14 @@ void LLFloaterPostcard::missingSubjMsgAlertCallback(S32 option, void* data) if((self->childGetValue("subject_form").asString()).empty()) { // Stuff the subject back into the form. - self->childSetValue("subject_form", self->childGetText("default_subject")); + self->childSetValue("subject_form", self->getString("default_subject")); } if(!self->mHasFirstMsgFocus) { // The user never switched focus to the messagee window. // Using the default string. - self->childSetValue("msg_form", self->childGetText("default_message")); + self->childSetValue("msg_form", self->getString("default_message")); } self->sendPostcard(); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 060952667b..cac2d0a0b6 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -127,7 +127,7 @@ S32 pref_min_height() } -LLPreferenceCore::LLPreferenceCore(LLTabContainerCommon* tab_container, LLButton * default_btn) : +LLPreferenceCore::LLPreferenceCore(LLTabContainer* tab_container, LLButton * default_btn) : mTabContainer(tab_container), mGeneralPanel(NULL), mInputPanel(NULL), @@ -314,7 +314,7 @@ void LLPreferenceCore::cancel() // static void LLPreferenceCore::onTabChanged(void* user_data, bool from_click) { - LLTabContainerCommon* self = (LLTabContainerCommon*)user_data; + LLTabContainer* self = (LLTabContainer*)user_data; gSavedSettings.setS32("LastPrefTab", self->getCurrentPanelIndex()); } @@ -363,7 +363,7 @@ BOOL LLFloaterPreference::postBuild() mPreferenceCore = new LLPreferenceCore( LLUICtrlFactory::getTabContainerByName(this, "pref core"), - static_cast<LLButton *>(getChildByName("OK")) + getChild<LLButton>("OK") ); sInstance = this; diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index bf554766b7..7396467d8c 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -62,13 +62,13 @@ class LLPreferenceCore { public: - LLPreferenceCore(LLTabContainerCommon* tab_container, LLButton * default_btn); + LLPreferenceCore(LLTabContainer* tab_container, LLButton * default_btn); ~LLPreferenceCore(); void apply(); void cancel(); - LLTabContainerCommon* getTabContainer() { return mTabContainer; } + LLTabContainer* getTabContainer() { return mTabContainer; } void setPersonalInfo( const char* visibility, @@ -78,7 +78,7 @@ public: static void onTabChanged(void* user_data, bool from_click); private: - LLTabContainerCommon *mTabContainer; + LLTabContainer *mTabContainer; LLPanelGeneral *mGeneralPanel; LLPanelInput *mInputPanel; LLPanelNetwork *mNetworkPanel; diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 82f72103f7..ace3eeac66 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -303,18 +303,13 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) ////////////////// // CREATOR NAME // ////////////////// - char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char last_name[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ if(!gCacheName) return; if(!gAgent.getRegion()) return; if (item->getCreatorUUID().notNull()) { - gCacheName->getName(item->getCreatorUUID(), first_name, last_name); - LLString name(first_name); - name.append(1, ' '); - name.append(last_name); - + std::string name; + gCacheName->getFullName(item->getCreatorUUID(), name); childSetEnabled("BtnCreator",TRUE); childSetEnabled("LabelCreatorTitle",TRUE); childSetEnabled("LabelCreatorName",TRUE); @@ -325,7 +320,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) childSetEnabled("BtnCreator",FALSE); childSetEnabled("LabelCreatorTitle",FALSE); childSetEnabled("LabelCreatorName",FALSE); - childSetText("LabelCreatorName",childGetText("unknown")); + childSetText("LabelCreatorName",getString("unknown")); } //////////////// @@ -336,16 +331,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) LLString name; if (perm.isGroupOwned()) { - char group_name[DB_GROUP_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - gCacheName->getGroupName(perm.getGroup(), group_name); - name.assign(group_name); + gCacheName->getGroupName(perm.getGroup(), name); } else { - gCacheName->getName(perm.getOwner(), first_name, last_name); - name.assign(first_name); - name.append(1, ' '); - name.append(last_name); + gCacheName->getFullName(perm.getOwner(), name); } childSetEnabled("BtnOwner",TRUE); childSetEnabled("LabelOwnerTitle",TRUE); @@ -357,7 +347,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) childSetEnabled("BtnOwner",FALSE); childSetEnabled("LabelOwnerTitle",FALSE); childSetEnabled("LabelOwnerName",FALSE); - childSetText("LabelOwnerName",childGetText("public")); + childSetText("LabelOwnerName",getString("public")); } ////////////////// @@ -368,7 +358,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) time_t time_utc = (time_t)item->getCreationDate(); if (0 == time_utc) { - childSetText("LabelAcquiredDate",childGetText("unknown")); + childSetText("LabelAcquiredDate",getString("unknown")); } else { @@ -380,11 +370,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) /////////////////////// if(can_agent_manipulate) { - childSetText("OwnerLabel",childGetText("you_can")); + childSetText("OwnerLabel",getString("you_can")); } else { - childSetText("OwnerLabel",childGetText("owner_can")); + childSetText("OwnerLabel",getString("owner_can")); } U32 base_mask = perm.getMaskBase(); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index c3ded7de4f..4a3b2192c0 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -214,7 +214,6 @@ BOOL LLFloaterRegionInfo::postBuild() LLFloaterRegionInfo::~LLFloaterRegionInfo() { - sInstance = NULL; } void LLFloaterRegionInfo::onOpen() @@ -248,14 +247,17 @@ void LLFloaterRegionInfo::requestRegionInfo() void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) { static LLDispatcher dispatch; - if(!sInstance) return; - + if(!findInstance()) + { + return; + } + if (!estate_dispatch_initialized) { LLPanelEstateInfo::initDispatch(dispatch); } - LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(sInstance, "region_panels"); + LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels"); if (!tab) return; LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab, "Estate"); @@ -283,8 +285,12 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) LLPanel* panel; llinfos << "LLFloaterRegionInfo::processRegionInfo" << llendl; - if(!sInstance) return; - LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(sInstance, "region_panels"); + if(!findInstance()) + { + return; + } + + LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels"); if(!tab) return; // extract message @@ -361,7 +367,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->childSetValue("sun_hour_slider", LLSD(sun_hour)); panel->childSetEnabled("sun_hour_slider", allow_modify && !use_estate_sun); - sInstance->refreshFromRegion( gAgent.getRegion() ); + getInstance()->refreshFromRegion( gAgent.getRegion() ); } // static @@ -369,7 +375,7 @@ LLPanelEstateInfo* LLFloaterRegionInfo::getPanelEstate() { LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); if (!floater) return NULL; - LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); + LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); if (!tab) return NULL; LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab,"Estate"); return panel; @@ -380,7 +386,7 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant() { LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); if (!floater) return NULL; - LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); + LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); if (!tab) return NULL; LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)LLUICtrlFactory::getPanelByName(tab, "Covenant"); return panel; @@ -1249,7 +1255,7 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); if (!floater) return true; - LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); + LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); if (!tab) return true; LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab, "Estate"); @@ -2543,35 +2549,35 @@ LLPanelEstateCovenant::LLPanelEstateCovenant() // virtual bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region) { - LLTextBox* region_name = (LLTextBox*)getChildByName("region_name_text"); + LLTextBox* region_name = getChild<LLTextBox>("region_name_text"); if (region_name) { region_name->setText(region->getName()); } - LLTextBox* resellable_clause = (LLTextBox*)getChildByName("resellable_clause"); + LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause"); if (resellable_clause) { if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) { - resellable_clause->setText(childGetText("can_not_resell")); + resellable_clause->setText(getString("can_not_resell")); } else { - resellable_clause->setText(childGetText("can_resell")); + resellable_clause->setText(getString("can_resell")); } } - LLTextBox* changeable_clause = (LLTextBox*)getChildByName("changeable_clause"); + LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause"); if (changeable_clause) { if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) { - changeable_clause->setText(childGetText("can_change")); + changeable_clause->setText(getString("can_change")); } else { - changeable_clause->setText(childGetText("can_not_change")); + changeable_clause->setText(getString("can_not_change")); } } @@ -2597,12 +2603,12 @@ bool LLPanelEstateCovenant::estateUpdate(LLMessageSystem* msg) BOOL LLPanelEstateCovenant::postBuild() { initHelpBtn("covenant_help", "HelpEstateCovenant"); - mEstateNameText = (LLTextBox*)getChildByName("estate_name_text"); - mEstateOwnerText = (LLTextBox*)getChildByName("estate_owner_text"); - mLastModifiedText = (LLTextBox*)getChildByName("covenant_timestamp_text"); - mEditor = (LLViewerTextEditor*)getChildByName("covenant_editor"); + mEstateNameText = getChild<LLTextBox>("estate_name_text"); + mEstateOwnerText = getChild<LLTextBox>("estate_owner_text"); + mLastModifiedText = getChild<LLTextBox>("covenant_timestamp_text"); + mEditor = getChild<LLViewerTextEditor>("covenant_editor"); if (mEditor) mEditor->setHandleEditKeysDirectly(TRUE); - LLButton* reset_button = (LLButton*)getChildByName("reset_covenant"); + LLButton* reset_button = getChild<LLButton>("reset_covenant"); reset_button->setEnabled(gAgent.canManageEstate()); reset_button->setClickedCallback(LLPanelEstateCovenant::resetCovenantID, NULL); diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 96cf8af667..cdda7e532c 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -58,9 +58,9 @@ class LLPanelRegionTerrainInfo; class LLPanelEstateInfo; class LLPanelEstateCovenant; -class LLFloaterRegionInfo : public LLFloater, public LLUISingleton<LLFloaterRegionInfo> +class LLFloaterRegionInfo : public LLFloater, public LLFloaterSingleton<LLFloaterRegionInfo> { - friend class LLUISingleton<LLFloaterRegionInfo>; + friend class LLUISingleton<LLFloaterRegionInfo, VisibilityPolicy<LLFloater> >; public: ~LLFloaterRegionInfo(); @@ -90,7 +90,7 @@ protected: void refreshFromRegion(LLViewerRegion* region); // member data - LLTabContainerCommon* mTab; + LLTabContainer* mTab; typedef std::vector<LLPanelRegionInfo*> info_panels_t; info_panels_t mInfoPanels; //static S32 sRequestSerial; // serial # of last EstateOwnerRequest diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 2da9ed4e14..63d7d7b958 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -903,7 +903,7 @@ void LLFloaterReporter::takeScreenshot() gImageList.addImage(image_in_list); // the texture picker then uses that texture - LLTexturePicker* texture = LLUICtrlFactory::getTexturePickerByName(this, "screenshot"); + LLTexturePicker* texture = getChild<LLTextureCtrl>("screenshot"); if (texture) { texture->setImageAssetID(mResourceDatap->mAssetInfo.mUuid); diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp index 80a686d162..3a17e232b6 100644 --- a/indra/newview/llfloaterscriptdebug.cpp +++ b/indra/newview/llfloaterscriptdebug.cpp @@ -163,14 +163,14 @@ LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput() LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLUUID& object_id) : LLFloater("script instance floater", LLRect(0, 200, 200, 0), "Script", TRUE), mObjectID(object_id) { - S32 y = mRect.getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD; + S32 y = getRect().getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD; S32 x = LLFLOATER_HPAD; // History editor // Give it a border on the top LLRect history_editor_rect( x, y, - mRect.getWidth() - LLFLOATER_HPAD, + getRect().getWidth() - LLFLOATER_HPAD, LLFLOATER_VPAD ); mHistoryEditor = new LLViewerTextEditor( "Chat History Editor", history_editor_rect, S32_MAX, "", LLFontGL::sSansSerif); @@ -186,14 +186,14 @@ void LLFloaterScriptDebugOutput::init(const LLString& title, BOOL resizable, BOOL minimizable, BOOL close_btn) { LLFloater::init(title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); - S32 y = mRect.getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD; + S32 y = getRect().getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD; S32 x = LLFLOATER_HPAD; // History editor // Give it a border on the top LLRect history_editor_rect( x, y, - mRect.getWidth() - LLFLOATER_HPAD, + getRect().getWidth() - LLFLOATER_HPAD, LLFLOATER_VPAD ); mHistoryEditor = new LLViewerTextEditor( "Chat History Editor", history_editor_rect, S32_MAX, "", LLFontGL::sSansSerif); diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index ffa1e13bf2..f3d8996b6a 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -244,13 +244,7 @@ void LLFloaterSellLandUI::updateParcelInfo() if(mSellToBuyer) { LLString name; - char firstname[MAX_STRING]; /* Flawfinder: ignore */ - char lastname[MAX_STRING]; /* Flawfinder: ignore */ - gCacheName->getName(mAuthorizedBuyer, firstname, lastname); - name.assign(firstname); - name.append(" "); - name.append(lastname); - + gCacheName->getFullName(mAuthorizedBuyer, name); childSetText("sell_to_agent", name); } } diff --git a/indra/newview/llfloatersellland.h b/indra/newview/llfloatersellland.h index 8cada4e579..d8eb5d0a0a 100644 --- a/indra/newview/llfloatersellland.h +++ b/indra/newview/llfloatersellland.h @@ -40,7 +40,7 @@ class LLFloaterSellLand { public: static void sellLand(LLViewerRegion* region, - LLHandle<LLParcelSelection> parcel); + LLSafeHandle<LLParcelSelection> parcel); }; #endif // LL_LLFLOATERSELLLAND_H diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 31c60d8b2d..d2f3bc7cf5 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -221,7 +221,7 @@ F32 LLSnapshotLivePreview::getImageAspect() } F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]); - F32 window_aspect_ratio = ((F32)mRect.getWidth()) / ((F32)mRect.getHeight()); + F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight()); if (gSavedSettings.getBOOL("KeepAspectForSnapshot")) { @@ -262,26 +262,26 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot) } LLRect& rect = mImageRect[mCurImageIndex]; - rect.set(0, mRect.getHeight(), mRect.getWidth(), 0); + rect.set(0, getRect().getHeight(), getRect().getWidth(), 0); F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]); - F32 window_aspect_ratio = ((F32)mRect.getWidth()) / ((F32)mRect.getHeight()); + F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight()); if (gSavedSettings.getBOOL("KeepAspectForSnapshot")) { if (image_aspect_ratio > window_aspect_ratio) { // trim off top and bottom - S32 new_height = llround((F32)mRect.getWidth() / image_aspect_ratio); - rect.mBottom += (mRect.getHeight() - new_height) / 2; - rect.mTop -= (mRect.getHeight() - new_height) / 2; + S32 new_height = llround((F32)getRect().getWidth() / image_aspect_ratio); + rect.mBottom += (getRect().getHeight() - new_height) / 2; + rect.mTop -= (getRect().getHeight() - new_height) / 2; } else if (image_aspect_ratio < window_aspect_ratio) { // trim off left and right - S32 new_width = llround((F32)mRect.getHeight() * image_aspect_ratio); - rect.mLeft += (mRect.getWidth() - new_width) / 2; - rect.mRight -= (mRect.getWidth() - new_width) / 2; + S32 new_width = llround((F32)getRect().getHeight() * image_aspect_ratio); + rect.mLeft += (getRect().getWidth() - new_width) / 2; + rect.mRight -= (getRect().getWidth() - new_width) / 2; } } } @@ -314,7 +314,7 @@ void LLSnapshotLivePreview::draw() mSnapshotUpToDate) { LLColor4 bg_color(0.f, 0.f, 0.3f, 0.4f); - gl_rect_2d(mRect, bg_color); + gl_rect_2d(getRect(), bg_color); LLRect &rect = mImageRect[mCurImageIndex]; LLRect shadow_rect = mImageRect[mCurImageIndex]; shadow_rect.stretch(BORDER_WIDTH); @@ -349,7 +349,7 @@ void LLSnapshotLivePreview::draw() glPopMatrix(); glColor4f(1.f, 1.f, 1.f, mFlashAlpha); - gl_rect_2d(mRect); + gl_rect_2d(getRect()); if (mNeedsFlash) { if (mFlashAlpha < 1.f) @@ -470,7 +470,7 @@ void LLSnapshotLivePreview::draw() glPushMatrix(); { LLRect& rect = mImageRect[old_image_index]; - glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(mRect.getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); + glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); glBegin(GL_QUADS); { @@ -497,7 +497,7 @@ void LLSnapshotLivePreview::draw() /*virtual*/ void LLSnapshotLivePreview::reshape(S32 width, S32 height, BOOL called_from_parent) { - LLRect old_rect = mRect; + LLRect old_rect = getRect(); LLView::reshape(width, height, called_from_parent); if (old_rect.getWidth() != width || old_rect.getHeight() != height) { @@ -742,7 +742,7 @@ public: static void updateControls(LLFloaterSnapshot* floater); static void updateLayout(LLFloaterSnapshot* floater); - static LLViewHandle sPreviewHandle; + static LLHandle<LLView> sPreviewHandle; private: static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater); @@ -757,12 +757,12 @@ public: }; // static -LLViewHandle LLFloaterSnapshot::Impl::sPreviewHandle; +LLHandle<LLView> LLFloaterSnapshot::Impl::sPreviewHandle; // static LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater) { - LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)LLView::getViewByHandle(sPreviewHandle); + LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)sPreviewHandle.get(); return previewp; } @@ -817,7 +817,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) floaterp->getParent()->setMouseOpaque(TRUE); // shrink to smaller layout - floaterp->reshape(floaterp->mRect.getWidth(), 410); + floaterp->reshape(floaterp->getRect().getWidth(), 410); // can see and interact with fullscreen preview now if (previewp) @@ -850,7 +850,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) else // turning off freeze frame mode { floaterp->getParent()->setMouseOpaque(FALSE); - floaterp->reshape(floaterp->mRect.getWidth(), 510); + floaterp->reshape(floaterp->getRect().getWidth(), 510); if (previewp) { previewp->setVisible(FALSE); @@ -1242,8 +1242,8 @@ LLFloaterSnapshot::~LLFloaterSnapshot() { if (sInstance == this) { - delete LLView::getViewByHandle(Impl::sPreviewHandle); - Impl::sPreviewHandle = LLViewHandle::sDeadHandle; + LLView::deleteViewByHandle(Impl::sPreviewHandle); + Impl::sPreviewHandle = LLHandle<LLView>(); sInstance = NULL; } @@ -1315,7 +1315,7 @@ BOOL LLFloaterSnapshot::postBuild() sInstance->getRootView()->addChild(previewp); sInstance->getRootView()->addChild(gSnapshotFloaterView); - Impl::sPreviewHandle = previewp->mViewHandle; + Impl::sPreviewHandle = previewp->getHandle(); impl.updateControls(this); @@ -1332,7 +1332,7 @@ void LLFloaterSnapshot::draw() return; } - if(getVisible() && !mMinimized) + if(getVisible() && !isMinimized()) { if (previewp && previewp->getDataSize() > 0) { @@ -1359,7 +1359,7 @@ void LLFloaterSnapshot::draw() } else { - childSetTextArg("file_size_label", "[SIZE]", childGetText("unknwon")); + childSetTextArg("file_size_label", "[SIZE]", getString("unknown")); childSetColor("file_size_label", gColors.getColor( "LabelTextColor" )); } childSetEnabled("upload_btn", previewp->getSnapshotUpToDate()); @@ -1386,7 +1386,7 @@ void LLFloaterSnapshot::draw() { F32 aspect = previewp->getImageAspect(); // UI size for thumbnail - S32 max_width = mRect.getWidth() - 20; + S32 max_width = getRect().getWidth() - 20; S32 max_height = 90; S32 img_render_width = 0; @@ -1414,7 +1414,7 @@ void LLFloaterSnapshot::draw() glScalef(llmin(1.f, (F32)image_width / (F32)previewp->getCurrentImage()->getWidth()), llmin(1.f, (F32)image_height / (F32)previewp->getCurrentImage()->getHeight()), 1.f); } glMatrixMode(GL_MODELVIEW); - gl_draw_scaled_image((mRect.getWidth() - img_render_width) / 2, 35 + (max_height - img_render_height) / 2, img_render_width, img_render_height, previewp->getCurrentImage(), LLColor4::white); + gl_draw_scaled_image((getRect().getWidth() - img_render_width) / 2, 35 + (max_height - img_render_height) / 2, img_render_width, img_render_height, previewp->getCurrentImage(), LLColor4::white); } glMatrixMode(GL_TEXTURE); glPopMatrix(); diff --git a/indra/newview/llfloatertelehub.h b/indra/newview/llfloatertelehub.h index 5b9821ebe9..dd7631f6dd 100644 --- a/indra/newview/llfloatertelehub.h +++ b/indra/newview/llfloatertelehub.h @@ -75,7 +75,7 @@ private: S32 mNumSpawn; LLVector3 mSpawnPointPos[MAX_SPAWNPOINTS_PER_TELEHUB]; - LLHandle<LLObjectSelection> mObjectSelection; + LLSafeHandle<LLObjectSelection> mObjectSelection; static LLFloaterTelehub* sInstance; }; diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index d03ce373cc..8879be2e51 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -181,7 +181,7 @@ BOOL LLFloaterTools::postBuild() // make sounds on visibility changes. setSoundFlags(LLView::SILENT); - mDragHandle->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") ); + getDragHandle()->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") ); LLRect rect; mBtnFocus = LLUICtrlFactory::getButtonByName(this,"button focus");//btn; @@ -317,14 +317,14 @@ BOOL LLFloaterTools::postBuild() mTab->selectFirstTab(); } - mStatusText["rotate"] = childGetText("status_rotate"); - mStatusText["scale"] = childGetText("status_scale"); - mStatusText["move"] = childGetText("status_move"); - mStatusText["modifyland"] = childGetText("status_modifyland"); - mStatusText["camera"] = childGetText("status_camera"); - mStatusText["grab"] = childGetText("status_grab"); - mStatusText["place"] = childGetText("status_place"); - mStatusText["selectland"] = childGetText("status_selectland"); + mStatusText["rotate"] = getString("status_rotate"); + mStatusText["scale"] = getString("status_scale"); + mStatusText["move"] = getString("status_move"); + mStatusText["modifyland"] = getString("status_modifyland"); + mStatusText["camera"] = getString("status_camera"); + mStatusText["grab"] = getString("status_grab"); + mStatusText["place"] = getString("status_place"); + mStatusText["selectland"] = getString("status_selectland"); return TRUE; } @@ -396,7 +396,7 @@ LLFloaterTools::LLFloaterTools() mTabLand(NULL), mDirty(TRUE) { - mAutoFocus = FALSE; + setAutoFocus(FALSE); LLCallbackMap::map_t factory_map; factory_map["General"] = LLCallbackMap(createPanelPermissions, this);//LLPanelPermissions factory_map["Object"] = LLCallbackMap(createPanelObject, this);//LLPanelObject @@ -442,7 +442,7 @@ void LLFloaterTools::setStatusText(const std::string& text) void LLFloaterTools::refresh() { - const S32 INFO_WIDTH = mRect.getWidth(); + const S32 INFO_WIDTH = getRect().getWidth(); const S32 INFO_HEIGHT = 384; LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT); BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME ); @@ -611,19 +611,19 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) switch (mObjectSelection->getSelectType()) { case SELECT_TYPE_HUD: - mComboGridMode->add(childGetText("grid_screen_text")); - mComboGridMode->add(childGetText("grid_local_text")); - //mComboGridMode->add(childGetText("grid_reference_text")); + mComboGridMode->add(getString("grid_screen_text")); + mComboGridMode->add(getString("grid_local_text")); + //mComboGridMode->add(getString("grid_reference_text")); break; case SELECT_TYPE_WORLD: - mComboGridMode->add(childGetText("grid_world_text")); - mComboGridMode->add(childGetText("grid_local_text")); - mComboGridMode->add(childGetText("grid_reference_text")); + mComboGridMode->add(getString("grid_world_text")); + mComboGridMode->add(getString("grid_local_text")); + mComboGridMode->add(getString("grid_reference_text")); break; case SELECT_TYPE_ATTACHMENT: - mComboGridMode->add(childGetText("grid_attachment_text")); - mComboGridMode->add(childGetText("grid_local_text")); - mComboGridMode->add(childGetText("grid_reference_text")); + mComboGridMode->add(getString("grid_attachment_text")); + mComboGridMode->add(getString("grid_local_text")); + mComboGridMode->add(getString("grid_reference_text")); break; } @@ -805,12 +805,12 @@ void LLFloaterTools::showMore(BOOL show_more) if (show_more) { - reshape( mRect.getWidth(), mLargeHeight, TRUE); + reshape( getRect().getWidth(), mLargeHeight, TRUE); translate( 0, mSmallHeight - mLargeHeight ); } else { - reshape( mRect.getWidth(), mSmallHeight, TRUE); + reshape( getRect().getWidth(), mSmallHeight, TRUE); translate( 0, mLargeHeight - mSmallHeight ); } childSetVisible("button less", show_more); diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index f56cdbecb5..a6fdc76d9f 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -34,6 +34,7 @@ #include "llfloater.h" #include "llcoord.h" +#include "llparcelselection.h" class LLButton; class LLTextBox; @@ -50,8 +51,7 @@ class LLComboBox; class LLParcelSelection; class LLObjectSelection; -typedef LLHandle<LLParcelSelection> LLParcelSelectionHandle; -typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle; +typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle; class LLFloaterTools : public LLFloater @@ -174,7 +174,7 @@ public: std::vector<LLButton*> mButtons;//[ 15 ]; - LLTabContainerCommon *mTab; + LLTabContainer *mTab; LLPanelPermissions *mPanelPermissions; LLPanelObject *mPanelObject; LLPanelVolume *mPanelVolume; diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 6bbb748a10..593d1f5114 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -207,7 +207,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) LLSD element; element["id"] = LLUUID::null; element["columns"][0]["column"] = "name"; - element["columns"][0]["value"] = childGetText("none_descriptor"); + element["columns"][0]["value"] = getString("none_descriptor"); element["columns"][0]["font"] = "SANSSERIF"; list->addElement(element); @@ -219,19 +219,19 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS) { - setTitle(childGetText("top_scripts_title")); - list->setColumnLabel("score", childGetText("scripts_score_label")); + setTitle(getString("top_scripts_title")); + list->setColumnLabel("score", getString("scripts_score_label")); - LLUIString format = childGetText("top_scripts_text"); + LLUIString format = getString("top_scripts_text"); format.setArg("[COUNT]", llformat("%d", total_count)); format.setArg("[TIME]", llformat("%0.1f", mtotalScore)); childSetValue("title_text", LLSD(format)); } else { - setTitle(childGetText("top_colliders_title")); - list->setColumnLabel("score", childGetText("colliders_score_label")); - LLUIString format = childGetText("top_colliders_text"); + setTitle(getString("top_colliders_title")); + list->setColumnLabel("score", getString("colliders_score_label")); + LLUIString format = getString("top_colliders_text"); format.setArg("[COUNT]", llformat("%d", total_count)); childSetValue("title_text", LLSD(format)); } diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index bdf583126f..5875c4bef7 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -159,7 +159,7 @@ BOOL LLFloaterTOS::postBuild() editor->setVisible( FALSE ); }; - LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "tos_html"); + LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("tos_html"); if ( web_browser ) { // start to observe it so we see navigate complete events @@ -169,7 +169,7 @@ BOOL LLFloaterTOS::postBuild() }; gResponsePtr = LLIamHere::build( this ); - LLHTTPClient::get( childGetValue( "real_url" ).asString(), gResponsePtr ); + LLHTTPClient::get( getString( "real_url" ), gResponsePtr ); }; return TRUE; @@ -180,14 +180,14 @@ void LLFloaterTOS::setSiteIsAlive( bool alive ) // only do this for TOS pages if ( mType == TOS_TOS ) { - LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "tos_html"); + LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("tos_html"); // if the contents of the site was retrieved if ( alive ) { if ( web_browser ) { // navigate to the "real" page - web_browser->navigateTo( childGetValue( "real_url" ).asString() ); + web_browser->navigateTo( getString( "real_url" ) ); }; } else @@ -212,7 +212,7 @@ void LLFloaterTOS::setSiteIsAlive( bool alive ) LLFloaterTOS::~LLFloaterTOS() { // stop obsaerving events - LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "tos_html"); + LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("tos_html"); if ( web_browser ) { web_browser->addObserver( this ); diff --git a/indra/newview/llfloaterurldisplay.h b/indra/newview/llfloaterurldisplay.h index 5ee447391f..307b16fd73 100644 --- a/indra/newview/llfloaterurldisplay.h +++ b/indra/newview/llfloaterurldisplay.h @@ -39,7 +39,7 @@ class LLPanelPlace; class LLSD; class LLUUID; -class LLFloaterURLDisplay : public LLFloater, public LLUISingleton<LLFloaterURLDisplay> +class LLFloaterURLDisplay : public LLFloater, public LLFloaterSingleton<LLFloaterURLDisplay> { public: LLFloaterURLDisplay(const LLSD& sd); diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 1ad9e0577c..f121efb6b7 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -27,11 +27,11 @@ static LLFloaterURLEntry* sInstance = NULL; class LLMediaTypeResponder : public LLHTTPClient::Responder { public: - LLMediaTypeResponder( LLViewHandle parent ) : + LLMediaTypeResponder( const LLHandle<LLFloater> parent ) : mParent( parent ) {} - LLViewHandle mParent; + LLHandle<LLFloater> mParent; virtual void completedHeader(U32 status, const std::string& reason, const LLSD& content) @@ -49,8 +49,7 @@ public: void completeAny(U32 status, const std::string& mime_type) { - LLFloaterURLEntry* floater_url_entry = - (LLFloaterURLEntry*)LLFloater::getFloaterByHandle(mParent); + LLFloaterURLEntry* floater_url_entry = (LLFloaterURLEntry*)mParent.get(); if ( floater_url_entry ) floater_url_entry->headerFetchComplete( status, mime_type ); } @@ -59,7 +58,7 @@ public: //----------------------------------------------------------------------------- // LLFloaterURLEntry() //----------------------------------------------------------------------------- -LLFloaterURLEntry::LLFloaterURLEntry(LLViewHandle parent) +LLFloaterURLEntry::LLFloaterURLEntry(LLHandle<LLPanel> parent) : LLFloater(), mPanelLandMediaHandle(parent) @@ -119,7 +118,7 @@ void LLFloaterURLEntry::buildURLHistory() void LLFloaterURLEntry::headerFetchComplete(U32 status, const std::string& mime_type) { - LLPanelLandMedia* panel_media = (LLPanelLandMedia*)LLPanel::getPanelByHandle(mPanelLandMediaHandle); + LLPanelLandMedia* panel_media = (LLPanelLandMedia*)mPanelLandMediaHandle.get(); if (panel_media) { // status is ignored for now -- error = "none/none" @@ -133,7 +132,7 @@ void LLFloaterURLEntry::headerFetchComplete(U32 status, const std::string& mime_ } // static -LLViewHandle LLFloaterURLEntry::show(LLViewHandle parent) +LLHandle<LLFloater> LLFloaterURLEntry::show(LLHandle<LLPanel> parent) { if (sInstance) { @@ -149,7 +148,7 @@ LLViewHandle LLFloaterURLEntry::show(LLViewHandle parent) void LLFloaterURLEntry::updateFromLandMediaPanel() { - LLPanelLandMedia* panel_media = (LLPanelLandMedia*)LLPanel::getPanelByHandle(mPanelLandMediaHandle); + LLPanelLandMedia* panel_media = (LLPanelLandMedia*)mPanelLandMediaHandle.get(); if (panel_media) { std::string media_url = panel_media->getMediaURL(); diff --git a/indra/newview/llfloaterurlentry.h b/indra/newview/llfloaterurlentry.h index 022c1eddd7..95954d82bb 100644 --- a/indra/newview/llfloaterurlentry.h +++ b/indra/newview/llfloaterurlentry.h @@ -10,15 +10,17 @@ #define LL_LLFLOATERURLENTRY_H #include "llfloater.h" +#include "llpanellandmedia.h" class LLLineEditor; +class LLComboBox; class LLFloaterURLEntry : public LLFloater { public: // Can only be shown by LLPanelLandMedia, and pushes data back into // that panel via the handle. - static LLViewHandle show(LLViewHandle panel_land_media_handle); + static LLHandle<LLFloater> show(LLHandle<LLPanel> panel_land_media_handle); void updateFromLandMediaPanel(); @@ -27,13 +29,13 @@ public: bool addURLToCombobox(const std::string& media_url); private: - LLFloaterURLEntry(LLViewHandle parent); + LLFloaterURLEntry(LLHandle<LLPanel> parent); /*virtual*/ ~LLFloaterURLEntry(); void buildURLHistory(); private: LLComboBox* mMediaURLEdit; - LLViewHandle mPanelLandMediaHandle; + LLHandle<LLPanel> mPanelLandMediaHandle; static void onBtnOK(void*); static void onBtnCancel(void*); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 9f9396a2d0..9da923e739 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -39,13 +39,6 @@ #include "llfloaterworldmap.h" -// Library includes -#include "llfontgl.h" -#include "llinventory.h" -#include "lllineeditor.h" -#include "message.h" - -// Viewer includes #include "llagent.h" #include "llviewerwindow.h" #include "llbutton.h" @@ -54,36 +47,23 @@ #include "llcombobox.h" #include "llviewercontrol.h" #include "lldraghandle.h" -#include "lleconomy.h" #include "llfirstuse.h" #include "llfocusmgr.h" -#include "lliconctrl.h" #include "llinventorymodel.h" -#include "llinventoryview.h" #include "lllandmarklist.h" +#include "lllineeditor.h" #include "llnetmap.h" #include "llpreviewlandmark.h" -#include "llradiogroup.h" #include "llregionhandle.h" -#include "llresizehandle.h" -#include "llresmgr.h" #include "llscrolllistctrl.h" -#include "llsliderctrl.h" -#include "llspinctrl.h" -#include "llstatusbar.h" -#include "lltabcontainer.h" #include "lltextbox.h" #include "lltracker.h" -#include "llui.h" -#include "lluiconstants.h" #include "llurldispatcher.h" -#include "llviewercamera.h" #include "llviewermenu.h" #include "llviewerregion.h" #include "llviewerstats.h" #include "llworldmap.h" #include "llworldmapview.h" -#include "llurl.h" #include "llvieweruictrlfactory.h" #include "llappviewer.h" #include "llmapimagetype.h" @@ -518,7 +498,7 @@ void LLFloaterWorldMap::draw() childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); setMouseOpaque(TRUE); - mDragHandle->setMouseOpaque(TRUE); + getDragHandle()->setMouseOpaque(TRUE); //RN: snaps to zoom value because interpolation caused jitter in the text rendering if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)childGetValue("zoom slider").asReal()) diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 6f3c583557..3cf12a9eb7 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -161,7 +161,7 @@ protected: void cacheLandmarkPosition(); protected: - LLTabContainerCommon* mTabs; + LLTabContainer* mTabs; // Sets gMapScale, in pixels per region F32 mCurZoomVal; diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 90df2284c5..a710d1688d 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -87,6 +87,11 @@ const F32 FOLDER_CLOSE_TIME_CONSTANT = 0.02f; const F32 FOLDER_OPEN_TIME_CONSTANT = 0.03f; const S32 MAX_FOLDER_ITEM_OVERLAP = 2; +enum { + SIGNAL_NO_KEYBOARD_FOCUS = 1, + SIGNAL_KEYBOARD_FOCUS = 2 +}; + F32 LLFolderView::sAutoOpenTime = 1.f; void delete_selected_item(void* user_data); @@ -600,16 +605,6 @@ const LLString& LLFolderViewItem::getName( void ) const return mLabel; } -LLFolderViewFolder* LLFolderViewItem::getParentFolder( void ) -{ - return mParentFolder; -} - -LLFolderViewEventListener* LLFolderViewItem::getListener( void ) -{ - return mListener; -} - // LLView functionality BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) { @@ -817,7 +812,7 @@ void LLFolderViewItem::draw() LLGLSTexture gls_texture; if (mArrowImage) { - gl_draw_scaled_rotated_image(mIndentation, mRect.getHeight() - ARROW_SIZE - TEXT_PAD, + gl_draw_scaled_rotated_image(mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD, ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, mArrowImage, sFgColor); } } @@ -853,33 +848,33 @@ void LLFolderViewItem::draw() gl_rect_2d( 0, - mRect.getHeight(), - mRect.getWidth() - 2, - llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD), + getRect().getHeight(), + getRect().getWidth() - 2, + llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD), bg_color, filled); if (mIsCurSelection) { gl_rect_2d( 0, - mRect.getHeight(), - mRect.getWidth() - 2, - llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD), + getRect().getHeight(), + getRect().getWidth() - 2, + llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD), sHighlightFgColor, FALSE); } - if (mRect.getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2) + if (getRect().getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2) { gl_rect_2d( 0, - llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, - mRect.getWidth() - 2, + llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, + getRect().getWidth() - 2, 2, sHighlightFgColor, FALSE); if (show_context) { gl_rect_2d( 0, - llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, - mRect.getWidth() - 2, + llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, + getRect().getWidth() - 2, 2, sHighlightBgColor, TRUE); } @@ -890,17 +885,17 @@ void LLFolderViewItem::draw() LLGLSNoTexture gls_no_texture; gl_rect_2d( 0, - mRect.getHeight(), - mRect.getWidth() - 2, - llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD), + getRect().getHeight(), + getRect().getWidth() - 2, + llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD), sHighlightBgColor, FALSE); - if (mRect.getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2) + if (getRect().getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2) { gl_rect_2d( 0, - llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, - mRect.getWidth() - 2, + llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD) - 2, + getRect().getWidth() - 2, 2, sHighlightBgColor, FALSE); } @@ -910,7 +905,7 @@ void LLFolderViewItem::draw() if(mIcon) { - gl_draw_image(mIndentation + ARROW_SIZE + TEXT_PAD, mRect.getHeight() - mIcon->getHeight(), mIcon); + gl_draw_image(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight(), mIcon); mIcon->addTextureStats( (F32)(mIcon->getWidth() * mIcon->getHeight())); } @@ -920,7 +915,7 @@ void LLFolderViewItem::draw() BOOL debug_filters = getRoot()->getDebugFilters(); LLColor4 color = ( (mIsSelected && filled) ? sHighlightFgColor : sFgColor ); F32 right_x; - F32 y = (F32)mRect.getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; + F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; if (debug_filters) { @@ -963,14 +958,14 @@ void LLFolderViewItem::draw() LLString combined_string = mLabel + mLabelSuffix; S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1; S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; - S32 bottom = llfloor(mRect.getHeight() - sFont->getLineHeight() - 3); - S32 top = mRect.getHeight(); + S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3); + S32 top = getRect().getHeight(); LLViewerImage::bindTexture(mBoxImage); glColor4fv(sFilterBGColor.mV); gl_segmented_rect_2d_tex(left, top, right, bottom, mBoxImage->getWidth(), mBoxImage->getHeight(), 16); F32 match_string_left = text_left + sFont->getWidthF32(combined_string, 0, mStringMatchOffset); - F32 y = (F32)mRect.getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; + F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; sFont->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, filter_string_length, S32_MAX, &right_x, FALSE ); @@ -1074,7 +1069,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) if (mIsOpen) { // Add sizes of children - S32 parent_item_height = mRect.getHeight(); + S32 parent_item_height = getRect().getHeight(); folders_t::iterator fit = mFolders.begin(); folders_t::iterator fend = mFolders.end(); @@ -1158,7 +1153,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) { folders_t::iterator fit = iter++; // number of pixels that bottom of folder label is from top of parent folder - if (mRect.getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight() + if (getRect().getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight() > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) { // hide if beyond current folder height @@ -1171,7 +1166,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) { items_t::iterator iit = iter++; // number of pixels that bottom of item label is from top of parent folder - if (mRect.getHeight() - (*iit)->getRect().mBottom + if (getRect().getHeight() - (*iit)->getRect().mBottom > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) { (*iit)->setVisible(FALSE); @@ -1184,7 +1179,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) } // don't change width as this item is already as wide as its parent folder - reshape(mRect.getWidth(),llround(mCurHeight)); + reshape(getRect().getWidth(),llround(mCurHeight)); // pass current height value back to parent *height = llround(mCurHeight); @@ -1903,7 +1898,7 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item) item, mSortFunction); mItems.insert(it,item); - item->setRect(LLRect(0, 0, mRect.getWidth(), 0)); + item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); item->setVisible(FALSE); addChild( item ); item->dirtyFilter(); @@ -1921,7 +1916,7 @@ BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) mSortFunction); mFolders.insert(it,folder); folder->setOrigin(0, 0); - folder->reshape(mRect.getWidth(), 0); + folder->reshape(getRect().getWidth(), 0); folder->setVisible(FALSE); addChild( folder ); folder->dirtyFilter(); @@ -1972,6 +1967,7 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL open, ERecurseType recur mListener->openItem(); } } + if (recurse == RECURSE_DOWN || recurse == RECURSE_UP_DOWN) { for (folders_t::iterator iter = mFolders.begin(); @@ -2131,7 +2127,7 @@ BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) handled = LLFolderViewItem::handleHover(x, y, mask); } - //if(x < LEFT_INDENTATION + mIndentation && x > mIndentation - LEFT_PAD && y > mRect.getHeight() - ) + //if(x < LEFT_INDENTATION + mIndentation && x > mIndentation - LEFT_PAD && y > getRect().getHeight() - ) //{ // gViewerWindow->setCursor(UI_CURSOR_ARROW); // mExpanderHighlighted = TRUE; @@ -2544,7 +2540,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico #pragma warning( pop ) #endif mScrollContainer( NULL ), - mPopupMenuHandle( LLViewHandle::sDeadHandle ), + mPopupMenuHandle(), mAllowMultiSelect(TRUE), mShowFolderHierarchy(FALSE), mSourceID(source_id), @@ -2562,11 +2558,11 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico mArrangeGeneration(0), mUserData(NULL), mSelectCallback(NULL), - mSelectionChanged(FALSE), + mSignalSelectCallback(0), mMinWidth(0), mDragAndDropThisFrame(FALSE) { - LLRect new_rect(rect.mLeft, rect.mBottom + mRect.getHeight(), rect.mLeft + mRect.getWidth(), rect.mBottom); + LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom); setRect( rect ); reshape(rect.getWidth(), rect.getHeight()); mIsOpen = TRUE; // this view is always open. @@ -2582,7 +2578,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico // just make sure the label ("Inventory Folder") never shows up mLabel = LLString::null; - mRenamer = new LLLineEditor("ren", mRect, "", sFont, + mRenamer = new LLLineEditor("ren", getRect(), "", sFont, DB_INV_ITEM_NAME_STR_LEN, &LLFolderView::commitRename, NULL, @@ -2606,7 +2602,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico } menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); menu->setVisible(FALSE); - mPopupMenuHandle = menu->mViewHandle; + mPopupMenuHandle = menu->getHandle(); setTabStop(TRUE); } @@ -2710,7 +2706,7 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder) mFolders.insert(mFolders.begin(), folder); } folder->setOrigin(0, 0); - folder->reshape(mRect.getWidth(), 0); + folder->reshape(getRect().getWidth(), 0); folder->setVisible(FALSE); addChild( folder ); folder->dirtyFilter(); @@ -2726,7 +2722,7 @@ void LLFolderView::closeAllFolders() void LLFolderView::openFolder(const LLString& foldername) { - LLFolderViewFolder* inv = (LLFolderViewFolder*)getChildByName(foldername); + LLFolderViewFolder* inv = getChild<LLFolderViewFolder>(foldername); if (inv) { setSelection(inv, FALSE, FALSE); @@ -2759,7 +2755,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen S32 total_width = LEFT_PAD; S32 running_height = mDebugFilters ? llceil(sSmallFont->getLineHeight()) : 0; S32 target_height = running_height; - S32 parent_item_height = mRect.getHeight(); + S32 parent_item_height = getRect().getHeight(); for (folders_t::iterator iter = mFolders.begin(); iter != mFolders.end();) @@ -2943,7 +2939,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL open, /* Flaw llassert(mSelectedItems.size() <= 1); - mSelectionChanged = TRUE; + mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS; return rv; } @@ -2985,7 +2981,7 @@ BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) rv = LLFolderViewFolder::changeSelection(selection, selected); - mSelectionChanged = TRUE; + mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS; return rv; } @@ -3011,7 +3007,7 @@ S32 LLFolderView::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* rv++; } - mSelectionChanged = TRUE; + mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS; return rv; } @@ -3181,7 +3177,7 @@ void LLFolderView::draw() LLString current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", mFilter.getCurrentGeneration(), mFilter.getMinRequiredGeneration(), mFilter.getMustPassGeneration()); sSmallFont->renderUTF8(current_filter_string, 0, 2, - mRect.getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), + getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); } @@ -3287,7 +3283,7 @@ void LLFolderView::revertRenamingItem( void ) void LLFolderView::removeSelectedItems( void ) { - if(getVisible() && mEnabled) + if(getVisible() && getEnabled()) { // just in case we're removing the renaming item. mRenameItem = NULL; @@ -3392,7 +3388,7 @@ void LLFolderView::removeSelectedItems( void ) // open the selected item. void LLFolderView::openSelectedItems( void ) { - if(getVisible() && mEnabled) + if(getVisible() && getEnabled()) { if (mSelectedItems.size() == 1) { @@ -3432,7 +3428,7 @@ void LLFolderView::openSelectedItems( void ) void LLFolderView::propertiesSelectedItems( void ) { - if(getVisible() && mEnabled) + if(getVisible() && getEnabled()) { if (mSelectedItems.size() == 1) { @@ -3531,17 +3527,16 @@ BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) return FALSE; } -BOOL LLFolderView::canCopy() +BOOL LLFolderView::canCopy() const { - if (!(getVisible() && mEnabled && (mSelectedItems.size() > 0))) + if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) { return FALSE; } - - selected_items_t::iterator selected_it; - for (selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) + + for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) { - LLFolderViewItem* item = *selected_it; + const LLFolderViewItem* item = *selected_it; if (!item->getListener()->isItemCopyable()) { return FALSE; @@ -3556,7 +3551,7 @@ void LLFolderView::copy() // *NOTE: total hack to clear the inventory clipboard LLInventoryClipboard::instance().reset(); S32 count = mSelectedItems.size(); - if(getVisible() && mEnabled && (count > 0)) + if(getVisible() && getEnabled() && (count > 0)) { LLFolderViewEventListener* listener = NULL; selected_items_t::iterator item_it; @@ -3572,7 +3567,7 @@ void LLFolderView::copy() mSearchString.clear(); } -BOOL LLFolderView::canCut() +BOOL LLFolderView::canCut() const { return FALSE; } @@ -3582,24 +3577,24 @@ void LLFolderView::cut() // implement Windows-style cut-and-leave } -BOOL LLFolderView::canPaste() +BOOL LLFolderView::canPaste() const { if (mSelectedItems.empty()) { return FALSE; } - if(getVisible() && mEnabled) + if(getVisible() && getEnabled()) { - selected_items_t::iterator item_it; - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); + item_it != mSelectedItems.end(); ++item_it) { // *TODO: only check folders and parent folders of items - LLFolderViewItem* item = (*item_it); - LLFolderViewEventListener* listener = item->getListener(); + const LLFolderViewItem* item = (*item_it); + const LLFolderViewEventListener* listener = item->getListener(); if(!listener || !listener->isClipboardPasteable()) { - LLFolderViewFolder* folderp = item->getParentFolder(); + const LLFolderViewFolder* folderp = item->getParentFolder(); listener = folderp->getListener(); if (!listener || !listener->isClipboardPasteable()) { @@ -3615,7 +3610,7 @@ BOOL LLFolderView::canPaste() // paste selected item void LLFolderView::paste() { - if(getVisible() && mEnabled) + if(getVisible() && getEnabled()) { // find set of unique folders to paste into std::set<LLFolderViewItem*> folder_set; @@ -3657,7 +3652,7 @@ void LLFolderView::startRenamingSelectedItem( void ) { item = mSelectedItems.front(); } - if(getVisible() && mEnabled && (count == 1) && item && item->getListener() && + if(getVisible() && getEnabled() && (count == 1) && item && item->getListener() && item->getListener()->isItemRenameable()) { mRenameItem = item; @@ -3676,7 +3671,7 @@ void LLFolderView::startRenamingSelectedItem( void ) mScrollContainer->calcVisibleSize( &scroller_width, &scroller_height, &dummy_bool, &dummy_bool); } - S32 width = llmax(llmin(item->getRect().getWidth() - x, scroller_width - x - mRect.mLeft), MINIMUM_RENAMER_WIDTH); + S32 width = llmax(llmin(item->getRect().getWidth() - x, scroller_width - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH); S32 height = llfloor(sFont->getLineHeight() + RENAME_HEIGHT_PAD); mRenamer->reshape( width, height, TRUE ); @@ -3709,7 +3704,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) // SL-51858: Key presses are not being passed to the Popup menu. // A proper fix is non-trivial so instead just close the menu. - LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if (menu && menu->isOpen()) { LLMenuGL::sMenuContainer->hideMenus(); @@ -3721,7 +3716,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) item = *(getChildList()->begin()); } - if( getVisible() && mEnabled && !called_from_parent ) + if( getVisible() && getEnabled() && !called_from_parent ) { switch( key ) { @@ -3952,7 +3947,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare { // SL-51858: Key presses are not being passed to the Popup menu. // A proper fix is non-trivial so instead just close the menu. - LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if (menu && menu->isOpen()) { LLMenuGL::sMenuContainer->hideMenus(); @@ -3977,11 +3972,11 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare } -BOOL LLFolderView::canDoDelete() +BOOL LLFolderView::canDoDelete() const { if (mSelectedItems.size() == 0) return FALSE; - selected_items_t::iterator item_it; - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + + for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) { if (!(*item_it)->getListener()->isItemRemovable()) { @@ -4103,7 +4098,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; S32 count = mSelectedItems.size(); - LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if(handled && (count > 0) && menu) { //menu->empty(); @@ -4179,7 +4174,7 @@ void LLFolderView::deleteAllChildren() gViewerWindow->setTopCtrl(NULL); } LLView::deleteViewByHandle(mPopupMenuHandle); - mPopupMenuHandle = LLViewHandle::sDeadHandle; + mPopupMenuHandle = LLHandle<LLView>(); mRenamer = NULL; mRenameItem = NULL; clearSelection(); @@ -4247,7 +4242,7 @@ LLRect LLFolderView::getVisibleRect() S32 visible_height = mScrollContainer->getRect().getHeight(); S32 visible_width = mScrollContainer->getRect().getWidth(); LLRect visible_rect; - visible_rect.setLeftTopAndSize(-mRect.mLeft, visible_height - mRect.mBottom, visible_width, visible_height); + visible_rect.setLeftTopAndSize(-getRect().mLeft, visible_height - getRect().mBottom, visible_width, visible_height); return visible_rect; } @@ -4257,7 +4252,7 @@ BOOL LLFolderView::getShowSelectionContext() { return TRUE; } - LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if (menu && menu->getVisible()) { return TRUE; @@ -4364,12 +4359,13 @@ void LLFolderView::doIdle() } } - if (mSelectionChanged && mSelectCallback) + if (mSignalSelectCallback && mSelectCallback) { //RN: we use keyboard focus as a proxy for user-explicit actions - mSelectCallback(mSelectedItems, gFocusMgr.childHasKeyboardFocus(this), mUserData); + BOOL take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); + mSelectCallback(mSelectedItems, take_keyboard_focus, mUserData); } - mSelectionChanged = FALSE; + mSignalSelectCallback = FALSE; } diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 37b9ee6c13..d451e75fa6 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -108,7 +108,7 @@ public: // This method should be called when a drag begins. returns TRUE // if the drag can begin, otherwise FALSE. - virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) = 0; + virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0; // This method will be called to determine if a drop can be // performed, and will set drop to TRUE if a drop is @@ -465,11 +465,14 @@ public: // Used for sorting, like getLabel() above. virtual U32 getCreationDate() const { return mCreationDate; } - LLFolderViewFolder* getParentFolder( void ); + LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; } + const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; } + LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE ); LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE ); - LLFolderViewEventListener* getListener( void ); + const LLFolderViewEventListener* getListener( void ) const { return mListener; } + LLFolderViewEventListener* getListener( void ) { return mListener; } // just rename the object. void rename(const LLString& new_name); @@ -803,16 +806,16 @@ public: // copy & paste virtual void copy(); - virtual BOOL canCopy(); + virtual BOOL canCopy() const; virtual void cut(); - virtual BOOL canCut(); + virtual BOOL canCut() const; virtual void paste(); - virtual BOOL canPaste(); + virtual BOOL canPaste() const; virtual void doDelete(); - virtual BOOL canDoDelete(); + virtual BOOL canDoDelete() const; // public rename functionality - can only start the process void startRenamingSelectedItem( void ); @@ -885,7 +888,7 @@ protected: void revertRenamingItem( void ); protected: - LLViewHandle mPopupMenuHandle; + LLHandle<LLView> mPopupMenuHandle; typedef std::deque<LLFolderViewItem*> selected_items_t; selected_items_t mSelectedItems; @@ -920,7 +923,7 @@ protected: void* mUserData; SelectCallback mSelectCallback; - BOOL mSelectionChanged; + S32 mSignalSelectCallback; S32 mMinWidth; std::map<LLUUID, LLFolderViewItem*> mItemMap; BOOL mDragAndDropThisFrame; diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 29b739bca3..a291f1da49 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -427,8 +427,8 @@ void LLHorizontalCompass::draw() LLGLSUIDefault gls_ui; - S32 width = mRect.getWidth(); - S32 height = mRect.getHeight(); + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); S32 half_width = width / 2; if( mTexture ) diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 0c34ef3ebc..c26e9de423 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -438,7 +438,7 @@ void LLVoiceChannel::handleStatusChange(EStatusType type) case STATUS_LOGGED_IN: if (!mLoginNotificationHandle.isDead()) { - LLNotifyBox* notifyp = (LLNotifyBox*)LLPanel::getPanelByHandle(mLoginNotificationHandle); + LLNotifyBox* notifyp = (LLNotifyBox*)mLoginNotificationHandle.get(); if (notifyp) { notifyp->close(); @@ -1251,9 +1251,9 @@ BOOL LLFloaterIMPanel::postBuild() childSetEnabled("profile_btn", FALSE); } - sTitleString = getFormattedUIString("title_string"); - sTypingStartString = getFormattedUIString("typing_start_string"); - sSessionStartString = getFormattedUIString("session_start_string"); + sTitleString = getString("title_string"); + sTypingStartString = getString("typing_start_string"); + sSessionStartString = getString("session_start_string"); if (mSpeakerPanel) { @@ -1330,12 +1330,12 @@ void LLFloaterIMPanel::draw() if (self_speaker.notNull() && self_speaker->mModeratorMutedText) { mInputEditor->setEnabled(FALSE); - mInputEditor->setLabel(getFormattedUIString("muted_text_label")); + mInputEditor->setLabel(getString("muted_text_label")); } else { mInputEditor->setEnabled(TRUE); - mInputEditor->setLabel(getFormattedUIString("default_text_label")); + mInputEditor->setLabel(getString("default_text_label")); } if (mAutoConnect && enable_connect) @@ -1539,7 +1539,7 @@ void LLFloaterIMPanel::selectNone() BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) { BOOL handled = FALSE; - if( getVisible() && mEnabled && !called_from_parent && gFocusMgr.childHasKeyboardFocus(this)) + if( getVisible() && getEnabled() && !called_from_parent && gFocusMgr.childHasKeyboardFocus(this)) { if( KEY_RETURN == key && mask == MASK_NONE) { @@ -1926,7 +1926,7 @@ void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update) if (voice_moderated) { - setTitle(mSessionLabel + LLString(" ") + getFormattedUIString("moderated_chat_label")); + setTitle(mSessionLabel + LLString(" ") + getString("moderated_chat_label")); } else { diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index ef36ff4a33..50830dedd0 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -100,7 +100,7 @@ protected: LLString mSessionName; LLString::format_map_t mNotifyArgs; BOOL mIgnoreNextSessionLeave; - LLViewHandle mLoginNotificationHandle; + LLHandle<LLPanel> mLoginNotificationHandle; typedef std::map<LLUUID, LLVoiceChannel*> voice_channel_map_t; static voice_channel_map_t sVoiceChannelMap; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 2be41f01c5..58139e41aa 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -158,7 +158,7 @@ LLFloaterIM::LLFloaterIM() BOOL LLFloaterIM::postBuild() { - sOnlyUserMessage = getFormattedUIString("only_user_message"); + sOnlyUserMessage = getString("only_user_message"); sOfflineMessage = getUIString("offline_message"); sInviteMessage = getUIString("invite_message"); @@ -166,75 +166,75 @@ BOOL LLFloaterIM::postBuild() if ( sErrorStringsMap.find("generic") == sErrorStringsMap.end() ) { sErrorStringsMap["generic"] = - getFormattedUIString("generic_request_error"); + getString("generic_request_error"); } if ( sErrorStringsMap.find("unverified") == sErrorStringsMap.end() ) { sErrorStringsMap["unverified"] = - getFormattedUIString("insufficient_perms_error"); + getString("insufficient_perms_error"); } if ( sErrorStringsMap.end() == sErrorStringsMap.find("no_ability") ) { sErrorStringsMap["no_ability"] = - getFormattedUIString("no_ability_error"); + getString("no_ability_error"); } if ( sErrorStringsMap.end() == sErrorStringsMap.find("muted") ) { sErrorStringsMap["muted"] = - getFormattedUIString("muted_error"); + getString("muted_error"); } if ( sErrorStringsMap.end() == sErrorStringsMap.find("not_a_moderator") ) { sErrorStringsMap["not_a_moderator"] = - getFormattedUIString("not_a_mod_error"); + getString("not_a_mod_error"); } if ( sErrorStringsMap.end() == sErrorStringsMap.find("does not exist") ) { sErrorStringsMap["does not exist"] = - getFormattedUIString("session_does_not_exist_error"); + getString("session_does_not_exist_error"); } if ( sEventStringsMap.end() == sEventStringsMap.find("add") ) { sEventStringsMap["add"] = - getFormattedUIString("add_session_event"); + getString("add_session_event"); } if ( sEventStringsMap.end() == sEventStringsMap.find("message") ) { sEventStringsMap["message"] = - getFormattedUIString("message_session_event"); + getString("message_session_event"); } if ( sEventStringsMap.end() == sEventStringsMap.find("mute") ) { - sEventStringsMap["mute"] = getFormattedUIString( - "mute_agent_event"); + sEventStringsMap["mute"] = + getString("mute_agent_event"); } if ( sForceCloseSessionMap.end() == sForceCloseSessionMap.find("removed") ) { sForceCloseSessionMap["removed"] = - getFormattedUIString("removed_from_group"); + getString("removed_from_group"); } if ( sForceCloseSessionMap.end() == sForceCloseSessionMap.find("no ability") ) { sForceCloseSessionMap["no ability"] = - getFormattedUIString("close_on_no_ability"); + getString("close_on_no_ability"); } return TRUE; @@ -1015,12 +1015,12 @@ BOOL LLIMMgr::getFloaterOpen() void LLIMMgr::disconnectAllSessions() { LLFloaterIMPanel* floater = NULL; - std::set<LLViewHandle>::iterator handle_it; + std::set<LLHandle<LLFloater> >::iterator handle_it; for(handle_it = mFloaters.begin(); handle_it != mFloaters.end(); ) { - floater = (LLFloaterIMPanel*)LLFloater::getFloaterByHandle(*handle_it); + floater = (LLFloaterIMPanel*)handle_it->get(); // MUST do this BEFORE calling floater->onClose() because that may remove the item from the set, causing the subsequent increment to crash. ++handle_it; @@ -1040,12 +1040,12 @@ void LLIMMgr::disconnectAllSessions() LLFloaterIMPanel* LLIMMgr::findFloaterBySession(const LLUUID& session_id) { LLFloaterIMPanel* rv = NULL; - std::set<LLViewHandle>::iterator handle_it; + std::set<LLHandle<LLFloater> >::iterator handle_it; for(handle_it = mFloaters.begin(); handle_it != mFloaters.end(); ++handle_it) { - rv = (LLFloaterIMPanel*)LLFloater::getFloaterByHandle(*handle_it); + rv = (LLFloaterIMPanel*)handle_it->get(); if(rv && session_id == rv->getSessionID()) { break; @@ -1171,7 +1171,7 @@ LLFloaterIMPanel* LLIMMgr::createFloater( session_id, other_participant_id, dialog); - LLTabContainerCommon::eInsertionPoint i_pt = user_initiated ? LLTabContainerCommon::RIGHT_OF_CURRENT : LLTabContainerCommon::END; + LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; LLFloaterChatterBox::getInstance(LLSD())->addFloater(floater, FALSE, i_pt); mFloaters.insert(floater->getHandle()); return floater; @@ -1197,7 +1197,7 @@ LLFloaterIMPanel* LLIMMgr::createFloater( other_participant_id, ids, dialog); - LLTabContainerCommon::eInsertionPoint i_pt = user_initiated ? LLTabContainerCommon::RIGHT_OF_CURRENT : LLTabContainerCommon::END; + LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; LLFloaterChatterBox::getInstance(LLSD())->addFloater(floater, FALSE, i_pt); mFloaters.insert(floater->getHandle()); return floater; @@ -1219,8 +1219,7 @@ void LLIMMgr::noteOfflineUsers( for(S32 i = 0; i < count; ++i) { info = at.getBuddyInfo(ids.get(i)); - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string first, last; if(info && !info->isOnline() && gCacheName->getName(ids.get(i), first, last)) { @@ -1628,3 +1627,4 @@ LLHTTPRegistration<LLViewerChatterBoxSessionUpdate> LLHTTPRegistration<LLViewerChatterBoxInvitation> gHTTPRegistrationMessageChatterBoxInvitation( "/message/ChatterBoxInvitation"); + diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 11a6905a63..e787368324 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -165,7 +165,7 @@ public: void clearPendingAgentListUpdates(const LLUUID& session_id); //HACK: need a better way of enumerating existing session, or listening to session create/destroy events - const std::set<LLViewHandle>& getIMFloaterHandles() { return mFloaters; } + const std::set<LLHandle<LLFloater> >& getIMFloaterHandles() { return mFloaters; } private: class LLIMSessionInvite; @@ -199,7 +199,7 @@ private: static void onInviteNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* userdata); private: - std::set<LLViewHandle> mFloaters; + std::set<LLHandle<LLFloater> > mFloaters; LLFriendObserver* mFriendObserver; // An IM has been received that you haven't seen yet. diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 2a260f6546..0e17d8503d 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -488,11 +488,11 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } // *TODO: remove this -BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) +BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { BOOL rv = FALSE; - LLInventoryObject* obj = getInventoryObject(); + const LLInventoryObject* obj = getInventoryObject(); if(obj) { diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index c61fa7f2b6..9ef666b357 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -188,7 +188,7 @@ public: void getClipboardEntries(bool show_asset_id, std::vector<LLString> &items, std::vector<LLString> &disabled_items, U32 flags); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id); + virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const; virtual BOOL dragOrDrop(MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data) { return FALSE; } diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 30106443c0..9e0fa26f25 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -72,18 +72,18 @@ LLJoystick::LLJoystick( mHeldDown(FALSE), mHeldDownTimer() { - mHeldDownCallback = &LLJoystick::onHeldDown; - mCallbackUserData = this; + setHeldDownCallback(&LLJoystick::onHeldDown); + setCallbackUserData(this); } void LLJoystick::updateSlop() { - mVertSlopNear = mRect.getHeight(); - mVertSlopFar = mRect.getHeight() * 2; + mVertSlopNear = getRect().getHeight(); + mVertSlopFar = getRect().getHeight() * 2; - mHorizSlopNear = mRect.getWidth(); - mHorizSlopFar = mRect.getWidth() * 2; + mHorizSlopNear = getRect().getWidth(); + mHorizSlopFar = getRect().getWidth() * 2; // Compute initial mouse offset based on initial quadrant. // Place the mouse evenly between the near and far zones. @@ -163,7 +163,7 @@ F32 LLJoystick::getElapsedHeldDownTime() { if( mHeldDown ) { - return mMouseDownTimer.getElapsedTimeF32(); + return getHeldDownTime(); } else { @@ -244,13 +244,13 @@ LLXMLNodePtr LLJoystick::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); - node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); + node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(getHAlign())); node->createChild("quadrant", TRUE)->setStringValue(nameFromQuadrant(mInitialQuadrant)); - addImageAttributeToXML(node,mImageUnselectedName,mImageUnselectedID,"image_unselected"); - addImageAttributeToXML(node,mImageSelectedName,mImageSelectedID,"image_selected"); + addImageAttributeToXML(node,getImageUnselectedName(),getImageUnselectedID(),"image_unselected"); + addImageAttributeToXML(node,getImageSelectedName(),getImageSelectedID(),"image_selected"); - node->createChild("scale_image", TRUE)->setBoolValue(mScaleImage); + node->createChild("scale_image", TRUE)->setBoolValue(getScaleImage()); return node; } @@ -504,8 +504,8 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) updateSlop(); // Set initial offset based on initial click location - S32 horiz_center = mRect.getWidth() / 2; - S32 vert_center = mRect.getHeight() / 2; + S32 horiz_center = getRect().getWidth() / 2; + S32 vert_center = getRect().getHeight() / 2; S32 dx = x - horiz_center; S32 dy = y - vert_center; @@ -607,26 +607,26 @@ void LLJoystickCameraRotate::draw() { LLGLSUIDefault gls_ui; - mImageUnselected->draw( 0, 0 ); + getImageUnselected()->draw( 0, 0 ); if( mInTop ) { - drawRotatedImage( mImageSelected->getImage(), 0 ); + drawRotatedImage( getImageSelected()->getImage(), 0 ); } if( mInRight ) { - drawRotatedImage( mImageSelected->getImage(), 1 ); + drawRotatedImage( getImageSelected()->getImage(), 1 ); } if( mInBottom ) { - drawRotatedImage( mImageSelected->getImage(), 2 ); + drawRotatedImage( getImageSelected()->getImage(), 2 ); } if( mInLeft ) { - drawRotatedImage( mImageSelected->getImage(), 3 ); + drawRotatedImage( getImageSelected()->getImage(), 3 ); } if (sDebugRects) @@ -637,7 +637,7 @@ void LLJoystickCameraRotate::draw() } // Draws image rotated by multiples of 90 degrees -void LLJoystickCameraRotate::drawRotatedImage( LLImageGL* image, S32 rotations ) +void LLJoystickCameraRotate::drawRotatedImage( const LLImageGL* image, S32 rotations ) { S32 width = image->getWidth(); S32 height = image->getHeight(); @@ -732,7 +732,7 @@ BOOL LLJoystickCameraZoom::handleMouseDown(S32 x, S32 y, MASK mask) if( handled ) { - if (mFirstMouse.mY > mRect.getHeight() / 2) + if (mFirstMouse.mY > getRect().getHeight() / 2) { mInitialQuadrant = JQ_UP; } @@ -801,7 +801,7 @@ void LLJoystickCameraZoom::draw() } else { - mImageUnselected->draw( 0, 0 ); + getImageUnselected()->draw( 0, 0 ); } if (sDebugRects) @@ -813,11 +813,11 @@ void LLJoystickCameraZoom::draw() void LLJoystickCameraZoom::updateSlop() { - mVertSlopNear = mRect.getHeight() / 4; - mVertSlopFar = mRect.getHeight() / 2; + mVertSlopNear = getRect().getHeight() / 4; + mVertSlopFar = getRect().getHeight() / 2; - mHorizSlopNear = mRect.getWidth() / 4; - mHorizSlopFar = mRect.getWidth() / 2; + mHorizSlopNear = getRect().getWidth() / 4; + mHorizSlopFar = getRect().getWidth() / 2; // Compute initial mouse offset based on initial quadrant. // Place the mouse evenly between the near and far zones. diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h index 1524b4f232..2cd53b4146 100644 --- a/indra/newview/lljoystickbutton.h +++ b/indra/newview/lljoystickbutton.h @@ -140,7 +140,7 @@ public: protected: F32 getOrbitRate(); virtual void updateSlop(); - void drawRotatedImage( LLImageGL* image, S32 rotations ); + void drawRotatedImage( const LLImageGL* image, S32 rotations ); protected: BOOL mInLeft; diff --git a/indra/newview/llmanip.h b/indra/newview/llmanip.h index 8c51746d1c..2dd0eab8b0 100644 --- a/indra/newview/llmanip.h +++ b/indra/newview/llmanip.h @@ -135,7 +135,7 @@ public: EManipPart getHighlightedPart() { return mHighlightedPart; } - LLHandle<LLObjectSelection> getSelection(); + LLSafeHandle<LLObjectSelection> getSelection(); protected: LLVector3 getSavedPivotPoint() const; @@ -153,7 +153,7 @@ protected: protected: LLFrameTimer mHelpTextTimer; BOOL mInSnapRegime; - LLHandle<LLObjectSelection> mObjectSelection; + LLSafeHandle<LLObjectSelection> mObjectSelection; EManipPart mHighlightedPart; static F32 sHelpTextVisibleTime; diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp index a698c53f7f..616fabebf7 100644 --- a/indra/newview/llmemoryview.cpp +++ b/indra/newview/llmemoryview.cpp @@ -147,8 +147,8 @@ static const int MTV_DISPLAY_NUM = (sizeof(mtv_display_table)/sizeof(mtv_displa void LLMemoryView::draw() { std::string tdesc; - S32 width = mRect.getWidth(); - S32 height = mRect.getHeight(); + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); LLGLSUIDefault gls_ui; LLGLSNoTexture gls_no_tex; diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index b5021eff9c..17185299a8 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -70,24 +70,15 @@ void LLNameBox::setNameID(const LLUUID& name_id, BOOL is_group) { mNameID = name_id; - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - LLString name; + std::string name; if (!is_group) { - gCacheName->getName(name_id, first, last); - - name.assign(first); - name.append(1, ' '); - name.append(last); + gCacheName->getFullName(name_id, name); } else { - gCacheName->getGroupName(name_id, group_name); - - name.assign(group_name); + gCacheName->getGroupName(name_id, name); } setText(name); diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index 1ca702b0a7..a36c67a879 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -90,23 +90,15 @@ void LLNameEditor::setNameID(const LLUUID& name_id, BOOL is_group) { mNameID = name_id; - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - LLString name; + std::string name; if (!is_group) { - gCacheName->getName(name_id, first, last); - - name.assign(first); - name.append(1, ' '); - name.append(last); + gCacheName->getFullName(name_id, name); } else { - gCacheName->getGroupName(name_id, group_name); - name.assign(group_name); + gCacheName->getGroupName(name_id, name); } setText(name); diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 9dd37cf47d..a3faa55a06 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -73,15 +73,9 @@ BOOL LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos, { //llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl; - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string fullname; + BOOL result = gCacheName->getFullName(agent_id, fullname); - BOOL result = gCacheName->getName(agent_id, first, last); - - LLString fullname; - fullname.assign(first); - fullname.append(1, ' '); - fullname.append(last); fullname.append(suffix); addStringUUIDItem(fullname, agent_id, pos, enabled); @@ -142,7 +136,7 @@ void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos, BOOL enabled) { //llinfos << "LLNameListCtrl::addGroupNameItem " << group_id << llendl; - char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string group_name; gCacheName->getGroupName(group_id, group_name); addStringUUIDItem(group_name, group_id, pos, enabled); } @@ -153,7 +147,7 @@ void LLNameListCtrl::addGroupNameItem(LLScrollListItem* item, EAddPosition pos) { //llinfos << "LLNameListCtrl::addGroupNameItem " << item->getUUID() << llendl; - char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + std::string group_name; gCacheName->getGroupName(item->getUUID(), group_name); LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); @@ -166,15 +160,8 @@ BOOL LLNameListCtrl::addNameItem(LLScrollListItem* item, EAddPosition pos) { //llinfos << "LLNameListCtrl::addNameItem " << item->getUUID() << llendl; - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - - BOOL result = gCacheName->getName(item->getUUID(), first, last); - - LLString fullname; - fullname.assign(first); - fullname.append(1, ' '); - fullname.append(last); + std::string fullname; + BOOL result = gCacheName->getFullName(item->getUUID(), fullname); LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); ((LLScrollListText*)cell)->setText( fullname ); @@ -195,17 +182,12 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos { LLScrollListItem* item = LLScrollListCtrl::addElement(value, pos, userdata); - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - // use supplied name by default - LLString fullname = value["name"].asString(); + std::string fullname = value["name"].asString(); if (value["target"].asString() == "GROUP") { - char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - gCacheName->getGroupName(item->getUUID(), group_name); + gCacheName->getGroupName(item->getUUID(), fullname); // fullname will be "nobody" if group not found - fullname = group_name; } else if (value["target"].asString() == "SPECIAL") { @@ -213,11 +195,10 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos } else // normal resident { - if (gCacheName->getName(item->getUUID(), first, last)) + std::string name; + if (gCacheName->getFullName(item->getUUID(), name)) { - fullname.assign(first); - fullname.append(1, ' '); - fullname.append(last); + fullname = name; } } @@ -268,7 +249,7 @@ void LLNameListCtrl::refresh(const LLUUID& id, const char* first, // TODO: scan items for that ID, fix if necessary item_list::iterator iter; - for (iter = mItemList.begin(); iter != mItemList.end(); iter++) + for (iter = getItemList().begin(); iter != getItemList().end(); iter++) { LLScrollListItem* item = *iter; if (item->getUUID() == id) diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index c3128652fe..257e87171a 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -158,7 +158,7 @@ LLNetMap::LLNetMap( &LLTracker::isTracking, NULL) ); menu->setVisible(FALSE); addChild(menu); - mPopupMenuHandle = menu->mViewHandle; + mPopupMenuHandle = menu->getHandle(); sInstance = this; @@ -191,8 +191,8 @@ void LLNetMap::setScale( F32 scale ) if (mObjectImagep.notNull()) { - F32 half_width = (F32)(mRect.getWidth() / 2); - F32 half_height = (F32)(mRect.getHeight() / 2); + F32 half_width = (F32)(getRect().getWidth() / 2); + F32 half_height = (F32)(getRect().getHeight() / 2); F32 radius = sqrt( half_width * half_width + half_height * half_height ); F32 region_widths = (2.f*radius)/gMiniMapScale; @@ -257,12 +257,12 @@ void LLNetMap::draw() // Draw background rectangle glColor4fv( mBackgroundColor.mV ); - gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0); } // region 0,0 is in the middle - S32 center_sw_left = mRect.getWidth() / 2 + llfloor(mCurPanX); - S32 center_sw_bottom = mRect.getHeight() / 2 + llfloor(mCurPanY); + S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPanX); + S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPanY); glPushMatrix(); @@ -542,8 +542,8 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos ) pos_local.rotVec( rot ); } - pos_local.mV[VX] += mRect.getWidth() / 2 + mCurPanX; - pos_local.mV[VY] += mRect.getHeight() / 2 + mCurPanY; + pos_local.mV[VX] += getRect().getWidth() / 2 + mCurPanX; + pos_local.mV[VY] += getRect().getHeight() / 2 + mCurPanY; return pos_local; } @@ -554,15 +554,15 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, LLVector3 pos_local = globalPosToView( pos_global ); if( (pos_local.mV[VX] < 0) || (pos_local.mV[VY] < 0) || - (pos_local.mV[VX] >= mRect.getWidth()) || - (pos_local.mV[VY] >= mRect.getHeight()) ) + (pos_local.mV[VX] >= getRect().getWidth()) || + (pos_local.mV[VY] >= getRect().getHeight()) ) { if (draw_arrow) { S32 x = llround( pos_local.mV[VX] ); S32 y = llround( pos_local.mV[VY] ); - LLWorldMapView::drawTrackingCircle( mRect, x, y, color, 1, 10 ); - LLWorldMapView::drawTrackingArrow( mRect, x, y, color ); + LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10 ); + LLWorldMapView::drawTrackingArrow( getRect(), x, y, color ); } } else @@ -576,8 +576,8 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) { - x -= llround(mRect.getWidth() / 2 + mCurPanX); - y -= llround(mRect.getHeight() / 2 + mCurPanY); + x -= llround(getRect().getWidth() / 2 + mCurPanX); + y -= llround(getRect().getHeight() / 2 + mCurPanY); LLVector3 pos_local( (F32)x, (F32)y, 0 ); @@ -612,35 +612,32 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_s { return FALSE; } - if( getVisible() && pointInView( x, y ) ) + LLViewerRegion* region = gWorldPointer->getRegionFromPosGlobal( viewPosToGlobal( x, y ) ); + if( region ) { - LLViewerRegion* region = gWorldPointer->getRegionFromPosGlobal( viewPosToGlobal( x, y ) ); - if( region ) - { - msg.assign( region->getName() ); + msg.assign( region->getName() ); #ifndef LL_RELEASE_FOR_DOWNLOAD - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - msg.append("\n"); - region->getHost().getHostName(buffer, MAX_STRING); - msg.append(buffer); - msg.append("\n"); - region->getHost().getString(buffer, MAX_STRING); - msg.append(buffer); + char buffer[MAX_STRING]; /*Flawfinder: ignore*/ + msg.append("\n"); + region->getHost().getHostName(buffer, MAX_STRING); + msg.append(buffer); + msg.append("\n"); + region->getHost().getString(buffer, MAX_STRING); + msg.append(buffer); #endif - // *TODO: put this under the control of XUI so it can be - // translated. - msg.append("\n(Double-click to open Map)"); - - S32 SLOP = 4; - localPointToScreen( - x - SLOP, y - SLOP, - &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); - sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; - sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; - } - handled = TRUE; + // *TODO: put this under the control of XUI so it can be + // translated. + msg.append("\n(Double-click to open Map)"); + + S32 SLOP = 4; + localPointToScreen( + x - SLOP, y - SLOP, + &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); + sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; + sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; } + handled = TRUE; return handled; } @@ -651,8 +648,8 @@ void LLNetMap::setDirectionPos( LLTextBox* text_box, F32 rotation ) // Rotation of 0 means x = 1, y = 0 on the unit circle. - F32 map_half_height = (F32)(mRect.getHeight() / 2); - F32 map_half_width = (F32)(mRect.getWidth() / 2); + F32 map_half_height = (F32)(getRect().getHeight() / 2); + F32 map_half_width = (F32)(getRect().getWidth() / 2); F32 text_half_height = (F32)(text_box->getRect().getHeight() / 2); F32 text_half_width = (F32)(text_box->getRect().getWidth() / 2); F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width ); @@ -762,9 +759,9 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color, void LLNetMap::createObjectImage() { - // Find the size of the side of a square that surrounds the circle that surrounds mRect. - F32 half_width = (F32)(mRect.getWidth() / 2); - F32 half_height = (F32)(mRect.getHeight() / 2); + // Find the size of the side of a square that surrounds the circle that surrounds getRect(). + F32 half_width = (F32)(getRect().getWidth() / 2); + F32 half_height = (F32)(getRect().getHeight() / 2); F32 radius = sqrt( half_width * half_width + half_height * half_height ); S32 square_size = S32( 2 * radius ); @@ -798,7 +795,7 @@ BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask ) BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) { - LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if (menu) { menu->buildDrawLabels(); diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 40d80646cf..d375413d1d 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -92,7 +92,7 @@ protected: static void fly( const LLVector3d& destination ); public: - LLViewHandle mPopupMenuHandle; + LLHandle<LLView> mPopupMenuHandle; LLColor4 mBackgroundColor; F32 mScale; // Size of a region in pixels diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index 2c33cccf71..8af83af272 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -123,7 +123,7 @@ BOOL LLOverlayBar::postBuild() childSetAction("Stand Up",onClickStandUp,this); childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible")); - mIsFocusRoot = TRUE; + setFocusRoot(TRUE); mBuilt = true; layoutButtons(); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index d9416bbf37..7c8acd3947 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -159,7 +159,7 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { // check if inside //LLRect parent_rect = mParentView->getRect(); - //mRect.set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0); + //getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0); handled = TRUE; // check the type @@ -282,13 +282,12 @@ void LLPanelAvatarSecondLife::updatePartnerName() { if (mPartnerID.notNull()) { - char first[128]; /*Flawfinder: ignore*/ - char last[128]; /*Flawfinder: ignore*/ + std::string first, last; BOOL found = gCacheName->getName(mPartnerID, first, last); if (found) { - childSetTextArg("partner_edit", "[FIRST]", LLString(first)); - childSetTextArg("partner_edit", "[LAST]", LLString(last)); + childSetTextArg("partner_edit", "[FIRST]", first); + childSetTextArg("partner_edit", "[LAST]", last); } childSetEnabled("partner_info", TRUE); } @@ -301,7 +300,7 @@ void LLPanelAvatarSecondLife::updatePartnerName() //----------------------------------------------------------------------------- void LLPanelAvatarSecondLife::clearControls() { - LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(this,"img"); + LLTextureCtrl* image_ctrl = getChild<LLTextureCtrl>("img"); if(image_ctrl) { image_ctrl->setImageAssetID(LLUUID::null); @@ -495,7 +494,7 @@ BOOL LLPanelAvatarWeb::postBuild(void) childSetControlName("auto_load","AutoLoadWebProfiles"); - mWebBrowser = (LLWebBrowserCtrl*)getChildByName("profile_html"); + mWebBrowser = getChild<LLWebBrowserCtrl>("profile_html"); // links open in internally mWebBrowser->setOpenInExternalBrowser( false ); @@ -722,7 +721,7 @@ void LLPanelAvatarAdvanced::enableControls(BOOL self) // setEnable is called, for some reason if (mWantToEdit) mWantToEdit->setReadOnlyBgColor(LLColor4::transparent); if (mSkillsEdit) mSkillsEdit->setReadOnlyBgColor(LLColor4::transparent); - LLLineEditor* languages_edit = (LLLineEditor*)getChildByName("languages_edit"); + LLLineEditor* languages_edit = getChild<LLLineEditor>("languages_edit"); languages_edit->setReadOnlyBgColor(LLColor4::transparent); } } @@ -798,7 +797,7 @@ void LLPanelAvatarNotes::refresh() void LLPanelAvatarNotes::clearControls() { - childSetText("notes edit", childGetText("Loading")); + childSetText("notes edit", getString("Loading")); childSetEnabled("notes edit", false); } @@ -825,7 +824,7 @@ void LLPanelAvatarClassified::refresh() { BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); - LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"classified tab"); + LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(this,"classified tab"); S32 tab_count = tabs ? tabs->getTabCount() : 0; @@ -859,7 +858,7 @@ void LLPanelAvatarClassified::refresh() BOOL LLPanelAvatarClassified::canClose() { - LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); + LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); for (S32 i = 0; i < tabs->getTabCount(); i++) { LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i); @@ -873,7 +872,7 @@ BOOL LLPanelAvatarClassified::canClose() BOOL LLPanelAvatarClassified::titleIsValid() { - LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); + LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); if ( tabs ) { LLPanelClassified* panel = (LLPanelClassified*)tabs->getCurrentPanel(); @@ -891,7 +890,7 @@ BOOL LLPanelAvatarClassified::titleIsValid() void LLPanelAvatarClassified::apply() { - LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); + LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); for (S32 i = 0; i < tabs->getTabCount(); i++) { LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i); @@ -902,7 +901,7 @@ void LLPanelAvatarClassified::apply() void LLPanelAvatarClassified::deleteClassifiedPanels() { - LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab"); + LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab"); if (tabs) { tabs->deleteAllTabs(); @@ -922,7 +921,7 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg, char classified_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/ LLPanelClassified* panel_classified = NULL; - LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab"); + LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab"); // Don't remove old panels. We need to be able to process multiple // packets for people who have lots of classifieds. JC @@ -933,7 +932,7 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg, msg->getUUIDFast(_PREHASH_Data, _PREHASH_ClassifiedID, classified_id, block); msg->getStringFast(_PREHASH_Data, _PREHASH_Name, DB_PICK_NAME_SIZE, classified_name, block); - panel_classified = new LLPanelClassified(FALSE); + panel_classified = new LLPanelClassified(false, false); panel_classified->setClassifiedID(classified_id); @@ -978,9 +977,9 @@ void LLPanelAvatarClassified::callbackNew(S32 option, void* data) if (0 == option) { - LLPanelClassified* panel_classified = new LLPanelClassified(FALSE); + LLPanelClassified* panel_classified = new LLPanelClassified(false, false); panel_classified->initNewClassified(); - LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab"); + LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab"); if(tabs) { tabs->addTabPanel(panel_classified, panel_classified->getClassifiedName()); @@ -995,7 +994,7 @@ void LLPanelAvatarClassified::onClickDelete(void* data) { LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; - LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab"); + LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab"); LLPanelClassified* panel_classified = NULL; if(tabs) { @@ -1014,7 +1013,7 @@ void LLPanelAvatarClassified::onClickDelete(void* data) void LLPanelAvatarClassified::callbackDelete(S32 option, void* data) { LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; - LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab"); + LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab"); LLPanelClassified* panel_classified=NULL; if(tabs) { @@ -1059,14 +1058,12 @@ LLPanelAvatarPicks::LLPanelAvatarPicks(const std::string& name, void LLPanelAvatarPicks::refresh() { BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); - - LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"picks tab"); + LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"picks tab"); S32 tab_count = tabs ? tabs->getTabCount() : 0; - BOOL allow_new = (tab_count < MAX_AVATAR_PICKS); - BOOL allow_delete = (tab_count > 0); - - childSetEnabled("New...",self && allow_new); - childSetEnabled("Delete...",self && allow_delete); + childSetEnabled("New...", self && tab_count < MAX_AVATAR_PICKS); + childSetEnabled("Delete...", self && tab_count > 0); + childSetVisible("New...", self && getPanelAvatar()->isEditable()); + childSetVisible("Delete...", self && getPanelAvatar()->isEditable()); sendAvatarProfileRequestIfNeeded("avatarpicksrequest"); } @@ -1074,7 +1071,7 @@ void LLPanelAvatarPicks::refresh() void LLPanelAvatarPicks::deletePickPanels() { - LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab"); + LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab"); if(tabs) { tabs->deleteAllTabs(); @@ -1093,7 +1090,7 @@ void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**) char pick_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/ LLPanelPick* panel_pick = NULL; - LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab"); + LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab"); // Clear out all the old panels. We'll replace them with the correct // number of new panels. @@ -1143,7 +1140,7 @@ void LLPanelAvatarPicks::onClickNew(void* data) { LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; LLPanelPick* panel_pick = new LLPanelPick(FALSE); - LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab"); + LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab"); panel_pick->initNewPick(); if(tabs) @@ -1158,7 +1155,7 @@ void LLPanelAvatarPicks::onClickNew(void* data) void LLPanelAvatarPicks::onClickDelete(void* data) { LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab"); + LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab"); LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL; if (!panel_pick) return; @@ -1176,7 +1173,7 @@ void LLPanelAvatarPicks::onClickDelete(void* data) void LLPanelAvatarPicks::callbackDelete(S32 option, void* data) { LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab"); + LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab"); LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL; LLMessageSystem* msg = gMessageSystem; @@ -1393,7 +1390,7 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, // Teens don't have this. if (mPanelFirstLife) mPanelFirstLife->enableControls(own_avatar && mAllowEdit); - LLView *target_view = getChildByName("drop_target_rect", TRUE); + LLView *target_view = getChild<LLView>("drop_target_rect"); if(target_view) { if (mDropTarget) @@ -1453,6 +1450,8 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, { childSetVisible("OK",FALSE); childSetEnabled("OK",FALSE); + childSetVisible("Cancel",FALSE); + childSetEnabled("Cancel",FALSE); } childSetVisible("Instant Message...",FALSE); childSetEnabled("Instant Message...",FALSE); @@ -1676,7 +1675,7 @@ void LLPanelAvatar::onClickOK(void *userdata) { self->sendAvatarPropertiesUpdate(); - LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"tab"); + LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"tab"); if ( tabs->getCurrentPanel() != self->mPanelClassified ) { self->mPanelClassified->apply(); @@ -1743,7 +1742,7 @@ void LLPanelAvatar::sendAvatarNotesUpdate() std::string notes = mPanelNotes->childGetValue("notes edit").asString(); if (!mHaveNotes - && (notes.empty() || notes == childGetText("Loading"))) + && (notes.empty() || notes == getString("Loading"))) { // no notes from server and no user updates return; @@ -1844,7 +1843,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) if(caption_text.empty()) { LLString::format_map_t args; - caption_text = self->mPanelSecondLife->childGetValue("CaptionTextAcctInfo").asString(); + caption_text = self->mPanelSecondLife->getString("CaptionTextAcctInfo"); const char* ACCT_TYPE[] = { "AcctTypeResident", @@ -1853,7 +1852,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) "AcctTypeEmployee" }; caption_index = llclamp(caption_index, (U8)0, (U8)(sizeof(ACCT_TYPE)/sizeof(ACCT_TYPE[0])-1)); - args["[ACCTTYPE]"] = self->mPanelSecondLife->childGetValue(ACCT_TYPE[caption_index]).asString(); + args["[ACCTTYPE]"] = self->mPanelSecondLife->getString(ACCT_TYPE[caption_index]); LLString payment_text = " "; const S32 DEFAULT_CAPTION_LINDEN_INDEX = 3; @@ -1871,10 +1870,10 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) { payment_text = "NoPaymentInfoOnFile"; } - args["[PAYMENTINFO]"] = self->mPanelSecondLife->childGetValue(payment_text).asString(); + args["[PAYMENTINFO]"] = self->mPanelSecondLife->getString(payment_text); LLString age_text = age_verified ? "AgeVerified" : "NotAgeVerified"; // Do not display age verification status at this time - //args["[AGEVERIFICATION]"] = self->mPanelSecondLife->childGetValue(age_text).asString(); + //args["[AGEVERIFICATION]"] = self->mPanelSecondLife->getString(age_text); args["[AGEVERIFICATION]"] = " "; } else @@ -1894,7 +1893,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) self->mPanelWeb->setWebURL(std::string(profile_url)); - LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(self->mPanelSecondLife,"img"); + LLTextureCtrl* image_ctrl = self->mPanelSecondLife->getChild<LLTextureCtrl>("img"); if(image_ctrl) { image_ctrl->setImageAssetID(image_id); @@ -1908,7 +1907,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) { // Teens don't get these self->mPanelFirstLife->childSetValue("about", fl_about_text); - LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(self->mPanelFirstLife,"img"); + LLTextureCtrl* image_ctrl = self->mPanelFirstLife->getChild<LLTextureCtrl>("img"); if(image_ctrl) { image_ctrl->setImageAssetID(fl_image_id); @@ -2074,7 +2073,7 @@ void LLPanelAvatar::sendAvatarPropertiesUpdate() if (mPanelFirstLife) { first_life_about_text = mPanelFirstLife->childGetValue("about").asString(); - LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(mPanelFirstLife,"img"); + LLTextureCtrl* image_ctrl = mPanelFirstLife->getChild<LLTextureCtrl>("img"); if(image_ctrl) { first_life_image_id = image_ctrl->getImageAssetID(); @@ -2091,7 +2090,7 @@ void LLPanelAvatar::sendAvatarPropertiesUpdate() msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); msg->nextBlockFast(_PREHASH_PropertiesData); - LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(mPanelSecondLife,"img"); + LLTextureCtrl* image_ctrl = mPanelSecondLife->getChild<LLTextureCtrl>("img"); if(image_ctrl) { msg->addUUIDFast( _PREHASH_ImageID, image_ctrl->getImageAssetID()); diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index d992c29304..6e5b7bfb41 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -46,7 +46,7 @@ class LLLineEditor; class LLNameEditor; class LLPanelAvatar; class LLScrollListCtrl; -class LLTabContainerCommon; +class LLTabContainer; class LLTextBox; class LLTextEditor; class LLTextureCtrl; @@ -302,6 +302,7 @@ public: void selectTabByName(std::string tab_name); BOOL haveData() { return mHaveProperties && mHaveStatistics; } + BOOL isEditable() const { return mAllowEdit; } static void processAvatarPropertiesReply(LLMessageSystem *msg, void **); static void processAvatarInterestsReply(LLMessageSystem *msg, void **); @@ -366,7 +367,7 @@ private: // note is changed from database version bool mHaveNotes; std::string mLastNotes; - LLTabContainerCommon* mTab; + LLTabContainer* mTab; BOOL mAllowEdit; typedef std::list<LLPanelAvatar*> panel_list_t; diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index f84ae06416..e24d258a22 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -144,7 +144,7 @@ public: LLClassifiedTeleportHandler gClassifiedTeleportHandler; */ -LLPanelClassified::LLPanelClassified(BOOL in_finder, bool from_search) +LLPanelClassified::LLPanelClassified(bool in_finder, bool from_search) : LLPanel("Classified Panel"), mInFinder(in_finder), mFromSearch(from_search), @@ -241,7 +241,7 @@ BOOL LLPanelClassified::postBuild() mDescEditor->setFocusReceivedCallback(onFocusReceived, this); mDescEditor->setCommitCallback(onCommitAny); mDescEditor->setCallbackUserData(this); - mDescEditor->setTabToNextField(TRUE); + mDescEditor->setTabsToNextField(TRUE); mLocationEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "location_editor"); @@ -403,13 +403,7 @@ void LLPanelClassified::initNewClassified() mCategoryCombo->setCurrentByIndex(0); } - // default new classifieds to publish - //mEnabledCheck->set(TRUE); - - // delay commit until user hits save - // sendClassifiedInfoUpdate(); - - mUpdateBtn->setLabel(childGetText("publish_txt")); + mUpdateBtn->setLabel(getString("publish_txt")); } @@ -502,7 +496,7 @@ void LLPanelClassified::sendClassifiedInfoRequest() if (!url.empty()) { llinfos << "Classified stat request via capability" << llendl; - LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(this->getHandle(), mClassifiedID)); + LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(((LLView*)this)->getHandle(), mClassifiedID)); } } } @@ -539,8 +533,6 @@ void LLPanelClassified::sendClassifiedInfoUpdate() msg->addUUIDFast(_PREHASH_SnapshotID, mSnapshotCtrl->getImageAssetID()); msg->addVector3dFast(_PREHASH_PosGlobal, mPosGlobal); BOOL mature = mMatureCheck->get(); - // Classifieds are always enabled/published 11/2005 JC - //BOOL enabled = mEnabledCheck->get(); BOOL auto_renew = FALSE; if (mAutoRenewCheck) { @@ -671,14 +663,15 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void ** } LLString datestr = llformat("%02d/%02d/%d", now->tm_mon+1, now->tm_mday, now->tm_year+1900); - self->childSetTextArg("ad_placed_paid", "[DATE]", datestr); - self->childSetTextArg("ad_placed_paid", "[AMT]", llformat("%d", price_for_listing)); - self->childSetText("classified_info_text", self->childGetValue("ad_placed_paid").asString()); + LLString::format_map_t string_args; + string_args["[DATE]"] = datestr; + string_args["[AMT]"] = llformat("%d", price_for_listing); + self->childSetText("classified_info_text", self->getString("ad_placed_paid", string_args)); // If we got data from the database, we know the listing is paid for. self->mPaidFor = TRUE; - self->mUpdateBtn->setLabel(self->childGetText("update_txt")); + self->mUpdateBtn->setLabel(self->getString("update_txt")); } } @@ -727,9 +720,6 @@ void LLPanelClassified::refresh() mCategoryCombo->setEnabled(godlike); mCategoryCombo->setVisible(godlike); - //mEnabledCheck->setVisible(godlike); - //mEnabledCheck->setEnabled(godlike); - mMatureCheck->setEnabled(godlike); mMatureCheck->setVisible(godlike); @@ -750,8 +740,6 @@ void LLPanelClassified::refresh() //mPriceEditor->setEnabled(is_self); mCategoryCombo->setEnabled(is_self); - //mEnabledCheck->setVisible(FALSE); - //mEnabledCheck->setEnabled(is_self); mMatureCheck->setEnabled(is_self); if (mAutoRenewCheck) @@ -845,7 +833,7 @@ void LLPanelClassified::confirmPublish(S32 option) } else { - LLTabContainerVertical* tab = (LLTabContainerVertical*)getParent(); + LLTabContainer* tab = (LLTabContainer*)getParent(); tab->setCurrentTabName(mNameEditor->getText()); } diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h index cc82d33d33..f28795a4f2 100644 --- a/indra/newview/llpanelclassified.h +++ b/indra/newview/llpanelclassified.h @@ -57,7 +57,7 @@ class LLMessageSystem; class LLPanelClassified : public LLPanel { public: - LLPanelClassified(BOOL in_finder, bool from_search = false); + LLPanelClassified(bool in_finder, bool from_search); /*virtual*/ ~LLPanelClassified(); void reset(); @@ -118,7 +118,7 @@ protected: BOOL checkDirty(); // Update and return mDirty protected: - BOOL mInFinder; + bool mInFinder; bool mFromSearch; // from web-based "All" search sidebar BOOL mDirty; bool mForceClose; diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 83fc991ae0..24b055b0a6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -81,7 +81,7 @@ BOOL LLPanelFace::postBuild() LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha setMouseOpaque(FALSE); - mTextureCtrl = LLUICtrlFactory::getTexturePickerByName(this,"texture control"); + mTextureCtrl = getChild<LLTextureCtrl>("texture control"); if(mTextureCtrl) { mTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); @@ -113,7 +113,7 @@ BOOL LLPanelFace::postBuild() } } - mColorSwatch = LLUICtrlFactory::getColorSwatchByName(this,"colorswatch"); + mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(mColorSwatch) { mColorSwatch->setCommitCallback(LLPanelFace::onCommitColor); @@ -187,7 +187,7 @@ LLPanelFace::~LLPanelFace() void LLPanelFace::sendTexture() { - LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(this,"texture control"); + LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("texture control"); if(!mTextureCtrl) return; if( !mTextureCtrl->getTentative() ) { @@ -656,13 +656,13 @@ void LLPanelFace::getState() if (selected_texgen == 1) { - childSetText("tex scale",childGetText("string repeats per meter")); + childSetText("tex scale",getString("string repeats per meter")); childSetValue("TexScaleU", 2.0f * childGetValue("TexScaleU").asReal() ); childSetValue("TexScaleV", 2.0f * childGetValue("TexScaleV").asReal() ); } else { - childSetText("tex scale",childGetText("string repeats per face")); + childSetText("tex scale",getString("string repeats per face")); } } @@ -722,14 +722,14 @@ void LLPanelFace::getState() clearCtrls(); // Disable non-UICtrls - LLTextureCtrl* texture_ctrl = LLUICtrlFactory::getTexturePickerByName(this,"texture control"); + LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); if(texture_ctrl) { texture_ctrl->setImageAssetID( LLUUID::null ); texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. // texture_ctrl->setValid(FALSE); } - LLColorSwatchCtrl* mColorSwatch = LLUICtrlFactory::getColorSwatchByName(this,"colorswatch"); + LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(mColorSwatch) { mColorSwatch->setEnabled( FALSE ); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 76fbada562..d8faecf83d 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -67,22 +67,14 @@ BOOL LLPanelGroupTab::isVisibleByAgent(LLAgent* agentp) BOOL LLPanelGroupTab::postBuild() { // Hook up the help button callback. - LLButton* button = (LLButton*) getChildByName("help_button"); + LLButton* button = getChild<LLButton>("help_button"); if (button) { button->setClickedCallback(onClickHelp); button->setCallbackUserData(this); } - // Read help text from the xml file. - LLTextBox* txt; - // Don't recurse for this, since we don't currently have a recursive removeChild() - txt = (LLTextBox*) getChildByName("help_text"); - if (txt) - { - mHelpText = txt->getText(); - removeChild(txt, TRUE); - } + mHelpText = getString("help_text"); return TRUE; } @@ -219,14 +211,14 @@ void LLPanelGroup::updateTabVisibility() BOOL LLPanelGroup::postBuild() { - mTabContainer = (LLTabContainerCommon*) getChildByName("group_tab_container"); + mTabContainer = getChild<LLTabContainer>("group_tab_container"); if (mTabContainer) { // Select the initial tab specified via constructor const BOOL recurse = TRUE; LLPanelGroupTab* tabp = - (LLPanelGroupTab*) getChildByName(mInitialTab, recurse); + getChild<LLPanelGroupTab>(mInitialTab, recurse); if (!tabp) { @@ -272,23 +264,10 @@ BOOL LLPanelGroup::postBuild() mCurrentTab->activate(); } - // Read apply text from the xml file. - LLTextBox* txt; - // Don't recurse for this, since we don't currently have a recursive removeChild() - txt = (LLTextBox*)getChildByName("default_needs_apply_text"); - if (txt) - { - mDefaultNeedsApplyMesg = txt->getText(); - removeChild(txt, TRUE); - } - txt = (LLTextBox*)getChildByName("want_apply_text"); - if (txt) - { - mWantApplyMesg = txt->getText(); - removeChild(txt, TRUE); - } + mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); + mWantApplyMesg = getString("want_apply_text"); - LLButton* button = (LLButton*) getChildByName("btn_ok"); + LLButton* button = getChild<LLButton>("btn_ok"); if (button) { button->setClickedCallback(onBtnOK); @@ -296,7 +275,7 @@ BOOL LLPanelGroup::postBuild() button->setVisible(mAllowEdit); } - button = (LLButton*) getChildByName("btn_cancel"); + button = getChild<LLButton>("btn_cancel"); if (button) { button->setClickedCallback(onBtnCancel); @@ -304,7 +283,7 @@ BOOL LLPanelGroup::postBuild() button->setVisible(mAllowEdit); } - button = (LLButton*) getChildByName("btn_apply"); + button = getChild<LLButton>("btn_apply"); if (button) { button->setClickedCallback(onBtnApply); @@ -314,7 +293,7 @@ BOOL LLPanelGroup::postBuild() mApplyBtn = button; } - button = (LLButton*) getChildByName("btn_refresh"); + button = getChild<LLButton>("btn_refresh"); if (button) { button->setClickedCallback(onBtnRefresh); @@ -400,7 +379,7 @@ void LLPanelGroup::selectTab(std::string tab_name) const BOOL recurse = TRUE; LLPanelGroupTab* tabp = - (LLPanelGroupTab*) getChildByName(tab_name, recurse); + getChild<LLPanelGroupTab>(tab_name, recurse); if ( tabp && mTabContainer ) { diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 19f43ecb88..3928d1d2f5 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -41,7 +41,7 @@ const S32 UPDATE_MEMBERS_PER_FRAME = 500; // Forward declares class LLPanelGroupTab; -class LLTabContainerCommon; +class LLTabContainer; class LLAgent; class LLPanelGroupTabObserver @@ -111,7 +111,7 @@ public: protected: LLPanelGroupTab* mCurrentTab; LLPanelGroupTab* mRequestedTab; - LLTabContainerCommon* mTabContainer; + LLTabContainer* mTabContainer; BOOL mIgnoreTransition; LLButton* mApplyBtn; @@ -183,7 +183,7 @@ public: protected: LLUUID mGroupID; - LLTabContainerCommon* mTabContainer; + LLTabContainer* mTabContainer; LLString mHelpText; BOOL mAllowEdit; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 31688256f5..2e55cfb30a 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -99,10 +99,10 @@ BOOL LLPanelGroupGeneral::postBuild() bool recurse = true; // General info - mGroupNameEditor = (LLLineEditor*) getChildByName("group_name_editor", recurse); - mGroupName = (LLTextBox*) getChildByName("group_name", recurse); + mGroupNameEditor = getChild<LLLineEditor>("group_name_editor", recurse); + mGroupName = getChild<LLTextBox>("group_name", recurse); - mInsignia = (LLTextureCtrl*) getChildByName("insignia", recurse); + mInsignia = getChild<LLTextureCtrl>("insignia", recurse); if (mInsignia) { mInsignia->setCommitCallback(onCommitAny); @@ -110,7 +110,7 @@ BOOL LLPanelGroupGeneral::postBuild() mDefaultIconID = mInsignia->getImageAssetID(); } - mEditCharter = (LLTextEditor*) getChildByName("charter", recurse); + mEditCharter = getChild<LLTextEditor>("charter", recurse); if(mEditCharter) { mEditCharter->setCommitCallback(onCommitAny); @@ -119,21 +119,21 @@ BOOL LLPanelGroupGeneral::postBuild() mEditCharter->setCallbackUserData(this); } - mBtnJoinGroup = (LLButton*) getChildByName("join_button", recurse); + mBtnJoinGroup = getChild<LLButton>("join_button", recurse); if ( mBtnJoinGroup ) { mBtnJoinGroup->setClickedCallback(onClickJoin); mBtnJoinGroup->setCallbackUserData(this); } - mBtnInfo = (LLButton*) getChildByName("info_button", recurse); + mBtnInfo = getChild<LLButton>("info_button", recurse); if ( mBtnInfo ) { mBtnInfo->setClickedCallback(onClickInfo); mBtnInfo->setCallbackUserData(this); } - LLTextBox* founder = (LLTextBox*) getChildByName("founder_name"); + LLTextBox* founder = getChild<LLTextBox>("founder_name"); if (founder) { mFounderName = new LLNameBox(founder->getName(),founder->getRect(),LLUUID::null,FALSE,founder->getFont(),founder->getMouseOpaque()); @@ -141,7 +141,7 @@ BOOL LLPanelGroupGeneral::postBuild() addChild(mFounderName); } - mListVisibleMembers = (LLNameListCtrl*) getChildByName("visible_members", recurse); + mListVisibleMembers = getChild<LLNameListCtrl>("visible_members", recurse); if (mListVisibleMembers) { mListVisibleMembers->setDoubleClickCallback(openProfile); @@ -149,14 +149,14 @@ BOOL LLPanelGroupGeneral::postBuild() } // Options - mCtrlShowInGroupList = (LLCheckBoxCtrl*) getChildByName("show_in_group_list", recurse); + mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse); if (mCtrlShowInGroupList) { mCtrlShowInGroupList->setCommitCallback(onCommitAny); mCtrlShowInGroupList->setCallbackUserData(this); } - mCtrlMature = (LLCheckBoxCtrl*) getChildByName("mature", recurse); + mCtrlMature = getChild<LLCheckBoxCtrl>("mature", recurse); if (mCtrlMature) { mCtrlMature->setCommitCallback(onCommitAny); @@ -164,21 +164,21 @@ BOOL LLPanelGroupGeneral::postBuild() mCtrlMature->setVisible( !gAgent.isTeen() ); } - mCtrlOpenEnrollment = (LLCheckBoxCtrl*) getChildByName("open_enrollement", recurse); + mCtrlOpenEnrollment = getChild<LLCheckBoxCtrl>("open_enrollement", recurse); if (mCtrlOpenEnrollment) { mCtrlOpenEnrollment->setCommitCallback(onCommitAny); mCtrlOpenEnrollment->setCallbackUserData(this); } - mCtrlEnrollmentFee = (LLCheckBoxCtrl*) getChildByName("check_enrollment_fee", recurse); + mCtrlEnrollmentFee = getChild<LLCheckBoxCtrl>("check_enrollment_fee", recurse); if (mCtrlEnrollmentFee) { mCtrlEnrollmentFee->setCommitCallback(onCommitEnrollment); mCtrlEnrollmentFee->setCallbackUserData(this); } - mSpinEnrollmentFee = (LLSpinCtrl*) getChildByName("spin_enrollment_fee", recurse); + mSpinEnrollmentFee = getChild<LLSpinCtrl>("spin_enrollment_fee", recurse); if (mSpinEnrollmentFee) { mSpinEnrollmentFee->setCommitCallback(onCommitAny); @@ -194,7 +194,7 @@ BOOL LLPanelGroupGeneral::postBuild() accept_notices = data.mAcceptNotices; list_in_profile = data.mListInProfile; } - mCtrlReceiveNotices = (LLCheckBoxCtrl*) getChildByName("receive_notices", recurse); + mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices", recurse); if (mCtrlReceiveNotices) { mCtrlReceiveNotices->setCommitCallback(onCommitUserOnly); @@ -203,7 +203,7 @@ BOOL LLPanelGroupGeneral::postBuild() mCtrlReceiveNotices->setEnabled(data.mID.notNull()); } - mCtrlListGroup = (LLCheckBoxCtrl*) getChildByName("list_groups_in_profile", recurse); + mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse); if (mCtrlListGroup) { mCtrlListGroup->setCommitCallback(onCommitUserOnly); @@ -212,31 +212,17 @@ BOOL LLPanelGroupGeneral::postBuild() mCtrlListGroup->setEnabled(data.mID.notNull()); } - mActiveTitleLabel = (LLTextBox*) getChildByName("active_title_label", recurse); + mActiveTitleLabel = getChild<LLTextBox>("active_title_label", recurse); - mComboActiveTitle = (LLComboBox*) getChildByName("active_title", recurse); + mComboActiveTitle = getChild<LLComboBox>("active_title", recurse); if (mComboActiveTitle) { mComboActiveTitle->setCommitCallback(onCommitTitle); mComboActiveTitle->setCallbackUserData(this); } - // Extra data - LLTextBox* txt; - // Don't recurse for this, since we don't currently have a recursive removeChild() - txt = (LLTextBox*)getChildByName("incomplete_member_data_str"); - if (txt) - { - mIncompleteMemberDataStr = txt->getText(); - removeChild(txt, TRUE); - } - - txt = (LLTextBox*)getChildByName("confirm_group_create_str"); - if (txt) - { - mConfirmGroupCreateStr = txt->getText(); - removeChild(txt, TRUE); - } + mIncompleteMemberDataStr = getString("incomplete_member_data_str"); + mConfirmGroupCreateStr = getString("confirm_group_create_str"); // If the group_id is null, then we are creating a new group if (mGroupID.isNull()) diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 9bab774a46..229daf44ff 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -474,12 +474,12 @@ BOOL LLPanelGroupInvite::postBuild() { BOOL recurse = TRUE; - mImplementation->mLoadingText = childGetText("loading"); - mImplementation->mRoleNames = (LLComboBox*) getChildByName("role_name", + mImplementation->mLoadingText = getString("loading"); + mImplementation->mRoleNames = getChild<LLComboBox>("role_name", recurse); - mImplementation->mGroupName = (LLTextBox*) getChildByName("group_name_text", recurse); + mImplementation->mGroupName = getChild<LLTextBox>("group_name_text", recurse); mImplementation->mInvitees = - (LLNameListCtrl*) getChildByName("invitee_list", recurse); + getChild<LLNameListCtrl>("invitee_list", recurse); if ( mImplementation->mInvitees ) { mImplementation->mInvitees->setCallbackUserData(mImplementation); @@ -487,7 +487,7 @@ BOOL LLPanelGroupInvite::postBuild() mImplementation->mInvitees->setCommitCallback(impl::callbackSelect); } - LLButton* button = (LLButton*) getChildByName("add_button", recurse); + LLButton* button = getChild<LLButton>("add_button", recurse); if ( button ) { // default to opening avatarpicker automatically @@ -497,7 +497,7 @@ BOOL LLPanelGroupInvite::postBuild() } mImplementation->mRemoveButton = - (LLButton*) getChildByName("remove_button", recurse); + getChild<LLButton>("remove_button", recurse); if ( mImplementation->mRemoveButton ) { mImplementation->mRemoveButton-> @@ -507,7 +507,7 @@ BOOL LLPanelGroupInvite::postBuild() } mImplementation->mOKButton = - (LLButton*) getChildByName("ok_button", recurse); + getChild<LLButton>("ok_button", recurse); if ( mImplementation->mOKButton ) { mImplementation->mOKButton-> @@ -516,7 +516,7 @@ BOOL LLPanelGroupInvite::postBuild() mImplementation->mOKButton->setEnabled(FALSE); } - button = (LLButton*) getChildByName("cancel_button", recurse); + button = getChild<LLButton>("cancel_button", recurse); if ( button ) { button->setClickedCallback(impl::callbackClickCancel); diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 7f12555fe2..c6aae2dd88 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -60,7 +60,7 @@ public: LLGroupMoneyTabEventHandler(LLButton* earlier_button, LLButton* later_button, LLTextEditor* text_editor, - LLTabContainerCommon* tab_containerp, + LLTabContainer* tab_containerp, LLPanel* panelp, const LLString& loading_text, const LLUUID& group_id, @@ -92,7 +92,7 @@ public: LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp, LLButton* later_buttonp, LLTextEditor* text_editorp, - LLTabContainerCommon* tab_containerp, + LLTabContainer* tab_containerp, LLPanel* panelp, const LLString& loading_text, const LLUUID& group_id); @@ -109,7 +109,7 @@ public: LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp, LLButton* later_buttonp, LLTextEditor* text_editorp, - LLTabContainerCommon* tab_containerp, + LLTabContainer* tab_containerp, LLPanel* panelp, const LLString& loading_text, const LLUUID& group_id); @@ -123,7 +123,7 @@ class LLGroupMoneyPlanningTabEventHandler : public LLGroupMoneyTabEventHandler { public: LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editor, - LLTabContainerCommon* tab_containerp, + LLTabContainer* tab_containerp, LLPanel* panelp, const LLString& loading_text, const LLUUID& group_id); @@ -501,7 +501,7 @@ void LLPanelGroupLandMoney::activate() if ( !mImplementationp->mBeenActivated ) { //select the first tab - LLTabContainerCommon* tabp = (LLTabContainerCommon*) getChildByName("group_money_tab_container"); + LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container"); if ( tabp ) { @@ -541,7 +541,7 @@ void LLPanelGroupLandMoney::update(LLGroupChange gc) { if (gc != GC_ALL) return; //Don't update if it's the wrong panel! - LLTabContainerCommon* tabp = (LLTabContainerCommon*) getChildByName("group_money_tab_container"); + LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container"); if ( tabp ) { @@ -605,12 +605,12 @@ BOOL LLPanelGroupLandMoney::postBuild() bool can_view = gAgent.isInGroup(mGroupID); mImplementationp->mGroupOverLimitIconp = - (LLIconCtrl*) getChildByName("group_over_limit_icon"); + getChild<LLIconCtrl>("group_over_limit_icon"); mImplementationp->mGroupOverLimitTextp = - (LLTextBox*) getChildByName("group_over_limit_text"); + getChild<LLTextBox>("group_over_limit_text"); mImplementationp->mYourContributionEditorp - = (LLLineEditor*) getChildByName("your_contribution_line_editor"); + = getChild<LLLineEditor>("your_contribution_line_editor"); if ( mImplementationp->mYourContributionEditorp ) { LLLineEditor* editor = mImplementationp->mYourContributionEditorp; @@ -620,26 +620,13 @@ BOOL LLPanelGroupLandMoney::postBuild() editor->setCallbackUserData(this); } - mImplementationp->mMapButtonp = (LLButton*) getChildByName("map_button"); + mImplementationp->mMapButtonp = getChild<LLButton>("map_button"); mImplementationp->mGroupParcelsp = - (LLScrollListCtrl*) getChildByName("group_parcel_list"); - - LLTextBox *no_permsp = - (LLTextBox*) getChildByName("cant_view_group_land_text"); - if ( no_permsp ) - { - mImplementationp->mCantViewParcelsText = no_permsp->getText(); - removeChild(no_permsp, TRUE); - } - - no_permsp = (LLTextBox*) getChildByName("cant_view_group_accounting_text"); - if ( no_permsp ) - { - mImplementationp->mCantViewAccountsText = no_permsp->getText(); - removeChild(no_permsp, TRUE); - } + getChild<LLScrollListCtrl>("group_parcel_list"); + mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text"); + mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text"); if ( mImplementationp->mMapButtonp ) { @@ -677,8 +664,7 @@ BOOL LLPanelGroupLandMoney::postBuild() LLTextEditor* textp; LLPanel* panelp; - LLTabContainerCommon* tabcp = (LLTabContainerCommon*) - getChildByName("group_money_tab_container", true); + LLTabContainer* tabcp = getChild<LLTabContainer>("group_money_tab_container"); if ( !can_view ) { @@ -694,13 +680,13 @@ BOOL LLPanelGroupLandMoney::postBuild() } } - LLString loading_text = childGetText("loading_txt"); + LLString loading_text = getString("loading_txt"); //pull out the widgets for the L$ details tab - earlierp = (LLButton*) getChildByName("earlier_details_button", true); - laterp = (LLButton*) getChildByName("later_details_button", true); - textp = (LLTextEditor*) getChildByName("group_money_details_text", true); - panelp = (LLPanel*) getChildByName("group_money_details_tab", true); + earlierp = getChild<LLButton>("earlier_details_button", true); + laterp = getChild<LLButton>("later_details_button", true); + textp = getChild<LLTextEditor>("group_money_details_text", true); + panelp = getChild<LLPanel>("group_money_details_tab", true); if ( !can_view ) { @@ -718,8 +704,8 @@ BOOL LLPanelGroupLandMoney::postBuild() mGroupID); } - textp = (LLTextEditor*) getChildByName("group_money_planning_text", true); - panelp = (LLPanel*) getChildByName("group_money_planning_tab", true); + textp = getChild<LLTextEditor>("group_money_planning_text", true); + panelp = getChild<LLPanel>("group_money_planning_tab", true); if ( !can_view ) { @@ -736,10 +722,10 @@ BOOL LLPanelGroupLandMoney::postBuild() } //pull out the widgets for the L$ sales tab - earlierp = (LLButton*) getChildByName("earlier_sales_button", true); - laterp = (LLButton*) getChildByName("later_sales_button", true); - textp = (LLTextEditor*) getChildByName("group_money_sales_text", true); - panelp = (LLPanel*) getChildByName("group_money_sales_tab", true); + earlierp = getChild<LLButton>("earlier_sales_button", true); + laterp = getChild<LLButton>("later_sales_button", true); + textp = getChild<LLTextEditor>("group_money_sales_text", true); + panelp = getChild<LLPanel>("group_money_sales_tab", true); if ( !can_view ) { @@ -881,7 +867,7 @@ std::map<LLPanel*, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sT LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_buttonp, LLButton* later_buttonp, LLTextEditor* text_editorp, - LLTabContainerCommon* tab_containerp, + LLTabContainer* tab_containerp, LLPanel* panelp, const LLString& loading_text, const LLUUID& group_id, @@ -998,7 +984,7 @@ void LLGroupMoneyTabEventHandler::clickTabCallback(void* data, bool from_click) LLGroupMoneyDetailsTabEventHandler::LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp, LLButton* later_buttonp, LLTextEditor* text_editorp, - LLTabContainerCommon* tab_containerp, + LLTabContainer* tab_containerp, LLPanel* panelp, const LLString& loading_text, const LLUUID& group_id) @@ -1138,7 +1124,7 @@ void LLPanelGroupLandMoney::processGroupAccountDetailsReply(LLMessageSystem* msg LLGroupMoneySalesTabEventHandler::LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp, LLButton* later_buttonp, LLTextEditor* text_editorp, - LLTabContainerCommon* tab_containerp, + LLTabContainer* tab_containerp, LLPanel* panelp, const LLString& loading_text, const LLUUID& group_id) @@ -1315,7 +1301,7 @@ void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem //*************************************************** LLGroupMoneyPlanningTabEventHandler::LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editorp, - LLTabContainerCommon* tab_containerp, + LLTabContainer* tab_containerp, LLPanel* panelp, const LLString& loading_text, const LLUUID& group_id) diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 9ac88a3cc2..4c16936b68 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -129,7 +129,7 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { // check if inside //LLRect parent_rect = mParentView->getRect(); - //mRect.set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0); + //getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0); handled = TRUE; // check the type @@ -229,67 +229,62 @@ BOOL LLPanelGroupNotices::postBuild() { bool recurse = true; - mNoticesList = (LLScrollListCtrl*)getChildByName("notice_list",recurse); + mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse); mNoticesList->setCommitOnSelectionChange(TRUE); mNoticesList->setCommitCallback(onSelectNotice); mNoticesList->setCallbackUserData(this); - mBtnNewMessage = (LLButton*)getChildByName("create_new_notice",recurse); + mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse); mBtnNewMessage->setClickedCallback(onClickNewMessage); mBtnNewMessage->setCallbackUserData(this); mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND)); - mBtnGetPastNotices = (LLButton*)getChildByName("refresh_notices",recurse); + mBtnGetPastNotices = getChild<LLButton>("refresh_notices",recurse); mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices); mBtnGetPastNotices->setCallbackUserData(this); // Create - mCreateSubject = (LLLineEditor*)getChildByName("create_subject",recurse); - mCreateMessage = (LLTextEditor*)getChildByName("create_message",recurse); + mCreateSubject = getChild<LLLineEditor>("create_subject",recurse); + mCreateMessage = getChild<LLTextEditor>("create_message",recurse); - mCreateInventoryName = (LLLineEditor*)getChildByName("create_inventory_name",recurse); + mCreateInventoryName = getChild<LLLineEditor>("create_inventory_name",recurse); mCreateInventoryName->setTabStop(FALSE); mCreateInventoryName->setEnabled(FALSE); - mCreateInventoryIcon = (LLIconCtrl*)getChildByName("create_inv_icon",recurse); + mCreateInventoryIcon = getChild<LLIconCtrl>("create_inv_icon",recurse); mCreateInventoryIcon->setVisible(FALSE); - mBtnSendMessage = (LLButton*)getChildByName("send_notice",recurse); + mBtnSendMessage = getChild<LLButton>("send_notice",recurse); mBtnSendMessage->setClickedCallback(onClickSendMessage); mBtnSendMessage->setCallbackUserData(this); - mBtnRemoveAttachment = (LLButton*)getChildByName("remove_attachment",recurse); + mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",recurse); mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment); mBtnRemoveAttachment->setCallbackUserData(this); mBtnRemoveAttachment->setEnabled(FALSE); // View - mViewSubject = (LLLineEditor*)getChildByName("view_subject",recurse); - mViewMessage = (LLTextEditor*)getChildByName("view_message",recurse); + mViewSubject = getChild<LLLineEditor>("view_subject",recurse); + mViewMessage = getChild<LLTextEditor>("view_message",recurse); - mViewInventoryName = (LLLineEditor*)getChildByName("view_inventory_name",recurse); + mViewInventoryName = getChild<LLLineEditor>("view_inventory_name",recurse); mViewInventoryName->setTabStop(FALSE); mViewInventoryName->setEnabled(FALSE); - mViewInventoryIcon = (LLIconCtrl*)getChildByName("view_inv_icon",recurse); + mViewInventoryIcon = getChild<LLIconCtrl>("view_inv_icon",recurse); mViewInventoryIcon->setVisible(FALSE); - mBtnOpenAttachment = (LLButton*)getChildByName("open_attachment",recurse); + mBtnOpenAttachment = getChild<LLButton>("open_attachment",recurse); mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment); mBtnOpenAttachment->setCallbackUserData(this); - LLTextBox *txt = (LLTextBox*) getChildByName("no_notices_text",false); - if (txt) - { - mNoNoticesStr = txt->getText(); - removeChild(txt, TRUE); - } + mNoNoticesStr = getString("no_notices_text"); - mPanelCreateNotice = (LLPanel*) getChildByName("panel_create_new_notice",recurse); - mPanelViewNotice = (LLPanel*) getChildByName("panel_view_past_notice",recurse); + mPanelCreateNotice = getChild<LLPanel>("panel_create_new_notice",recurse); + mPanelViewNotice = getChild<LLPanel>("panel_view_past_notice",recurse); // Must be in front of all other UI elements. - LLPanel* dtv = (LLPanel*)getChildByName("drop_target",recurse); + LLPanel* dtv = getChild<LLPanel>("drop_target",recurse); LLGroupDropTarget* target = new LLGroupDropTarget("drop_target", dtv->getRect(), this, mGroupID); diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 1556f24afa..6ca3e1e085 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -133,7 +133,7 @@ BOOL LLPanelGroupRoles::postBuild() { lldebugs << "LLPanelGroupRoles::postBuild()" << llendl; - mSubTabContainer = (LLTabContainerCommon*) getChildByName("roles_tab_container"); + mSubTabContainer = getChild<LLTabContainer>("roles_tab_container"); if (!mSubTabContainer) return FALSE; @@ -169,20 +169,8 @@ BOOL LLPanelGroupRoles::postBuild() mCurrentTab->activate(); // Read apply text from the xml file. - LLTextBox* txt; - // Don't recurse for this, since we don't currently have a recursive removeChild() - txt = (LLTextBox*)getChildByName("default_needs_apply_text"); - if (txt) - { - mDefaultNeedsApplyMesg = txt->getText(); - removeChild(txt, TRUE); - } - txt = (LLTextBox*)getChildByName("want_apply_text"); - if (txt) - { - mWantApplyMesg = txt->getText(); - removeChild(txt, TRUE); - } + mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); + mWantApplyMesg = getString("want_apply_text"); return LLPanelGroupTab::postBuild(); } @@ -515,20 +503,20 @@ BOOL LLPanelGroupSubTab::postBuild() { // Hook up the search widgets. bool recurse = true; - mSearchLineEditor = (LLLineEditor*) getChildByName("search_text", recurse); + mSearchLineEditor = getChild<LLLineEditor>("search_text", recurse); if (!mSearchLineEditor) return FALSE; mSearchLineEditor->setKeystrokeCallback(onSearchKeystroke); mSearchLineEditor->setCallbackUserData(this); - mSearchButton = (LLButton*) getChildByName("search_button", recurse); + mSearchButton = getChild<LLButton>("search_button", recurse); if (!mSearchButton) return FALSE; mSearchButton->setClickedCallback(onClickSearch); mSearchButton->setCallbackUserData(this); mSearchButton->setEnabled(FALSE); - mShowAllButton = (LLButton*) getChildByName("show_all_button", recurse); + mShowAllButton = getChild<LLButton>("show_all_button", recurse); if (!mShowAllButton) return FALSE; mShowAllButton->setClickedCallback(onClickShowAll); @@ -540,21 +528,21 @@ BOOL LLPanelGroupSubTab::postBuild() bool no_recurse = false; - LLIconCtrl* icon = (LLIconCtrl*) getChildByName("power_folder_icon",no_recurse); + LLIconCtrl* icon = getChild<LLIconCtrl>("power_folder_icon",no_recurse); if (icon && icon->getImage().notNull()) { mActionIcons["folder"] = icon->getImage(); removeChild(icon, TRUE); } - icon = (LLIconCtrl*) getChildByName("power_all_have_icon",no_recurse); + icon = getChild<LLIconCtrl>("power_all_have_icon",no_recurse); if (icon && icon->getImage().notNull()) { mActionIcons["full"] = icon->getImage(); removeChild(icon, TRUE); } - icon = (LLIconCtrl*) getChildByName("power_partial_icon",no_recurse); + icon = getChild<LLIconCtrl>("power_partial_icon",no_recurse); if (icon && icon->getImage().notNull()) { mActionIcons["partial"] = icon->getImage(); @@ -913,12 +901,12 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) // Look recursively from the parent to find all our widgets. bool recurse = true; - mHeader = (LLPanel*) parent->getChildByName("members_header", recurse); - mFooter = (LLPanel*) parent->getChildByName("members_footer", recurse); + mHeader = parent->getChild<LLPanel>("members_header", recurse); + mFooter = parent->getChild<LLPanel>("members_footer", recurse); - mMembersList = (LLNameListCtrl*) parent->getChildByName("member_list", recurse); - mAssignedRolesList = (LLScrollListCtrl*) parent->getChildByName("member_assigned_roles", recurse); - mAllowedActionsList = (LLScrollListCtrl*) parent->getChildByName("member_allowed_actions", recurse); + mMembersList = parent->getChild<LLNameListCtrl>("member_list", recurse); + mAssignedRolesList = parent->getChild<LLScrollListCtrl>("member_assigned_roles", recurse); + mAllowedActionsList = parent->getChild<LLScrollListCtrl>("member_allowed_actions", recurse); if (!mMembersList || !mAssignedRolesList || !mAllowedActionsList) return FALSE; @@ -929,7 +917,7 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) // Show the member's profile on double click. mMembersList->setDoubleClickCallback(onMemberDoubleClick); - LLButton* button = (LLButton*) parent->getChildByName("member_invite", recurse); + LLButton* button = parent->getChild<LLButton>("member_invite", recurse); if ( button ) { button->setClickedCallback(onInviteMember); @@ -937,7 +925,7 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE)); } - mEjectBtn = (LLButton*) parent->getChildByName("member_eject", recurse); + mEjectBtn = parent->getChild<LLButton>("member_eject", recurse); if ( mEjectBtn ) { mEjectBtn->setClickedCallback(onEjectMembers); @@ -1483,19 +1471,16 @@ void LLPanelGroupMembersSubTab::applyMemberChanges() notifyObservers(); } -bool LLPanelGroupMembersSubTab::matchesSearchFilter(char* first, char* last) +bool LLPanelGroupMembersSubTab::matchesSearchFilter(const std::string& fullname) { // If the search filter is empty, everything passes. if (mSearchFilter.empty()) return true; // Create a full name, and compare it to the search filter. - LLString fullname; - fullname.assign(first); - fullname.append(1, ' '); - fullname.append(last); - LLString::toLower(fullname); + std::string fullname_lc(fullname); + LLString::toLower(fullname_lc); - std::string::size_type match = fullname.find(mSearchFilter); + std::string::size_type match = fullname_lc.find(mSearchFilter); if (std::string::npos == match) { @@ -1709,8 +1694,6 @@ void LLPanelGroupMembersSubTab::updateMembers() LLGroupMgrGroupData::member_iter end = gdatap->mMembers.end(); - char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ S32 i = 0; for( ; mMemberProgress != end && i<UPDATE_MEMBERS_PER_FRAME; ++mMemberProgress, ++i) @@ -1720,9 +1703,10 @@ void LLPanelGroupMembersSubTab::updateMembers() // Do filtering on name if it is already in the cache. bool add_member = true; - if (gCacheName->getName(mMemberProgress->first, first, last)) + std::string fullname; + if (gCacheName->getFullName(mMemberProgress->first, fullname)) { - if ( !matchesSearchFilter(first, last) ) + if ( !matchesSearchFilter(fullname) ) { add_member = false; } @@ -1802,19 +1786,19 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) // Look recursively from the parent to find all our widgets. bool recurse = true; - mHeader = (LLPanel*) parent->getChildByName("roles_header", recurse); - mFooter = (LLPanel*) parent->getChildByName("roles_footer", recurse); + mHeader = parent->getChild<LLPanel>("roles_header", recurse); + mFooter = parent->getChild<LLPanel>("roles_footer", recurse); - mRolesList = (LLScrollListCtrl*) parent->getChildByName("role_list", recurse); - mAssignedMembersList = (LLNameListCtrl*) parent->getChildByName("role_assigned_members", recurse); - mAllowedActionsList = (LLScrollListCtrl*) parent->getChildByName("role_allowed_actions", recurse); + mRolesList = parent->getChild<LLScrollListCtrl>("role_list", recurse); + mAssignedMembersList = parent->getChild<LLNameListCtrl>("role_assigned_members", recurse); + mAllowedActionsList = parent->getChild<LLScrollListCtrl>("role_allowed_actions", recurse); - mRoleName = (LLLineEditor*) parent->getChildByName("role_name", recurse); - mRoleTitle = (LLLineEditor*) parent->getChildByName("role_title", recurse); - mRoleDescription = (LLTextEditor*) parent->getChildByName("role_description", recurse); + mRoleName = parent->getChild<LLLineEditor>("role_name", recurse); + mRoleTitle = parent->getChild<LLLineEditor>("role_title", recurse); + mRoleDescription = parent->getChild<LLTextEditor>("role_description", recurse); - mMemberVisibleCheck = (LLCheckBoxCtrl*) parent->getChildByName("role_visible_in_list", recurse); + mMemberVisibleCheck = parent->getChild<LLCheckBoxCtrl>("role_visible_in_list", recurse); if (!mRolesList || !mAssignedMembersList || !mAllowedActionsList || !mRoleName || !mRoleTitle || !mRoleDescription || !mMemberVisibleCheck) @@ -1823,15 +1807,10 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) return FALSE; } - LLTextBox* txt = (LLTextBox*) parent->getChildByName("cant_delete_role", FALSE); - if (txt) - { - mRemoveEveryoneTxt = txt->getText(); - parent->removeChild(txt, TRUE); - } + mRemoveEveryoneTxt = getString("cant_delete_role"); mCreateRoleButton = - (LLButton*) parent->getChildByName("role_create", recurse); + parent->getChild<LLButton>("role_create", recurse); if ( mCreateRoleButton ) { mCreateRoleButton->setCallbackUserData(this); @@ -1840,7 +1819,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) } mDeleteRoleButton = - (LLButton*) parent->getChildByName("role_delete", recurse); + parent->getChild<LLButton>("role_delete", recurse); if ( mDeleteRoleButton ) { mDeleteRoleButton->setCallbackUserData(this); @@ -2515,14 +2494,14 @@ BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root) // Look recursively from the parent to find all our widgets. bool recurse = true; - mHeader = (LLPanel*) parent->getChildByName("actions_header", recurse); - mFooter = (LLPanel*) parent->getChildByName("actions_footer", recurse); + mHeader = parent->getChild<LLPanel>("actions_header", recurse); + mFooter = parent->getChild<LLPanel>("actions_footer", recurse); - mActionDescription = (LLTextEditor*) parent->getChildByName("action_description", recurse); + mActionDescription = parent->getChild<LLTextEditor>("action_description", recurse); - mActionList = (LLScrollListCtrl*) parent->getChildByName("action_list",recurse); - mActionRoles = (LLScrollListCtrl*) parent->getChildByName("action_roles",recurse); - mActionMembers = (LLNameListCtrl*) parent->getChildByName("action_members",recurse); + mActionList = parent->getChild<LLScrollListCtrl>("action_list",recurse); + mActionRoles = parent->getChild<LLScrollListCtrl>("action_roles",recurse); + mActionMembers = parent->getChild<LLNameListCtrl>("action_members",recurse); if (!mActionList || !mActionDescription || !mActionRoles || !mActionMembers) return FALSE; diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index 13d64d4edb..6d2c6ab4cf 100644 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -93,7 +93,7 @@ public: protected: LLPanelGroupTab* mCurrentTab; LLPanelGroupTab* mRequestedTab; - LLTabContainerCommon* mSubTabContainer; + LLTabContainer* mSubTabContainer; BOOL mFirstUse; BOOL mIgnoreTransition; @@ -205,7 +205,7 @@ protected: typedef std::map<LLUUID, role_change_data_map_t*>::iterator member_role_change_iter; typedef std::map<LLUUID, role_change_data_map_t*> member_role_changes_map_t; - bool matchesSearchFilter(char* first, char* last); + bool matchesSearchFilter(const std::string& fullname); U64 getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id); bool getRoleChangeType(const LLUUID& member_id, diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp index 1ac95c9a82..eb40eefcb7 100644 --- a/indra/newview/llpanellandmedia.cpp +++ b/indra/newview/llpanellandmedia.cpp @@ -66,7 +66,7 @@ BOOL LLPanelLandMedia::postBuild() mMusicURLEdit = LLUICtrlFactory::getLineEditorByName(this, "music_url"); childSetCommitCallback("music_url", onCommitAny, this); - mMediaTextureCtrl = LLUICtrlFactory::getTexturePickerByName(this, "media texture"); + mMediaTextureCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this, "media texture"); if (mMediaTextureCtrl) { mMediaTextureCtrl->setCommitCallback( onCommitAny ); @@ -77,7 +77,7 @@ BOOL LLPanelLandMedia::postBuild() } else { - llwarns << "LLUICtrlFactory::getTexturePickerByName() returned NULL for 'media texure'" << llendl; + llwarns << "LLViewerUICtrlFactory::getTexturePickerByName() returned NULL for 'media texure'" << llendl; } mMediaAutoScaleCheck = LLUICtrlFactory::getCheckBoxByName(this, "media_auto_scale"); @@ -242,7 +242,7 @@ void LLPanelLandMedia::refresh() }; #endif - LLFloaterURLEntry* floater_url_entry = (LLFloaterURLEntry*)LLFloater::getFloaterByHandle(mURLEntryFloater); + LLFloaterURLEntry* floater_url_entry = (LLFloaterURLEntry*)mURLEntryFloater.get(); if (floater_url_entry) { floater_url_entry->updateFromLandMediaPanel(); @@ -373,6 +373,6 @@ void LLPanelLandMedia::onSetBtn(void *userdata) LLFloater* parent_floater = gFloaterView->getParentFloater(self); if (parent_floater) { - parent_floater->addDependentFloater(LLFloater::getFloaterByHandle(self->mURLEntryFloater)); + parent_floater->addDependentFloater(self->mURLEntryFloater.get()); } } diff --git a/indra/newview/llpanellandmedia.h b/indra/newview/llpanellandmedia.h index aa84b245e2..769bc27532 100644 --- a/indra/newview/llpanellandmedia.h +++ b/indra/newview/llpanellandmedia.h @@ -11,7 +11,6 @@ #define LLPANELLANDMEDIA_H #include "lllineeditor.h" -#include "llmemory.h" // LLHandle<> #include "llpanel.h" #include "llparcelselection.h" #include "lluifwd.h" // widget pointer types @@ -20,7 +19,7 @@ class LLPanelLandMedia : public LLPanel { public: - LLPanelLandMedia(LLHandle<LLParcelSelection>& parcelp); + LLPanelLandMedia(LLSafeHandle<LLParcelSelection>& parcelp); /*virtual*/ ~LLPanelLandMedia(); /*virtual*/ BOOL postBuild(); void refresh(); @@ -50,9 +49,9 @@ private: LLCheckBoxCtrl* mMediaLoopCheck; LLCheckBoxCtrl* mMediaUrlCheck; LLCheckBoxCtrl* mMusicUrlCheck; - LLViewHandle mURLEntryFloater; + LLHandle<LLFloater> mURLEntryFloater; - LLHandle<LLParcelSelection>& mParcel; + LLSafeHandle<LLParcelSelection>& mParcel; }; #endif diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index a80765c805..b65835fed3 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -328,7 +328,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mCallbackData(cb_data), mHtmlAvailable( TRUE ) { - mIsFocusRoot = TRUE; + setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); @@ -437,7 +437,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, #endif // get the web browser control - LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "login_html"); + LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); if ( web_browser ) { // Need to handle login secondlife:///app/ URLs @@ -454,22 +454,22 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, web_browser->setOpenInExternalBrowser( true ); // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) - LLRect htmlRect = mRect; + LLRect htmlRect = getRect(); #if USE_VIEWER_AUTH - htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY(), mRect.getWidth() + 6, mRect.getHeight()); + htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); #else - htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY() + 40, mRect.getWidth() + 6, mRect.getHeight() - 78 ); + htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); #endif web_browser->setRect( htmlRect ); web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); - reshape( mRect.getWidth(), mRect.getHeight(), 1 ); + reshape( getRect().getWidth(), getRect().getHeight(), 1 ); // kick off a request to grab the url manually gResponsePtr = LLIamHereLogin::build( this ); std::string login_page = LLAppViewer::instance()->getLoginPage(); if (login_page.empty()) { - login_page = childGetValue( "real_url" ).asString(); + login_page = getString( "real_url" ); } LLHTTPClient::head( login_page, gResponsePtr ); }; @@ -482,7 +482,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, void LLPanelLogin::setSiteIsAlive( bool alive ) { - LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "login_html"); + LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); // if the contents of the site was retrieved if ( alive ) { @@ -555,16 +555,16 @@ void LLPanelLogin::draw() glPushMatrix(); { F32 image_aspect = 1.333333f; - F32 view_aspect = (F32)mRect.getWidth() / (F32)mRect.getHeight(); + F32 view_aspect = (F32)getRect().getWidth() / (F32)getRect().getHeight(); // stretch image to maintain aspect ratio if (image_aspect > view_aspect) { - glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * mRect.getWidth(), 0.f, 0.f); + glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f); glScalef(image_aspect / view_aspect, 1.f, 1.f); } - S32 width = mRect.getWidth(); - S32 height = mRect.getHeight(); + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); if ( mHtmlAvailable ) { @@ -905,7 +905,7 @@ void LLPanelLogin::setAlwaysRefresh(bool refresh) { if (LLStartUp::getStartupState() >= STATE_LOGIN_CLEANUP) return; - LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html"); + LLWebBrowserCtrl* web_browser = sInstance->getChild<LLWebBrowserCtrl>("login_html"); if (web_browser) { @@ -924,7 +924,7 @@ void LLPanelLogin::loadLoginPage() std::string login_page = LLAppViewer::instance()->getLoginPage(); if (login_page.empty()) { - login_page = sInstance->childGetValue( "real_url" ).asString(); + login_page = sInstance->getString( "real_url" ); } oStr << login_page; @@ -1036,7 +1036,7 @@ void LLPanelLogin::loadLoginPage() #endif #endif - LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html"); + LLWebBrowserCtrl* web_browser = sInstance->getChild<LLWebBrowserCtrl>("login_html"); // navigate to the "real" page web_browser->navigateTo( oStr.str() ); @@ -1044,7 +1044,7 @@ void LLPanelLogin::loadLoginPage() void LLPanelLogin::onNavigateComplete( const EventType& eventIn ) { - LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html"); + LLWebBrowserCtrl* web_browser = sInstance->getChild<LLWebBrowserCtrl>("login_html"); if (web_browser) { // *HACK HACK HACK HACK! @@ -1157,7 +1157,7 @@ void LLPanelLogin::onClickForgotPassword(void*) { if (sInstance ) { - LLWeb::loadURL(sInstance->childGetValue( "forgot_password_url" ).asString()); + LLWeb::loadURL(sInstance->getString( "forgot_password_url" )); } } diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index a57993820f..f717088de6 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -259,7 +259,7 @@ BOOL LLPanelObject::postBuild() mSpinRevolutions->setValidateBeforeCommit( &precommitValidate ); // Sculpt - mCtrlSculptTexture = LLUICtrlFactory::getTexturePickerByName(this,"sculpt texture control"); + mCtrlSculptTexture = getChild<LLTextureCtrl>("sculpt texture control"); if (mCtrlSculptTexture) { mCtrlSculptTexture->setDefaultImageAssetID(LLUUID(SCULPT_DEFAULT_TEXTURE)); @@ -1903,7 +1903,7 @@ void LLPanelObject::onSelectSculpt(LLUICtrl* ctrl, void* userdata) { LLPanelObject* self = (LLPanelObject*) userdata; - LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(self, "sculpt texture control"); + LLTextureCtrl* mTextureCtrl = self->getChild<LLTextureCtrl>("sculpt texture control"); if (mTextureCtrl) { @@ -1926,7 +1926,7 @@ BOOL LLPanelObject::onDropSculpt(LLUICtrl*, LLInventoryItem* item, void* userdat { LLPanelObject* self = (LLPanelObject*) userdata; - LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(self, "sculpt texture control"); + LLTextureCtrl* mTextureCtrl = self->getChild<LLTextureCtrl>("sculpt texture control"); if (mTextureCtrl) { @@ -1945,7 +1945,7 @@ void LLPanelObject::onCancelSculpt(LLUICtrl* ctrl, void* userdata) { LLPanelObject* self = (LLPanelObject*) userdata; - LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(self,"sculpt texture control"); + LLTextureCtrl* mTextureCtrl = self->getChild<LLTextureCtrl>("sculpt texture control"); if(!mTextureCtrl) return; diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 7beba92ebb..8ab31acb49 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -138,11 +138,11 @@ void LLPanelPermissions::refresh() LLString deedText; if (gSavedSettings.getWarning("DeedObject")) { - deedText = this->childGetText("text deed continued"); + deedText = getString("text deed continued"); } else { - deedText = this->childGetText("text deed"); + deedText = getString("text deed"); } BtnDeedToGroup->setLabelSelected(deedText); BtnDeedToGroup->setLabelUnselected(deedText); @@ -261,10 +261,10 @@ void LLPanelPermissions::refresh() S32 string_index = 0; LLString MODIFY_INFO_STRINGS[] = { - childGetText("text modify info 1"), - childGetText("text modify info 2"), - childGetText("text modify info 3"), - childGetText("text modify info 4") + getString("text modify info 1"), + getString("text modify info 2"), + getString("text modify info 3"), + getString("text modify info 4") }; if(!is_perm_modify) { @@ -572,7 +572,7 @@ void LLPanelPermissions::refresh() if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) { // ...must select root to choose permissions - childSetValue("perm_modify", childGetText("text modify warning")); + childSetValue("perm_modify", getString("text modify warning")); } if (has_change_perm_ability) diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index cd251314d3..2a85d52689 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -134,7 +134,7 @@ BOOL LLPanelPick::postBuild() mDescEditor->setCommitOnFocusLost(TRUE); mDescEditor->setCommitCallback(onCommitAny); mDescEditor->setCallbackUserData(this); - mDescEditor->setTabToNextField(TRUE); + mDescEditor->setTabsToNextField(TRUE); mLocationEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "location_editor"); @@ -507,7 +507,7 @@ void LLPanelPick::onCommitAny(LLUICtrl* ctrl, void* data) } else {*/ - LLTabContainerVertical* tab = (LLTabContainerVertical*)self->getParent(); + LLTabContainer* tab = (LLTabContainer*)self->getParent(); if (tab) { if(tab) tab->setCurrentTabName(self->mNameEditor->getText()); diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp index a05f7129ae..aa10dda62c 100644 --- a/indra/newview/llpanelplace.cpp +++ b/indra/newview/llpanelplace.cpp @@ -190,11 +190,11 @@ void LLPanelPlace::setErrorStatus(U32 status, const std::string& reason) LLString error_text; if(status == 404) { - error_text = childGetText("server_error_text"); + error_text = getString("server_error_text"); } else if(status == 499) { - error_text = childGetText("server_forbidden_text"); + error_text = getString("server_forbidden_text"); } mDescEditor->setText(error_text); } @@ -260,13 +260,13 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) std::string desc_str(desc); if( !name_str.empty() - && self->mNameEditor->getText().empty()) + && self->mNameEditor && self->mNameEditor->getText().empty()) { self->mNameEditor->setText(name_str); } if( !desc_str.empty() - && self->mDescEditor->getText().empty()) + && self->mDescEditor && self->mDescEditor->getText().empty()) { self->mDescEditor->setText(desc_str); } @@ -290,8 +290,10 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) auction.setArg("[ID]", llformat("%010d ", auction_id)); info_text += auction; } - self->mInfoEditor->setText(info_text); - + if (self->mInfoEditor) + { + self->mInfoEditor->setText(info_text); + } // HACK: Flag 0x1 == mature region, otherwise assume PG const char* rating = LLViewerRegion::accessToString(SIM_ACCESS_PG); @@ -320,7 +322,10 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) LLString location = llformat("%s %d, %d, %d (%s)", sim_name, region_x, region_y, region_z, rating); - self->mLocationEditor->setText(location); + if (self->mLocationEditor) + { + self->mLocationEditor->setText(location); + } BOOL show_auction = (auction_id > 0); self->mAuctionBtn->setVisible(show_auction); @@ -354,7 +359,7 @@ void LLPanelPlace::displayParcelInfo(const LLVector3& pos_region, } else { - mDescEditor->setText(childGetText("server_update_text")); + mDescEditor->setText(getString("server_update_text")); } mSnapshotCtrl->setImageAssetID(LLUUID::null); } diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index e7b5e79377..83a2a5e0bd 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -104,7 +104,7 @@ BOOL LLPanelVolume::postBuild() // LIGHT Parameters { childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this); - LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(this,"colorswatch"); + LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch){ LightColorSwatch->setOnCancelCallback(onLightCancelColor); LightColorSwatch->setOnSelectCallback(onLightSelectColor); @@ -213,7 +213,7 @@ void LLPanelVolume::getState( ) { childSetEnabled("label color",true); //mLabelColor ->setEnabled( TRUE ); - LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(this,"colorswatch"); + LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setEnabled( TRUE ); @@ -233,7 +233,7 @@ void LLPanelVolume::getState( ) else { childSetEnabled("label color",false); - LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(this,"colorswatch"); + LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setEnabled( FALSE ); @@ -342,7 +342,7 @@ void LLPanelVolume::clearCtrls() childSetEnabled("Light Checkbox Ctrl",false); childSetEnabled("label color",false); childSetEnabled("label color",false); - LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(this,"colorswatch"); + LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setEnabled( FALSE ); @@ -416,7 +416,7 @@ void LLPanelVolume::sendIsFlexible() void LLPanelVolume::onLightCancelColor(LLUICtrl* ctrl, void* userdata) { LLPanelVolume* self = (LLPanelVolume*) userdata; - LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(self,"colorswatch"); + LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setColor(self->mLightSavedColor); @@ -435,7 +435,7 @@ void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata) LLVOVolume *volobjp = (LLVOVolume *)objectp; - LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(self,"colorswatch"); + LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LLColor4 clr = LightColorSwatch->get(); @@ -460,7 +460,7 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) volobjp->setLightIntensity((F32)self->childGetValue("Light Intensity").asReal()); volobjp->setLightRadius((F32)self->childGetValue("Light Radius").asReal()); volobjp->setLightFalloff((F32)self->childGetValue("Light Falloff").asReal()); - LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(self,"colorswatch"); + LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LLColor4 clr = LightColorSwatch->get(); diff --git a/indra/newview/llparcelselection.cpp b/indra/newview/llparcelselection.cpp index 5478a96b97..e49ae57bcf 100644 --- a/indra/newview/llparcelselection.cpp +++ b/indra/newview/llparcelselection.cpp @@ -17,9 +17,8 @@ LLPointer<LLParcelSelection> LLParcelSelection::sNullSelection; template<> - const LLHandle<LLParcelSelection>::NullFunc - LLHandle<LLParcelSelection>::sNullFunc = - LLParcelSelection::getNullParcelSelection; + const LLSafeHandle<LLParcelSelection>::NullFunc + LLSafeHandle<LLParcelSelection>::sNullFunc = LLParcelSelection::getNullParcelSelection; // // LLParcelSelection diff --git a/indra/newview/llparcelselection.h b/indra/newview/llparcelselection.h index 579a0f2549..e6729646c7 100644 --- a/indra/newview/llparcelselection.h +++ b/indra/newview/llparcelselection.h @@ -58,6 +58,6 @@ private: static LLPointer<LLParcelSelection> sNullSelection; }; -typedef LLHandle<LLParcelSelection> LLParcelSelectionHandle; +typedef LLSafeHandle<LLParcelSelection> LLParcelSelectionHandle; #endif diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index b0d7aa6d1b..cad38e36ff 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -56,7 +56,7 @@ // Globals and statics LLPreview::preview_multimap_t LLPreview::sPreviewsBySource; LLPreview::preview_map_t LLPreview::sInstances; -std::map<LLUUID, LLViewHandle> LLMultiPreview::sAutoOpenPreviewHandles; +std::map<LLUUID, LLHandle<LLFloater> > LLMultiPreview::sAutoOpenPreviewHandles; // Functions LLPreview::LLPreview(const std::string& name) : @@ -72,7 +72,7 @@ LLPreview::LLPreview(const std::string& name) : // don't add to instance list, since ItemID is null mAuxItem = new LLInventoryItem; // (LLPointer is auto-deleted) // don't necessarily steal focus on creation -- sometimes these guys pop up without user action - mAutoFocus = FALSE; + setAutoFocus(FALSE); gInventory.addObserver(this); } @@ -91,7 +91,7 @@ LLPreview::LLPreview(const std::string& name, const LLRect& rect, const std::str { mAuxItem = new LLInventoryItem; // don't necessarily steal focus on creation -- sometimes these guys pop up without user action - mAutoFocus = FALSE; + setAutoFocus(FALSE); if (mItemUUID.notNull()) { @@ -114,7 +114,7 @@ LLPreview::~LLPreview() preview_multimap_t::iterator found_it = sPreviewsBySource.find(mSourceID); for (; found_it != sPreviewsBySource.end(); ++found_it) { - if (found_it->second == mViewHandle) + if (found_it->second == getHandle()) { sPreviewsBySource.erase(found_it); break; @@ -152,7 +152,7 @@ void LLPreview::setSourceID(const LLUUID& source_id) preview_multimap_t::iterator found_it = sPreviewsBySource.find(mSourceID); for (; found_it != sPreviewsBySource.end(); ++found_it) { - if (found_it->second == mViewHandle) + if (found_it->second == getHandle()) { sPreviewsBySource.erase(found_it); break; @@ -160,7 +160,7 @@ void LLPreview::setSourceID(const LLUUID& source_id) } } mSourceID = source_id; - sPreviewsBySource.insert(preview_multimap_t::value_type(mSourceID, mViewHandle)); + sPreviewsBySource.insert(preview_multimap_t::value_type(mSourceID, getHandle())); } const LLViewerInventoryItem *LLPreview::getItem() const @@ -427,8 +427,7 @@ BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask) void LLPreview::open() /*Flawfinder: ignore*/ { - LLMultiFloater* hostp = getHost(); - if (!sHostp && !hostp && getAssetStatus() == PREVIEW_ASSET_UNLOADED) + if (!getFloaterHost() && !getHost() && getAssetStatus() == PREVIEW_ASSET_UNLOADED) { loadAsset(); } @@ -524,14 +523,14 @@ LLPreview* LLPreview::getFirstPreviewForSource(const LLUUID& source_id) if (found_it != sPreviewsBySource.end()) { // just return first one - return (LLPreview*)LLFloater::getFloaterByHandle(found_it->second); + return (LLPreview*)found_it->second.get(); } return NULL; } void LLPreview::userSetShape(const LLRect& new_rect) { - if(new_rect.getWidth() != mRect.getWidth() || new_rect.getHeight() != mRect.getHeight()) + if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()) { userResized(); } @@ -560,7 +559,7 @@ void LLMultiPreview::open() /*Flawfinder: ignore*/ void LLMultiPreview::userSetShape(const LLRect& new_rect) { - if(new_rect.getWidth() != mRect.getWidth() || new_rect.getHeight() != mRect.getHeight()) + if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()) { LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel(); if (frontmost_preview) frontmost_preview->userResized(); @@ -584,7 +583,7 @@ LLMultiPreview* LLMultiPreview::getAutoOpenInstance(const LLUUID& id) handle_map_t::iterator found_it = sAutoOpenPreviewHandles.find(id); if (found_it != sAutoOpenPreviewHandles.end()) { - return (LLMultiPreview*)gFloaterView->getFloaterByHandle(found_it->second); + return (LLMultiPreview*)found_it->second.get(); } return NULL; } diff --git a/indra/newview/llpreview.h b/indra/newview/llpreview.h index 97cd2d5b07..5f129b99d4 100644 --- a/indra/newview/llpreview.h +++ b/indra/newview/llpreview.h @@ -58,10 +58,12 @@ public: static void setAutoOpenInstance(LLMultiPreview* previewp, const LLUUID& id); protected: - typedef std::map<LLUUID, LLViewHandle> handle_map_t; - static std::map<LLUUID, LLViewHandle> sAutoOpenPreviewHandles; + typedef std::map<LLUUID, LLHandle<LLFloater> > handle_map_t; + static handle_map_t sAutoOpenPreviewHandles; }; +// https://wiki.lindenlab.com/mediawiki/index.php?title=LLPreview&oldid=81373 + class LLPreview : public LLFloater, LLInventoryObserver { public: @@ -160,7 +162,7 @@ protected: EAssetStatus mAssetStatus; typedef std::map<LLUUID, LLPreview*> preview_map_t; - typedef std::multimap<LLUUID, LLViewHandle> preview_multimap_t; + typedef std::multimap<LLUUID, LLHandle<LLFloater> > preview_multimap_t; static preview_multimap_t sPreviewsBySource; static preview_map_t sInstances; diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index f6d5d9d9b7..ba96ba088b 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -96,8 +96,8 @@ LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const // static void LLPreviewAnim::endAnimCallback( void *userdata ) { - LLViewHandle* handlep = ((LLViewHandle*)userdata); - LLFloater* self = getFloaterByHandle(*handlep); + LLHandle<LLFloater>* handlep = ((LLHandle<LLFloater>*)userdata); + LLFloater* self = handlep->get(); delete handlep; // done with the handle if (self) { @@ -132,7 +132,7 @@ void LLPreviewAnim::playAnim( void *userdata ) if (motion) { - motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLViewHandle(self->getHandle()))); + motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle()))); } } else @@ -169,7 +169,7 @@ void LLPreviewAnim::auditionAnim( void *userdata ) if (motion) { - motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLViewHandle(self->getHandle()))); + motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle()))); } } else diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 61bda9dfc0..ba2925d45a 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -585,7 +585,7 @@ void LLPreviewGesture::addAnimations() combo->removeall(); - LLString none_text = childGetText("none_text"); + LLString none_text = getString("none_text"); combo->add(none_text, LLUUID::null); @@ -640,7 +640,7 @@ void LLPreviewGesture::addSounds() LLComboBox* combo = mSoundCombo; combo->removeall(); - LLString none_text = childGetText("none_text"); + LLString none_text = getString("none_text"); combo->add(none_text, LLUUID::null); @@ -789,7 +789,7 @@ void LLPreviewGesture::refresh() case STEP_ANIMATION: { LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step; - optionstext = childGetText("step_anim"); + optionstext = getString("step_anim"); mAnimationCombo->setVisible(TRUE); mAnimationRadio->setVisible(TRUE); mAnimationRadio->setSelectedIndex((anim_step->mFlags & ANIM_FLAG_STOP) ? 1 : 0); @@ -799,7 +799,7 @@ void LLPreviewGesture::refresh() case STEP_SOUND: { LLGestureStepSound* sound_step = (LLGestureStepSound*)step; - optionstext = childGetText("step_sound"); + optionstext = getString("step_sound"); mSoundCombo->setVisible(TRUE); mSoundCombo->setCurrentByID(sound_step->mSoundAssetID); break; @@ -807,7 +807,7 @@ void LLPreviewGesture::refresh() case STEP_CHAT: { LLGestureStepChat* chat_step = (LLGestureStepChat*)step; - optionstext = childGetText("step_chat"); + optionstext = getString("step_chat"); mChatEditor->setVisible(TRUE); mChatEditor->setText(chat_step->mChatText); break; @@ -815,7 +815,7 @@ void LLPreviewGesture::refresh() case STEP_WAIT: { LLGestureStepWait* wait_step = (LLGestureStepWait*)step; - optionstext = childGetText("step_wait"); + optionstext = getString("step_wait"); mWaitAnimCheck->setVisible(TRUE); mWaitAnimCheck->set(wait_step->mFlags & WAIT_FLAG_ALL_ANIM); mWaitTimeCheck->setVisible(TRUE); @@ -1753,7 +1753,7 @@ void LLPreviewGesture::onClickPreview(void* data) self->mPreviewGesture->mCallbackData = self; // set the button title - self->mPreviewBtn->setLabel(self->childGetText("stop_txt")); + self->mPreviewBtn->setLabel(self->getString("stop_txt")); // play it, and delete when done gGestureManager.playGesture(self->mPreviewGesture); @@ -1775,7 +1775,7 @@ void LLPreviewGesture::onDonePreview(LLMultiGesture* gesture, void* data) { LLPreviewGesture* self = (LLPreviewGesture*)data; - self->mPreviewBtn->setLabel(self->childGetText("preview_txt")); + self->mPreviewBtn->setLabel(self->getString("preview_txt")); delete self->mPreviewGesture; self->mPreviewGesture = NULL; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index eef8c0d636..37d0ba8303 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -307,7 +307,7 @@ void LLPreviewNotecard::loadAsset() // The object that we're trying to look at disappeared, bail. llwarns << "Can't find object " << mObjectUUID << " associated with notecard." << llendl; mAssetID.setNull(); - editor->setText(childGetText("no_object")); + editor->setText(getString("no_object")); editor->makePristine(); editor->setEnabled(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; @@ -332,7 +332,7 @@ void LLPreviewNotecard::loadAsset() else { mAssetID.setNull(); - editor->setText(childGetText("not_allowed")); + editor->setText(getString("not_allowed")); editor->makePristine(); editor->setEnabled(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; @@ -654,7 +654,7 @@ void LLPreviewNotecard::reshape(S32 width, S32 height, BOOL called_from_parent) { // So that next time you open a script it will have the same height and width // (although not the same position). - gSavedSettings.setRect("NotecardEditorRect", mRect); + gSavedSettings.setRect("NotecardEditorRect", getRect()); } } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index d3afd65cbe..dd49262cb2 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -288,7 +288,7 @@ LLScriptEdCore::LLScriptEdCore( const LLRect& rect, const std::string& sample, const std::string& help, - const LLViewHandle& floater_handle, + const LLHandle<LLFloater>& floater_handle, void (*load_callback)(void*), void (*save_callback)(void*, BOOL), void (*search_replace_callback) (void* userdata), @@ -343,19 +343,19 @@ LLScriptEdCore::LLScriptEdCore( LLKeywordToken *token; - LLKeywords::word_token_map_t::iterator token_it; - for (token_it = mEditor->mKeywords.mWordTokenMap.begin(); token_it != mEditor->mKeywords.mWordTokenMap.end(); ++token_it) + LLKeywords::keyword_iterator_t token_it; + for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) { token = token_it->second; - if (token->mColor == color) - mFunctions->add(wstring_to_utf8str(token->mToken)); + if (token->getColor() == color) + mFunctions->add(wstring_to_utf8str(token->getToken())); } - for (token_it = mEditor->mKeywords.mWordTokenMap.begin(); token_it != mEditor->mKeywords.mWordTokenMap.end(); ++token_it) + for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) { token = token_it->second; - if (token->mColor != color) - mFunctions->add(wstring_to_utf8str(token->mToken)); + if (token->getColor() != color) + mFunctions->add(wstring_to_utf8str(token->getToken())); } @@ -365,7 +365,7 @@ LLScriptEdCore::LLScriptEdCore( initMenu(); // Do the work that addTabPanel() normally does. - //LLRect tab_panel_rect( 0, mRect.getHeight(), mRect.getWidth(), 0 ); + //LLRect tab_panel_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); //tab_panel_rect.stretch( -LLPANEL_BORDER_WIDTH ); //mCodePanel->setFollowsAll(); //mCodePanel->translate( tab_panel_rect.mLeft - mCodePanel->getRect().mLeft, tab_panel_rect.mBottom - mCodePanel->getRect().mBottom); @@ -468,13 +468,13 @@ void LLScriptEdCore::draw() void LLScriptEdCore::updateDynamicHelp(BOOL immediate) { - LLFloater* help_floater = LLFloater::getFloaterByHandle(mLiveHelpHandle); + LLFloater* help_floater = mLiveHelpHandle.get(); if (!help_floater) return; // update back and forward buttons LLButton* fwd_button = LLUICtrlFactory::getButtonByName(help_floater, "fwd_btn"); LLButton* back_button = LLUICtrlFactory::getButtonByName(help_floater, "back_btn"); - LLWebBrowserCtrl* browser = LLUICtrlFactory::getWebBrowserCtrlByName(help_floater, "lsl_guide_html"); + LLWebBrowserCtrl* browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); back_button->setEnabled(browser->canNavigateBack()); fwd_button->setEnabled(browser->canNavigateForward()); @@ -483,12 +483,12 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate) return; } - LLTextSegment* segment = NULL; - std::vector<LLTextSegment*> selected_segments; + const LLTextSegment* segment = NULL; + std::vector<const LLTextSegment*> selected_segments; mEditor->getSelectedSegments(selected_segments); // try segments in selection range first - std::vector<LLTextSegment*>::iterator segment_iter; + std::vector<const LLTextSegment*>::iterator segment_iter; for (segment_iter = selected_segments.begin(); segment_iter != selected_segments.end(); ++segment_iter) { if((*segment_iter)->getToken() && (*segment_iter)->getToken()->getType() == LLKeywordToken::WORD) @@ -501,7 +501,7 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate) // then try previous segment in case we just typed it if (!segment) { - LLTextSegment* test_segment = mEditor->getPreviousSegment(); + const LLTextSegment* test_segment = mEditor->getPreviousSegment(); if(test_segment->getToken() && test_segment->getToken()->getType() == LLKeywordToken::WORD) { segment = test_segment; @@ -530,10 +530,10 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate) void LLScriptEdCore::setHelpPage(const LLString& help_string) { - LLFloater* help_floater = LLFloater::getFloaterByHandle(mLiveHelpHandle); + LLFloater* help_floater = mLiveHelpHandle.get(); if (!help_floater) return; - LLWebBrowserCtrl* web_browser = gUICtrlFactory->getWebBrowserCtrlByName(help_floater, "lsl_guide_html"); + LLWebBrowserCtrl* web_browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); if (!web_browser) return; LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo"); @@ -553,7 +553,7 @@ void LLScriptEdCore::addHelpItemToHistory(const LLString& help_string) { if (help_string.empty()) return; - LLFloater* help_floater = LLFloater::getFloaterByHandle(mLiveHelpHandle); + LLFloater* help_floater = mLiveHelpHandle.get(); if (!help_floater) return; LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo"); @@ -660,7 +660,7 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) { LLScriptEdCore* corep = (LLScriptEdCore*)userdata; - LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle); + LLFloater* live_help_floater = corep->mLiveHelpHandle.get(); if (live_help_floater) { live_help_floater->setFocus(TRUE); @@ -678,18 +678,18 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) live_help_floater->childSetAction("back_btn", onClickBack, userdata); live_help_floater->childSetAction("fwd_btn", onClickForward, userdata); - LLWebBrowserCtrl* browser = LLUICtrlFactory::getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html"); + LLWebBrowserCtrl* browser = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); browser->setAlwaysRefresh(TRUE); LLComboBox* help_combo = LLUICtrlFactory::getComboBoxByName(live_help_floater, "history_combo"); LLKeywordToken *token; - LLKeywords::word_token_map_t::iterator token_it; - for (token_it = corep->mEditor->mKeywords.mWordTokenMap.begin(); - token_it != corep->mEditor->mKeywords.mWordTokenMap.end(); + LLKeywords::keyword_iterator_t token_it; + for (token_it = corep->mEditor->keywordsBegin(); + token_it != corep->mEditor->keywordsEnd(); ++token_it) { token = token_it->second; - help_combo->add(wstring_to_utf8str(token->mToken)); + help_combo->add(wstring_to_utf8str(token->getToken())); } help_combo->sortByName(); @@ -704,10 +704,10 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) void LLScriptEdCore::onClickBack(void* userdata) { LLScriptEdCore* corep = (LLScriptEdCore*)userdata; - LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle); + LLFloater* live_help_floater = corep->mLiveHelpHandle.get(); if (live_help_floater) { - LLWebBrowserCtrl* browserp = LLUICtrlFactory::getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html"); + LLWebBrowserCtrl* browserp = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); if (browserp) { browserp->navigateBack(); @@ -719,10 +719,10 @@ void LLScriptEdCore::onClickBack(void* userdata) void LLScriptEdCore::onClickForward(void* userdata) { LLScriptEdCore* corep = (LLScriptEdCore*)userdata; - LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle); + LLFloater* live_help_floater = corep->mLiveHelpHandle.get(); if (live_help_floater) { - LLWebBrowserCtrl* browserp = LLUICtrlFactory::getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html"); + LLWebBrowserCtrl* browserp = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); if (browserp) { browserp->navigateForward(); @@ -757,14 +757,14 @@ void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata) { LLScriptEdCore* corep = (LLScriptEdCore*)userdata; - LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle); + LLFloater* live_help_floater = corep->mLiveHelpHandle.get(); if (live_help_floater) { LLString help_string = ctrl->getValue().asString(); corep->addHelpItemToHistory(help_string); - LLWebBrowserCtrl* web_browser = gUICtrlFactory->getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html"); + LLWebBrowserCtrl* web_browser = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); url_string.setArg("[APP_DIRECTORY]", gDirUtilp->getWorkingDir()); url_string.setArg("[LSL_STRING]", help_string); @@ -971,7 +971,7 @@ void LLScriptEdCore::handleReloadFromServerDialog( S32 option, void* userdata ) case 0: // "Yes" if( self->mLoadCallback ) { - self->mEditor->setText( self->childGetText("loading") ); + self->mEditor->setText( self->getString("loading") ); self->mLoadCallback( self->mUserdata ); } break; @@ -1071,7 +1071,7 @@ void* LLPreviewLSL::createScriptEdPanel(void* userdata) LLRect(), HELLO_LSL, HELP_LSL, - self->mViewHandle, + self->getHandle(), LLPreviewLSL::onLoad, LLPreviewLSL::onSave, LLPreviewLSL::onSearchReplace, @@ -1104,9 +1104,7 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect, childSetText("desc", item->getDescription()); childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); - LLMultiFloater* hostp = getHost(); - - if (!sHostp && !hostp && getAssetStatus() == PREVIEW_ASSET_UNLOADED) + if (!getFloaterHost() && !getHost() && getAssetStatus() == PREVIEW_ASSET_UNLOADED) { loadAsset(); } @@ -1185,7 +1183,7 @@ void LLPreviewLSL::loadAsset() } else { - mScriptEd->mEditor->setText(mScriptEd->childGetText("can_not_view")); + mScriptEd->mEditor->setText(mScriptEd->getString("can_not_view")); mScriptEd->mEditor->makePristine(); mScriptEd->mEditor->setEnabled(FALSE); mScriptEd->mFunctions->setEnabled(FALSE); @@ -1565,7 +1563,7 @@ void LLPreviewLSL::reshape(S32 width, S32 height, BOOL called_from_parent) { // So that next time you open a script it will have the same height and width // (although not the same position). - gSavedSettings.setRect("PreviewScriptRect", mRect); + gSavedSettings.setRect("PreviewScriptRect", getRect()); } } @@ -1587,7 +1585,7 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) LLRect(), HELLO_LSL, HELP_LSL, - self->mViewHandle, + self->getHandle(), &LLLiveLSLEditor::onLoad, &LLLiveLSLEditor::onSave, &LLLiveLSLEditor::onSearchReplace, @@ -1717,7 +1715,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) || !gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)))) { mItem = new LLViewerInventoryItem(item); - mScriptEd->mEditor->setText(childGetText("not_allowed")); + mScriptEd->mEditor->setText(getString("not_allowed")); mScriptEd->mEditor->makePristine(); mScriptEd->mEditor->setEnabled(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; @@ -1971,12 +1969,12 @@ void LLLiveLSLEditor::draw() { if(object->permAnyOwner()) { - runningCheckbox->setLabel(childGetText("script_running")); + runningCheckbox->setLabel(getString("script_running")); runningCheckbox->setEnabled(TRUE); } else { - runningCheckbox->setLabel(childGetText("public_objects_can_not_run")); + runningCheckbox->setLabel(getString("public_objects_can_not_run")); runningCheckbox->setEnabled(FALSE); // *FIX: Set it to false so that the ui is correct for // a box that is released to public. It could be @@ -2224,7 +2222,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, // If we successfully saved it, then we should be able to check/uncheck the running box! LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(this, "running"); - runningCheckbox->setLabel(childGetText("script_running")); + runningCheckbox->setLabel(getString("script_running")); runningCheckbox->setEnabled(TRUE); } @@ -2404,6 +2402,6 @@ void LLLiveLSLEditor::reshape(S32 width, S32 height, BOOL called_from_parent) { // So that next time you open a script it will have the same height and width // (although not the same position). - gSavedSettings.setRect("PreviewScriptRect", mRect); + gSavedSettings.setRect("PreviewScriptRect", getRect()); } } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index a9b36f3978..55b006908f 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -67,7 +67,7 @@ public: const LLRect& rect, const std::string& sample, const std::string& help, - const LLViewHandle& floater_handle, + const LLHandle<LLFloater>& floater_handle, void (*load_callback)(void* userdata), void (*save_callback)(void* userdata, BOOL close_after_save), void (*search_replace_callback)(void* userdata), @@ -144,7 +144,7 @@ private: LLPanel* mCodePanel; LLScrollListCtrl* mErrorList; LLDynamicArray<LLEntryAndEdCore*> mBridges; - LLViewHandle mLiveHelpHandle; + LLHandle<LLFloater> mLiveHelpHandle; LLKeywordToken* mLastHelpToken; LLFrameTimer mLiveHelpTimer; S32 mLiveHelpHistorySize; diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 78d066f85f..20737eb7f1 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -199,7 +199,7 @@ void LLPreviewTexture::draw() LLPreview::draw(); - if (!mMinimized) + if (!isMinimized()) { LLGLSUIDefault gls_ui; LLGLSNoTexture gls_notex; @@ -255,7 +255,7 @@ void LLPreviewTexture::draw() const S32 BAR_HEIGHT = 12; const S32 BAR_LEFT_PAD = 80; S32 left = interior.mLeft + 4 + BAR_LEFT_PAD; - S32 bar_width = mRect.getWidth() - left - RESIZE_HANDLE_WIDTH - 2; + 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; @@ -434,8 +434,8 @@ void LLPreviewTexture::updateAspectRatio() mLastWidth = client_width; mLastHeight = client_height; - S32 old_top = mRect.mTop; - S32 old_left = mRect.mLeft; + S32 old_top = getRect().mTop; + S32 old_left = getRect().mLeft; if (getHost()) { getHost()->growToFit(view_width, view_height); @@ -443,7 +443,7 @@ void LLPreviewTexture::updateAspectRatio() else { reshape( view_width, view_height ); - S32 new_bottom = old_top - mRect.getHeight(); + S32 new_bottom = old_top - getRect().getHeight(); setOrigin( old_left, new_bottom ); // Try to keep whole view onscreen, don't allow partial offscreen. gFloaterView->adjustToFitScreen(this, FALSE); @@ -454,20 +454,20 @@ void LLPreviewTexture::updateAspectRatio() if (!mUserResized) { // clamp texture size to fit within actual size of floater after attempting resize - client_width = llmin(client_width, mRect.getWidth() - horiz_pad); - client_height = llmin(client_height, mRect.getHeight() - PREVIEW_HEADER_SIZE + client_width = llmin(client_width, getRect().getWidth() - horiz_pad); + client_height = llmin(client_height, getRect().getHeight() - PREVIEW_HEADER_SIZE - (2 * CLIENT_RECT_VPAD) - LLPANEL_BORDER_WIDTH - info_height); } else { - client_width = mRect.getWidth() - horiz_pad; + client_width = getRect().getWidth() - horiz_pad; client_height = llround(client_width * inv_aspect_ratio); } - S32 max_height = mRect.getHeight() - PREVIEW_BORDER - button_height + S32 max_height = getRect().getHeight() - PREVIEW_BORDER - button_height - CLIENT_RECT_VPAD - info_height - CLIENT_RECT_VPAD - PREVIEW_HEADER_SIZE; max_height = llmax(max_height, 1); @@ -478,7 +478,7 @@ void LLPreviewTexture::updateAspectRatio() client_width = llround(client_height * aspect_ratio); } - LLRect window_rect(0, mRect.getHeight(), mRect.getWidth(), 0); + LLRect window_rect(0, getRect().getHeight(), getRect().getWidth(), 0); window_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD); window_rect.mBottom += PREVIEW_BORDER + button_height + CLIENT_RECT_VPAD + info_height + CLIENT_RECT_VPAD; diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index cc9c3fa503..9e437df2d1 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -74,7 +74,7 @@ LLProgressView::LLProgressView(const std::string& name, const LLRect &rect) const S32 CANCEL_BTN_OFFSET = 16; LLRect r; r.setOriginAndSize( - mRect.getWidth() - CANCEL_BTN_OFFSET - CANCEL_BTN_WIDTH, CANCEL_BTN_OFFSET, + getRect().getWidth() - CANCEL_BTN_OFFSET - CANCEL_BTN_WIDTH, CANCEL_BTN_OFFSET, CANCEL_BTN_WIDTH, BTN_HEIGHT ); mCancelBtn = new LLButton( @@ -162,7 +162,7 @@ void LLProgressView::draw() // Make sure the progress view always fills the entire window. S32 width = gViewerWindow->getWindowWidth(); S32 height = gViewerWindow->getWindowHeight(); - if( (width != mRect.getWidth()) || (height != mRect.getHeight()) ) + if( (width != getRect().getWidth()) || (height != getRect().getHeight()) ) { reshape( width, height ); } @@ -189,14 +189,14 @@ void LLProgressView::draw() glTranslatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f); glScalef(1.f, view_aspect / image_aspect, 1.f); } - gl_rect_2d_simple_tex( mRect.getWidth(), mRect.getHeight() ); + gl_rect_2d_simple_tex( getRect().getWidth(), getRect().getHeight() ); gStartImageGL->unbindTexture(0, GL_TEXTURE_2D); } else { LLGLSNoTexture gls_no_texture; glColor4f(0.f, 0.f, 0.f, 1.f); - gl_rect_2d(mRect); + gl_rect_2d(getRect()); } glPopMatrix(); } @@ -213,8 +213,8 @@ void LLProgressView::draw() return; } - S32 line_x = mRect.getWidth() / 2; - S32 line_one_y = mRect.getHeight() / 2 + 64; + S32 line_x = getRect().getWidth() / 2; + S32 line_one_y = getRect().getHeight() / 2 + 64; const S32 LINE_SPACING = 25; S32 line_two_y = line_one_y - LINE_SPACING; const LLFontGL* font = LLFontGL::sSansSerif; @@ -243,8 +243,8 @@ void LLProgressView::draw() S32 bar_bottom = line_two_y - 30; S32 bar_height = 18; - S32 bar_width = mRect.getWidth() * 2 / 3; - S32 bar_left = (mRect.getWidth() / 2) - (bar_width / 2); + S32 bar_width = getRect().getWidth() * 2 / 3; + S32 bar_left = (getRect().getWidth() / 2) - (bar_width / 2); gl_draw_scaled_image_with_border( bar_left + 2, diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp index c28623723f..d8bb7c1a61 100644 --- a/indra/newview/llremoteparcelrequest.cpp +++ b/indra/newview/llremoteparcelrequest.cpp @@ -44,7 +44,7 @@ #include "llview.h" #include "message.h" -LLRemoteParcelRequestResponder::LLRemoteParcelRequestResponder(LLViewHandle place_panel_handle) +LLRemoteParcelRequestResponder::LLRemoteParcelRequestResponder(LLHandle<LLPanel> place_panel_handle) { mPlacePanelHandle = place_panel_handle; } @@ -53,7 +53,7 @@ void LLRemoteParcelRequestResponder::result(const LLSD& content) { LLUUID parcel_id = content["parcel_id"]; - LLPanelPlace* place_panelp = (LLPanelPlace*)LLPanel::getPanelByHandle(mPlacePanelHandle); + LLPanelPlace* place_panelp = (LLPanelPlace*)mPlacePanelHandle.get(); if(place_panelp) { @@ -67,7 +67,7 @@ void LLRemoteParcelRequestResponder::error(U32 status, const std::string& reason { llinfos << "LLRemoteParcelRequest::error(" << status << ": " << reason << ")" << llendl; - LLPanelPlace* place_panelp = (LLPanelPlace*)LLPanel::getPanelByHandle(mPlacePanelHandle); + LLPanelPlace* place_panelp = (LLPanelPlace*)mPlacePanelHandle.get(); if(place_panelp) { diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h index 628994a744..8cbe3f74bf 100644 --- a/indra/newview/llremoteparcelrequest.h +++ b/indra/newview/llremoteparcelrequest.h @@ -35,19 +35,19 @@ #define LL_LLREMOTEPARCELREQUEST_H #include "llhttpclient.h" -#include "llview.h" +#include "llpanel.h" class LLRemoteParcelRequestResponder : public LLHTTPClient::Responder { public: - LLRemoteParcelRequestResponder(LLViewHandle place_panel_handle); + LLRemoteParcelRequestResponder(LLHandle<LLPanel> place_panel_handle); //If we get back a normal response, handle it here virtual void result(const LLSD& content); //If we get back an error (not found, etc...), handle it here virtual void error(U32 status, const std::string& reason); protected: - LLViewHandle mPlacePanelHandle; + LLHandle<LLPanel> mPlacePanelHandle; }; #endif // LL_LLREMOTEPARCELREQUEST_H diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 511fd73ef7..d80a9ee053 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -126,8 +126,8 @@ LLColor4 LLSelectMgr::sContextSilhouetteColor; static LLObjectSelection *get_null_object_selection(); template<> - const LLHandle<LLObjectSelection>::NullFunc - LLHandle<LLObjectSelection>::sNullFunc = get_null_object_selection; + const LLSafeHandle<LLObjectSelection>::NullFunc + LLSafeHandle<LLObjectSelection>::sNullFunc = get_null_object_selection; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // struct LLDeRezInfo @@ -2272,12 +2272,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, LLString& name) if (identical) { - char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - gCacheName->getName(first_id, firstname, lastname); - name.assign( firstname ); - name.append( " " ); - name.append( lastname ); + gCacheName->getFullName(first_id, name); } else { @@ -2340,12 +2335,7 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, LLString& name) } else if(!public_owner) { - char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - gCacheName->getName(first_id, firstname, lastname); - name.assign( firstname ); - name.append( " " ); - name.append( lastname ); + gCacheName->getFullName(first_id, name); } else { @@ -2405,12 +2395,7 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, LLString& name) BOOL public_owner = (first_id.isNull()); if(!public_owner) { - char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - gCacheName->getName(first_id, firstname, lastname); - name.assign( firstname ); - name.append( " " ); - name.append( lastname ); + gCacheName->getFullName(first_id, name); } else { @@ -4348,12 +4333,8 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use LLFloaterReporter *reporterp = LLFloaterReporter::getReporter(report_type); if (reporterp) { - char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - char last_name[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - gCacheName->getName(owner_id, first_name, last_name); - LLString fullname(first_name); - fullname.append(" "); - fullname.append(last_name); + std::string fullname; + gCacheName->getFullName(owner_id, fullname); reporterp->setPickedObjectProperties(name, fullname, owner_id); } } @@ -5476,9 +5457,9 @@ LLBBox LLSelectMgr::getBBoxOfSelection() const //----------------------------------------------------------------------------- // canUndo() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canUndo() +BOOL LLSelectMgr::canUndo() const { - return mSelectedObjects->getFirstEditableObject() != NULL; + return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstEditableObject() != NULL; // HACK: casting away constness - MG } //----------------------------------------------------------------------------- @@ -5494,9 +5475,9 @@ void LLSelectMgr::undo() //----------------------------------------------------------------------------- // canRedo() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canRedo() +BOOL LLSelectMgr::canRedo() const { - return mSelectedObjects->getFirstEditableObject() != NULL; + return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstEditableObject() != NULL; // HACK: casting away constness - MG } //----------------------------------------------------------------------------- @@ -5512,10 +5493,10 @@ void LLSelectMgr::redo() //----------------------------------------------------------------------------- // canDoDelete() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canDoDelete() +BOOL LLSelectMgr::canDoDelete() const { // Note: Can only delete root objects (see getFirstDeleteableObject() for more info) - return mSelectedObjects->getFirstDeleteableObject() != NULL; + return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstDeleteableObject() != NULL; // HACK: casting away constness - MG } //----------------------------------------------------------------------------- @@ -5529,7 +5510,7 @@ void LLSelectMgr::doDelete() //----------------------------------------------------------------------------- // canDeselect() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canDeselect() +BOOL LLSelectMgr::canDeselect() const { return !mSelectedObjects->isEmpty(); } @@ -5544,9 +5525,9 @@ void LLSelectMgr::deselect() //----------------------------------------------------------------------------- // canDuplicate() //----------------------------------------------------------------------------- -BOOL LLSelectMgr::canDuplicate() +BOOL LLSelectMgr::canDuplicate() const { - return mSelectedObjects->getFirstCopyableObject() != NULL; + return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstCopyableObject() != NULL; // HACK: casting away constness - MG } //----------------------------------------------------------------------------- // duplicate() @@ -5744,7 +5725,7 @@ LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp) //----------------------------------------------------------------------------- // isEmpty() //----------------------------------------------------------------------------- -BOOL LLObjectSelection::isEmpty() +BOOL LLObjectSelection::isEmpty() const { return (mList.size() == 0); } @@ -6135,3 +6116,4 @@ LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_parent) return getFirstSelectedObject(&func, get_parent); } + diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 071aa15236..32c7f7617e 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -272,7 +272,7 @@ public: void updateEffects(); void cleanupNodes(); - BOOL isEmpty(); + BOOL isEmpty() const; S32 getOwnershipCost(S32 &cost); @@ -331,7 +331,7 @@ private: ESelectType mSelectType; }; -typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle; +typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle; class LLSelectMgr : public LLEditMenuHandler { @@ -360,20 +360,20 @@ public: static void cleanupGlobals(); // LLEditMenuHandler interface - virtual BOOL canUndo(); + virtual BOOL canUndo() const; virtual void undo(); - virtual BOOL canRedo(); + virtual BOOL canRedo() const; virtual void redo(); - virtual BOOL canDoDelete(); + virtual BOOL canDoDelete() const; virtual void doDelete(); virtual void deselect(); - virtual BOOL canDeselect(); + virtual BOOL canDeselect() const; virtual void duplicate(); - virtual BOOL canDuplicate(); + virtual BOOL canDuplicate() const; void clearSelections(); void update(); diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 58039bf878..d64b3864b3 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -127,7 +127,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) mSquareMetersCommitted(0) { // status bar can possible overlay menus? - mMouseOpaque = FALSE; + setMouseOpaque(FALSE); setIsChrome(TRUE); // size of day of the weeks and year @@ -171,7 +171,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) childSetActionTextbox("BalanceText", onClickBalance ); // Adding Net Stat Graph - S32 x = mRect.getWidth() - 2; + S32 x = getRect().getWidth() - 2; S32 y = 0; LLRect r; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); @@ -241,9 +241,9 @@ void LLStatusBar::draw() { refresh(); - if (mBgVisible) + if (isBackgroundVisible()) { - gl_drop_shadow(0, mRect.getHeight(), mRect.getWidth(), 0, + gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0, LLUI::sColorsGroup->getColor("ColorDropShadow"), LLUI::sConfigGroup->getS32("DropShadowFloater") ); } @@ -504,7 +504,7 @@ void LLStatusBar::refresh() mRegionDetails.mTime = mTextTime->getText(); mRegionDetails.mBalance = mBalance; - mRegionDetails.mAccesString = (char *)region->getSimAccessString(); + mRegionDetails.mAccesString = region->getSimAccessString(); mRegionDetails.mPing = region->getNetDetailsForLCD(); if (parcel && !parcel->getName().empty()) { @@ -516,7 +516,7 @@ void LLStatusBar::refresh() // keep these around for the LCD to use mRegionDetails.mRegionName = region->getName(); - mRegionDetails.mParcelName = (char *)parcel->getName().c_str(); + mRegionDetails.mParcelName = parcel->getName(); mRegionDetails.mX = pos_x; mRegionDetails.mY = pos_y; mRegionDetails.mZ = pos_z; @@ -526,7 +526,7 @@ void LLStatusBar::refresh() if (parcel->isPublic()) { - snprintf(mRegionDetails.mOwner, MAX_STRING, "Public"); + mRegionDetails.mOwner = "Public"; } else { @@ -538,16 +538,13 @@ void LLStatusBar::refresh() } else { - snprintf(mRegionDetails.mOwner, MAX_STRING, "Group Owned"); + mRegionDetails.mOwner = "Group Owned"; } } else { // Figure out the owner's name - char owner_first[MAX_STRING]; /*Flawfinder: ignore*/ - char owner_last[MAX_STRING]; /*Flawfinder: ignore*/ - gCacheName->getName(parcel->getOwnerID(), owner_first, owner_last); - snprintf(mRegionDetails.mOwner, MAX_STRING, "%s %s", owner_first, owner_last); /* Flawfinder: ignore */ + gCacheName->getFullName(parcel->getOwnerID(), mRegionDetails.mOwner); } } } @@ -566,7 +563,7 @@ void LLStatusBar::refresh() mRegionDetails.mZ = pos_z; mRegionDetails.mArea = 0; mRegionDetails.mForSale = FALSE; - snprintf(mRegionDetails.mOwner, MAX_STRING, "Unknown"); + mRegionDetails.mOwner = "Unknown"; mRegionDetails.mTraffic = 0.0f; } } @@ -575,7 +572,7 @@ void LLStatusBar::refresh() // no region location_name = "(Unknown)"; // keep these around for the LCD to use - mRegionDetails.mRegionName = LLString("Unknown"); + mRegionDetails.mRegionName = "Unknown"; mRegionDetails.mParcelName = "Unknown"; mRegionDetails.mAccesString = "Unknown"; mRegionDetails.mX = 0; @@ -583,7 +580,7 @@ void LLStatusBar::refresh() mRegionDetails.mZ = 0; mRegionDetails.mArea = 0; mRegionDetails.mForSale = FALSE; - snprintf(mRegionDetails.mOwner, MAX_STRING, "Unknown"); + mRegionDetails.mOwner = "Unknown"; mRegionDetails.mTraffic = 0.0f; } @@ -640,7 +637,7 @@ void LLStatusBar::refresh() x += 8; const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5); - r.set(x+4, mRect.getHeight() - 2, PARCEL_RIGHT, 0); + r.set(x+4, getRect().getHeight() - 2, PARCEL_RIGHT, 0); mTextParcelName->setRect(r); // Set search bar visibility @@ -841,7 +838,7 @@ static void onClickBuyLand(void*) void LLStatusBar::setupDate() { // fill the day array with what's in the xui - LLString day_list = getFormattedUIString("StatBarDaysOfWeek"); + LLString day_list = getString("StatBarDaysOfWeek"); size_t length = day_list.size(); // quick input check @@ -865,7 +862,7 @@ void LLStatusBar::setupDate() } // fill the day array with what's in the xui - LLString month_list = getFormattedUIString( "StatBarMonthsOfYear" ); + LLString month_list = getString( "StatBarMonthsOfYear" ); length = month_list.size(); // quick input check diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 78f744c4b5..0605246f16 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -51,30 +51,33 @@ class LLStatGraph; class LLRegionDetails { public: - LLRegionDetails() + LLRegionDetails() : + mRegionName("Unknown"), + mParcelName("Unknown"), + mAccesString("Unknown"), + mX(0), + mY(0), + mZ(0), + mArea (0), + mForSale(FALSE), + mOwner("Unknown"), + mTraffic(0), + mBalance(0), + mPing(0) { - mRegionName = LLString("Unknown"); - mParcelName = "Unknown"; - mAccesString = "Unknown"; - mX = 0; - mY = 0; - mZ = 0; - mArea = 0; - mForSale = FALSE; - snprintf(mOwner, MAX_STRING, "Unknown"); } - LLString mRegionName; - char *mParcelName; - char *mAccesString; + std::string mRegionName; + std::string mParcelName; + std::string mAccesString; S32 mX; S32 mY; S32 mZ; S32 mArea; BOOL mForSale; - char mOwner[MAX_STRING]; + std::string mOwner; F32 mTraffic; S32 mBalance; - LLString mTime; + std::string mTime; U32 mPing; }; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index c17f0007c2..7368ac9fdb 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -462,7 +462,7 @@ BOOL LLFloaterTexturePicker::postBuild() if (!mLabel.empty()) { - std::string pick = childGetText("pick title"); + std::string pick = getString("pick title"); setTitle(pick + mLabel); } @@ -518,7 +518,7 @@ void LLFloaterTexturePicker::draw() } } - if (gFocusMgr.childHasMouseCapture(mDragHandle)) + if (gFocusMgr.childHasMouseCapture(getDragHandle())) { mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); } @@ -566,9 +566,9 @@ void LLFloaterTexturePicker::draw() // Border LLRect border( BORDER_PAD, - mRect.getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD, + getRect().getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD, ((TEX_PICKER_MIN_WIDTH / 2) - TEXTURE_INVENTORY_PADDING - HPAD) - BORDER_PAD, - BORDER_PAD + FOOTER_HEIGHT + (mRect.getHeight() - TEX_PICKER_MIN_HEIGHT)); + BORDER_PAD + FOOTER_HEIGHT + (getRect().getHeight() - TEX_PICKER_MIN_HEIGHT)); gl_rect_2d( border, LLColor4::black, FALSE ); @@ -908,13 +908,13 @@ LLTextureCtrl::LLTextureCtrl( mDirty( FALSE ) { mCaption = new LLTextBox( label, - LLRect( 0, BTN_HEIGHT_SMALL, mRect.getWidth(), 0 ), - NULL, + LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ), + label, LLFontGL::sSansSerifSmall ); mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); addChild( mCaption ); - S32 image_top = mRect.getHeight(); + S32 image_top = getRect().getHeight(); S32 image_bottom = BTN_HEIGHT_SMALL; S32 image_middle = (image_top + image_bottom) / 2; S32 line_height = llround(LLFontGL::sSansSerifSmall->getLineHeight()); @@ -922,14 +922,14 @@ LLTextureCtrl::LLTextureCtrl( mTentativeLabel = new LLTextBox( "Multiple", LLRect( 0, image_middle + line_height / 2, - mRect.getWidth(), image_middle - line_height / 2 ), - NULL, + getRect().getWidth(), image_middle - line_height / 2 ), + "Multiple", LLFontGL::sSansSerifSmall ); mTentativeLabel->setHAlign( LLFontGL::HCENTER ); mTentativeLabel->setFollowsAll(); addChild( mTentativeLabel ); - LLRect border_rect(0, mRect.getHeight(), mRect.getWidth(), 0); + LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0); border_rect.mBottom += BTN_HEIGHT_SMALL; mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); addChild(mBorder); @@ -1013,7 +1013,7 @@ void LLTextureCtrl::setCaption(const LLString& caption) void LLTextureCtrl::setCanApplyImmediately(BOOL b) { mCanApplyImmediately = b; - LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if( floaterp ) { floaterp->setCanApplyImmediately(b); @@ -1031,7 +1031,7 @@ void LLTextureCtrl::setVisible( BOOL visible ) void LLTextureCtrl::setEnabled( BOOL enabled ) { - LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if( enabled ) { LLString tooltip; @@ -1061,7 +1061,7 @@ void LLTextureCtrl::setValid(BOOL valid ) mValid = valid; if (!valid) { - LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); + LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if (pickerp) { pickerp->setActive(FALSE); @@ -1096,7 +1096,7 @@ void LLTextureCtrl::setLabel(const LLString& label) void LLTextureCtrl::showPicker(BOOL take_focus) { - LLFloater* floaterp = LLFloater::getFloaterByHandle(mFloaterHandle); + LLFloater* floaterp = mFloaterHandle.get(); // Show the dialog if( floaterp ) @@ -1134,7 +1134,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus) void LLTextureCtrl::closeFloater() { - LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if( floaterp ) { floaterp->setOwner(NULL); @@ -1180,7 +1180,7 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) void LLTextureCtrl::onFloaterClose() { - LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if (floaterp) { @@ -1193,9 +1193,9 @@ void LLTextureCtrl::onFloaterClose() void LLTextureCtrl::onFloaterCommit(ETexturePickOp op) { - LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); - if( floaterp && mEnabled) + if( floaterp && getEnabled()) { mDirty = (op != TEXTURE_CANCEL); if( floaterp->isDirty() ) @@ -1227,7 +1227,7 @@ void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id ) { mImageItemID.setNull(); mImageAssetID = asset_id; - LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if( floaterp && getEnabled() ) { floaterp->setImageID( asset_id ); @@ -1247,7 +1247,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, // returns true, then the cast was valid, and we can perform // the third test without problems. LLInventoryItem* item = (LLInventoryItem*)cargo_data; - if (mEnabled && (cargo_type == DAD_TEXTURE) && allowDrop(item)) + if (getEnabled() && (cargo_type == DAD_TEXTURE) && allowDrop(item)) { if (drop) { @@ -1290,7 +1290,7 @@ void LLTextureCtrl::draw() } // Border - LLRect border( 0, mRect.getHeight(), mRect.getWidth(), BTN_HEIGHT_SMALL ); + LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); gl_rect_2d( border, mBorderColor, FALSE ); // Interior @@ -1315,7 +1315,7 @@ void LLTextureCtrl::draw() gl_draw_x( interior, LLColor4::black ); } - mTentativeLabel->setVisible( !mTexturep.isNull() && mTentative ); + mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() ); LLUICtrl::draw(); } @@ -1371,7 +1371,7 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item) BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) { - if( getVisible() && mEnabled && !called_from_parent && ' ' == uni_char ) + if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char ) { showPicker(TRUE); return TRUE; @@ -1450,3 +1450,4 @@ BOOL LLToolTexEyedropper::handleHover(S32 x, S32 y, MASK mask) } + diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index cad3980394..4a279d4084 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -44,6 +44,7 @@ class LLFloaterTexturePicker; class LLInventoryItem; class LLTextBox; class LLViewBorder; +class LLViewerImage; // used for setting drag & drop callbacks. typedef BOOL (*drag_n_drop_callback)(LLUICtrl*, LLInventoryItem*, void*); @@ -163,7 +164,7 @@ private: LLUUID mImageAssetID; LLUUID mDefaultImageAssetID; LLString mDefaultImageName; - LLViewHandle mFloaterHandle; + LLHandle<LLFloater> mFloaterHandle; LLTextBox* mTentativeLabel; LLTextBox* mCaption; LLString mLabel; diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 465a40c1ef..031492e0e9 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -210,7 +210,7 @@ void LLTextureBar::draw() mImagep->mFetchPriority); } - LLFontGL::sMonospace->renderUTF8(tex_str, 0, title_x1, mRect.getHeight(), + LLFontGL::sMonospace->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(), color, LLFontGL::LEFT, LLFontGL::TOP); // State @@ -246,7 +246,7 @@ void LLTextureBar::draw() mImagep->mFetchState; state = llclamp(state,0,fetch_state_desc_size-1); - LLFontGL::sMonospace->renderUTF8(fetch_state_desc[state].desc, 0, title_x2, mRect.getHeight(), + LLFontGL::sMonospace->renderUTF8(fetch_state_desc[state].desc, 0, title_x2, getRect().getHeight(), fetch_state_desc[state].color, LLFontGL::LEFT, LLFontGL::TOP); LLGLSNoTexture gls_no_texture; @@ -328,7 +328,7 @@ void LLTextureBar::draw() // draw the packet data // { // LLString num_str = llformat("%3d/%3d", mImagep->mLastPacket+1, mImagep->mPackets); -// LLFontGL::sMonospace->renderUTF8(num_str, 0, bar_left + 100, mRect.getHeight(), color, +// LLFontGL::sMonospace->renderUTF8(num_str, 0, bar_left + 100, getRect().getHeight(), color, // LLFontGL::LEFT, LLFontGL::TOP); // } @@ -336,7 +336,7 @@ void LLTextureBar::draw() { LLString num_str = llformat("%3dx%3d (%d) %7d", mImagep->getWidth(), mImagep->getHeight(), mImagep->getDiscardLevel(), mImagep->mTextureMemory); - LLFontGL::sMonospace->renderUTF8(num_str, 0, title_x4, mRect.getHeight(), color, + LLFontGL::sMonospace->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color, LLFontGL::LEFT, LLFontGL::TOP); } } @@ -727,7 +727,7 @@ void LLTextureView::draw() mGLTexMemBar = new LLGLTexMemBar("gl texmem bar", this); addChild(mGLTexMemBar); - reshape(mRect.getWidth(), mRect.getHeight(), TRUE); + reshape(getRect().getWidth(), getRect().getHeight(), TRUE); /* count = gImageList.getNumImages(); @@ -806,3 +806,4 @@ BOOL LLTextureView::handleKey(KEY key, MASK mask, BOOL called_from_parent) return FALSE; } + diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index cfc3f78fd9..48743aeb39 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -42,7 +42,6 @@ #include "lltoolfocus.h" #include "llfocusmgr.h" #include "llagent.h" -#include "llviewborder.h" extern BOOL gDebugClicks; diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h index 33dc4785c6..7d565f1574 100644 --- a/indra/newview/lltool.h +++ b/indra/newview/lltool.h @@ -51,7 +51,7 @@ public: virtual ~LLTool(); // Hack to support LLFocusMgr - virtual BOOL isView() { return FALSE; } + virtual BOOL isView() const { return FALSE; } // Virtual functions inherited from LLMouseHandler virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index c80edd0eab..444a2d1524 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -389,7 +389,7 @@ void LLToolBar::updateCommunicateList() communicate_button->addSeparator(ADD_TOP); communicate_button->add(LLFloaterMute::getInstance()->getShortTitle(), LLSD("mute list"), ADD_TOP); - std::set<LLViewHandle>::const_iterator floater_handle_it; + std::set<LLHandle<LLFloater> >::const_iterator floater_handle_it; if (gIMMgr->getIMFloaterHandles().size() > 0) { @@ -398,7 +398,7 @@ void LLToolBar::updateCommunicateList() for(floater_handle_it = gIMMgr->getIMFloaterHandles().begin(); floater_handle_it != gIMMgr->getIMFloaterHandles().end(); ++floater_handle_it) { - LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)LLFloater::getFloaterByHandle(*floater_handle_it); + LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)floater_handle_it->get(); if (im_floaterp) { LLString floater_title = im_floaterp->getNumUnreadMessages() > 0 ? "*" : ""; @@ -443,10 +443,10 @@ void LLToolBar::onClickCommunicate(LLUICtrl* ctrl, void* user_data) LLFloaterChatterBox::getInstance()->addFloater(LLFloaterChat::getInstance(), FALSE); LLUUID session_to_show; - std::set<LLViewHandle>::const_iterator floater_handle_it; + std::set<LLHandle<LLFloater> >::const_iterator floater_handle_it; for(floater_handle_it = gIMMgr->getIMFloaterHandles().begin(); floater_handle_it != gIMMgr->getIMFloaterHandles().end(); ++floater_handle_it) { - LLFloater* im_floaterp = LLFloater::getFloaterByHandle(*floater_handle_it); + LLFloater* im_floaterp = floater_handle_it->get(); if (im_floaterp) { if (im_floaterp->isFrontmost()) diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h index 76a361e560..738934ebb1 100644 --- a/indra/newview/lltoolbrush.h +++ b/indra/newview/lltoolbrush.h @@ -74,11 +74,7 @@ public: void modifyLandInSelectionGlobal(); virtual void undo(); - virtual BOOL canUndo() { return TRUE; } - - //virtual void redo(); - virtual BOOL canRedo() { return FALSE; } - + virtual BOOL canUndo() const { return TRUE; } protected: void brush( void ); diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 182ea5602e..d8f4e55b0e 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -173,7 +173,7 @@ void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask) { if (gSelectMgr->getSelection()->getObjectCount()) { - gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = gSelectMgr; } gToolInspect->setCurrentTool( gToolInspect->mSelectRect ); gToolInspect->mSelectRect->handleMouseDown( x, y, mask ); @@ -247,7 +247,7 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask) { if (gToolTranslate->mManip->getSelection()->getObjectCount()) { - gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = gSelectMgr; } BOOL can_move = gToolTranslate->mManip->canAffectSelection(); @@ -372,7 +372,7 @@ void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask) { if (gToolStretch->mManip->getSelection()->getObjectCount()) { - gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = gSelectMgr; } if( LLManip::LL_NO_PART != gToolStretch->mManip->getHighlightedPart() ) { @@ -572,7 +572,7 @@ void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask) { if (gToolRotate->mManip->getSelection()->getObjectCount()) { - gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = gSelectMgr; } if( LLManip::LL_NO_PART != gToolRotate->mManip->getHighlightedPart() ) { diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 43c8e1a8d1..6d33a9c2bc 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -51,7 +51,6 @@ #include "llstatusbar.h" #include "lltoolmgr.h" #include "lltoolselect.h" -#include "llviewborder.h" #include "llviewercamera.h" #include "llviewerobject.h" #include "llviewerwindow.h" diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 0c88442fd2..1bf08d9e22 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -70,7 +70,7 @@ LLToolPie *gToolPie = NULL; LLPointer<LLViewerObject> LLToolPie::sClickActionObject; -LLHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL; +LLSafeHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL; U8 LLToolPie::sClickAction = 0; extern void handle_buy(void*); diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index ffc2fb9122..1af4b26a94 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -78,7 +78,7 @@ protected: BOOL mMouseOutsideSlop; // for this drag, has mouse moved outside slop region static LLPointer<LLViewerObject> sClickActionObject; static U8 sClickAction; - static LLHandle<LLObjectSelection> sLeftClickSelection; + static LLSafeHandle<LLObjectSelection> sLeftClickSelection; }; extern LLToolPie *gToolPie; diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 37c8b00ed2..3f4c823d40 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -96,7 +96,7 @@ BOOL LLToolSelect::handleDoubleClick(S32 x, S32 y, MASK mask) } // static -LLHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObject *object, MASK mask, BOOL ignore_group, BOOL temp_select) +LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObject *object, MASK mask, BOOL ignore_group, BOOL temp_select) { BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly"); BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly"); @@ -275,3 +275,4 @@ void LLToolSelect::onMouseCaptureLost() } + diff --git a/indra/newview/lltoolselect.h b/indra/newview/lltoolselect.h index bbf3529017..cc9168f7cc 100644 --- a/indra/newview/lltoolselect.h +++ b/indra/newview/lltoolselect.h @@ -49,7 +49,7 @@ public: virtual void stopEditing(); - static LLHandle<LLObjectSelection> handleObjectSelection(LLViewerObject *object, MASK mask, BOOL ignore_group, BOOL temp_select); + static LLSafeHandle<LLObjectSelection> handleObjectSelection(LLViewerObject *object, MASK mask, BOOL ignore_group, BOOL temp_select); virtual void onMouseCaptureLost(); virtual void handleDeselect(); diff --git a/indra/newview/lltoolselectland.h b/indra/newview/lltoolselectland.h index 8abcdc33b9..f847967ac8 100644 --- a/indra/newview/lltoolselectland.h +++ b/indra/newview/lltoolselectland.h @@ -75,7 +75,7 @@ protected: LLVector3d mEastNorthTop; // global coords, from drag BOOL mLastShowParcelOwners; // store last Show Parcel Owners setting - LLHandle<LLParcelSelection> mSelection; // hold on to a parcel selection + LLSafeHandle<LLParcelSelection> mSelection; // hold on to a parcel selection }; extern LLToolSelectLand *gToolParcel; diff --git a/indra/newview/lltoolview.cpp b/indra/newview/lltoolview.cpp index b3f0dc4883..93729a5b91 100644 --- a/indra/newview/lltoolview.cpp +++ b/indra/newview/lltoolview.cpp @@ -130,7 +130,7 @@ LLRect LLToolView::getButtonRect(S32 button_index) const S32 HORIZ_SPACING = TOOL_SIZE + 5; const S32 VERT_SPACING = TOOL_SIZE + 14; - S32 tools_per_row = mRect.getWidth() / HORIZ_SPACING; + S32 tools_per_row = getRect().getWidth() / HORIZ_SPACING; S32 row = button_index / tools_per_row; S32 column = button_index % tools_per_row; @@ -196,3 +196,4 @@ void LLToolView::onClickToolButton(void* userdata) } + diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index a63f546761..b9f2ef2ddf 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -78,7 +78,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg) LLRect msg_rect; for (int line_num=0; line_num<16; ++line_num) { - mLabelBox[line_num] = new LLTextBox( "Filename", msg_rect, "", font ); + mLabelBox[line_num] = new LLTextBox( "Filename", msg_rect, "Filename", font ); addChild(mLabelBox[line_num]); } @@ -131,8 +131,8 @@ void LLUploadDialog::setMessage( const std::string& msg) reshape( dialog_width, dialog_height, FALSE ); // Message - S32 msg_x = (mRect.getWidth() - max_msg_width) / 2; - S32 msg_y = mRect.getHeight() - VPAD - line_height; + S32 msg_x = (getRect().getWidth() - max_msg_width) / 2; + S32 msg_y = getRect().getHeight() - VPAD - line_height; int line_num; for (line_num=0; line_num<16; ++line_num) { @@ -152,7 +152,7 @@ void LLUploadDialog::setMessage( const std::string& msg) } msg_lines.deleteAllData(); - centerDialog(); + centerWithin(gViewerWindow->getRootView()->getRect()); } LLUploadDialog::~LLUploadDialog() @@ -165,13 +165,5 @@ LLUploadDialog::~LLUploadDialog() LLUploadDialog::sDialog = NULL; } -void LLUploadDialog::centerDialog() -{ - LLRect window_rect = gViewerWindow->getRootView()->getRect(); - - S32 dialog_left = window_rect.mLeft + (window_rect.getWidth() - mRect.getWidth()) / 2; - S32 dialog_bottom = window_rect.mBottom + (window_rect.getHeight() - mRect.getHeight()) / 2; - translate( dialog_left - mRect.mLeft, dialog_bottom - mRect.mBottom ); -} diff --git a/indra/newview/lluploaddialog.h b/indra/newview/lluploaddialog.h index b975fd595c..06bc0f45e2 100644 --- a/indra/newview/lluploaddialog.h +++ b/indra/newview/lluploaddialog.h @@ -50,8 +50,6 @@ private: LLUploadDialog( const std::string& msg); virtual ~LLUploadDialog(); // No you can't kill it. It can only kill itself. - void centerDialog(); - LLTextBox* mLabelBox[16]; private: diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 7180683a86..9c81f89e99 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -114,13 +114,13 @@ BOOL LLFloaterSettingsDebug::postBuild() childSetCommitCallback("color_swatch", onCommitSettings); childSetUserData("color_swatch", this); childSetAction("default_btn", onClickDefault, this); - mComment = (LLTextEditor*)getChildByName("comment_text"); + mComment = getChild<LLTextEditor>("comment_text"); return TRUE; } void LLFloaterSettingsDebug::draw() { - LLComboBox* settings_combo = (LLComboBox*)getChildByName("settings_combo"); + LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata(); updateControl(controlp); @@ -155,7 +155,7 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) { LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; - LLComboBox* settings_combo = (LLComboBox*)floaterp->getChildByName("settings_combo"); + LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo"); LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata(); LLVector3 vector; @@ -229,7 +229,7 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) void LLFloaterSettingsDebug::onClickDefault(void* user_data) { LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; - LLComboBox* settings_combo = (LLComboBox*)floaterp->getChildByName("settings_combo"); + LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo"); LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata(); if (controlp) @@ -246,7 +246,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp) LLSpinCtrl* spinner2 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_2"); LLSpinCtrl* spinner3 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_3"); LLSpinCtrl* spinner4 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_4"); - LLColorSwatchCtrl* color_swatch = LLUICtrlFactory::getColorSwatchByName(this, "color_swatch"); + LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch"); if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) { diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index b5d30df2f4..a8f88ec036 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -473,11 +473,8 @@ void stop_moving( EKeystate s ) void start_chat( EKeystate s ) { - if (!gChatBar->inputEditorHasFocus()) - { - // start chat - gChatBar->startChat(NULL); - } + // start chat + gChatBar->startChat(NULL); } void bind_keyboard_functions() diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 7a86b1d67c..b8ff934f8d 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -115,9 +115,12 @@ void LLViewerMediaImpl::play(const std::string& media_url, mMediaSource = mgr->createSourceFromMimeType(scheme, mMimeType ); if ( !mMediaSource ) { - llwarns << "media source create failed " << media_url - << " type " << mMimeType - << llendl; + if (mMimeType != "none/none") + { + llwarns << "media source create failed " << media_url + << " type " << mMimeType + << llendl; + } return; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9c94306fb7..fc9b765525 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -245,8 +245,8 @@ LLPieMenu *gPieLand = NULL; // local constants const LLString LANDMARK_MENU_NAME("Landmarks"); -const LLString CLIENT_MENU_NAME("Client"); -const LLString SERVER_MENU_NAME("Server"); +const LLString CLIENT_MENU_NAME("Advanced"); +const LLString SERVER_MENU_NAME("Admin"); const LLString SAVE_INTO_INVENTORY("Save Object Back to My Inventory"); const LLString SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents"); @@ -424,7 +424,6 @@ BOOL enable_dehinge(void*); void handle_force_delete(void*); void print_object_info(void*); void print_agent_nvpairs(void*); -void show_debug_menus(); void toggle_debug_menus(void*); void toggle_map( void* user_data ); void export_info_callback(LLAssetInfo *info, void **user_data, S32 result); @@ -613,13 +612,13 @@ void set_underclothes_menu_options() { if (gMenuHolder && gAgent.isTeen()) { - gMenuHolder->getChildByName("Self Underpants", TRUE)->setVisible(FALSE); - gMenuHolder->getChildByName("Self Undershirt", TRUE)->setVisible(FALSE); + gMenuHolder->getChild<LLView>("Self Underpants", TRUE)->setVisible(FALSE); + gMenuHolder->getChild<LLView>("Self Undershirt", TRUE)->setVisible(FALSE); } if (gMenuBarView && gAgent.isTeen()) { - gMenuBarView->getChildByName("Menu Underpants", TRUE)->setVisible(FALSE); - gMenuBarView->getChildByName("Menu Undershirt", TRUE)->setVisible(FALSE); + gMenuBarView->getChild<LLView>("Menu Underpants", TRUE)->setVisible(FALSE); + gMenuBarView->getChild<LLView>("Menu Undershirt", TRUE)->setVisible(FALSE); } } @@ -656,16 +655,16 @@ void init_menus() gPieSelf = gUICtrlFactory->buildPieMenu("menu_pie_self.xml", gMenuHolder); // TomY TODO: what shall we do about these? - gDetachScreenPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Detach HUD", true); - gDetachPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Detach", true); + gDetachScreenPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Detach HUD", true); + gDetachPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Detach", true); gPieAvatar = gUICtrlFactory->buildPieMenu("menu_pie_avatar.xml", gMenuHolder); gPieObject = gUICtrlFactory->buildPieMenu("menu_pie_object.xml", gMenuHolder); - gAttachScreenPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Attach HUD", true); - gAttachPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Attach", true); - gPieRate = (LLPieMenu*)gMenuHolder->getChildByName("Rate Menu", true); + gAttachScreenPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Attach HUD"); + gAttachPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Attach"); + gPieRate = gMenuHolder->getChild<LLPieMenu>("Rate Menu"); gPieAttachment = gUICtrlFactory->buildPieMenu("menu_pie_attachment.xml", gMenuHolder); @@ -715,8 +714,8 @@ void init_menus() gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost); gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost); - gAFKMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Away", TRUE); - gBusyMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Busy", TRUE); + gAFKMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Away", TRUE); + gBusyMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Busy", TRUE); gAttachSubMenu = gMenuBarView->getChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->getChildMenuByName("Detach Object", TRUE); @@ -1101,6 +1100,13 @@ void init_client_menu(LLMenuGL* menu) menu->append(new LLMenuItemCallGL("Debug Settings", LLFloaterSettingsDebug::show, NULL, NULL)); menu->append(new LLMenuItemCheckGL("View Admin Options", &handle_admin_override_toggle, NULL, &check_admin_override, NULL, 'V', MASK_CONTROL | MASK_ALT)); + + menu->append(new LLMenuItemCallGL("Request Admin Status", + &handle_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_CONTROL)); + + menu->append(new LLMenuItemCallGL("Leave Admin Status", + &handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL)); + menu->createJumpKeys(); } @@ -1586,19 +1592,11 @@ void init_server_menu(LLMenuGL* menu) &LLPanelRegionTools::onSaveState, &enable_god_customer_service, NULL)); // menu->append(new LLMenuItemCallGL("Force Join Group", handle_force_join_group)); - - - - menu->appendSeparator(); +// +// menu->appendSeparator(); // // menu->append(new LLMenuItemCallGL( "OverlayTitle", // &handle_show_overlay_title, &enable_god_customer_service, NULL)); - - menu->append(new LLMenuItemCallGL("Request Admin Status", - &handle_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_CONTROL)); - - menu->append(new LLMenuItemCallGL("Leave Admin Status", - &handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL)); menu->createJumpKeys(); } @@ -2627,12 +2625,10 @@ BOOL check_admin_override(void*) void handle_admin_override_toggle(void*) { - if(!gAgent.getAdminOverride()) - { - gAgent.setAdminOverride(TRUE); - show_debug_menus(); - } - else gAgent.setAdminOverride(FALSE); + gAgent.setAdminOverride(!gAgent.getAdminOverride()); + + // The above may have affected which debug menus are visible + show_debug_menus(); } void handle_god_mode(void*) @@ -2649,7 +2645,6 @@ void set_god_level(U8 god_level) { U8 old_god_level = gAgent.getGodLevel(); gAgent.setGodLevel( god_level ); - show_debug_menus(); gIMMgr->refresh(); gParcelMgr->notifyObservers(); @@ -2681,6 +2676,9 @@ void set_god_level(U8 god_level) LLNotifyBox::showXml("LeavingGodMode", args); } + + // changing god-level can affect which menus we see + show_debug_menus(); } #ifdef TOGGLE_HACKED_GODLIKE_VIEWER @@ -3351,9 +3349,9 @@ class LLEditDuplicate : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if(gEditMenuHandler) + if(LLEditMenuHandler::gEditMenuHandler) { - gEditMenuHandler->duplicate(); + LLEditMenuHandler::gEditMenuHandler->duplicate(); } return true; } @@ -3363,7 +3361,7 @@ class LLEditEnableDuplicate : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canDuplicate(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDuplicate(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4445,7 +4443,7 @@ class LLEditEnableCut : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canCut(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCut(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4455,9 +4453,9 @@ class LLEditCut : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->cut(); + LLEditMenuHandler::gEditMenuHandler->cut(); } return true; } @@ -4467,7 +4465,7 @@ class LLEditEnableCopy : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canCopy(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCopy(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4477,9 +4475,9 @@ class LLEditCopy : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->copy(); + LLEditMenuHandler::gEditMenuHandler->copy(); } return true; } @@ -4489,7 +4487,7 @@ class LLEditEnablePaste : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canPaste(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canPaste(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4499,9 +4497,9 @@ class LLEditPaste : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->paste(); + LLEditMenuHandler::gEditMenuHandler->paste(); } return true; } @@ -4511,7 +4509,7 @@ class LLEditEnableDelete : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canDoDelete(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4523,9 +4521,9 @@ class LLEditDelete : public view_listener_t { // If a text field can do a deletion, it gets precedence over deleting // an object in the world. - if( gEditMenuHandler && gEditMenuHandler->canDoDelete()) + if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete()) { - gEditMenuHandler->doDelete(); + LLEditMenuHandler::gEditMenuHandler->doDelete(); } // and close any pie/context menus when done @@ -4605,7 +4603,7 @@ class LLEditEnableDeselect : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canDeselect(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDeselect(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4615,9 +4613,9 @@ class LLEditDeselect : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->deselect(); + LLEditMenuHandler::gEditMenuHandler->deselect(); } return true; } @@ -4627,7 +4625,7 @@ class LLEditEnableSelectAll : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canSelectAll(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canSelectAll(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4638,9 +4636,9 @@ class LLEditSelectAll : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->selectAll(); + LLEditMenuHandler::gEditMenuHandler->selectAll(); } return true; } @@ -4651,7 +4649,7 @@ class LLEditEnableUndo : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canUndo(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4661,9 +4659,9 @@ class LLEditUndo : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if( gEditMenuHandler && gEditMenuHandler->canUndo() ) + if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo() ) { - gEditMenuHandler->undo(); + LLEditMenuHandler::gEditMenuHandler->undo(); } return true; } @@ -4673,7 +4671,7 @@ class LLEditEnableRedo : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canRedo(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4683,9 +4681,9 @@ class LLEditRedo : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if( gEditMenuHandler && gEditMenuHandler->canRedo() ) + if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo() ) { - gEditMenuHandler->redo(); + LLEditMenuHandler::gEditMenuHandler->redo(); } return true; } @@ -4731,8 +4729,12 @@ void show_debug_menus() gMenuBarView->setItemVisible(CLIENT_MENU_NAME, debug); gMenuBarView->setItemEnabled(CLIENT_MENU_NAME, debug); - gMenuBarView->setItemVisible(SERVER_MENU_NAME, debug); - gMenuBarView->setItemEnabled(SERVER_MENU_NAME, debug); + + // Server ('Admin') menu hidden when not in godmode. + const bool show_server_menu = debug && (gAgent.getGodLevel() > GOD_NOT); + gMenuBarView->setItemVisible(SERVER_MENU_NAME, show_server_menu); + gMenuBarView->setItemEnabled(SERVER_MENU_NAME, show_server_menu); + //gMenuBarView->setItemVisible(LLString("DebugOptions"), visible); //gMenuBarView->setItemVisible(LLString(AVI_TOOLS), visible); }; @@ -5366,19 +5368,7 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "help f1") { - gViewerHtmlHelp.show( gSavedSettings.getString("HelpHomeURL") ); - } - else if (floater_name == "help in-world") - { - const bool open_app_slurls = true; - LLFloaterHtml::getInstance()->show( - "in-world_help", open_app_slurls ); - } - else if (floater_name == "help additional") - { - const bool open_app_slurls = true; - LLFloaterHtml::getInstance()->show( - "additional_help", open_app_slurls ); + gViewerHtmlHelp.show(); } else if (floater_name == "complaint reporter") { @@ -5436,7 +5426,7 @@ class LLFloaterVisible : public view_listener_t } else if (floater_name == "chat history") { - new_value = LLFloaterChat::visible(NULL); + new_value = LLFloaterChat::instanceVisible(); } else if (floater_name == "im") { @@ -7112,12 +7102,12 @@ BOOL LLViewerMenuHolderGL::hideMenus() return handled; } -void LLViewerMenuHolderGL::setParcelSelection(LLHandle<LLParcelSelection> selection) +void LLViewerMenuHolderGL::setParcelSelection(LLSafeHandle<LLParcelSelection> selection) { mParcelSelection = selection; } -void LLViewerMenuHolderGL::setObjectSelection(LLHandle<LLObjectSelection> selection) +void LLViewerMenuHolderGL::setObjectSelection(LLSafeHandle<LLObjectSelection> selection) { mObjectSelection = selection; } @@ -7125,7 +7115,7 @@ void LLViewerMenuHolderGL::setObjectSelection(LLHandle<LLObjectSelection> select const LLRect LLViewerMenuHolderGL::getMenuRect() const { - return LLRect(0, mRect.getHeight() - MENU_BAR_HEIGHT, mRect.getWidth(), STATUS_BAR_HEIGHT); + return LLRect(0, getRect().getHeight() - MENU_BAR_HEIGHT, getRect().getWidth(), STATUS_BAR_HEIGHT); } void handle_save_to_xml(void*) @@ -7168,8 +7158,9 @@ void handle_load_from_xml(void*) void handle_slurl_test(void*) { - LLFloaterHtml::getInstance()->show( - "http://secondlife.com/app/search/slurls.html", "SLURL Test", true); + bool open_app_slurls = true; + bool open_links_externally = false; + LLFloaterHtml::getInstance()->show("http://secondlife.com/app/search/slurls.html", "SLURL Test", open_app_slurls, open_links_externally); } void handle_rebake_textures(void*) diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 003e3efe42..21b2554ceb 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -126,14 +126,14 @@ public: virtual BOOL hideMenus(); - void setParcelSelection(LLHandle<LLParcelSelection> selection); - void setObjectSelection(LLHandle<LLObjectSelection> selection); + void setParcelSelection(LLSafeHandle<LLParcelSelection> selection); + void setObjectSelection(LLSafeHandle<LLObjectSelection> selection); virtual const LLRect getMenuRect() const; protected: - LLHandle<LLParcelSelection> mParcelSelection; - LLHandle<LLObjectSelection> mObjectSelection; + LLSafeHandle<LLParcelSelection> mParcelSelection; + LLSafeHandle<LLObjectSelection> mObjectSelection; }; extern const LLString SAVE_INTO_INVENTORY; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5e3ffb5e04..e9839d64dc 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -919,37 +919,25 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, gFloaterMute->selectMute(blocked_id); } - // purge the offer queue of any previously queued inventory offers from the same source. - LLView::child_list_t notification_queue(*(gNotifyBoxView->getChildList())); - for(LLView::child_list_iter_t iter = notification_queue.begin(); - iter != notification_queue.end(); - iter++) - { - LLNotifyBox* notification = (LLNotifyBox*)*iter; - // scan for other inventory offers (i.e. ignore other types of notifications). - // we can tell by looking for the associated callback they were created with. - if(notification->getNotifyCallback() == inventory_offer_callback) - { - // found one. - // safe to downcast user data because we know it's associated with offer callback. - LLOfferInfo* offer_data = (LLOfferInfo*)notification->getUserData(); - if(offer_data == user_data) - { - continue; // don't remove the msg triggering us. it will be dequeued normally. - } - if(offer_data->mFromID == blocked_id) - { - gNotifyBoxView->removeChild(notification); - } + // purge the message queue of any previously queued inventory offers from the same source. + class OfferMatcher : public LLNotifyBoxView::Matcher + { + public: + OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {} + BOOL matches(LLNotifyBox::notify_callback_t callback, void* cb_data) const + { + return callback == inventory_offer_callback && ((LLOfferInfo*)cb_data)->mFromID == blocked_id; } - } + private: + const LLUUID& blocked_id; + }; + gNotifyBoxView->purgeMessagesMatching(OfferMatcher(blocked_id)); } void inventory_offer_callback(S32 button, void* user_data) { LLChat chat; LLString log_message; - LLOfferInfo* info = (LLOfferInfo*)user_data; if(!info) return; @@ -997,7 +985,7 @@ void inventory_offer_callback(S32 button, void* user_data) { if (info->mFromGroup) { - char group_name[MAX_STRING]; /* Flawfinder: ignore */ + std::string group_name; if (gCacheName->getGroupName(info->mFromID, group_name)) { from_string = LLString("An object named '") + info->mFromName + "' owned by the group '" + group_name + "'"; @@ -1011,8 +999,7 @@ void inventory_offer_callback(S32 button, void* user_data) } else { - char first_name[MAX_STRING]; /* Flawfinder: ignore */ - char last_name[MAX_STRING]; /* Flawfinder: ignore */ + std::string first_name, last_name; if (gCacheName->getName(info->mFromID, first_name, last_name)) { from_string = LLString("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; @@ -1213,19 +1200,19 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) // Name cache callbacks don't store userdata, so can't save // off the LLOfferInfo. Argh. JC BOOL name_found = FALSE; - char first_name[MAX_STRING]; /* Flawfinder: ignore */ - char last_name[MAX_STRING]; /* Flawfinder: ignore */ if (info->mFromGroup) { - if (gCacheName->getGroupName(info->mFromID, first_name)) + std::string group_name; + if (gCacheName->getGroupName(info->mFromID, group_name)) { - args["[FIRST]"] = first_name; + args["[FIRST]"] = group_name; args["[LAST]"] = ""; name_found = TRUE; } } else { + std::string first_name, last_name; if (gCacheName->getName(info->mFromID, first_name, last_name)) { args["[FIRST]"] = first_name; @@ -4413,9 +4400,23 @@ void script_question_cb(S32 option, void* user_data) notify_cautioned_script_question(cbdata, orig, allowed); } - if ( option == 2 ) + if ( option == 2 ) // mute { gMuteListp->add(LLMute(cbdata->mItemID, cbdata->mObjectName, LLMute::OBJECT)); + + // purge the message queue of any previously queued requests from the same source. DEV-4879 + class OfferMatcher : public LLNotifyBoxView::Matcher + { + public: + OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {} + BOOL matches(LLNotifyBox::notify_callback_t callback, void* cb_data) const + { + return callback == script_question_cb && ((LLScriptQuestionCBData*)cb_data)->mItemID == blocked_id; + } + private: + const LLUUID& blocked_id; + }; + gNotifyBoxView->purgeMessagesMatching(OfferMatcher(cbdata->mItemID)); } delete cbdata; } diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index 33c8ed919c..4c9a0aab95 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -160,7 +160,7 @@ void LLViewerParcelMedia::update(LLParcel* parcel) // static void LLViewerParcelMedia::play(LLParcel* parcel) { - llinfos << "play" << llendl; + lldebugs << "LLViewerParcelMedia::play" << llendl; if (!parcel) return; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index b5c2e81ab7..290650e251 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -590,13 +590,13 @@ void LLViewerParcelMgr::deselectLand() mSelectedDwell = 0.f; - notifyObservers(); - // invalidate parcel selection so that existing users of this selection can clean up mCurrentParcelSelection->setParcel(NULL); mFloatingParcelSelection->setParcel(NULL); // create new parcel selection mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel); + + notifyObservers(); // Notify observers *after* changing the parcel selection } } @@ -1968,17 +1968,14 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which) void LLViewerParcelMgr::deedLandToGroup() { - char group_name[MAX_STRING]; /* Flawfinder: ignore */ + std::string group_name; gCacheName->getGroupName(mCurrentParcel->getGroupID(), group_name); LLString::format_map_t args; args["[AREA]"] = llformat("%d", mCurrentParcel->getArea()); args["[GROUP_NAME]"] = group_name; if(mCurrentParcel->getContributeWithDeed()) { - char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - first_name[0] = '\0'; - char last_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ - last_name[0] = '\0'; + std::string first_name, last_name; gCacheName->getName(mCurrentParcel->getOwnerID(), first_name, last_name); args["[FIRST_NAME]"] = first_name; args["[LAST_NAME]"] = last_name; diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index efea18158c..f86ffe309f 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -110,7 +110,7 @@ public: void selectCollisionParcel(); // Select the parcel at a specific point - LLHandle<LLParcelSelection> selectParcelAt(const LLVector3d& pos_global); + LLSafeHandle<LLParcelSelection> selectParcelAt(const LLVector3d& pos_global); // Take the current rectangle select, and select the parcel contained // within it. diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 871fc9702e..2721a626c7 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -1,6 +1,6 @@ /** * @file llviewertexteditor.cpp - * @brief Text editor widget to let users enter a a multi-line ASCII document. + * @brief Text editor widget to let users enter a multi-line document. * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -145,8 +145,8 @@ public: // return true if there are no embedded items. bool empty(); - void bindEmbeddedChars(const LLFontGL* font); - void unbindEmbeddedChars(const LLFontGL* font); + void bindEmbeddedChars(LLFontGL* font) const; + void unbindEmbeddedChars(LLFontGL* font) const; BOOL insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new); BOOL removeEmbeddedItem( llwchar ext_char ); @@ -167,12 +167,13 @@ public: static LLInventoryItem* getEmbeddedItem(llwchar ext_char); // returns item from static list static BOOL getEmbeddedItemSaved(llwchar ext_char); // returns whether item from static list is saved +private: + struct embedded_info_t { LLPointer<LLInventoryItem> mItem; BOOL mSaved; }; -private: typedef std::map<llwchar, embedded_info_t > item_map_t; static item_map_t sEntries; static std::stack<llwchar> sFreeEntries; @@ -227,14 +228,14 @@ BOOL LLEmbeddedItems::insertEmbeddedItem( LLInventoryItem* item, llwchar* ext_ch } else if (sEntries.empty()) { - wc_emb = FIRST_EMBEDDED_CHAR; + wc_emb = LLTextEditor::FIRST_EMBEDDED_CHAR; } else { item_map_t::iterator last = sEntries.end(); --last; wc_emb = last->first; - if (wc_emb >= LAST_EMBEDDED_CHAR) + if (wc_emb >= LLTextEditor::LAST_EMBEDDED_CHAR) { return FALSE; } @@ -265,7 +266,7 @@ BOOL LLEmbeddedItems::removeEmbeddedItem( llwchar ext_char ) // static LLInventoryItem* LLEmbeddedItems::getEmbeddedItem(llwchar ext_char) { - if( ext_char >= FIRST_EMBEDDED_CHAR && ext_char <= LAST_EMBEDDED_CHAR ) + if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR ) { item_map_t::iterator iter = sEntries.find(ext_char); if (iter != sEntries.end()) @@ -279,7 +280,7 @@ LLInventoryItem* LLEmbeddedItems::getEmbeddedItem(llwchar ext_char) // static BOOL LLEmbeddedItems::getEmbeddedItemSaved(llwchar ext_char) { - if( ext_char >= FIRST_EMBEDDED_CHAR && ext_char <= LAST_EMBEDDED_CHAR ) + if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR ) { item_map_t::iterator iter = sEntries.find(ext_char); if (iter != sEntries.end()) @@ -307,7 +308,7 @@ void LLEmbeddedItems::removeUnusedChars() for (S32 i=0; i<(S32)wtext.size(); i++) { llwchar wc = wtext[i]; - if( wc >= FIRST_EMBEDDED_CHAR && wc <= LAST_EMBEDDED_CHAR ) + if( wc >= LLTextEditor::FIRST_EMBEDDED_CHAR && wc <= LLTextEditor::LAST_EMBEDDED_CHAR ) { used.erase(wc); } @@ -365,14 +366,14 @@ BOOL LLEmbeddedItems::hasEmbeddedItem(llwchar ext_char) return FALSE; } -void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) +void LLEmbeddedItems::bindEmbeddedChars( LLFontGL* font ) const { if( sEntries.empty() ) { return; } - for (std::set<llwchar>::iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1) + for (std::set<llwchar>::const_iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1) { llwchar wch = *iter1; item_map_t::iterator iter2 = sEntries.find(wch); @@ -431,20 +432,20 @@ void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) LLViewerImage* image = gImageList.getImage(LLUUID(gViewerArt.getString(img_name)), MIPMAP_FALSE, TRUE); - ((LLFontGL*)font)->addEmbeddedChar( wch, image, item->getName() ); + font->addEmbeddedChar( wch, image, item->getName() ); } } -void LLEmbeddedItems::unbindEmbeddedChars( const LLFontGL* font ) +void LLEmbeddedItems::unbindEmbeddedChars( LLFontGL* font ) const { if( sEntries.empty() ) { return; } - for (std::set<llwchar>::iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1) + for (std::set<llwchar>::const_iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1) { - ((LLFontGL*)font)->removeEmbeddedChar(*iter1); + font->removeEmbeddedChar(*iter1); } } @@ -490,7 +491,7 @@ void LLEmbeddedItems::markSaved() /////////////////////////////////////////////////////////////////// -class LLTextCmdInsertEmbeddedItem : public LLTextCmd +class LLViewerTextEditor::LLTextCmdInsertEmbeddedItem : public LLTextEditor::LLTextCmd { public: LLTextCmdInsertEmbeddedItem( S32 pos, LLInventoryItem* item ) @@ -509,7 +510,7 @@ public: { LLWString ws; ws.assign(1, mExtCharValue); - *delta = insert(editor, mPos, ws ); + *delta = insert(editor, getPosition(), ws ); return (*delta != 0); } return FALSE; @@ -517,18 +518,18 @@ public: virtual S32 undo( LLTextEditor* editor ) { - remove(editor, mPos, 1); - return mPos; + remove(editor, getPosition(), 1); + return getPosition(); } virtual S32 redo( LLTextEditor* editor ) { LLWString ws; ws += mExtCharValue; - insert(editor, mPos, ws ); - return mPos + 1; + insert(editor, getPosition(), ws ); + return getPosition() + 1; } - virtual BOOL hasExtCharValue( llwchar value ) + virtual BOOL hasExtCharValue( llwchar value ) const { return (value == mExtCharValue); } @@ -571,17 +572,17 @@ LLViewerTextEditor::LLViewerTextEditor(const LLString& name, mEmbeddedItemList = new LLEmbeddedItems(this); mInventoryCallback->setEditor(this); + // *TODO: Add right click menus for SLURLs // Build the right click menu // make the popup menu available - - LLMenuGL* menu = gUICtrlFactory->buildMenu("menu_slurl.xml", this); - if (!menu) - { - menu = new LLMenuGL(""); - } - menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); - // menu->setVisible(FALSE); - mPopupMenuHandle = menu->mViewHandle; + //LLMenuGL* menu = gUICtrlFactory->buildMenu("menu_slurl.xml", this); + //if (!menu) + //{ + // menu = new LLMenuGL(""); + //} + //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); + //// menu->setVisible(FALSE); + //mPopupMenuHandle = menu->getHandle(); } LLViewerTextEditor::~LLViewerTextEditor() @@ -623,7 +624,7 @@ BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* stic return TRUE; } - LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); + const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); if( cur_segment ) { BOOL has_tool_tip = FALSE; @@ -674,13 +675,13 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) } BOOL start_select = TRUE; - if( mAllowEmbeddedItems ) + if( allowsEmbeddedItems() ) { setCursorAtLocalPos( x, y, FALSE ); llwchar wc = 0; if (mCursorPos < getLength()) { - wc = mWText[mCursorPos]; + wc = getWChar(mCursorPos); } LLInventoryItem* item_at_pos = LLEmbeddedItems::getEmbeddedItem(wc); if (item_at_pos) @@ -763,7 +764,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) } // Delay cursor flashing - mKeystrokeTimer.reset(); + resetKeystrokeTimer(); return handled; } @@ -790,12 +791,12 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) mLastSelectionY = y; } - if( y > mTextRect.mTop ) + if( y > getTextRect().mTop ) { mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 ); } else - if( y < mTextRect.mBottom ) + if( y < getTextRect().mBottom ) { mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 ); } @@ -817,7 +818,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) LLAssetType::lookupDragAndDropType( mDragItem->getType() ), mDragItem->getUUID(), LLToolDragAndDrop::SOURCE_NOTECARD, - mSourceID, mObjectID); + getSourceID(), mObjectID); return gToolDragAndDrop->handleHover( x, y, mask ); } @@ -837,7 +838,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) if( handled ) { // Delay cursor flashing - mKeystrokeTimer.reset(); + resetKeystrokeTimer(); } // Opaque @@ -846,7 +847,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) // Check to see if we're over an HTML-style link if( !mSegments.empty() ) { - LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); + const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); if( cur_segment ) { if(cur_segment->getStyle().isLink()) @@ -870,7 +871,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) if( !handled ) { lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; - if (!mScrollbar->getVisible() || x < mRect.getWidth() - SCROLLBAR_SIZE) + if (!mScrollbar->getVisible() || x < getRect().getWidth() - SCROLLBAR_SIZE) { getWindow()->setCursor(UI_CURSOR_IBEAM); } @@ -894,7 +895,7 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) // let scrollbar have first dibs handled = LLView::childrenHandleMouseUp(x, y, mask) != NULL; - // enable I Agree checkbox if the user scrolled through entire text + // Used to enable I Agree checkbox if the user scrolled through entire text BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); if (mOnScrollEndCallback && was_scrolled_to_bottom) { @@ -906,12 +907,12 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) if( mIsSelecting ) { // Finish selection - if( y > mTextRect.mTop ) + if( y > getTextRect().mTop ) { mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 ); } else - if( y < mTextRect.mBottom ) + if( y < getTextRect().mBottom ) { mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 ); } @@ -931,7 +932,7 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) } // Delay cursor flashing - mKeystrokeTimer.reset(); + resetKeystrokeTimer(); if( hasMouseCapture() ) { @@ -965,34 +966,35 @@ BOOL LLViewerTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; - if(! handled) - { - LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); - if( cur_segment ) - { - if(cur_segment->getStyle().isLink()) - { - handled = TRUE; - mHTML = cur_segment->getStyle().getLinkHREF(); - } - } - } - LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle); - if(handled && menu && mParseHTML && mHTML.length() > 0) - { - menu->setVisible(TRUE); - menu->arrange(); - menu->updateParent(LLMenuGL::sMenuContainer); - LLMenuGL::showPopup(this, menu, x, y); - mHTML = ""; - } - else - { - if(menu && menu->getVisible()) - { - menu->setVisible(FALSE); - } - } + // *TODO: Add right click menus for SLURLs +// if(! handled) +// { +// const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); +// if( cur_segment ) +// { +// if(cur_segment->getStyle().isLink()) +// { +// handled = TRUE; +// mHTML = cur_segment->getStyle().getLinkHREF(); +// } +// } +// } +// LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); +// if(handled && menu && mParseHTML && mHTML.length() > 0) +// { +// menu->setVisible(TRUE); +// menu->arrange(); +// menu->updateParent(LLMenuGL::sMenuContainer); +// LLMenuGL::showPopup(this, menu, x, y); +// mHTML = ""; +// } +// else +// { +// if(menu && menu->getVisible()) +// { +// menu->setVisible(FALSE); +// } +// } return handled; } @@ -1005,9 +1007,9 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) if( !handled && mTakesNonScrollClicks) { - if( mAllowEmbeddedItems ) + if( allowsEmbeddedItems() ) { - LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); + const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); if( cur_segment && cur_segment->getStyle().getIsEmbeddedItem() ) { if( openEmbeddedItemAtPos( cur_segment->getStart() ) ) @@ -1054,7 +1056,7 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) mIsSelecting = FALSE; // delay cursor flashing - mKeystrokeTimer.reset(); + resetKeystrokeTimer(); handled = TRUE; } @@ -1074,12 +1076,12 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, if (mTakesNonScrollClicks) { - if (getEnabled() && !mReadOnly) + if (getEnabled() && acceptsTextInput()) { switch( cargo_type ) { case DAD_CALLINGCARD: - if(mAcceptCallingCardNames) + if(acceptsCallingCardNames()) { if (drop) { @@ -1107,7 +1109,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, case DAD_GESTURE: { LLInventoryItem *item = (LLInventoryItem *)cargo_data; - if( mAllowEmbeddedItems ) + if( allowsEmbeddedItems() ) { U32 mask_next = item->getPermissions().getMaskNextOwner(); if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) @@ -1208,9 +1210,9 @@ LLString LLViewerTextEditor::getEmbeddedText() // New version (Version 2) mEmbeddedItemList->copyUsedCharsToIndexed(); LLWString outtextw; - for (S32 i=0; i<(S32)mWText.size(); i++) + for (S32 i=0; i<(S32)getWText().size(); i++) { - llwchar wch = mWText[i]; + llwchar wch = getWChar(i); if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR ) { S32 index = mEmbeddedItemList->getIndexFromEmbeddedChar(wch); @@ -1282,21 +1284,21 @@ llwchar LLViewerTextEditor::pasteEmbeddedItem(llwchar ext_char) return LL_UNKNOWN_CHAR; // item not found or list full } -void LLViewerTextEditor::bindEmbeddedChars(const LLFontGL* font) +void LLViewerTextEditor::bindEmbeddedChars(LLFontGL* font) const { mEmbeddedItemList->bindEmbeddedChars( font ); } -void LLViewerTextEditor::unbindEmbeddedChars(const LLFontGL* font) +void LLViewerTextEditor::unbindEmbeddedChars(LLFontGL* font) const { mEmbeddedItemList->unbindEmbeddedChars( font ); } -BOOL LLViewerTextEditor::getEmbeddedItemToolTipAtPos(S32 pos, LLWString &msg) +BOOL LLViewerTextEditor::getEmbeddedItemToolTipAtPos(S32 pos, LLWString &msg) const { if (pos < getLength()) { - LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem(mWText[pos]); + LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem(getWChar(pos)); if( item ) { msg = utf8str_to_wstring(item->getName()); @@ -1313,10 +1315,10 @@ BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos) { if( pos < getLength()) { - LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem( mWText[pos] ); + LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem( getWChar(pos) ); if( item ) { - BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( mWText[pos] ); + BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( getWChar(pos) ); if (saved) { return openEmbeddedItem(item); @@ -1490,7 +1492,7 @@ bool LLViewerTextEditor::importStream(std::istream& str) const std::vector<LLPointer<LLInventoryItem> >& items = nc.getItems(); mEmbeddedItemList->addItems(items); // Actually set the text - if (mAllowEmbeddedItems) + if (allowsEmbeddedItems()) { if (nc.getVersion() == 1) setASCIIEmbeddedText( nc.getText() ); @@ -1514,7 +1516,7 @@ void LLViewerTextEditor::copyInventory(const LLInventoryItem* item, U32 callback bool LLViewerTextEditor::hasEmbeddedInventory() { - return (!(mEmbeddedItemList->empty())); + return ! mEmbeddedItemList->empty(); } //////////////////////////////////////////////////////////////////////////// @@ -1577,11 +1579,9 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF font, allow_embedded_items); - BOOL ignore_tabs = text_editor->mTabToNextField; + BOOL ignore_tabs = text_editor->tabsToNextField(); node->getAttributeBOOL("ignore_tab", ignore_tabs); - - text_editor->setTabToNextField(ignore_tabs); - + text_editor->setTabsToNextField(ignore_tabs); text_editor->setTextEditorParameters(node); @@ -1589,7 +1589,7 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF node->getAttributeBOOL("hide_scrollbar",hide_scrollbar); text_editor->setHideScrollbarForShortDocs(hide_scrollbar); - BOOL hide_border = !text_editor->mBorder->getVisible(); + BOOL hide_border = !text_editor->isBorderVisible(); node->getAttributeBOOL("hide_border", hide_border); text_editor->setBorderVisible(!hide_border); diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h index 02d934fc3c..237c85ad53 100644 --- a/indra/newview/llviewertexteditor.h +++ b/indra/newview/llviewertexteditor.h @@ -1,6 +1,6 @@ /** * @file llviewertexteditor.h - * @brief Text editor widget to let users enter a a multi-line document// + * @brief Text editor widget to let users enter a multi-line document// * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -34,17 +34,12 @@ #include "lltexteditor.h" -class LLInventoryItem; -class LLEmbeddedItems; -class LLEmbeddedNotecardOpener; // // Classes // class LLViewerTextEditor : public LLTextEditor { - friend class LLEmbeddedItems; - friend class LLTextCmdInsertEmbeddedItem; public: LLViewerTextEditor(const LLString& name, @@ -72,7 +67,7 @@ public: BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, LLString& tooltip_msg); - const LLInventoryItem* getDragItem() { return mDragItem; } + const class LLInventoryItem* getDragItem() const { return mDragItem; } virtual BOOL importBuffer(const LLString& buffer); virtual bool importStream(std::istream& str); virtual BOOL exportBuffer(LLString& buffer); @@ -86,9 +81,9 @@ public: void setEmbeddedText(const LLString& instr); LLString getEmbeddedText(); + // Appends Second Life time, small font, grey. + // If this starts a line, you need to prepend a newline. LLString appendTime(bool prepend_newline); - // Appends Second Life time, small font, grey - // If this starts a line, you need to prepend a newline. void copyInventory(const LLInventoryItem* item, U32 callback_id = 0); @@ -99,13 +94,13 @@ public: // rather than checking if a re-load is necessary. Phoenix 2007-02-27 bool hasEmbeddedInventory(); -protected: +private: // Embedded object operations virtual llwchar pasteEmbeddedItem(llwchar ext_char); - virtual void bindEmbeddedChars(const LLFontGL* font); - virtual void unbindEmbeddedChars(const LLFontGL* font); + virtual void bindEmbeddedChars(LLFontGL* font) const; + virtual void unbindEmbeddedChars(LLFontGL* font) const; - BOOL getEmbeddedItemToolTipAtPos(S32 pos, LLWString &wmsg); + BOOL getEmbeddedItemToolTipAtPos(S32 pos, LLWString &wmsg) const; BOOL openEmbeddedItemAtPos( S32 pos ); BOOL openEmbeddedItem(LLInventoryItem* item); @@ -121,17 +116,24 @@ protected: static void onCopyToInvDialog( S32 option, void* userdata ); static void onNotecardDialog( S32 option, void* userdata ); -protected: LLPointer<LLInventoryItem> mDragItem; BOOL mDragItemSaved; - LLEmbeddedItems* mEmbeddedItemList; + class LLEmbeddedItems* mEmbeddedItemList; LLUUID mObjectID; LLUUID mNotecardInventoryID; - LLPointer<LLEmbeddedNotecardOpener> mInventoryCallback; + LLPointer<class LLEmbeddedNotecardOpener> mInventoryCallback; + + // *TODO: Add right click menus for SLURLs + //LLHandle<LLView> mPopupMenuHandle; + + // + // Inner classes + // + + class LLTextCmdInsertEmbeddedItem; - LLViewHandle mPopupMenuHandle; }; #endif // LL_VIEWERTEXTEDITOR_H diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 95adf32ed5..5dcf4fdb5d 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -607,6 +607,8 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); + LLView::sMouseHandlerMessage = ""; + if (gDebugClicks) { llinfos << "ViewerWindow left mouse down at " << x << "," << y << llendl; @@ -684,7 +686,6 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask if (LLView::sDebugMouseHandling) { llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; - LLView::sMouseHandlerMessage = ""; } return TRUE; } @@ -720,6 +721,8 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); + LLView::sMouseHandlerMessage = ""; + if (gDebugClicks) { llinfos << "ViewerWindow left mouse double-click at " << x << "," << y << llendl; @@ -768,7 +771,6 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma if (LLView::sDebugMouseHandling) { llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; - LLView::sMouseHandlerMessage = ""; } return TRUE; } @@ -802,6 +804,8 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); + LLView::sMouseHandlerMessage = ""; + if (gDebugClicks) { llinfos << "ViewerWindow left mouse up" << llendl; @@ -868,7 +872,6 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) if (handled) { llinfos << "Left Mouse Up" << LLView::sMouseHandlerMessage << llendl; - LLView::sMouseHandlerMessage = ""; } else { @@ -896,6 +899,8 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); + LLView::sMouseHandlerMessage = ""; + if (gDebugClicks) { llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl; @@ -966,7 +971,6 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK if (LLView::sDebugMouseHandling) { llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl; - LLView::sMouseHandlerMessage = ""; } return TRUE; } @@ -1008,6 +1012,8 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); + LLView::sMouseHandlerMessage = ""; + // Don't care about caps lock for mouse events. if (gDebugClicks) { @@ -1074,7 +1080,6 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m if (handled) { llinfos << "Right Mouse Up" << LLView::sMouseHandlerMessage << llendl; - LLView::sMouseHandlerMessage = ""; } else { @@ -2641,6 +2646,8 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask) void LLViewerWindow::handleScrollWheel(S32 clicks) { + LLView::sMouseHandlerMessage = ""; + gMouseIdleTimer.reset(); // Hide tooltips @@ -2677,7 +2684,6 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) if (LLView::sDebugMouseHandling) { llinfos << "Scroll Wheel" << LLView::sMouseHandlerMessage << llendl; - LLView::sMouseHandlerMessage = ""; } return; } @@ -2719,6 +2725,8 @@ BOOL LLViewerWindow::handlePerFrameHover() { static std::string last_handle_msg; + LLView::sMouseHandlerMessage = ""; + //RN: fix for asynchronous notification of mouse leaving window not working LLCoordWindow mouse_pos; mWindow->getCursorPosition(&mouse_pos); @@ -2776,23 +2784,23 @@ BOOL LLViewerWindow::handlePerFrameHover() { gFocusMgr.releaseFocusIfNeeded(cur_focus); - LLView* parent = cur_focus->getParent(); - LLView* focus_root = cur_focus->findRootMostFocusRoot(); + LLUICtrl* parent = cur_focus->getParentUICtrl(); + const LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot(); while(parent) { if (parent->isCtrl() && - (((LLUICtrl*)parent)->hasTabStop() || parent == focus_root) && - !((LLUICtrl*)parent)->getIsChrome() && + (parent->hasTabStop() || parent == focus_root) && + !parent->getIsChrome() && parent->isInVisibleChain() && parent->isInEnabledChain()) { if (!parent->focusFirstItem()) { - ((LLUICtrl*)parent)->setFocus(TRUE); + parent->setFocus(TRUE); } break; } - parent = parent->getParent(); + parent = parent->getParentUICtrl(); } } else if (cur_focus->isFocusRoot()) @@ -2854,7 +2862,6 @@ BOOL LLViewerWindow::handlePerFrameHover() last_handle_msg = LLView::sMouseHandlerMessage; llinfos << "Hover" << LLView::sMouseHandlerMessage << llendl; } - LLView::sMouseHandlerMessage = ""; handled = TRUE; } else if (LLView::sDebugMouseHandling) @@ -3020,7 +3027,7 @@ BOOL LLViewerWindow::handlePerFrameHover() } // snap floaters to top of chat bar/button strip - LLView* chatbar_and_buttons = gOverlayBar->getChildByName("chatbar_and_buttons", TRUE); + LLView* chatbar_and_buttons = gOverlayBar->getChild<LLView>("chatbar_and_buttons", TRUE); if (chatbar_and_buttons) { // convert top/left corner of chatbar/buttons container to gFloaterView-relative coordinates @@ -3048,9 +3055,9 @@ BOOL LLViewerWindow::handlePerFrameHover() mLastMousePoint = mCurrentMousePoint; // last ditch force of edit menu to selection manager - if (gEditMenuHandler == NULL && gSelectMgr && gSelectMgr->getSelection()->getObjectCount()) + if (LLEditMenuHandler::gEditMenuHandler == NULL && gSelectMgr && gSelectMgr->getSelection()->getObjectCount()) { - gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = gSelectMgr; } if (gFloaterView->getCycleMode()) diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index b188c70b70..1abc1b165c 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -325,8 +325,8 @@ void LLWorldMapView::draw() sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(0.1f)); sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(0.1f)); - const S32 width = mRect.getWidth(); - const S32 height = mRect.getHeight(); + const S32 width = getRect().getWidth(); + const S32 height = getRect().getHeight(); const S32 half_width = width / 2; const S32 half_height = height / 2; LLVector3d camera_global = gAgent.getCameraPositionGlobal(); @@ -990,8 +990,8 @@ void LLWorldMapView::drawFrustum() F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 ); F32 half_width_pixels = half_width_meters * meters_to_pixels; - F32 ctr_x = mRect.getWidth() * 0.5f + sPanX; - F32 ctr_y = mRect.getHeight() * 0.5f + sPanY; + F32 ctr_x = getRect().getWidth() * 0.5f + sPanX; + F32 ctr_y = getRect().getHeight() * 0.5f + sPanY; LLGLSNoTexture gls_no_texture; @@ -1027,8 +1027,8 @@ LLVector3 LLWorldMapView::globalPosToView( const LLVector3d& global_pos ) // leave Z component in meters - pos_local.mV[VX] += mRect.getWidth() / 2 + sPanX; - pos_local.mV[VY] += mRect.getHeight() / 2 + sPanY; + pos_local.mV[VX] += getRect().getWidth() / 2 + sPanX; + pos_local.mV[VY] += getRect().getHeight() / 2 + sPanY; return pos_local; } @@ -1048,13 +1048,13 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& if( x < 0 || y < 0 - || x >= mRect.getWidth() - || y >= mRect.getHeight() ) + || x >= getRect().getWidth() + || y >= getRect().getHeight() ) { if (draw_arrow) { - drawTrackingCircle( mRect, x, y, color, 3, 15 ); - drawTrackingArrow( mRect, x, y, color ); + drawTrackingCircle( getRect(), x, y, color, 3, 15 ); + drawTrackingArrow( getRect(), x, y, color ); text_x = sTrackingArrowX; text_y = sTrackingArrowY; } @@ -1063,7 +1063,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& else if (LLTracker::getTrackingStatus() == LLTracker::TRACKING_LOCATION && LLTracker::getTrackedLocationType() != LLTracker::LOCATION_NOTHING) { - drawTrackingCircle( mRect, x, y, color, 3, 15 ); + drawTrackingCircle( getRect(), x, y, color, 3, 15 ); } else { @@ -1073,8 +1073,8 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& // clamp text position to on-screen const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2; S32 half_text_width = llfloor(font->getWidthF32(label) * 0.5f); - text_x = llclamp(text_x, half_text_width + TEXT_PADDING, mRect.getWidth() - half_text_width - TEXT_PADDING); - text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, mRect.getHeight() - llround(font->getLineHeight()) - TEXT_PADDING - vert_offset); + text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING); + text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - llround(font->getLineHeight()) - TEXT_PADDING - vert_offset); if (label != "") { @@ -1102,8 +1102,8 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& // If you change this, then you need to change LLTracker::getTrackedPositionGlobal() as well LLVector3d LLWorldMapView::viewPosToGlobal( S32 x, S32 y ) { - x -= llfloor((mRect.getWidth() / 2 + sPanX)); - y -= llfloor((mRect.getHeight() / 2 + sPanY)); + x -= llfloor((getRect().getWidth() / 2 + sPanX)); + y -= llfloor((getRect().getHeight() / 2 + sPanY)); LLVector3 pos_local( (F32)x, (F32)y, 0.f ); @@ -1448,8 +1448,8 @@ void LLWorldMapView::setDirectionPos( LLTextBox* text_box, F32 rotation ) // Rotation of 0 means x = 1, y = 0 on the unit circle. - F32 map_half_height = mRect.getHeight() * 0.5f; - F32 map_half_width = mRect.getWidth() * 0.5f; + F32 map_half_height = getRect().getHeight() * 0.5f; + F32 map_half_width = getRect().getWidth() * 0.5f; F32 text_half_height = text_box->getRect().getHeight() * 0.5f; F32 text_half_width = text_box->getRect().getWidth() * 0.5f; F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width ); @@ -1462,8 +1462,8 @@ void LLWorldMapView::setDirectionPos( LLTextBox* text_box, F32 rotation ) void LLWorldMapView::updateDirections() { - S32 width = mRect.getWidth(); - S32 height = mRect.getHeight(); + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); S32 text_height = mTextBoxNorth->getRect().getHeight(); S32 text_width = mTextBoxNorth->getRect().getWidth(); @@ -1695,7 +1695,7 @@ BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) S32 local_x, local_y; local_x = mMouseDownX + llfloor(sPanX - mMouseDownPanX); local_y = mMouseDownY + llfloor(sPanY - mMouseDownPanY); - LLRect clip_rect = mRect; + LLRect clip_rect = getRect(); clip_rect.stretch(-8); clip_rect.clipPointToRect(mMouseDownX, mMouseDownY, local_x, local_y); LLUI::setCursorPositionLocal(this, local_x, local_y); |