Avoid several excessive per-frame LLView::getChildView calls by instead caching the results in postBuild. (Added CachedUICtrl, which is basically just a self-nulling pointer to not have to make ui ctors dirtier)

This commit is contained in:
Shyotl
2012-08-03 20:51:53 -05:00
parent ef601d3345
commit d2b13f515d
20 changed files with 210 additions and 99 deletions

View File

@@ -1915,7 +1915,7 @@ void LLRender::flush()
}
}
void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
void LLRender::vertex4a(const LLVector4a& vertex)
{
//the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095]
if (mCount > 2048)
@@ -1937,15 +1937,13 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
if (mUIOffset.empty())
{
mVerticesp[mCount].set(x,y,z);
mVerticesp[mCount]=vertex;
}
else
{
//LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back());
LLVector4a& vert = mVerticesp[mCount];
vert.set(x,y,z);
vert.add(*mUIOffset.back());
vert.mul(*mUIScale.back());
mVerticesp[mCount].setAdd(vertex,*mUIOffset.back());
mVerticesp[mCount].mul(*mUIScale.back());
}
if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
@@ -2148,26 +2146,6 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLCo
mColorsp[mCount] = mColorsp[mCount-1];
}
void LLRender::vertex2i(const GLint& x, const GLint& y)
{
vertex3f((GLfloat) x, (GLfloat) y, 0);
}
void LLRender::vertex2f(const GLfloat& x, const GLfloat& y)
{
vertex3f(x,y,0);
}
void LLRender::vertex2fv(const GLfloat* v)
{
vertex3f(v[0], v[1], 0);
}
void LLRender::vertex3fv(const GLfloat* v)
{
vertex3f(v[0], v[1], v[2]);
}
void LLRender::texCoord2f(const GLfloat& x, const GLfloat& y)
{
mTexcoordsp[mCount] = LLVector2(x,y);

View File

@@ -364,12 +364,14 @@ public:
void begin(const GLuint& mode);
void end();
void vertex2i(const GLint& x, const GLint& y);
void vertex2f(const GLfloat& x, const GLfloat& y);
void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z);
void vertex2fv(const GLfloat* v);
void vertex3fv(const GLfloat* v);
LL_FORCE_INLINE void vertex2i(const GLint& x, const GLint& y) { vertex4a(LLVector4a((GLfloat)x,(GLfloat)y,0.f)); }
LL_FORCE_INLINE void vertex2f(const GLfloat& x, const GLfloat& y) { vertex4a(LLVector4a(x,y,0.f)); }
LL_FORCE_INLINE void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) { vertex4a(LLVector4a(x,y,z)); }
LL_FORCE_INLINE void vertex2fv(const GLfloat* v) { vertex4a(LLVector4a(v[0],v[1],0.f)); }
LL_FORCE_INLINE void vertex3fv(const GLfloat* v) { vertex4a(LLVector4a(v[0],v[1],v[2])); }
void vertex4a(const LLVector4a& v);
void texCoord2i(const GLint& x, const GLint& y);
void texCoord2f(const GLfloat& x, const GLfloat& y);
void texCoord2fv(const GLfloat* tc);

View File

@@ -187,6 +187,15 @@ public:
void initFromParams(const LLView::Params&);
template<typename T>
struct CachedUICtrl
{
CachedUICtrl():mPtr(NULL){}
T* connect(LLView* parent,const char* pName){return mPtr = parent->getChild<T>(pName);}
T* operator->(){return mPtr;}
operator T*() const{return mPtr;}
T* mPtr;
};
protected:
LLView(const LLView::Params&);
//friend class LLUICtrlFactory;

View File

