summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelplaces.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelplaces.cpp')
-rw-r--r--indra/newview/llpanelplaces.cpp141
1 files changed, 110 insertions, 31 deletions
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 53870fb5c7..11ae980941 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -53,6 +53,7 @@
#include "llagentpicksinfo.h"
#include "llavatarpropertiesprocessor.h"
#include "llcommandhandler.h"
+#include "lldndbutton.h"
#include "llfloaterworldmap.h"
#include "llinventorybridge.h"
#include "llinventoryobserver.h"
@@ -79,6 +80,7 @@
static const F32 PLACE_INFO_UPDATE_INTERVAL = 3.0;
static const std::string AGENT_INFO_TYPE = "agent";
static const std::string CREATE_LANDMARK_INFO_TYPE = "create_landmark";
+static const std::string CREATE_PICK_TYPE = "create_pick";
static const std::string LANDMARK_INFO_TYPE = "landmark";
static const std::string REMOTE_PLACE_INFO_TYPE = "remote_place";
static const std::string TELEPORT_HISTORY_INFO_TYPE = "teleport_history";
@@ -293,8 +295,25 @@ BOOL LLPanelPlaces::postBuild()
mOverflowBtn = getChild<LLMenuButton>("overflow_btn");
mOverflowBtn->setMouseDownCallback(boost::bind(&LLPanelPlaces::onOverflowButtonClicked, this));
- mPlaceInfoBtn = getChild<LLButton>("profile_btn");
- mPlaceInfoBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onProfileButtonClicked, this));
+ mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
+ mGearMenuButton->setMouseDownCallback(boost::bind(&LLPanelPlaces::onGearMenuClick, this));
+
+ mSortingMenuButton = getChild<LLMenuButton>("sorting_menu_btn");
+ mSortingMenuButton->setMouseDownCallback(boost::bind(&LLPanelPlaces::onSortingMenuClick, this));
+
+ mAddMenuButton = getChild<LLMenuButton>("add_menu_btn");
+ mAddMenuButton->setMouseDownCallback(boost::bind(&LLPanelPlaces::onAddMenuClick, this));
+
+ mRemoveSelectedBtn = getChild<LLButton>("trash_btn");
+ mRemoveSelectedBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onRemoveButtonClicked, this));
+
+ LLDragAndDropButton* trash_btn = (LLDragAndDropButton*)mRemoveSelectedBtn;
+ trash_btn->setDragAndDropHandler(boost::bind(&LLPanelPlaces::handleDragAndDropToTrash, this
+ , _4 // BOOL drop
+ , _5 // EDragAndDropType cargo_type
+ , _6 // void* cargo_data
+ , _7 // EAcceptance* accept
+ ));
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
registrar.add("Places.OverflowMenu.Action", boost::bind(&LLPanelPlaces::onOverflowMenuItemClicked, this, _2));
@@ -323,6 +342,10 @@ BOOL LLPanelPlaces::postBuild()
mTabContainer->setCommitCallback(boost::bind(&LLPanelPlaces::onTabSelected, this));
}
+ mButtonsContainer = getChild<LLPanel>("button_layout_panel");
+ mButtonsContainer->setVisible(FALSE);
+ mFilterContainer = getChild<LLLayoutStack>("top_menu_panel");
+
mFilterEditor = getChild<LLFilterEditor>("Filter");
if (mFilterEditor)
{
@@ -388,7 +411,22 @@ void LLPanelPlaces::onOpen(const LLSD& key)
// Update the buttons at the bottom of the panel
updateVerbs();
}
- else
+ else if (key_type == CREATE_PICK_TYPE)
+ {
+ LLUUID item_id = key["item_id"];
+
+ LLLandmarksPanel* landmarks_panel =
+ dynamic_cast<LLLandmarksPanel*>(mTabContainer->getPanelByName("Landmarks"));
+ if (landmarks_panel && item_id.notNull())
+ {
+ LLLandmark* landmark = LLLandmarkActions::getLandmark(item_id, boost::bind(&LLLandmarksPanel::doCreatePick, landmarks_panel, _1, item_id));
+ if (landmark)
+ {
+ landmarks_panel->doCreatePick(landmark, item_id);
+ }
+ }
+ }
+ else // "create_landmark"
{
mFilterEditor->clear();
onFilterEdit("", false);
@@ -409,7 +447,8 @@ void LLPanelPlaces::onOpen(const LLSD& key)
}
else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE)
{
- mLandmarkInfo->setInfoType(LLPanelPlaceInfo::CREATE_LANDMARK);
+ LLUUID dest_folder = key["dest_folder"];
+ mLandmarkInfo->setInfoAndCreateLandmark(dest_folder);
if (key.has("x") && key.has("y") && key.has("z"))
{
@@ -612,6 +651,12 @@ void LLPanelPlaces::onTabSelected()
onFilterEdit(mActivePanel->getFilterSubString(), true);
mActivePanel->updateVerbs();
+
+ // History panel does not support deletion nor creation
+ // Hide menus
+ bool supports_create = mActivePanel->getCreateMenu() != NULL;
+ childSetVisible("add_btn_panel", supports_create);
+ childSetVisible("trash_btn_panel", supports_create);
}
void LLPanelPlaces::onTeleportButtonClicked()
@@ -885,14 +930,6 @@ void LLPanelPlaces::onOverflowButtonClicked()
mOverflowBtn->setMenu(menu, LLMenuButton::MP_TOP_RIGHT);
}
-void LLPanelPlaces::onProfileButtonClicked()
-{
- if (!mActivePanel)
- return;
-
- mActivePanel->onShowProfile();
-}
-
bool LLPanelPlaces::onOverflowMenuItemEnable(const LLSD& param)
{
std::string value = param.asString();
@@ -981,6 +1018,50 @@ void LLPanelPlaces::onBackButtonClicked()
updateVerbs();
}
+void LLPanelPlaces::onGearMenuClick()
+{
+ if (mActivePanel)
+ {
+ LLToggleableMenu* menu = mActivePanel->getSelectionMenu();
+ mGearMenuButton->setMenu(menu, LLMenuButton::MP_BOTTOM_LEFT);
+ }
+}
+
+void LLPanelPlaces::onSortingMenuClick()
+{
+ if (mActivePanel)
+ {
+ LLToggleableMenu* menu = mActivePanel->getSortingMenu();
+ mSortingMenuButton->setMenu(menu, LLMenuButton::MP_BOTTOM_LEFT);
+ }
+}
+
+void LLPanelPlaces::onAddMenuClick()
+{
+ if (mActivePanel)
+ {
+ LLToggleableMenu* menu = mActivePanel->getCreateMenu();
+ mAddMenuButton->setMenu(menu, LLMenuButton::MP_BOTTOM_LEFT);
+ }
+}
+
+void LLPanelPlaces::onRemoveButtonClicked()
+{
+ if (mActivePanel)
+ {
+ mActivePanel->onRemoveSelected();
+ }
+}
+
+bool LLPanelPlaces::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept)
+{
+ if (mActivePanel)
+ {
+ return mActivePanel->handleDragAndDropToTrash(drop, cargo_type, cargo_data, accept);
+ }
+ return false;
+}
+
void LLPanelPlaces::togglePickPanel(BOOL visible)
{
if (mPickPanel)
@@ -997,8 +1078,9 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible)
if (!mPlaceProfile || !mLandmarkInfo)
return;
- mFilterEditor->setVisible(!visible);
mTabContainer->setVisible(!visible);
+ mButtonsContainer->setVisible(visible);
+ mFilterContainer->setVisible(!visible);
if (mPlaceInfoType == AGENT_INFO_TYPE ||
mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
@@ -1014,10 +1096,6 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible)
// to avoid text blinking.
mResetInfoTimer.setTimerExpirySec(PLACE_INFO_UPDATE_INTERVAL);
- LLRect rect = getRect();
- LLRect new_rect = LLRect(rect.mLeft, rect.mTop, rect.mRight, mTabContainer->getRect().mBottom);
- mPlaceProfile->reshape(new_rect.getWidth(), new_rect.getHeight());
-
mLandmarkInfo->setVisible(FALSE);
}
else if (mPlaceInfoType == AGENT_INFO_TYPE)
@@ -1038,10 +1116,6 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible)
if (visible)
{
mLandmarkInfo->resetLocation();
-
- LLRect rect = getRect();
- LLRect new_rect = LLRect(rect.mLeft, rect.mTop, rect.mRight, mTabContainer->getRect().mBottom);
- mLandmarkInfo->reshape(new_rect.getWidth(), new_rect.getHeight());
}
else
{
@@ -1056,6 +1130,10 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible)
{
landmarks_panel->setItemSelected(mItem->getUUID(), TRUE);
}
+ else
+ {
+ landmarks_panel->resetSelection();
+ }
}
}
}
@@ -1126,8 +1204,6 @@ void LLPanelPlaces::createTabs()
LLLandmarksPanel* landmarks_panel = new LLLandmarksPanel();
if (landmarks_panel)
{
- landmarks_panel->setPanelPlacesButtons(this);
-
mTabContainer->addTabPanel(
LLTabContainer::TabPanelParams().
panel(landmarks_panel).
@@ -1138,8 +1214,6 @@ void LLPanelPlaces::createTabs()
LLTeleportHistoryPanel* teleport_history_panel = new LLTeleportHistoryPanel();
if (teleport_history_panel)
{
- teleport_history_panel->setPanelPlacesButtons(this);
-
mTabContainer->addTabPanel(
LLTabContainer::TabPanelParams().
panel(teleport_history_panel).
@@ -1151,9 +1225,17 @@ void LLPanelPlaces::createTabs()
mActivePanel = dynamic_cast<LLPanelPlacesTab*>(mTabContainer->getCurrentPanel());
- // Filter applied to show all items.
- if (mActivePanel)
- mActivePanel->onSearchEdit(mActivePanel->getFilterSubString());
+ if (mActivePanel)
+ {
+ // Filter applied to show all items.
+ mActivePanel->onSearchEdit(mActivePanel->getFilterSubString());
+
+ // History panel does not support deletion nor creation
+ // Hide menus
+ bool supports_create = mActivePanel->getCreateMenu() != NULL;
+ childSetVisible("add_btn_panel", supports_create);
+ childSetVisible("trash_btn_panel", supports_create);
+ }
mTabsCreated = true;
}
@@ -1219,15 +1301,12 @@ void LLPanelPlaces::updateVerbs()
mSaveBtn->setVisible(isLandmarkEditModeOn);
mCancelBtn->setVisible(isLandmarkEditModeOn);
mCloseBtn->setVisible(is_create_landmark_visible && !isLandmarkEditModeOn);
- mPlaceInfoBtn->setVisible(!is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn && !is_pick_panel_visible);
bool show_options_btn = is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn;
mOverflowBtn->setVisible(show_options_btn);
getChild<LLLayoutPanel>("lp_options")->setVisible(show_options_btn);
getChild<LLLayoutPanel>("lp2")->setVisible(!show_options_btn);
- mPlaceInfoBtn->setEnabled(!is_create_landmark_visible && !isLandmarkEditModeOn && have_3d_pos);
-
if (is_place_info_visible)
{
mShowOnMapBtn->setEnabled(have_3d_pos);