Created branch for docking window state work. Currently not suitable for everyday use because of very very ugly code, debugging output and a few code flaws, so I put it in a branch to keep workign on it.

--HG--
branch : Docking_Window_States_Branch
meow-7.2.2
ziree 2011-05-06 18:21:25 +02:00
parent 33031f64f0
commit aab64557b6
10 changed files with 91 additions and 22 deletions

View File

@ -245,7 +245,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
mAutoFocus(TRUE), // automatically take focus when opened
mCanDock(false),
mDocked(false),
mTornOff(false),
mTornOff(true),
mHasBeenDraggedWhileMinimized(FALSE),
mPreviousMinimizedBottom(0),
mPreviousMinimizedLeft(0),
@ -529,9 +529,11 @@ LLFloater::~LLFloater()
void LLFloater::storeRectControl()
{
if( mRectControl.size() > 1 )
llwarns << getName() << " LLFloater::storeRectControl() " << mTornOff << " " << getHost() << llendl;
if( mTornOff && mRectControl.size() > 1 )
{
getControlGroup()->setRect( mRectControl, getRect() );
llwarns << getName() << " stored " << getRect() << llendl;
}
}
@ -561,6 +563,7 @@ void LLFloater::storeMinimizeStateControl()
LLRect LLFloater::getSavedRect() const
{
llwarns << getName() << " LLFloater::getSavedRect()" << llendl;
LLRect rect;
if (mRectControl.size() > 1)
@ -568,6 +571,8 @@ LLRect LLFloater::getSavedRect() const
rect = getControlGroup()->getRect(mRectControl);
}
llwarns << getName() << " rect " << rect << llendl;
return rect;
}
@ -851,7 +856,7 @@ void LLFloater::applyRectControl()
}
// override center if we have saved rect control
if (mRectControl.size() > 1)
if (mTornOff && mRectControl.size() > 1)
{
const LLRect& rect = getControlGroup()->getRect(mRectControl);
if (rect.getWidth() > 0 && rect.getHeight() > 0)
@ -1575,26 +1580,44 @@ void LLFloater::onClickTearOff(LLFloater* self)
LLMultiFloater* host_floater = self->getHost();
if (host_floater) //Tear off
{
llwarns << self->getName() << " tear off" << llendl;
LLRect new_rect;
host_floater->removeFloater(self);
// reparent to floater view
gFloaterView->addChild(self);
self->openFloater(self->getKey());
// only force position for floaters that don't have that data saved
if (self->mRectControl.size() <= 1)
// if (self->getRect().isEmpty())
{
new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - floater_header_size - 5, self->getRect().getWidth(), self->getRect().getHeight());
self->setRect(new_rect);
new_rect=self->getExpandedRect();
if(new_rect.isEmpty())
{
llwarns << "no rect saved yet, so reshape the floater" << llendl;
new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - floater_header_size - 5, self->getRect().getWidth(), self->getRect().getHeight());
}
self->setShape(new_rect);
self->storeRectControl();
}
else
{
self->setShape(self->getSavedRect(),FALSE);
llwarns <<self->getName() << " restored rect: " << self->getSavedRect() << llendl;
}
gFloaterView->adjustToFitScreen(self, FALSE);
// give focus to new window to keep continuity for the user
self->setFocus(TRUE);
self->setTornOff(true);
}
else //Attach to parent.
{
self->storeRectControl();
self->setExpandedRect(self->getRect());
llwarns << self->getName() << " stored rect " << self->getRect() << llendl;
self->setTornOff(false);
LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get();
if (new_host)
{
@ -1603,7 +1626,6 @@ void LLFloater::onClickTearOff(LLFloater* self)
// make sure host is visible
new_host->openFloater(new_host->getKey());
}
self->setTornOff(false);
}
self->updateTitleButtons();
}

View File

@ -431,13 +431,16 @@ void LLFloaterReg::registerControlVariables()
for (build_map_t::iterator iter = sBuildMap.begin(); iter != sBuildMap.end(); ++iter)
{
const std::string& name = iter->first;
llwarns << name << llendl;
if (LLFloater::getControlGroup()->controlExists(getRectControlName(name)))
{
declareRectControl(name);
llwarns << "rect " << name << llendl;
}
if (LLFloater::getControlGroup()->controlExists(getVisibilityControlName(name)))
{
declareVisibilityControl(name);
llwarns << "vis " << name << llendl;
}
}

View File

@ -109,7 +109,7 @@ LLFloaterChatterBox::~LLFloaterChatterBox()
BOOL LLFloaterChatterBox::postBuild()
{
setVisibleCallback(boost::bind(&LLFloaterChatterBox::onVisibilityChange, this, _2));
llwarns << __LINE__ << llendl;
if (gSavedSettings.getBOOL("ContactsTornOff"))
{
LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance();

View File

@ -828,6 +828,14 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
if (gSavedSettings.getBOOL("ContactsTornOff"))
{
floater->setHost(floater_container);
gFloaterView->addChild(floater);
floater->setTornOff(TRUE);
}
else
// do not add existed floaters to avoid adding torn off instances
if (!exist)
{
@ -867,8 +875,8 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
}
// window is positioned, now we can show it.
floater->setVisible(TRUE);
}
floater->setVisible(TRUE);
return floater;
}

View File