@@ -165,6 +165,9 @@ BOOL LLChatBar::postBuild()
mInputEditor->setEnableLineHistory(TRUE);
}
mHistoryBtn.connect(this,"History");
mSayBtn.connect(this,"Say");
mIsBuilt = TRUE;
return TRUE;
@@ -228,9 +231,9 @@ void LLChatBar::refresh()
gAgent.stopTyping();
}
childSetValue("History", LLFloaterChat::instanceVisible(LLSD()));
mHistoryBtn->setValue(LLFloaterChat::instanceVisible(LLSD()));
childSetEnabled("Say", mInputEditor->getText().size() > 0);
mSayBtn->setEnabled(mInputEditor->getText().size() > 0);
//childSetEnabled("Shout", mInputEditor->getText().size() > 0); createDummyWidget Making Dummy -HgB
}

View File

@@ -110,6 +110,9 @@ protected:
LLComboBox* mGestureCombo;
LLChatBarGestureObserver* mObserver;
CachedUICtrl<LLButton> mHistoryBtn;
CachedUICtrl<LLButton> mSayBtn;
};
extern LLChatBar *gChatBar;

View File

@@ -353,6 +353,13 @@ BOOL LLPanelActiveSpeakers::postBuild()
childSetCommitCallback("moderator_allow_text", onModeratorMuteText, this);
childSetCommitCallback("moderation_mode", onChangeModerationMode, this);
mVolumeSlider.connect(this,"speaker_volume");
mModeratorCtrlLbl.connect(this,"moderator_controls_label");
mModeratorAllowVoiceCheckbox.connect(this,"moderator_allow_voice");
mModeratorAllowTextCheckbox.connect(this,"moderator_allow_text");
mModeratorModePanel.connect(this,"moderation_mode_panel");
mModeratorControlsPanel.connect(this,"moderator_controls");
// update speaker UI
handleSpeakerSelect();
@@ -618,25 +625,21 @@ void LLPanelActiveSpeakers::refreshSpeakers()
//&& !LLMuteList::getInstance()->isLinden(selected_speakerp->mDisplayName));
&& !LLMuteList::getInstance()->isLinden(selected_speakerp->mLegacyName));
}
childSetValue("speaker_volume", gVoiceClient->getUserVolume(selected_id));
childSetEnabled("speaker_volume", LLVoiceClient::voiceEnabled()
mVolumeSlider->setValue(gVoiceClient->getUserVolume(selected_id));
mVolumeSlider->setEnabled(LLVoiceClient::voiceEnabled()
&& gVoiceClient->getVoiceEnabled(selected_id)
&& selected_id.notNull()
&& selected_id != gAgent.getID()
&& (selected_speakerp.notNull() && (selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT || selected_speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL)));
childSetEnabled(
"moderator_controls_label",
selected_id.notNull());
mModeratorCtrlLbl->setEnabled(selected_id.notNull());
childSetEnabled(
"moderator_allow_voice",
mModeratorAllowVoiceCheckbox->setEnabled(
selected_id.notNull()
&& mSpeakerMgr->isVoiceActive()
&& gVoiceClient->getVoiceEnabled(selected_id));
childSetEnabled(
"moderator_allow_text",
mModeratorAllowTextCheckbox->setEnabled(
selected_id.notNull());
if (mProfileBtn)
@@ -661,8 +664,8 @@ void LLPanelActiveSpeakers::refreshSpeakers()
LLPointer<LLSpeaker> self_speakerp = mSpeakerMgr->findSpeaker(gAgent.getID());
if(self_speakerp)
{
childSetVisible("moderation_mode_panel", self_speakerp->mIsModerator && mSpeakerMgr->isVoiceActive());
childSetVisible("moderator_controls", self_speakerp->mIsModerator);
mModeratorModePanel->setVisible(self_speakerp->mIsModerator && mSpeakerMgr->isVoiceActive());
mModeratorControlsPanel->setVisible(self_speakerp->mIsModerator);
}
// keep scroll value stable

View File

@@ -46,6 +46,9 @@ class LLButton;
class LLPanelActiveSpeakers;
class LLSpeakerMgr;
class LLVoiceChannel;
class LLSlider;
class LLTextBox;
class LLCheckBoxCtrl;
// data for a given participant in a voice channel
@@ -296,6 +299,13 @@ protected:
LLPointer<SpeakerAddListener> mSpeakerAddListener;
LLPointer<SpeakerRemoveListener> mSpeakerRemoveListener;
LLPointer<SpeakerClearListener> mSpeakerClearListener;
CachedUICtrl<LLUICtrl> mVolumeSlider;
CachedUICtrl<LLTextBox> mModeratorCtrlLbl;
CachedUICtrl<LLCheckBoxCtrl> mModeratorAllowVoiceCheckbox;
CachedUICtrl<LLCheckBoxCtrl> mModeratorAllowTextCheckbox;
CachedUICtrl<LLPanel> mModeratorModePanel;
CachedUICtrl<LLPanel> mModeratorControlsPanel;
};

View File

@@ -135,9 +135,9 @@ void LLFloaterChat::draw()
{
// enable say and shout only when text available
childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel"));
mToggleActiveSpeakersBtn->setValue(mPanel->getVisible());
LLChatBar* chat_barp = getChild<LLChatBar>("chat_panel", TRUE);
LLChatBar* chat_barp = mChatPanel;
if (chat_barp)
{
chat_barp->refresh();
@@ -156,6 +156,9 @@ BOOL LLFloaterChat::postBuild()
{
chat_barp->setGestureCombo(getChild<LLComboBox>( "Gesture"));
}
mToggleActiveSpeakersBtn.connect(this,"toggle_active_speakers_btn");
mChatPanel.connect(this,"chat_panel");
return TRUE;
}

View File

@@ -50,6 +50,7 @@ class LLUUID;
class LLCheckBoxCtrl;
class LLPanelActiveSpeakers;
class LLLogChat;
class LLChatBar;
class LLFloaterChat
: public LLFloater, public LLUISingleton<LLFloaterChat, LLFloaterChat>
@@ -95,6 +96,9 @@ public:
LLPanelActiveSpeakers* mPanel;
BOOL mScrolledToEnd;
CachedUICtrl<LLButton> mToggleActiveSpeakersBtn;
CachedUICtrl<LLChatBar> mChatPanel;
};
#endif

View File

@@ -1411,6 +1411,15 @@ BOOL LLFloaterIMPanel::postBuild()
}
setDefaultBtn("send_btn");
mActiveSpeakersPanel.connect(this,"active_speakers_panel");
mToggleActiveSpeakersBtn.connect(this,"toggle_active_speakers_btn");
mVolumeSlider.connect(this,"speaker_volume");
mEndCallBtn.connect(this,"end_call_btn");
mStartCallBtn.connect(this,"start_call_btn");
mSendBtn.connect(this,"send_btn");
mMuteBtn.connect(this,"mute_btn");
return TRUE;
}
@@ -1466,10 +1475,10 @@ void LLFloaterIMPanel::draw()
&& mCallBackEnabled;
// hide/show start call and end call buttons
childSetVisible("end_call_btn", LLVoiceClient::voiceEnabled() && mVoiceChannel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
childSetVisible("start_call_btn", LLVoiceClient::voiceEnabled() && mVoiceChannel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
childSetEnabled("start_call_btn", enable_connect);
childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty());
mEndCallBtn->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
mStartCallBtn->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
mStartCallBtn->setEnabled(enable_connect);
mSendBtn->setEnabled(!childGetValue("chat_editor").asString().empty());
LLPointer<LLSpeaker> self_speaker = mSpeakers->findSpeaker(gAgent.getID());
if(!mTextIMPossible)
@@ -1497,10 +1506,10 @@ void LLFloaterIMPanel::draw()
// show speakers window when voice first connects
if (mShowSpeakersOnConnect && mVoiceChannel->isActive())
{
childSetVisible("active_speakers_panel", TRUE);
mActiveSpeakersPanel->setVisible(true);
mShowSpeakersOnConnect = FALSE;
}
childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel"));
mToggleActiveSpeakersBtn->setValue(mActiveSpeakersPanel->getVisible());
if (mTyping)
{
@@ -1531,11 +1540,11 @@ void LLFloaterIMPanel::draw()
else
{
// refresh volume and mute checkbox
childSetVisible("speaker_volume", LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive());
childSetValue("speaker_volume", gVoiceClient->getUserVolume(mOtherParticipantUUID));
mVolumeSlider->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive());
mVolumeSlider->setValue(gVoiceClient->getUserVolume(mOtherParticipantUUID));
childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
childSetVisible("mute_btn", LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive());
mMuteBtn->setValue(LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
mMuteBtn->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive());
}
LLFloater::draw();
}

