* Major Bugs: EXT-1248 EXT-1127 EXT-844 EXT-1160
* Changes: EXT-1139 (places context menu)
master
Steven Bennetts 2009-10-01 17:52:30 +00:00
parent cf9814bc05
commit 1713a3552b
14 changed files with 271 additions and 60 deletions

View File

@ -77,7 +77,7 @@ LLScreenChannel* LLChannelManager::createNotificationChannel()
p.channel_align = CA_RIGHT;
// Getting a Channel for our notifications
return dynamic_cast<LLScreenChannel*> (LLChannelManager::getInstance()->createChannel(p));
return dynamic_cast<LLScreenChannel*> (LLChannelManager::getInstance()->getChannel(p));
}
//--------------------------------------------------------------------------

View File

@ -53,10 +53,15 @@
#include "llagentui.h"
class LLFetchlLandmarkByAgentPos : public LLInventoryCollectFunctor
class LLFetchlLandmarkByPos : public LLInventoryCollectFunctor
{
private:
LLVector3d mPos;
public:
LLFetchlLandmarkByPos(const LLVector3d& pos) :
mPos(pos)
{}
/*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
if (!item || item->getType() != LLAssetType::AT_LANDMARK)
@ -69,11 +74,10 @@ public:
LLVector3d landmark_global_pos;
if (!landmark->getGlobalPos(landmark_global_pos))
return false;
LLVector3d a_pos = gAgent.getPositionGlobal();
//we have to round off each coordinates to compare positions properly
return llround(a_pos.mdV[VX]) == llround(landmark_global_pos.mdV[VX])
&& llround(a_pos.mdV[VY]) == llround(landmark_global_pos.mdV[VY])
&& llround(a_pos.mdV[VZ]) == llround(landmark_global_pos.mdV[VZ]);
return llround(mPos.mdV[VX]) == llround(landmark_global_pos.mdV[VX])
&& llround(mPos.mdV[VY]) == llround(landmark_global_pos.mdV[VY])
&& llround(mPos.mdV[VZ]) == llround(landmark_global_pos.mdV[VZ]);
}
};
@ -147,12 +151,12 @@ bool LLLandmarkActions::landmarkAlreadyExists()
}
LLViewerInventoryItem* LLLandmarkActions::findLandmarkForAgentPos()
LLViewerInventoryItem* LLLandmarkActions::findLandmarkForGlobalPos(const LLVector3d &pos)
{
// Determine whether there are landmarks pointing to the current parcel.
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
LLFetchlLandmarkByAgentPos is_current_pos_landmark;
LLFetchlLandmarkByPos is_current_pos_landmark(pos);
gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
cats,
items,
@ -167,6 +171,11 @@ LLViewerInventoryItem* LLLandmarkActions::findLandmarkForAgentPos()
return items[0];
}
LLViewerInventoryItem* LLLandmarkActions::findLandmarkForAgentPos()
{
return findLandmarkForGlobalPos(gAgent.getPositionGlobal());
}
bool LLLandmarkActions::canCreateLandmarkHere()
{
LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();

View File

@ -52,6 +52,14 @@ public:
*/
static bool landmarkAlreadyExists();
/**
* @brief Searches landmark for global position.
* @return Returns landmark or NULL.
*
* *TODO: dzaporozhan: There can be many landmarks for single parcel.
*/
static LLViewerInventoryItem* findLandmarkForGlobalPos(const LLVector3d &pos);
/**
* @brief Searches landmark for agent global position.
* @return Returns landmark or NULL.
@ -60,6 +68,7 @@ public:
*/
static LLViewerInventoryItem* findLandmarkForAgentPos();
/**
* @brief Checks whether agent has rights to create landmark for current parcel.
*/

View File

@ -55,7 +55,7 @@ LLAlertHandler::LLAlertHandler(e_notification_type type, const LLSD& id) : mIsMo
// Getting a Channel for our notifications
mChannel = LLChannelManager::getInstance()->getChannel(p);
mChannel->setShowToasts(true);
mChannel->setCanStoreToasts(false);
}
//--------------------------------------------------------------------------

View File