@ -71,26 +71,37 @@ void LLIMFloaterContainer::onOpen(const LLSD& key)
LLMultiFloater::onOpen(key);
llwarns << __LINE__ << llendl;
// If we're using multitabs, and we open up for the first time
// Add localchat by default if it's not already on the screen somewhere else. -AO
// But only if it hasnt been already so we can reopen it to the same tab -KC
LLFloater* floater = LLNearbyChat::getInstance();
llwarns << __LINE__ << llendl;
if (! LLFloater::isVisible(floater) && (floater->getHost() != this))
{
llwarns << __LINE__ << llendl;
if (gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
llwarns << __LINE__ << llendl;
// const LLRect rect=floater->getRect();
floater->setHost(this);
// add then remove to set up relationship for re-attach
LLMultiFloater::showFloater(floater);
removeFloater(floater);
// LLMultiFloater::showFloater(floater);
// removeFloater(floater);
// reparent to floater view
gFloaterView->addChild(floater);
floater->setTornOff(TRUE);
// floater->setShape(rect);
}
else
{
llwarns << __LINE__ << llendl;
floater->setTornOff(FALSE);
LLMultiFloater::showFloater(floater);
}
}
llwarns << __LINE__ << llendl;
/*
@ -118,6 +129,7 @@ void LLIMFloaterContainer::removeFloater(LLFloater* floaterp)
{
// only chat floater now locked
mTabContainer->lockTabs(mTabContainer->getNumLockedTabs() - 1);
gSavedSettings.setBOOL("ContactsTornOff", TRUE);
}
LLMultiFloater::removeFloater(floaterp);
}
@ -143,9 +155,11 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
if (floaterp->getName() == "imcontacts")
{
LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::START);
gSavedSettings.setBOOL("ContactsTornOff", FALSE);
}
else
{
llwarns << floaterp->getName() << " adding with rect " << floaterp->getRect() << llendl;
// add chat history as second tab if contact window is present, first tab otherwise
if (getChildView("imcontacts"))
{
@ -158,6 +172,7 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
{
LLMultiFloater::addFloater(floaterp, select_added_floater, LLTabContainer::START);
}
llwarns << floaterp->getName() << " added. rect now " << floaterp->getRect() << llendl;
gSavedSettings.setBOOL("ChatHistoryTornOff", FALSE);
}
// make sure first two tabs are now locked

View File

@ -164,28 +164,40 @@ BOOL LLNearbyChat::postBuild()
LLButton* slide_right = getChild<LLButton>("slide_right_btn");
slide_right->setVisible(false);
llwarns << __LINE__ << llendl;
if (getDockControl() == NULL)
{
llwarns << __LINE__ << llendl;
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
if (floater_container)
{
llwarns << __LINE__ << llendl;
if (gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
llwarns << __LINE__ << llendl;
// BOOL visible=LLFloater::isVisible(floater_container);
// add then remove to set up relationship for re-attach
floater_container->addFloater(this, FALSE);
floater_container->removeFloater(this);
// reparent to floater view
// floater_container->addFloater(this, FALSE);
// floater_container->removeFloater(this);
// reparent to floater view
setHost(floater_container);
gFloaterView->addChild(this);
// setTornOff(TRUE);
}
else
{
llwarns << __LINE__ << llendl;
setTornOff(FALSE);
floater_container->addFloater(this, FALSE);
}
llwarns << __LINE__ << llendl;
floater_container->setVisible(FALSE);
}
}
PhoenixUseNearbyChatConsole = gSavedSettings.getBOOL("PhoenixUseNearbyChatConsole");
PhoenixUseNearbyChatConsole = gSavedSettings.getBOOL("PhoenixUseNearbyChatConsole");
gSavedSettings.getControl("PhoenixUseNearbyChatConsole")->getSignal()->connect(boost::bind(&LLNearbyChat::updatePhoenixUseNearbyChatConsole, this, _2));
return LLDockableFloater::postBuild();
@ -210,6 +222,8 @@ BOOL LLNearbyChat::postBuild()
return true;
}
/*
void LLNearbyChat::applySavedVariables()
{
if (mRectControl.size() > 1)
@ -222,7 +236,6 @@ void LLNearbyChat::applySavedVariables()
}
}
if(!LLFloater::getControlGroup()->controlExists(mDocStateControl))
{
setDocked(true);
@ -236,6 +249,7 @@ void LLNearbyChat::applySavedVariables()
}
}
}
*/
@ -340,7 +354,7 @@ void LLNearbyChat::openFloater(const LLSD& key)
if(isChatMultiTab())
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
if (floater_container)
if (floater_container && !gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
floater_container->showFloater(this, LLTabContainer::START);
}
@ -373,7 +387,7 @@ void LLNearbyChat::onOpen(const LLSD& key )
if(isChatMultiTab() && ! isVisible(this))
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
if (floater_container)
if (floater_container && !gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
floater_container->showFloater(this, LLTabContainer::START);
}

View File

@ -81,7 +81,7 @@ public:
void updatePhoenixUseNearbyChatConsole(const LLSD &data);
private:
virtual void applySavedVariables();
// virtual void applySavedVariables();
void getAllowedRect (LLRect& rect);

View File

@ -8,6 +8,7 @@
name="floater_im_box"
save_rect="true"
save_visibility="true"
save_dock_state="true"
single_instance="true"
title="CONVERSATIONS"
width="396">

View File

@ -8,12 +8,15 @@
layout="topleft"
left="0"
name="nearby_chat"
title="NEARBY CHAT"
title="NEARBY CHAT CB"
top="0"
can_dock="false"
can_close="true"
can_minimize="false"
single_instance="true"
save_rect="true"
save_visibility="true"
save_dock_state="true"
visible="false"
width="394"
can_resize="true"

View File

@ -8,12 +8,15 @@
layout="topleft"
left="0"
name="nearby_chat"
title="NEARBY CHAT"
title="NEARBY CHAT N"
top="0"
can_dock="false"
can_close="true"
can_minimize="false"
single_instance="true"
save_rect="true"
save_visibility="true"
save_dock_state="true"
visible="false"
width="394"
can_resize="true"