summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth ProductEngine <slitovchuk@productengine.com>2012-09-10 20:12:27 +0300
committerSeth ProductEngine <slitovchuk@productengine.com>2012-09-10 20:12:27 +0300
commitbe06bebffcc1a08c3018ab3712048599455e025b (patch)
tree534921492c215067be5d93de1669f5b78343b2b6
parentd79037017e3a1627be848b9162f28ae16fcb6004 (diff)
CHUI-282 WIP Modified conversation view item and IM floater container so that the folder view handles the positioning of items in conversations list.
-rw-r--r--indra/llui/llfolderviewitem.h1
-rw-r--r--indra/newview/llconversationview.cpp170
-rw-r--r--indra/newview/llconversationview.h13
-rw-r--r--indra/newview/llimfloatercontainer.cpp60
-rw-r--r--indra/newview/llimfloatercontainer.h2
-rw-r--r--indra/newview/llinventoryicon.h2
-rw-r--r--indra/newview/skins/default/xui/en/panel_conversation_list_item.xml78
7 files changed, 307 insertions, 19 deletions
diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h
index 6eacbe8bd0..141956c3f0 100644
--- a/indra/llui/llfolderviewitem.h
+++ b/indra/llui/llfolderviewitem.h
@@ -113,7 +113,6 @@ protected:
static LLFontGL* getLabelFontForStyle(U8 style);
-private:
BOOL mIsSelected;
public:
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
index 9f3df93aba..514bf38b00 100644
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -42,10 +42,173 @@ LLConversationViewSession::Params::Params() :
LLConversationViewSession::LLConversationViewSession( const LLConversationViewSession::Params& p ):
LLFolderViewFolder(p),
- mContainer(p.container)
+ mContainer(p.container),
+ mItemPanel(NULL),
+ mSessionTitle(NULL)
{
}
+BOOL LLConversationViewSession::postBuild()
+{
+ LLFolderViewItem::postBuild();
+
+ mItemPanel = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>("panel_conversation_list_item.xml", NULL, LLPanel::child_registry_t::instance());
+
+ addChild(mItemPanel);
+
+ mSessionTitle = mItemPanel->getChild<LLTextBox>("conversation_title");
+
+ refresh();
+
+ return TRUE;
+}
+
+void LLConversationViewSession::draw()
+{
+ if (mAutoOpenCountdown != 0.f)
+ {
+ mControlLabelRotation = mAutoOpenCountdown * -90.f;
+ }
+ else if (isOpen())
+ {
+ mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(0.04f));
+ }
+ else
+ {
+ mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(0.025f));
+ }
+
+ const LLColor4U DEFAULT_WHITE(255, 255, 255);
+
+ static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+ static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
+ static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
+ static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE);
+
+ const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
+ const S32 TOP_PAD = default_params.item_top_pad;
+ const S32 FOCUS_LEFT = 1;
+
+ getViewModelItem()->update();
+
+ //--------------------------------------------------------------------------------//
+ // Draw open folder arrow
+ //
+ if (hasVisibleChildren() || getViewModelItem()->hasChildren())
+ {
+ LLUIImage* arrow_image = default_params.folder_arrow_image;
+ gl_draw_scaled_rotated_image(
+ mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD - TOP_PAD,
+ ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, arrow_image->getImage(), sFgColor);
+ }
+
+
+ //--------------------------------------------------------------------------------//
+ // Draw highlight for selected items
+ //
+ const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE);
+ const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled
+ const S32 focus_top = getRect().getHeight();
+ const S32 focus_bottom = getRect().getHeight() - mItemHeight;
+ const bool folder_open = (getRect().getHeight() > mItemHeight + 4);
+ if (mIsSelected) // always render "current" item. Only render other selected items if mShowSingleSelection is FALSE
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLColor4 bg_color = sHighlightBgColor;
+ if (!mIsCurSelection)
+ {
+ // do time-based fade of extra objects
+ F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f);
+ if (getRoot() && getRoot()->getShowSingleSelection())
+ {
+ // fading out
+ bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, bg_color.mV[VALPHA], 0.f);
+ }
+ else
+ {
+ // fading in
+ bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, 0.f, bg_color.mV[VALPHA]);
+ }
+ }
+ gl_rect_2d(FOCUS_LEFT,
+ focus_top,
+ getRect().getWidth() - 2,
+ focus_bottom,
+ bg_color, filled);
+ if (mIsCurSelection)
+ {
+ gl_rect_2d(FOCUS_LEFT,
+ focus_top,
+ getRect().getWidth() - 2,
+ focus_bottom,
+ sFocusOutlineColor, FALSE);
+ }
+ if (folder_open)
+ {
+ gl_rect_2d(FOCUS_LEFT,
+ focus_bottom + 1, // overlap with bottom edge of above rect
+ getRect().getWidth() - 2,
+ 0,
+ sFocusOutlineColor, FALSE);
+ if (show_context)
+ {
+ gl_rect_2d(FOCUS_LEFT,
+ focus_bottom + 1,
+ getRect().getWidth() - 2,
+ 0,
+ sHighlightBgColor, TRUE);
+ }
+ }
+ }
+ else if (mIsMouseOverTitle)
+ {
+ gl_rect_2d(FOCUS_LEFT,
+ focus_top,
+ getRect().getWidth() - 2,
+ focus_bottom,
+ sMouseOverColor, FALSE);
+ }
+
+ //--------------------------------------------------------------------------------//
+ // Draw DragNDrop highlight
+ //
+ if (mDragAndDropTarget)
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gl_rect_2d(FOCUS_LEFT,
+ focus_top,
+ getRect().getWidth() - 2,
+ focus_bottom,
+ sHighlightBgColor, FALSE);
+ if (folder_open)
+ {
+ gl_rect_2d(FOCUS_LEFT,
+ focus_bottom + 1, // overlap with bottom edge of above rect
+ getRect().getWidth() - 2,
+ 0,
+ sHighlightBgColor, FALSE);
+ }
+ mDragAndDropTarget = FALSE;
+ }
+
+ LLView::draw();
+
+ mExpanderHighlighted = FALSE;
+}
+
+// virtual
+S32 LLConversationViewSession::arrange(S32* width, S32* height)
+{
+ LLRect rect(getIndentation() + ARROW_SIZE,
+ getLocalRect().mTop,
+ getLocalRect().mRight,
+ getLocalRect().mTop - getItemHeight());
+ mItemPanel->setRect(rect);
+ mItemPanel->reshape(rect.getWidth(), rect.getHeight());
+
+ return LLFolderViewFolder::arrange(width, height);
+}
+
void LLConversationViewSession::selectItem()
{
LLFolderViewItem::selectItem();
@@ -103,6 +266,11 @@ void LLConversationViewSession::refresh()
LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(getViewModelItem());
vmi->resetRefresh();
+ if (mSessionTitle)
+ {
+ mSessionTitle->setText(vmi->getDisplayName());
+ }
+
// Note: for the moment, all that needs to be done is done by LLFolderViewItem::refresh()
// Do the regular upstream refresh
diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h
index a3755d9722..ec99b2eb9b 100644
--- a/indra/newview/llconversationview.h
+++ b/indra/newview/llconversationview.h
@@ -29,6 +29,7 @@
#include "llfolderviewitem.h"
+class LLTextBox;
class LLIMFloaterContainer;
class LLConversationViewSession;
class LLConversationViewParticipant;
@@ -53,11 +54,21 @@ protected:
public:
virtual ~LLConversationViewSession( void ) { }
- virtual void selectItem();
+ virtual void selectItem();
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
+
+ /*virtual*/ S32 arrange(S32* width, S32* height);
+
void setVisibleIfDetached(BOOL visible);
LLConversationViewParticipant* findParticipant(const LLUUID& participant_id);
virtual void refresh();
+
+private:
+ LLPanel* mItemPanel;
+ LLTextBox* mSessionTitle;
};
// Implementation of conversations list participant (avatar) widgets
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 480f964939..9157d16aea 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -38,6 +38,7 @@
#include "llavataractions.h"
#include "llavatariconctrl.h"
#include "llavatarnamecache.h"
+#include "llcallbacklist.h"
#include "llgroupiconctrl.h"
#include "llfloateravatarpicker.h"
#include "llfloaterpreference.h"
@@ -76,6 +77,8 @@ LLIMFloaterContainer::~LLIMFloaterContainer()
{
LLIMMgr::getInstance()->removeSessionObserver(this);
}
+
+ gIdleCallbacks.deleteFunction(idle, (void*)this);
}
void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id)
@@ -117,16 +120,31 @@ BOOL LLIMFloaterContainer::postBuild()
// CHUI-98 : View Model for conversations
LLConversationItem* base_item = new LLConversationItem(getRootViewModel());
- LLFolderView::Params p;
- p.view_model = &mConversationViewModel;
- p.parent_panel = mConversationsListPanel;
- p.rect = mConversationsListPanel->getLocalRect();
- p.follows.flags = FOLLOWS_ALL;
- p.listener = base_item;
- p.root = NULL;
+ LLFolderView::Params p(LLUICtrlFactory::getDefaultParams<LLFolderView>());
+ p.name = getName();
+ p.title = getLabel();
+ p.rect = LLRect(0, 0, getRect().getWidth(), 0);
+ p.parent_panel = mConversationsListPanel;
+ p.tool_tip = p.name;
+ p.listener = base_item;
+ p.view_model = &mConversationViewModel;
+ p.root = NULL;
mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p);
- mConversationsListPanel->addChild(mConversationsRoot);
+
+ // Scroller
+ LLRect scroller_view_rect = mConversationsListPanel->getRect();
+ scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
+ LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams<LLFolderViewScrollContainer>());
+ scroller_params.rect(scroller_view_rect);
+
+ LLScrollContainer* scroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
+ scroller->setFollowsAll();
+ mConversationsListPanel->addChild(scroller);
+ scroller->addChild(mConversationsRoot);
+ mConversationsRoot->setScrollContainer(scroller);
+ mConversationsRoot->setFollowsAll();
+ mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox);
addConversationListItem(LLUUID()); // manually add nearby chat
@@ -149,6 +167,9 @@ BOOL LLIMFloaterContainer::postBuild()
mConversationsPane->handleReshape(list_size, TRUE);
}
+
+ gIdleCallbacks.addFunction(idle, (void*)this);
+
mInitialized = true;
return TRUE;
}
@@ -301,6 +322,13 @@ void LLIMFloaterContainer::setMinimized(BOOL b)
}
}
+// static
+void LLIMFloaterContainer::idle(void* user_data)
+{
+ LLIMFloaterContainer* self = static_cast<LLIMFloaterContainer*>(user_data);
+ self->mConversationsRoot->update();
+}
+
void LLIMFloaterContainer::draw()
{
// CHUI Notes
@@ -338,7 +366,6 @@ void LLIMFloaterContainer::draw()
{
participant_view = createConversationViewParticipant(participant_model);
participant_view->addToFolder(session_view);
- mConversationsListPanel->addChild(participant_view);
participant_view->setVisible(TRUE);
}
else
@@ -363,8 +390,6 @@ void LLIMFloaterContainer::draw()
collapseMessagesPane(true);
}
LLFloater::draw();
-
- repositioningWidgets();
}
void LLIMFloaterContainer::tabClose()
@@ -616,7 +641,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid)
widget->addToFolder(mConversationsRoot);
// Add it to the UI
- mConversationsListPanel->addChild(widget);
+// mConversationsListPanel->addChild(widget);
widget->setVisible(TRUE);
// Create the participants widgets now
@@ -629,12 +654,16 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid)
LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model);
LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model);
participant_view->addToFolder(widget);
- mConversationsListPanel->addChild(participant_view);
- participant_view->setVisible(TRUE);
+// mConversationsListPanel->addChild(participant_view);
+// participant_view->setVisible(TRUE);
current_participant_model++;
}
- repositioningWidgets();
+ S32 width = 0;
+ S32 height = 0;
+ mConversationsRoot->arrange(&width, &height);
+
+// repositioningWidgets();
return;
}
@@ -678,6 +707,7 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL
//params.icon = bridge->getIcon();
//params.icon_open = bridge->getOpenIcon();
//params.creation_date = bridge->getCreationDate();
+ params.item_height = 24;
params.root = mConversationsRoot;
params.listener = item;
params.rect = LLRect (0, 0, 0, 0);
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index 53e3849600..427baa03e3 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -71,6 +71,8 @@ public:
static LLIMFloaterContainer* getInstance();
+ static void idle(void* user_data);
+
virtual void setMinimized(BOOL b);
void collapseMessagesPane(bool collapse);
diff --git a/indra/newview/llinventoryicon.h b/indra/newview/llinventoryicon.h
index c7e2998a20..5c8acf9e85 100644
--- a/indra/newview/llinventoryicon.h
+++ b/indra/newview/llinventoryicon.h
@@ -1,5 +1,5 @@
/**
- * @file llinventoryfunctions.h
+ * @file llinventoryicon.h
* @brief Miscellaneous inventory-related functions and classes
* class definition
*
diff --git a/indra/newview/skins/default/xui/en/panel_conversation_list_item.xml b/indra/newview/skins/default/xui/en/panel_conversation_list_item.xml
new file mode 100644
index 0000000000..d1f25b45fe
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_conversation_list_item.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ follows="left|top|right"
+ height="24"
+ layout="topleft"
+ mouse_opaque="flase"
+ name="conversation_list_item"
+ width="120">
+ <avatar_icon
+ follows="top|left"
+ height="20"
+ default_icon_name="Generic_Person"
+ layout="topleft"
+ left="5"
+ mouse_opaque="true"
+ top="2"
+ width="20" />
+ <layout_stack
+ animate="false"
+ follows="all"
+ height="24"
+ layout="topleft"
+ left_pad="5"
+ name="caonversation_item_stack"
+ orientation="horizontal"
+ top="0"
+ width="90">
+ <layout_panel
+ auto_resize="false"
+ user_resize="false"
+ height="24"
+ name="call_icon_panel"
+ visible="false"
+ width="20">
+ <icon
+ height="20"
+ follows="top|right|left"
+ image_name="Conv_toolbar_hang_up"
+ layout="topleft"
+ left="0"
+ name="selected_icon"
+ top="2"
+ width="20" />
+ </layout_panel>
+ <layout_panel
+ auto_resize="true"
+ user_resize="false"
+ left_pad="0"
+ height="24"
+ name="conversation_title_panel"
+ min_dim="50"
+ width="70"
+ expanded_min_dim="50">
+ <text
+ follows="left|top|right"
+ font="SansSerifSmall"
+ height="15"
+ layout="topleft"
+ left="5"
+ name="conversation_title"
+ parse_urls="false"
+ top="6"
+ use_ellipses="true"
+ value="(loading)"
+ width="35" />
+ <output_monitor
+ auto_update="true"
+ follows="top|right"
+ draw_border="false"
+ height="16"
+ layout="topleft"
+ left_pad="5"
+ mouse_opaque="true"
+ name="speaking_indicator"
+ width="20" />
+ </layout_panel>
+ </layout_stack>
+</panel>