@ -129,7 +129,7 @@ void LLOutputMonitorCtrl::draw()
const F32 LEVEL_1 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL * 2.f / 3.f;
const F32 LEVEL_2 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
if (mIsParentVisible && getVisible() && mAutoUpdate && !mIsMuted && mSpeakerId.notNull())
if (getVisible() && mAutoUpdate && !mIsMuted && mSpeakerId.notNull())
{
setPower(gVoiceClient->getCurrentPower(mSpeakerId));
setIsTalking(gVoiceClient->getIsSpeaking(mSpeakerId));
@ -220,12 +220,6 @@ void LLOutputMonitorCtrl::draw()
gl_rect_2d(0, monh, monw, 0, sColorBound, FALSE);
}
void LLOutputMonitorCtrl::handleVisibilityChange(BOOL new_visibility)
{
mIsParentVisible = new_visibility;
LLView::handleVisibilityChange(new_visibility);
}
void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id)
{
if (speaker_id.isNull()) return;

View File

@ -72,8 +72,6 @@ public:
// llview overrides
virtual void draw();
void handleVisibilityChange(BOOL new_visibility);
void setPower(F32 val);
F32 getPower(F32 val) const { return mPower; }
@ -104,8 +102,6 @@ private:
F32 mPower;
bool mIsMuted;
bool mIsTalking;
/** Stores flag whether parent is visible. If not it will not update indicator*/
bool mIsParentVisible;
LLPointer<LLUIImage> mImageMute;
LLPointer<LLUIImage> mImageOff;
LLPointer<LLUIImage> mImageOn;

View File

@ -42,11 +42,15 @@
#include "llaccordionctrltab.h"
#include "llflatlistview.h"
#include "lltextbox.h"
#include "llviewermenu.h"
#include "llviewerinventory.h"
#include "lllandmarkactions.h"
#include "llclipboard.h"
class LLTeleportHistoryFlatItem : public LLPanel
{
public:
LLTeleportHistoryFlatItem(S32 index, const std::string &region_name);
LLTeleportHistoryFlatItem(S32 index, LLTeleportHistoryPanel::ContextMenu *context_menu, const std::string &region_name);
virtual ~LLTeleportHistoryFlatItem() {};
virtual BOOL postBuild();
@ -57,18 +61,23 @@ public:
void onMouseEnter(S32 x, S32 y, MASK mask);
void onMouseLeave(S32 x, S32 y, MASK mask);
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
static void showPlaceInfoPanel(S32 index);
private:
void onInfoBtnClick();
LLButton* mInfoBtn;
LLTeleportHistoryPanel::ContextMenu *mContextMenu;
S32 mIndex;
std::string mRegionName;
};
LLTeleportHistoryFlatItem::LLTeleportHistoryFlatItem(S32 index, const std::string &region_name)
LLTeleportHistoryFlatItem::LLTeleportHistoryFlatItem(S32 index, LLTeleportHistoryPanel::ContextMenu *context_menu, const std::string &region_name)
: LLPanel(),
mIndex(index),
mContextMenu(context_menu),
mRegionName(region_name)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history_item.xml");
@ -109,15 +118,105 @@ void LLTeleportHistoryFlatItem::onMouseLeave(S32 x, S32 y, MASK mask)
LLPanel::onMouseLeave(x, y, mask);
}
void LLTeleportHistoryFlatItem::onInfoBtnClick()
// virtual
BOOL LLTeleportHistoryFlatItem::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
if (mContextMenu)
mContextMenu->show(this, mIndex, x, y);
return LLPanel::handleRightMouseDown(x, y, mask);
}
void LLTeleportHistoryFlatItem::showPlaceInfoPanel(S32 index)
{
LLSD params;
params["id"] = mIndex;
params["id"] = index;
params["type"] = "teleport_history";
LLSideTray::getInstance()->showPanel("panel_places", params);
}
void LLTeleportHistoryFlatItem::onInfoBtnClick()
{
LLTeleportHistoryFlatItem::showPlaceInfoPanel(mIndex);
}
LLTeleportHistoryPanel::ContextMenu::ContextMenu() :
mMenu(NULL)
{
}
void LLTeleportHistoryPanel::ContextMenu::show(LLView* spawning_view, S32 index, S32 x, S32 y)
{
if (mMenu)
{
//preventing parent (menu holder) from deleting already "dead" context menus on exit
LLView* parent = mMenu->getParent();
if (parent)
{
parent->removeChild(mMenu);
mMenu->setParent(NULL);
}
delete mMenu;
}
mIndex = index;
mMenu = createMenu();
LLViewerInventoryItem *landmark = LLLandmarkActions::findLandmarkForGlobalPos(
LLTeleportHistoryStorage::getInstance()->getItems()[index].mGlobalPos);
mMenu->setItemEnabled("Make Landmark", !landmark || landmark->getUUID().isNull());
mMenu->show(x, y);
LLMenuGL::showPopup(spawning_view, mMenu, x, y);
}
LLContextMenu* LLTeleportHistoryPanel::ContextMenu::createMenu()
{
// set up the callbacks for all of the avatar menu items
// (N.B. callbacks don't take const refs as mID is local scope)
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
registrar.add("TeleportHistory.Teleport", boost::bind(&LLTeleportHistoryPanel::ContextMenu::onTeleport, this));
registrar.add("TeleportHistory.MoreInformation",boost::bind(&LLTeleportHistoryPanel::ContextMenu::onInfo, this));
registrar.add("TeleportHistory.Copy", boost::bind(&LLTeleportHistoryPanel::ContextMenu::onCopy, this));
registrar.add("TeleportHistory.MakeLandmark", boost::bind(&LLTeleportHistoryPanel::ContextMenu::onMakeLandmark, this));
// create the context menu from the XUI
return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
"menu_teleport_history_item.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
}
void LLTeleportHistoryPanel::ContextMenu::onTeleport()
{
LLTeleportHistoryStorage::getInstance()->goToItem(mIndex);
}
void LLTeleportHistoryPanel::ContextMenu::onInfo()
{
LLTeleportHistoryFlatItem::showPlaceInfoPanel(mIndex);
}
//static
void LLTeleportHistoryPanel::ContextMenu::gotSLURLCallback(const std::string& slurl)
{
gClipboard.copyFromString(utf8str_to_wstring(slurl));
}
void LLTeleportHistoryPanel::ContextMenu::onCopy()
{
LLVector3d globalPos = LLTeleportHistoryStorage::getInstance()->getItems()[mIndex].mGlobalPos;
LLLandmarkActions::getSLURLfromPosGlobal(globalPos,
boost::bind(&LLTeleportHistoryPanel::ContextMenu::gotSLURLCallback, _1), false);
}
void LLTeleportHistoryPanel::ContextMenu::onMakeLandmark()
{
//FIXME: it creates landmark for current agent positon, not for the global position of item of teleport history
LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark"));
}
// Not yet implemented; need to remove buildPanel() from constructor when we switch
//static LLRegisterPanelClassWrapper<LLTeleportHistoryPanel> t_teleport_history("panel_teleport_history");
@ -126,6 +225,7 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel()
mFilterSubString(LLStringUtil::null),
mTeleportHistory(NULL),
mHistoryAccordion(NULL),
mAccordionTabMenu(NULL),
mLastSelectedScrollList(NULL)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history.xml");
@ -153,6 +253,8 @@ BOOL LLTeleportHistoryPanel::postBuild()
if (dynamic_cast<LLAccordionCtrlTab*>(*iter))
{
LLAccordionCtrlTab* tab = (LLAccordionCtrlTab*)*iter;
tab->setRightMouseDownCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionTabRightClick, this, _1, _2, _3, _4));
mItemContainers.put(tab);
LLFlatListView* fl = getFlatListViewFromTab(tab);
@ -354,7 +456,7 @@ void LLTeleportHistoryPanel::showTeleportHistory()
if (curr_flat_view)
{
curr_flat_view->addItem(new LLTeleportHistoryFlatItem(index, (*iter).mTitle));
curr_flat_view->addItem(new LLTeleportHistoryFlatItem(index, &mContextMenu, (*iter).mTitle));
}
index--;
@ -411,6 +513,56 @@ void LLTeleportHistoryPanel::onDoubleClickItem(void* user_data)
LLSideTray::getInstance()->showPanel("panel_places", key);*/
}
void LLTeleportHistoryPanel::onAccordionTabRightClick(LLView *view, S32 x, S32 y, MASK mask)
{
LLAccordionCtrlTab *tab = (LLAccordionCtrlTab *) view;
// If click occurred below the header, don't show this menu
if (y < tab->getRect().getHeight() - tab->getHeaderHeight() - tab->getPaddingBottom())
return;
if (mAccordionTabMenu)
{
//preventing parent (menu holder) from deleting already "dead" context menus on exit
LLView* parent = mAccordionTabMenu->getParent();
if (parent)
{
parent->removeChild(mAccordionTabMenu);
mAccordionTabMenu->setParent(NULL);
}
delete mAccordionTabMenu;
}
// set up the callbacks for all of the avatar menu items
// (N.B. callbacks don't take const refs as mID is local scope)
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
registrar.add("TeleportHistory.TabOpen", boost::bind(&LLTeleportHistoryPanel::onAccordionTabOpen, this, tab));
registrar.add("TeleportHistory.TabClose", boost::bind(&LLTeleportHistoryPanel::onAccordionTabClose, this, tab));
// create the context menu from the XUI
mAccordionTabMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
"menu_teleport_history_tab.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
mAccordionTabMenu->setItemVisible("TabOpen", !tab->isExpanded() ? true : false);
mAccordionTabMenu->setItemVisible("TabClose", tab->isExpanded() ? true : false);
mAccordionTabMenu->show(x, y);
LLMenuGL::showPopup(tab, mAccordionTabMenu, x, y);
}
void LLTeleportHistoryPanel::onAccordionTabOpen(LLAccordionCtrlTab *tab)
{
tab->setDisplayChildren(true);
mHistoryAccordion->arrange();
}
void LLTeleportHistoryPanel::onAccordionTabClose(LLAccordionCtrlTab *tab)
{
tab->setDisplayChildren(false);
mHistoryAccordion->arrange();
}
LLFlatListView* LLTeleportHistoryPanel::getFlatListViewFromTab(LLAccordionCtrlTab *tab)
{
for (child_list_const_iter_t iter = tab->beginChild(); iter != tab->endChild(); iter++)

View File

@ -37,6 +37,7 @@
#include "llpanelplacestab.h"
#include "llteleporthistory.h"
#include "llmenugl.h"
class LLTeleportHistoryStorage;
class LLAccordionCtrl;
@ -46,6 +47,25 @@ class LLFlatListView;
class LLTeleportHistoryPanel : public LLPanelPlacesTab
{
public:
class ContextMenu
{
public:
ContextMenu();
void show(LLView* spawning_view, S32 index, S32 x, S32 y);
private:
LLContextMenu* createMenu();
void onTeleport();
void onInfo();
void onCopy();
void onMakeLandmark();
static void gotSLURLCallback(const std::string& slurl);
LLContextMenu* mMenu;
S32 mIndex;
};
LLTeleportHistoryPanel();
virtual ~LLTeleportHistoryPanel();
@ -59,6 +79,9 @@ public:
private:
static void onDoubleClickItem(void* user_data);
void onAccordionTabRightClick(LLView *view, S32 x, S32 y, MASK mask);
void onAccordionTabOpen(LLAccordionCtrlTab *tab);
void onAccordionTabClose(LLAccordionCtrlTab *tab);
void showTeleportHistory();
void handleItemSelect(LLFlatListView* );
LLFlatListView* getFlatListViewFromTab(LLAccordionCtrlTab *);
@ -70,6 +93,9 @@ private:
typedef LLDynamicArray<LLAccordionCtrlTab*> item_containers_t;
item_containers_t mItemContainers;
ContextMenu mContextMenu;
LLContextMenu* mAccordionTabMenu;
};
#endif //LL_LLPANELTELEPORTHISTORY_H

View File

@ -66,7 +66,7 @@ LLScreenChannelBase::LLScreenChannelBase(const LLUUID& id) :
,mOverflowToastHidden(false)
,mIsHovering(false)
,mControlHovering(false)
,mShowToasts(false)
,mShowToasts(true)
{
mID = id;
mOverflowFormatString = LLTrans::getString("OverflowInfoChannelString");
@ -142,7 +142,7 @@ void LLScreenChannel::addToast(LLToast::Params p)
{
bool store_toast = false, show_toast = false;
show_toast = mWasStartUpToastShown && (mShowToasts || p.force_show);
mDisplayToastsAlways ? show_toast = true : show_toast = mWasStartUpToastShown && (mShowToasts || p.force_show);
store_toast = !show_toast && p.can_be_stored && mCanStoreToasts;
if(!show_toast && !store_toast)

View File

@ -111,7 +111,8 @@ BOOL LLSysWellWindow::postBuild()
//---------------------------------------------------------------------------------
void LLSysWellWindow::setMinimized(BOOL minimize)
{
setVisible(!minimize);
// we don't show empty Message Well window
setVisible(!minimize && !isWindowEmpty());
LLFloater::setMinimized(minimize);
}

View File

@ -41,7 +41,7 @@
using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLToast::LLToast(LLToast::Params p) : LLFloater(LLSD()),
LLToast::LLToast(LLToast::Params p) : LLModalDialog(LLSD(), p.is_modal),
mPanel(p.panel),
mTimerValue(p.timer_period),
mNotificationID(p.notif_id),
@ -49,7 +49,6 @@ LLToast::LLToast(LLToast::Params p) : LLFloater(LLSD()),
mCanFade(p.can_fade),
mCanBeStored(p.can_be_stored),
mHideBtnEnabled(p.enable_hide_btn),
mIsModal(p.is_modal),
mHideBtn(NULL),
mNotification(p.notification),
mHideBtnPressed(false)
@ -67,13 +66,6 @@ LLToast::LLToast(LLToast::Params p) : LLFloater(LLSD()),
mHideBtn->setClickedCallback(boost::bind(&LLToast::hide,this));
}
if(mIsModal)
{
gFocusMgr.setMouseCapture( this );
gFocusMgr.setTopCtrl( this );
setFocus(TRUE);
}
// init callbacks if present
if(!p.on_delete_toast.empty())
mOnDeleteToastSignal.connect(p.on_delete_toast);
@ -104,11 +96,6 @@ void LLToast::setHideButtonEnabled(bool enabled)
LLToast::~LLToast()
{
mOnToastDestroyedSignal(this);
if(mIsModal)
{
gFocusMgr.unlockFocus();
gFocusMgr.releaseFocusIfNeeded( this );
}
}
//--------------------------------------------------------------------------
@ -204,18 +191,6 @@ void LLToast::draw()
LLFloater::draw();
}
//--------------------------------------------------------------------------
void LLToast::setModal(bool modal)
{
mIsModal = modal;
if(mIsModal)
{
gFocusMgr.setMouseCapture( this );
gFocusMgr.setTopCtrl( this );
setFocus(TRUE);
}
}
//--------------------------------------------------------------------------
void LLToast::setVisible(BOOL show)
{

View File

@ -35,7 +35,7 @@
#include "llpanel.h"
#include "llfloater.h"
#include "llmodaldialog.h"
#include "lltimer.h"
#include "llnotifications.h"
@ -51,7 +51,7 @@ namespace LLNotificationsUI
* Represents toast pop-up.
* This is a parent view for all toast panels.
*/
class LLToast : public LLFloater
class LLToast : public LLModalDialog
{
public:
typedef boost::function<void (LLToast* toast)> toast_callback_t;
@ -134,8 +134,6 @@ public:
void setCanBeStored(bool can_be_stored) { mCanBeStored = can_be_stored; }
//
bool getCanBeStored() { return mCanBeStored; }
//
void setModal(bool modal);
// Registers signals/callbacks for events
@ -171,7 +169,6 @@ private:
LLColor4 mBgColor;
bool mCanFade;
bool mIsModal;
bool mCanBeStored;
bool mHideBtnEnabled;
bool mHideBtnPressed;

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<context_menu
layout="topleft"
name="Teleport History Item Context Menu">
<menu_item_call
label="Teleport"
layout="topleft"
name="Teleport">
<menu_item_call.on_click
function="TeleportHistory.Teleport" />
</menu_item_call>
<menu_item_call
label="More Information"
layout="topleft"
name="More Information">
<menu_item_call.on_click
function="TeleportHistory.MoreInformation" />
</menu_item_call>
<menu_item_call
label="Copy"
layout="topleft"
name="Copy">
<menu_item_call.on_click
function="TeleportHistory.Copy" />
</menu_item_call>
<menu_item_call
label="Make Landmark"
layout="topleft"
name="Make Landmark">
<menu_item_call.on_click
function="TeleportHistory.MakeLandmark" />
</menu_item_call>
</context_menu>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<context_menu
layout="topleft"
name="Teleport History Item Context Menu">
<menu_item_call
label="Open"
layout="topleft"
name="TabOpen">
<menu_item_call.on_click
function="TeleportHistory.TabOpen" />
</menu_item_call>
<menu_item_call
label="Close"
layout="topleft"
name="TabClose">
<menu_item_call.on_click
function="TeleportHistory.TabClose" />
</menu_item_call>
</context_menu>