[Floater Flexibility] Part three and a half: Toolbar code cleanup, toolbar in mouselook option
Go into Preferences->Input and Camera, to find the new option~ Thanks to Cinder for checking that the mac changes build and look nice.
This commit is contained in:
@@ -834,6 +834,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<boolean>0</boolean>
|
<boolean>0</boolean>
|
||||||
</map>
|
</map>
|
||||||
|
<key>LiruMouselookHidesToolbar</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Whether or not the toolbar will be hidden in mouselook</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<boolean>1</boolean>
|
||||||
|
</map>
|
||||||
<key>LiruMouselookMenu</key>
|
<key>LiruMouselookMenu</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
|
|||||||
@@ -66,15 +66,21 @@
|
|||||||
class LLFakeResizeHandle : public LLResizeHandle
|
class LLFakeResizeHandle : public LLResizeHandle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLFakeResizeHandle(const LLResizeHandle::Params& p)
|
LLFakeResizeHandle(const LLResizeHandle::Params& p) : LLResizeHandle(p) {}
|
||||||
: LLResizeHandle(p)
|
|
||||||
|
virtual BOOL handleHover(S32 x, S32 y, MASK mask) { return false; }
|
||||||
|
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return false; }
|
||||||
|
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) { return false; }
|
||||||
|
virtual void reshape(S32 width, S32 height, BOOL called_from_parent)
|
||||||
{
|
{
|
||||||
|
// Only when running in windowed mode on the Mac, leave room for a resize widget on the right edge of the bar.
|
||||||
|
if (gViewerWindow->getWindow()->getFullscreen())
|
||||||
|
return setVisible(false);
|
||||||
|
|
||||||
|
setVisible(true);
|
||||||
|
const F32 wide(gViewerWindow->getWindowWidth() + 2);
|
||||||
|
setRect(LLRect(wide - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, wide, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual BOOL handleHover(S32 x, S32 y, MASK mask) { return FALSE; };
|
|
||||||
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
|
|
||||||
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) { return FALSE; };
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_DARWIN
|
#endif // LL_DARWIN
|
||||||
@@ -98,9 +104,6 @@ void show_floater(const std::string& floater_name);
|
|||||||
|
|
||||||
LLToolBar::LLToolBar()
|
LLToolBar::LLToolBar()
|
||||||
: LLLayoutPanel()
|
: LLLayoutPanel()
|
||||||
#if LL_DARWIN
|
|
||||||
, mResizeHandle(NULL)
|
|
||||||
#endif // LL_DARWIN
|
|
||||||
{
|
{
|
||||||
setIsChrome(TRUE);
|
setIsChrome(TRUE);
|
||||||
setFocusRoot(TRUE);
|
setFocusRoot(TRUE);
|
||||||
@@ -130,22 +133,16 @@ BOOL LLToolBar::postBuild()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if LL_DARWIN
|
#if LL_DARWIN
|
||||||
if(mResizeHandle == NULL)
|
|
||||||
{
|
|
||||||
LLResizeHandle::Params p;
|
LLResizeHandle::Params p;
|
||||||
p.rect(LLRect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT));
|
p.rect(LLRect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT));
|
||||||
p.name(std::string(""));
|
p.name(std::string(""));
|
||||||
p.min_width(RESIZE_HANDLE_WIDTH);
|
p.min_width(RESIZE_HANDLE_WIDTH);
|
||||||
p.min_height(RESIZE_HANDLE_HEIGHT);
|
p.min_height(RESIZE_HANDLE_HEIGHT);
|
||||||
p.corner(LLResizeHandle::RIGHT_BOTTOM);
|
p.corner(LLResizeHandle::RIGHT_BOTTOM);
|
||||||
mResizeHandle = new LLFakeResizeHandle(p); this->addChildInBack(mResizeHandle);
|
addChildInBack(new LLFakeResizeHandle(p));
|
||||||
LLLayoutStack* toolbar_stack = getChild<LLLayoutStack>("toolbar_stack");
|
reshape(getRect().getWidth(), getRect().getHeight());
|
||||||
toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight());
|
|
||||||
}
|
|
||||||
#endif // LL_DARWIN
|
#endif // LL_DARWIN
|
||||||
|
|
||||||
layoutButtons();
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,18 +158,18 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
|
|||||||
EAcceptance* accept,
|
EAcceptance* accept,
|
||||||
std::string& tooltip_msg)
|
std::string& tooltip_msg)
|
||||||
{
|
{
|
||||||
LLButton* inventory_btn = getChild<LLButton>("inventory_btn");
|
LLButton* inventory_btn = mInventoryBtn;
|
||||||
if (!inventory_btn || !inventory_btn->getVisible()) return FALSE;
|
if (!inventory_btn || !inventory_btn->getVisible()) return FALSE;
|
||||||
|
|
||||||
LLInventoryView* active_inventory = LLInventoryView::getActiveInventory();
|
LLInventoryView* active_inventory = LLInventoryView::getActiveInventory();
|
||||||
|
|
||||||
if (active_inventory && active_inventory->getVisible())
|
if (active_inventory && active_inventory->getVisible())
|
||||||
{
|
{
|
||||||
mInventoryAutoOpen = FALSE;
|
mInventoryAutoOpenTimer.stop();
|
||||||
}
|
}
|
||||||
else if (inventory_btn->getRect().pointInRect(x, y))
|
else if (inventory_btn->getRect().pointInRect(x, y))
|
||||||
{
|
{
|
||||||
if (mInventoryAutoOpen)
|
if (mInventoryAutoOpenTimer.getStarted())
|
||||||
{
|
{
|
||||||
if (!(active_inventory && active_inventory->getVisible()) &&
|
if (!(active_inventory && active_inventory->getVisible()) &&
|
||||||
mInventoryAutoOpenTimer.getElapsedTimeF32() > sInventoryAutoOpenTime)
|
mInventoryAutoOpenTimer.getElapsedTimeF32() > sInventoryAutoOpenTime)
|
||||||
@@ -182,71 +179,35 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mInventoryAutoOpen = TRUE;
|
mInventoryAutoOpenTimer.start();
|
||||||
mInventoryAutoOpenTimer.reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
|
return LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLToolBar::layoutButtons()
|
|
||||||
{
|
|
||||||
#if LL_DARWIN
|
|
||||||
const S32 FUDGE_WIDTH_OF_SCREEN = 4;
|
|
||||||
S32 width = gViewerWindow->getWindowWidth() + FUDGE_WIDTH_OF_SCREEN;
|
|
||||||
S32 pad = 2;
|
|
||||||
|
|
||||||
// this function may be called before postBuild(), in which case mResizeHandle won't have been set up yet.
|
|
||||||
if(mResizeHandle != NULL)
|
|
||||||
{
|
|
||||||
if(!gViewerWindow->getWindow()->getFullscreen())
|
|
||||||
{
|
|
||||||
// Only when running in windowed mode on the Mac, leave room for a resize widget on the right edge of the bar.
|
|
||||||
width -= RESIZE_HANDLE_WIDTH;
|
|
||||||
|
|
||||||
LLRect r;
|
|
||||||
r.mLeft = width - pad;
|
|
||||||
r.mBottom = 0;
|
|
||||||
r.mRight = r.mLeft + RESIZE_HANDLE_WIDTH;
|
|
||||||
r.mTop = r.mBottom + RESIZE_HANDLE_HEIGHT;
|
|
||||||
mResizeHandle->setRect(r);
|
|
||||||
mResizeHandle->setVisible(TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mResizeHandle->setVisible(FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // LL_DARWIN
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// virtual
|
|
||||||
void LLToolBar::reshape(S32 width, S32 height, BOOL called_from_parent)
|
|
||||||
{
|
|
||||||
LLPanel::reshape(width, height, called_from_parent);
|
|
||||||
|
|
||||||
layoutButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Per-frame updates of visibility
|
// Per-frame updates of visibility
|
||||||
void LLToolBar::refresh()
|
void LLToolBar::refresh()
|
||||||
{
|
{
|
||||||
if(!isAgentAvatarValid())
|
static const LLCachedControl<bool> show_toolbar("ShowToolBar", true);
|
||||||
return;
|
bool show = show_toolbar;
|
||||||
|
if (show && gAgentCamera.cameraMouselook())
|
||||||
|
{
|
||||||
|
static const LLCachedControl<bool> hidden("LiruMouselookHidesToolbar");
|
||||||
|
show = !hidden;
|
||||||
|
}
|
||||||
|
setVisible(show);
|
||||||
|
if (!show) return; // Everything below this point manipulates visible UI, anyway
|
||||||
|
|
||||||
static LLCachedControl<bool> show("ShowToolBar", true);
|
updateCommunicateList();
|
||||||
BOOL mouselook = gAgentCamera.cameraMouselook();
|
|
||||||
setVisible(show && !mouselook);
|
|
||||||
|
|
||||||
static LLCachedControl<bool> continue_flying_on_unsit("LiruContinueFlyingOnUnsit");
|
if (!isAgentAvatarValid()) return;
|
||||||
bool sitting = !continue_flying_on_unsit && gAgentAvatarp && gAgentAvatarp->isSitting();
|
|
||||||
|
|
||||||
mFlyBtn->setEnabled((gAgent.canFly() || gAgent.getFlying()) && !sitting );
|
static const LLCachedControl<bool> continue_flying_on_unsit("LiruContinueFlyingOnUnsit");
|
||||||
static LLCachedControl<bool> ascent_build_always_enabled("AscentBuildAlwaysEnabled", true);
|
mFlyBtn->setEnabled((gAgent.canFly() || gAgent.getFlying()) && (continue_flying_on_unsit || !gAgentAvatarp->isSitting()));
|
||||||
mBuildBtn->setEnabled((LLViewerParcelMgr::getInstance()->allowAgentBuild() || ascent_build_always_enabled));
|
static const LLCachedControl<bool> ascent_build_always_enabled("AscentBuildAlwaysEnabled", true);
|
||||||
|
mBuildBtn->setEnabled(ascent_build_always_enabled || LLViewerParcelMgr::getInstance()->allowAgentBuild());
|
||||||
|
|
||||||
// Check to see if we're in build mode
|
// Check to see if we're in build mode
|
||||||
// And not just clicking on a scripted object
|
// And not just clicking on a scripted object
|
||||||
@@ -268,11 +229,6 @@ void LLToolBar::refresh()
|
|||||||
mInventoryBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV));
|
mInventoryBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV));
|
||||||
}
|
}
|
||||||
// [/RLVa:KB]
|
// [/RLVa:KB]
|
||||||
|
|
||||||
if (isInVisibleChain() && mCommunicateBtn->getVisible())
|
|
||||||
{
|
|
||||||
updateCommunicateList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bold_if_equal(const LLFloater* f1, const LLFloater* f2, LLScrollListItem* itemp)
|
void bold_if_equal(const LLFloater* f1, const LLFloater* f2, LLScrollListItem* itemp)
|
||||||
@@ -283,11 +239,13 @@ void bold_if_equal(const LLFloater* f1, const LLFloater* f2, LLScrollListItem* i
|
|||||||
|
|
||||||
void LLToolBar::updateCommunicateList()
|
void LLToolBar::updateCommunicateList()
|
||||||
{
|
{
|
||||||
|
if (!mCommunicateBtn->getVisible()) return;
|
||||||
|
|
||||||
LLSD selected = mCommunicateBtn->getValue();
|
LLSD selected = mCommunicateBtn->getValue();
|
||||||
|
|
||||||
mCommunicateBtn->removeall();
|
mCommunicateBtn->removeall();
|
||||||
|
|
||||||
LLFloater* frontmost_floater = LLFloaterChatterBox::getInstance()->getActiveFloater();
|
const LLFloater* frontmost_floater = LLFloaterChatterBox::getInstance()->getActiveFloater();
|
||||||
bold_if_equal(LLFloaterMyFriends::getInstance(), frontmost_floater, mCommunicateBtn->add(LLFloaterMyFriends::getInstance()->getShortTitle(), LLSD("contacts"), ADD_TOP));
|
bold_if_equal(LLFloaterMyFriends::getInstance(), frontmost_floater, mCommunicateBtn->add(LLFloaterMyFriends::getInstance()->getShortTitle(), LLSD("contacts"), ADD_TOP));
|
||||||
bold_if_equal(LLFloaterChat::getInstance(), frontmost_floater, mCommunicateBtn->add(LLFloaterChat::getInstance()->getShortTitle(), LLSD("local chat"), ADD_TOP));
|
bold_if_equal(LLFloaterChat::getInstance(), frontmost_floater, mCommunicateBtn->add(LLFloaterChat::getInstance()->getShortTitle(), LLSD("local chat"), ADD_TOP));
|
||||||
mCommunicateBtn->addSeparator(ADD_TOP);
|
mCommunicateBtn->addSeparator(ADD_TOP);
|
||||||
@@ -300,11 +258,11 @@ void LLToolBar::updateCommunicateList()
|
|||||||
{
|
{
|
||||||
if (LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)floater_handle_it->get())
|
if (LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)floater_handle_it->get())
|
||||||
{
|
{
|
||||||
S32 count = im_floaterp->getNumUnreadMessages();
|
const S32 count = im_floaterp->getNumUnreadMessages();
|
||||||
std::string floater_title;
|
std::string floater_title;
|
||||||
if (count > 0) floater_title = "*";
|
if (count > 0) floater_title = "*";
|
||||||
floater_title.append(im_floaterp->getShortTitle());
|
floater_title.append(im_floaterp->getShortTitle());
|
||||||
static LLCachedControl<bool> show_counts("ShowUnreadIMsCounts", true);
|
static const LLCachedControl<bool> show_counts("ShowUnreadIMsCounts", true);
|
||||||
if (show_counts && count > 0)
|
if (show_counts && count > 0)
|
||||||
{
|
{
|
||||||
floater_title += " - ";
|
floater_title += " - ";
|
||||||
@@ -323,7 +281,8 @@ void LLToolBar::updateCommunicateList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mCommunicateBtn->setToggleState(gSavedSettings.getBOOL("ShowCommunicate"));
|
static const LLCachedControl<bool> show_comm("ShowCommunicate", true);
|
||||||
|
mCommunicateBtn->setToggleState(show_comm);
|
||||||
if (!selected.isUndefined()) mCommunicateBtn->setValue(selected);
|
if (!selected.isUndefined()) mCommunicateBtn->setValue(selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,10 +41,6 @@
|
|||||||
// "Constants" loaded from settings.xml at start time
|
// "Constants" loaded from settings.xml at start time
|
||||||
extern S32 TOOL_BAR_HEIGHT;
|
extern S32 TOOL_BAR_HEIGHT;
|
||||||
|
|
||||||
#if LL_DARWIN
|
|
||||||
class LLFakeResizeHandle;
|
|
||||||
#endif // LL_DARWIN
|
|
||||||
|
|
||||||
class LLFlyoutButton;
|
class LLFlyoutButton;
|
||||||
|
|
||||||
class LLToolBar
|
class LLToolBar
|
||||||
@@ -62,11 +58,6 @@ public:
|
|||||||
EAcceptance* accept,
|
EAcceptance* accept,
|
||||||
std::string& tooltip_msg);
|
std::string& tooltip_msg);
|
||||||
|
|
||||||
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
|
|
||||||
|
|
||||||
// Move buttons to appropriate locations based on rect.
|
|
||||||
void layoutButtons();
|
|
||||||
|
|
||||||
// Per-frame refresh call
|
// Per-frame refresh call
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
@@ -79,12 +70,8 @@ private:
|
|||||||
void updateCommunicateList();
|
void updateCommunicateList();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BOOL mInventoryAutoOpen;
|
|
||||||
LLFrameTimer mInventoryAutoOpenTimer;
|
LLFrameTimer mInventoryAutoOpenTimer;
|
||||||
S32 mNumUnreadIMs;
|
S32 mNumUnreadIMs;
|
||||||
#if LL_DARWIN
|
|
||||||
LLFakeResizeHandle *mResizeHandle;
|
|
||||||
#endif // LL_DARWIN
|
|
||||||
|
|
||||||
CachedUICtrl<LLFlyoutButton> mCommunicateBtn;
|
CachedUICtrl<LLFlyoutButton> mCommunicateBtn;
|
||||||
CachedUICtrl<LLButton> mFlyBtn;
|
CachedUICtrl<LLButton> mFlyBtn;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<check_box bottom_delta="-18" follows="top" height="16" control_name="LiruMouselookHidesFloaters" name="mouselook_hides_floaters" label="Floaters"/>
|
<check_box bottom_delta="-18" follows="top" height="16" control_name="LiruMouselookHidesFloaters" name="mouselook_hides_floaters" label="Floaters"/>
|
||||||
<check_box left_delta="80" bottom_delta="0" follows="top" height="16" control_name="LiruMouselookHidesNotices" name="mouselook_hides_notices" label="Notices"/>
|
<check_box left_delta="80" bottom_delta="0" follows="top" height="16" control_name="LiruMouselookHidesNotices" name="mouselook_hides_notices" label="Notices"/>
|
||||||
<check_box left="148" bottom_delta="-18" follows="top" height="16" control_name="LiruMouselookHidesMenubar" name="mouselook_hides_menubar" label="Menubar"/>
|
<check_box left="148" bottom_delta="-18" follows="top" height="16" control_name="LiruMouselookHidesMenubar" name="mouselook_hides_menubar" label="Menubar"/>
|
||||||
|
<check_box left_delta="80" bottom_delta="0" follows="top" height="16" control_name="LiruMouselookHidesToolbar" name="mouselook_hides_toolbar" label="Toolbar"/>
|
||||||
<text bottom_delta="-30" follows="top" height="10" left="10" name=" Movement Options:">Movement Options:</text>
|
<text bottom_delta="-30" follows="top" height="10" left="10" name=" Movement Options:">Movement Options:</text>
|
||||||
<check_box bottom_delta="-6" follows="top" height="16" label="Fly/land on holding up/down" left="148" name="automatic_fly"/>
|
<check_box bottom_delta="-6" follows="top" height="16" label="Fly/land on holding up/down" left="148" name="automatic_fly"/>
|
||||||
<check_box bottom_delta="-18" follows="top" height="16" label="Allow crouch toggle by holding shift" name="crouch_toggle" control_name="SGShiftCrouchToggle"/>
|
<check_box bottom_delta="-18" follows="top" height="16" label="Allow crouch toggle by holding shift" name="crouch_toggle" control_name="SGShiftCrouchToggle"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user