View File

@@ -48,6 +48,8 @@ class LLInventoryItem;
class LLInventoryCategory;
class LLIMSpeakerMgr;
class LLPanelActiveSpeakers;
class LLPanel;
class LLButton;
class LLVoiceChannel : public LLVoiceClientStatusObserver
{
@@ -385,6 +387,13 @@ private:
boost::signals2::connection mFocusLostSignal;
CachedUICtrl<LLPanel> mActiveSpeakersPanel;
CachedUICtrl<LLButton> mToggleActiveSpeakersBtn;
CachedUICtrl<LLUICtrl> mVolumeSlider;
CachedUICtrl<LLButton> mEndCallBtn;
CachedUICtrl<LLButton> mStartCallBtn;
CachedUICtrl<LLButton> mSendBtn;
CachedUICtrl<LLButton> mMuteBtn;
void disableWhileSessionStarting();

View File

@@ -89,6 +89,16 @@ BOOL LLMediaRemoteCtrl::postBuild()
childSetAction("media_pause",LLOverlayBar::toggleMediaPlay,this);
childSetAction("music_pause",LLOverlayBar::toggleMusicPlay,this);
mMusicPlayBtn.connect(this,"music_play");
mMusicStopBtn.connect(this,"music_stop");
mMusicPauseBtn.connect(this,"music_pause");
mMediaPlayBtn.connect(this,"media_play");
mMediaStopBtn.connect(this,"media_stop");
mMediaPauseBtn.connect(this,"media_pause");
mMediaIcon.connect(this,"media_icon");
mMusicIcon.connect(this,"music_icon");
mExpandBtn.connect(this,"expand");
childSetAction("expand", onClickExpandBtn, this);
LLButton *pause = getChild<LLButton>("music_pause");
@@ -101,7 +111,7 @@ void LLMediaRemoteCtrl::draw()
{
enableMediaButtons();
LLButton* expand_button = getChild<LLButton>("expand");
LLButton* expand_button = mExpandBtn;
if (expand_button)
{
if (expand_button->getToggleState())
@@ -147,8 +157,8 @@ void LLMediaRemoteCtrl::setToolTip(const std::string& msg)
std::string tool_tip = LLMIMETypes::findToolTip(mime_type);
std::string play_tip = LLMIMETypes::findPlayTip(mime_type);
// childSetToolTip("media_stop", mControls->getString("stop_label") + "\n" + tool_tip);
childSetToolTip("media_icon", tool_tip);
childSetToolTip("media_play", play_tip);
mMediaIcon->setToolTip(tool_tip);
mMediaIcon->setToolTip(play_tip);
}
void LLMediaRemoteCtrl::enableMediaButtons()
@@ -227,13 +237,13 @@ void LLMediaRemoteCtrl::enableMediaButtons()
// Don't test the mime-type: this is not updated in a consistent basis. The existence of a valid gAudiop is enough guarantee.
}
const std::string media_icon_name = LLMIMETypes::findIcon(media_type);
LLButton* music_play_btn = getChild<LLButton>("music_play");
LLButton* music_stop_btn = getChild<LLButton>("music_stop");
LLButton* music_pause_btn = getChild<LLButton>("music_pause");
LLButton* media_play_btn = getChild<LLButton>("media_play");
LLButton* media_stop_btn = getChild<LLButton>("media_stop");
LLButton* media_pause_btn = getChild<LLButton>("media_pause");
LLIconCtrl* media_icon = getChild<LLIconCtrl>("media_icon");
LLButton* music_play_btn = mMusicPlayBtn;
LLButton* music_stop_btn = mMusicStopBtn;
LLButton* music_pause_btn = mMusicPauseBtn;
LLButton* media_play_btn = mMediaPlayBtn;
LLButton* media_stop_btn = mMediaPlayBtn;
LLButton* media_pause_btn = mMediaPauseBtn;
LLIconCtrl* media_icon = mMediaIcon;
music_play_btn->setEnabled(play_music_enabled);
music_stop_btn->setEnabled(stop_music_enabled);
@@ -262,7 +272,7 @@ void LLMediaRemoteCtrl::enableMediaButtons()
music_pause_btn->setToolTip(mCachedPauseTip);
}
childSetColor("music_icon", music_icon_color);
mMusicIcon->setColor(music_icon_color);
if(!media_icon_name.empty())
{
media_icon->setImage(media_icon_name);
@@ -273,7 +283,7 @@ void LLMediaRemoteCtrl::enableMediaButtons()
media_pause_btn->setEnabled(media_show_pause);
media_pause_btn->setVisible(media_show_pause);
media_play_btn->setVisible(! media_show_pause);
childSetColor("media_icon", media_icon_color);
mMediaIcon->setColor(media_icon_color);
setToolTip(media_url);
}

