Added option for edge snapping based on the legacy method of toolbars changing the edge offsets
Includes one hack for chatbar being unable to return its own height correctly
parent
d9efa25951
commit
661f9aacd7
|
|
@ -2357,6 +2357,8 @@ LLFloaterView::LLFloaterView (const Params& p)
|
|||
mFocusCycleMode(FALSE),
|
||||
mMinimizePositionVOffset(0),
|
||||
mSnapOffsetBottom(0),
|
||||
mSnapOffsetChatBar(0),
|
||||
mSnapOffsetLeft(0),
|
||||
mSnapOffsetRight(0)
|
||||
{
|
||||
mSnapView = getHandle();
|
||||
|
|
@ -3012,11 +3014,23 @@ LLRect LLFloaterView::getSnapRect() const
|
|||
{
|
||||
LLRect snap_rect = getLocalRect();
|
||||
|
||||
// <FS:KC> Fix for bad edge snapping
|
||||
static LLUICachedControl<bool> legacy_snap ("FSLegacyEdgeSnap", false);
|
||||
if (legacy_snap)
|
||||
{
|
||||
snap_rect.mBottom += (mSnapOffsetBottom + mSnapOffsetChatBar);
|
||||
snap_rect.mLeft += mSnapOffsetLeft;
|
||||
snap_rect.mRight -= mSnapOffsetRight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// <\FS:KC> Fix for bad edge snapping
|
||||
LLView* snap_view = mSnapView.get();
|
||||
if (snap_view)
|
||||
{
|
||||
snap_view->localRectToOtherView(snap_view->getLocalRect(), &snap_rect, this);
|
||||
}
|
||||
}// <FS:KC> Fix for bad edge snapping
|
||||
|
||||
return snap_rect;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -588,6 +588,13 @@ public:
|
|||
void setFloaterSnapView(LLHandle<LLView> snap_view) {mSnapView = snap_view; }
|
||||
LLFloater* getFrontmostClosableFloater();
|
||||
|
||||
// <FS:KC> Fix for bad edge snapping
|
||||
void setSnapOffsetBottom(S32 offset) { mSnapOffsetBottom = offset; }
|
||||
void setSnapOffsetChatBar(S32 offset) { mSnapOffsetChatBar = offset; }
|
||||
void setSnapOffsetRight(S32 offset) { mSnapOffsetRight = offset; }
|
||||
void setSnapOffsetLeft(S32 offset) { mSnapOffsetLeft = offset; }
|
||||
// </FS:KC> Fix for bad edge snapping
|
||||
|
||||
private:
|
||||
void hiddenFloaterClosed(LLFloater* floater);
|
||||
|
||||
|
|
@ -595,6 +602,8 @@ private:
|
|||
LLHandle<LLView> mSnapView;
|
||||
BOOL mFocusCycleMode;
|
||||
S32 mSnapOffsetBottom;
|
||||
S32 mSnapOffsetChatBar; // <FS:KC> Fix for bad edge snapping
|
||||
S32 mSnapOffsetLeft; // <FS:KC> Fix for bad edge snapping
|
||||
S32 mSnapOffsetRight;
|
||||
S32 mMinimizePositionVOffset;
|
||||
typedef std::vector<std::pair<LLHandle<LLFloater>, boost::signals2::connection> > hidden_floaters_t;
|
||||
|
|
|
|||
|
|
@ -919,6 +919,21 @@ void LLToolBar::updateLayoutAsNeeded()
|
|||
mEndCenteringPanel->setVisible(FALSE);
|
||||
}
|
||||
// <FS:Zi>
|
||||
|
||||
// <FS:KC> Fix for bad edge snapping
|
||||
if (mSideType == SIDE_BOTTOM)
|
||||
{
|
||||
gFloaterView->setSnapOffsetBottom(mButtons.empty() ? 0 : getRect().getHeight());
|
||||
}
|
||||
else if (mSideType == SIDE_LEFT)
|
||||
{
|
||||
gFloaterView->setSnapOffsetLeft(mButtons.empty() ? 0 : getRect().getWidth());
|
||||
}
|
||||
else if (mSideType == SIDE_RIGHT)
|
||||
{
|
||||
gFloaterView->setSnapOffsetRight(mButtons.empty() ? 0 : getRect().getWidth());
|
||||
}
|
||||
// </FS:KC> Fix for bad edge snapping
|
||||
|
||||
if (!mButtons.empty())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20445,5 +20445,16 @@ Change of this parameter will affect the layout of buttons in notification toast
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>FSLegacyEdgeSnap</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Use old method for adjusting edge snap regions.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
</map>
|
||||
</llsd>
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@
|
|||
// </FS:Zi>
|
||||
#include "fscommon.h"
|
||||
|
||||
// <FS:KC> Fix for bad edge snapping
|
||||
// *HACK* chat bar cannot return its correct height for some reason
|
||||
static const S32 MAGIC_CHAT_BAR_PAD = 5;
|
||||
// </FS:KC> Fix for bad edge snapping
|
||||
|
||||
//<FS:TS> FIRE-787: break up too long chat lines into multiple messages
|
||||
void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel);
|
||||
void really_send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel);
|
||||
|
|
@ -504,6 +509,16 @@ void FSNearbyChat::showDefaultChatBar(BOOL visible,const char* text) const
|
|||
mDefaultChatBar->setVisible(visible);
|
||||
mDefaultChatBar->setFocus(visible);
|
||||
|
||||
// <FS:KC> Fix for bad edge snapping
|
||||
if(visible)
|
||||
{
|
||||
gFloaterView->setSnapOffsetChatBar(mDefaultChatBar->getRect().getHeight() + MAGIC_CHAT_BAR_PAD);
|
||||
}
|
||||
else
|
||||
{
|
||||
gFloaterView->setSnapOffsetChatBar(0);
|
||||
}
|
||||
|
||||
if(!text)
|
||||
return;
|
||||
|
||||
|
|
@ -512,6 +527,7 @@ void FSNearbyChat::showDefaultChatBar(BOOL visible,const char* text) const
|
|||
mDefaultChatBar->setText(LLStringExplicit(text));
|
||||
mDefaultChatBar->setCursorToEnd();
|
||||
}
|
||||
// </FS:KC> Fix for bad edge snapping
|
||||
}
|
||||
|
||||
// We want to know which nearby chat editor (if any) currently has focus
|
||||
|
|
|
|||
Loading…
Reference in New Issue