Added optional chat overlay to hide main chat bar (Firestorm / Chat / Autohide main chat bar)

ziree 2011-09-24 21:40:33 +02:00
parent c09d721617
commit 8e72998abd
5 changed files with 81 additions and 20 deletions

View File

@ -14,6 +14,17 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>AutohideChatBar</key>
<map>
<key>Comment</key>
<string>Hide the chat bar from the bottom button bar and only show it as an overlay when needed.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>GridListDownload</key>
<map>
<key>Comment</key>

View File

@ -201,10 +201,7 @@ public:
void onFocusLost()
{
if (gAgentCamera.cameraMouselook())
{
LLBottomTray::getInstance()->setVisible(FALSE);
}
setVisible(FALSE);
}
LLNearbyChatBar* mNearbyChatBar;
@ -225,6 +222,7 @@ LLBottomTray::LLBottomTray(const LLSD&)
mBottomTrayContextMenu(NULL),
mCamButton(NULL),
mBottomTrayLite(NULL),
mPopupChatBar(NULL),
mIsInLiteMode(false),
mDragStarted(false),
mDraggedItem(NULL),
@ -237,7 +235,6 @@ LLBottomTray::LLBottomTray(const LLSD&)
mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL);
buildFromFile("panel_bottomtray.xml");
// <AW: Flat cam floater>
// find this callback registered in llfloatercamera.cpp now
// LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
@ -251,8 +248,14 @@ LLBottomTray::LLBottomTray(const LLSD&)
mBottomTrayLite = new LLBottomTrayLite();
mBottomTrayLite->setFollowsAll();
mBottomTrayLite->setVisible(FALSE);
mPopupChatBar = new LLBottomTrayLite();
mPopupChatBar->setFollowsAll();
mPopupChatBar->setVisible(FALSE);
}
buildFromFile("panel_bottomtray.xml");
mImageDragIndication = LLUI::getUIImage(getString("DragIndicationImageName"));
mDesiredNearbyChatWidth = mNearbyChatBar ? mNearbyChatBar->getRect().getWidth() : 0;
}
@ -288,7 +291,13 @@ void* LLBottomTray::createNearbyChatBar(void* userdata)
LLNearbyChatBar* LLBottomTray::getNearbyChatBar()
{
return mIsInLiteMode ? mBottomTrayLite->mNearbyChatBar : mNearbyChatBar;
if(mIsInLiteMode)
return mBottomTrayLite->mNearbyChatBar;
if(gSavedSettings.getBOOL("AutohideChatBar"))
return mPopupChatBar->mNearbyChatBar;
return mNearbyChatBar;
}
LLIMChiclet* LLBottomTray::createIMChiclet(const LLUUID& session_id)
@ -421,6 +430,7 @@ void LLBottomTray::onMouselookModeOut()
mIsInLiteMode = false;
mBottomTrayLite->setVisible(FALSE);
mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText());
mPopupChatBar->mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText());
setVisible(TRUE);
}
@ -433,30 +443,38 @@ void LLBottomTray::onMouselookModeIn()
getParent()->addChild(mBottomTrayLite);
mBottomTrayLite->setShape(getLocalRect());
mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText());
if(gSavedSettings.getBOOL("AutohideChatBar"))
mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mPopupChatBar->mNearbyChatBar->getChatBox()->getText());
else
mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText());
mBottomTrayLite->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton"));
mIsInLiteMode = true;
}
//virtual
// setVisible used instead of onVisibilityChange, since LLAgent calls it on entering/leaving mouselook mode.
// If bottom tray is already visible in mouselook mode, then onVisibilityChange will not be called from setVisible(true),
void LLBottomTray::setVisible(BOOL visible)
void LLBottomTray::setChatBarVisible(BOOL visible)
{
if (mIsInLiteMode)
{
mBottomTrayLite->setVisible(visible);
}
else
else if(gSavedSettings.getBOOL("AutohideChatBar"))
{
LLPanel::setVisible(visible);
// Attach the lite bottom tray
if (getParent() && mPopupChatBar->getParent() != getParent())
getParent()->addChild(mPopupChatBar);
if(visible)
{
if(mPopupChatBar->getVisible())
return;
mPopupChatBar->setShape(getLocalRect());
mPopupChatBar->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton"));
}
mPopupChatBar->setVisible(visible);
}
//-TT 2.6.9 - removed?
//if(visible)
// gFloaterView->setSnapOffsetBottom(getRect().getHeight());
//else
// gFloaterView->setSnapOffsetBottom(0);
}
S32 LLBottomTray::notifyParent(const LLSD& info)
@ -649,9 +667,27 @@ BOOL LLBottomTray::postBuild()
mAOToggleButton->setCommitCallback(boost::bind(&LLBottomTray::toggleAO,this));
mAOToggleButton->setToggleState(gSavedPerAccountSettings.getBOOL("UseAO"));
// ## Zi: Animation Overrider
gSavedSettings.getControl("AutohideChatBar")->getSignal()->connect(boost::bind(&LLBottomTray::onAutohideChatBarChanged, this));
onAutohideChatBarChanged();
return TRUE;
}
void LLBottomTray::onAutohideChatBarChanged()
{
if(gSavedSettings.getBOOL("AutohideChatBar"))
{
mChatBarContainer->setVisible(FALSE);
mNearbyCharResizeHandlePanel->setVisible(FALSE);
}
else
{
mChatBarContainer->setVisible(TRUE);
mNearbyCharResizeHandlePanel->setVisible(TRUE);
}
}
//Drag-n-drop
void LLBottomTray::onDraggableButtonMouseDown(LLUICtrl* ctrl, S32 x, S32 y)

View File

@ -103,7 +103,7 @@ public:
virtual void reshape(S32 width, S32 height, BOOL called_from_parent);
virtual void setVisible(BOOL visible);
void setChatBarVisible(BOOL visible);
/*virtual*/ S32 notifyParent(const LLSD& info);
@ -536,6 +536,7 @@ protected:
void showSidebarPanel(const LLSD& panel_name);
//-TT
bool onContextMenuItemEnabled(const LLSD& userdata);
void onAutohideChatBarChanged();
// Either default or saved after user's manual resize width of nearby chat.
// Nearby chat will not always have it, because sometimes it can be shrunk on resize,
@ -552,6 +553,7 @@ protected:
LLButton* mCamButton;
LLButton* mMovementButton;
LLBottomTrayLite* mBottomTrayLite;
LLBottomTrayLite* mPopupChatBar;
LLButton* mAOToggleButton; // ## Zi: Animation Overrider
bool mIsInLiteMode;

View File

@ -917,7 +917,7 @@ void LLNearbyChatBar::startChat(const char* line)
if (!cb )
return;
bt->setVisible(TRUE);
bt->setChatBarVisible(TRUE);
cb->mChatBox->setFocus(TRUE);
if (line)
@ -943,6 +943,7 @@ void LLNearbyChatBar::stopChat()
if (!cb)
return;
bt->setChatBarVisible(FALSE);
cb->mChatBox->setFocus(FALSE);
// stop typing animation

View File

@ -900,6 +900,17 @@
text_color="White_25">
(requires restart)
</text>
<check_box
control_name="AutohideChatBar"
height="16"
initial_value="false"
label="Autohide Main Chatbar"
layout="topleft"
left="20"
name="AutohideChatBar"
tool_tip="Hide the chat bar from the bottom button bar and only show it as an overlay when needed."
top_pad="0"
width="256" />
<check_box
layout="topleft"
follows="left|top"