View File

@@ -36,6 +36,7 @@
#include "llpanel.h"
class LLButton;
class LLIconCtrl;
////////////////////////////////////////////////////////////////////////////////
//
@@ -61,6 +62,16 @@ protected:
void build();
std::string mCachedPauseTip;
CachedUICtrl<LLButton> mMusicPlayBtn;
CachedUICtrl<LLButton> mMusicStopBtn;
CachedUICtrl<LLButton> mMusicPauseBtn;
CachedUICtrl<LLButton> mMediaPlayBtn;
CachedUICtrl<LLButton> mMediaStopBtn;
CachedUICtrl<LLButton> mMediaPauseBtn;
CachedUICtrl<LLButton> mExpandBtn;
CachedUICtrl<LLIconCtrl> mMediaIcon;
CachedUICtrl<LLIconCtrl> mMusicIcon;
};
#endif

View File

@@ -189,7 +189,16 @@ BOOL LLOverlayBar::postBuild()
setFocusRoot(TRUE);
mBuilt = true;
mOriginalIMLabel = getChild<LLButton>("New IM")->getLabelSelected();
mChatbarAndButtons.connect(this,"chatbar_and_buttons");
mNewIM.connect(this,"New IM");
mNotBusy.connect(this,"Set Not Busy");
mMouseLook.connect(this,"Mouselook");
mStandUp.connect(this,"Stand Up");
mFlyCam.connect(this,"Flycam");
mChatBar.connect(this,"chat_bar");
mVoiceRemoteContainer.connect(this,"voice_remote_container");
mOriginalIMLabel = mNewIM->getLabelSelected();
layoutButtons();
@@ -203,6 +212,7 @@ BOOL LLOverlayBar::postBuild()
childSetVisible("AdvSettings_container_exp", sAdvSettingsPopup);
childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote"));
return TRUE;
}
@@ -214,6 +224,12 @@ LLOverlayBar::~LLOverlayBar()
// virtual
void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent)
{
S32 delta_width = width - getRect().getWidth();
S32 delta_height = height - getRect().getHeight();
if (!delta_width && !delta_height && !sForceReshape)
return;
LLView::reshape(width, height, called_from_parent);
if (mBuilt)
@@ -266,7 +282,7 @@ void LLOverlayBar::refresh()
BOOL im_received = gIMMgr->getIMReceived();
int unread_count = gIMMgr->getIMUnreadCount();
LLButton* button = getChild<LLButton>("New IM");
LLButton* button = mNewIM;
if ((button && button->getVisible() != im_received) ||
(button && button->getVisible()))
@@ -291,7 +307,7 @@ void LLOverlayBar::refresh()
}
BOOL busy = gAgent.getBusy();
button = getChild<LLButton>("Set Not Busy");
button = mNotBusy;
if (button && button->getVisible() != busy)
{
button->setVisible(busy);
@@ -301,7 +317,7 @@ void LLOverlayBar::refresh()
}
BOOL flycam = LLViewerJoystick::getInstance()->getOverrideCamera();
button = getChild<LLButton>("Flycam");
button = mFlyCam;
if (button && button->getVisible() != flycam)
{
button->setVisible(flycam);
@@ -313,7 +329,7 @@ void LLOverlayBar::refresh()
BOOL mouselook_grabbed;
mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX)
|| gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX);
button = getChild<LLButton>("Mouselook");
button = mMouseLook;
if (button && button->getVisible() != mouselook_grabbed)
{
@@ -331,7 +347,7 @@ void LLOverlayBar::refresh()
sitting = gAgentAvatarp->isSitting() && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT);
// [/RLVa:KB]
}
button = getChild<LLButton>("Stand Up");
button = mStandUp;
if (button && button->getVisible() != sitting)
{
@@ -355,7 +371,7 @@ void LLOverlayBar::refresh()
}
button = getChild<LLButton>("Cancel TP");
button = mCancelBtn;
if (button && button->getVisible() != teleporting)
{
@@ -398,11 +414,11 @@ void LLOverlayBar::refresh()
}
}
if(!in_mouselook)
childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled());
mVoiceRemoteContainer->setVisible(LLVoiceClient::voiceEnabled());
// always let user toggle into and out of chatbar
static const LLCachedControl<bool> chat_visible("ChatVisible",true);
childSetVisible("chat_bar", chat_visible);
mChatBar->setVisible(chat_visible);
if (buttons_changed)
{

View File

@@ -52,6 +52,7 @@ class LLSlider;
class LLVoiceRemoteCtrl;
class wlfPanel_AdvSettings;
class AORemoteCtrl;
class LLChatBar;
class LLOverlayBar
: public LLPanel
@@ -68,6 +69,8 @@ public:
// helpers for returning desired state
BOOL musicPlaying() { return mMusicState == PLAYING; }
LLView* getChatbarAndButtons() const {return mChatbarAndButtons;}
static void onClickIMReceived(void* data);
static void onClickSetNotBusy(void* data);
@@ -114,7 +117,14 @@ protected:
S32 mMusicState;
std::string mOriginalIMLabel;
CachedUICtrl<LLView> mChatbarAndButtons;
CachedUICtrl<LLButton> mNewIM;
CachedUICtrl<LLButton> mNotBusy;
CachedUICtrl<LLButton> mMouseLook;
CachedUICtrl<LLButton> mStandUp;
CachedUICtrl<LLButton> mFlyCam;
CachedUICtrl<LLChatBar> mChatBar;
CachedUICtrl<LLPanel> mVoiceRemoteContainer;
private:

View File

@@ -161,6 +161,13 @@ BOOL LLToolBar::postBuild()
childSetAction("inventory_btn", onClickInventory, this);
childSetControlName("inventory_btn", "ShowInventory");
mCommunicateBtn.connect(this, "communicate_btn");
mFlyBtn.connect(this, "fly_btn");
mBuildBtn.connect(this, "build_btn");
mMapBtn.connect(this, "map_btn");
mRadarBtn.connect(this, "radar_btn");
mInventoryBtn.connect(this, "inventory_button");
for (child_list_const_iter_t child_iter = getChildList()->begin();
child_iter != getChildList()->end(); ++child_iter)
{
@@ -292,7 +299,9 @@ void LLToolBar::refresh()
if(!isAgentAvatarValid())
return;
BOOL show = gSavedSettings.getBOOL("ShowToolBar");
static LLCachedControl<bool> show("ShowToolBar", true);
static LLCachedControl<bool> ascent_fly_always_enabled("AscentFlyAlwaysEnabled", true);
static LLCachedControl<bool> ascent_build_always_enabled("AscentBuildAlwaysEnabled", true);
BOOL mouselook = gAgentCamera.cameraMouselook();
setVisible(show && !mouselook);
@@ -302,9 +311,8 @@ void LLToolBar::refresh()
sitting = gAgentAvatarp->isSitting();
}
childSetEnabled("fly_btn", (gAgent.canFly() || gAgent.getFlying() || gSavedSettings.getBOOL("AscentFlyAlwaysEnabled")) && !sitting );
childSetEnabled("build_btn", (LLViewerParcelMgr::getInstance()->allowAgentBuild() || gSavedSettings.getBOOL("AscentBuildAlwaysEnabled")) );
mFlyBtn->setEnabled((gAgent.canFly() || gAgent.getFlying() || ascent_fly_always_enabled) && !sitting );
mBuildBtn->setEnabled((LLViewerParcelMgr::getInstance()->allowAgentBuild() || ascent_build_always_enabled));
// Check to see if we're in build mode
BOOL build_mode = LLToolMgr::getInstance()->inEdit();
@@ -323,11 +331,11 @@ void LLToolBar::refresh()
{
// If we're rez-restricted, we can still edit => allow build floater
// If we're edit-restricted, we can still rez => allow build floater
childSetEnabled("build_btn", !(gRlvHandler.hasBehaviour(RLV_BHVR_REZ) && gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) );
mBuildBtn->setEnabled(!(gRlvHandler.hasBehaviour(RLV_BHVR_REZ) && gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)));
childSetEnabled("map_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP) );
childSetEnabled("radar_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP) );
childSetEnabled("inventory_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV) );
mMapBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP));
mRadarBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP));
mInventoryBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV));
}
// [/RLVa:KB]
@@ -339,7 +347,7 @@ void LLToolBar::refresh()
void LLToolBar::updateCommunicateList()
{
LLFlyoutButton* communicate_button = getChild<LLFlyoutButton>("communicate_btn");
LLFlyoutButton* communicate_button = mCommunicateBtn;
LLSD selected = communicate_button->getValue();
communicate_button->removeall();

View File

@@ -44,6 +44,8 @@ extern S32 TOOL_BAR_HEIGHT;
class LLFakeResizeHandle;
#endif // LL_DARWIN
class LLFlyoutButton;
class LLToolBar
: public LLPanel
{
@@ -97,6 +99,13 @@ private:
#if LL_DARWIN
LLFakeResizeHandle *mResizeHandle;
#endif // LL_DARWIN
CachedUICtrl<LLFlyoutButton> mCommunicateBtn;
CachedUICtrl<LLButton> mFlyBtn;
CachedUICtrl<LLButton> mBuildBtn;
CachedUICtrl<LLButton> mMapBtn;
CachedUICtrl<LLButton> mRadarBtn;
CachedUICtrl<LLButton> mInventoryBtn;
};
extern LLToolBar *gToolBar;

View File

@@ -3094,7 +3094,7 @@ void LLViewerWindow::updateUI()
}
// snap floaters to top of chat bar/button strip
LLView* chatbar_and_buttons = gOverlayBar->getChild<LLView>("chatbar_and_buttons", TRUE);
LLView* chatbar_and_buttons = gOverlayBar->getChatbarAndButtons();
// find top of chatbar and state buttons, if either are visible
if (chatbar_and_buttons && chatbar_and_buttons->getLocalBoundingRect().notEmpty())
{

View File

@@ -90,7 +90,12 @@ BOOL LLVoiceRemoteCtrl::postBuild()
childSetAction("voice_channel_bg", onClickVoiceChannel, this);
mEndCallBtn.connect(this,"end_call_btn");
mVoiceVolIcon.connect(this,"voice_volume");
mVoiceChanIcon.connect(this,"voice_channel_icon");
mVoiceChanBgBtn.connect(this,"voice_channel_bg");
mChanLabelTextBox.connect(this,"channel_label");
mShowChanBtn.connect(this,"show_channel");
return TRUE;
}
@@ -106,14 +111,15 @@ void LLVoiceRemoteCtrl::draw()
mTalkBtn->setEnabled(voice_active);
mTalkLockBtn->setEnabled(voice_active);
static LLCachedControl<bool> ptt_currently_enabled("PPTCurrentlyEnabled",false);
// propagate ptt state to button display,
if (!mTalkBtn->hasMouseCapture())
{
// not in push to talk mode, or push to talk is active means I'm talking
mTalkBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled") || gVoiceClient->getUserPTTState());
mTalkBtn->setToggleState(!ptt_currently_enabled || gVoiceClient->getUserPTTState());
}
mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD()));
mTalkLockBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
mTalkLockBtn->setToggleState(!ptt_currently_enabled);
std::string talk_blip_image;
if (gVoiceClient->getIsSpeaking(gAgent.getID()))
@@ -148,7 +154,7 @@ void LLVoiceRemoteCtrl::draw()
talk_blip_image = "icn_voice_ptt-off.tga";
}
LLIconCtrl* icon = getChild<LLIconCtrl>("voice_volume");
LLIconCtrl* icon = mVoiceVolIcon;
if (icon)
{
icon->setImage(talk_blip_image);
@@ -162,23 +168,23 @@ void LLVoiceRemoteCtrl::draw()
}
LLVoiceChannel* current_channel = LLVoiceChannel::getCurrentVoiceChannel();
childSetEnabled("end_call_btn", LLVoiceClient::voiceEnabled()
mEndCallBtn->setEnabled(LLVoiceClient::voiceEnabled()
&& current_channel
&& current_channel->isActive()
&& current_channel != LLVoiceChannelProximal::getInstance());
childSetValue("channel_label", active_channel_name);
childSetToolTip("voice_channel_bg", active_channel_name);
mChanLabelTextBox->setValue(active_channel_name);
mVoiceChanBgBtn->setToolTip(active_channel_name);
if (current_channel)
{
LLIconCtrl* voice_channel_icon = getChild<LLIconCtrl>("voice_channel_icon");
LLIconCtrl* voice_channel_icon = mVoiceChanIcon;
if (voice_channel_icon && voice_floater)
{
voice_channel_icon->setImage(voice_floater->getString("voice_icon"));
}
LLButton* voice_channel_bg = getChild<LLButton>("voice_channel_bg");
LLButton* voice_channel_bg = mVoiceChanBgBtn;
if (voice_channel_bg)
{
LLColor4 bg_color;
@@ -198,7 +204,7 @@ void LLVoiceRemoteCtrl::draw()
}
}
LLButton* expand_button = getChild<LLButton>("show_channel");
LLButton* expand_button = mShowChanBtn;
if (expand_button)
{
if (expand_button->getToggleState())

View File

@@ -36,6 +36,8 @@
#include "llpanel.h"
class LLButton;
class LLIconCtrl;
class LLTextBox;
class LLVoiceRemoteCtrl : public LLPanel
{
@@ -59,6 +61,12 @@ protected:
LLButton* mTalkBtn;
LLButton* mTalkLockBtn;
LLButton* mSpeakersBtn;
CachedUICtrl<LLButton> mEndCallBtn;
CachedUICtrl<LLIconCtrl> mVoiceVolIcon;
CachedUICtrl<LLIconCtrl> mVoiceChanIcon;
CachedUICtrl<LLButton> mVoiceChanBgBtn;
CachedUICtrl<LLTextBox> mChanLabelTextBox;
CachedUICtrl<LLButton> mShowChanBtn;
};
#endif // LL_LLVOICEREMOTECTRL_H