summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llflatlistview.cpp96
-rw-r--r--indra/llui/llflatlistview.h6
-rw-r--r--indra/llui/llview.h2
-rw-r--r--indra/newview/llnearbychat.cpp21
-rw-r--r--indra/newview/llnearbychathandler.cpp28
5 files changed, 99 insertions, 54 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index f4a5f1c990..d4c3cfb7b6 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -689,6 +689,17 @@ LLRect LLFlatListView::getSelectedItemsRect()
return rc;
}
+void LLFlatListView::selectFirstItem ()
+{
+ selectItemPair(mItemPairs.front(), true);
+}
+
+void LLFlatListView::selectLastItem ()
+{
+ selectItemPair(mItemPairs.back(), true);
+}
+
+
// virtual
bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selection)
{
@@ -696,53 +707,53 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti
if ( !mItemPairs.size() )
return false;
- item_pair_t* cur_sel_pair = NULL;
+
item_pair_t* to_sel_pair = NULL;
-
+ item_pair_t* cur_sel_pair = NULL;
if ( mSelectedItemPairs.size() )
{
// Take the last selected pair
cur_sel_pair = mSelectedItemPairs.back();
- }
- else
- {
- // If there weren't selected items then choose the first one bases on given direction
- cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front();
- // Force selection to first item
- to_sel_pair = cur_sel_pair;
- }
-
- // Bases on given direction choose next item to select
- if ( is_up_direction )
- {
- // Find current selected item position in mItemPairs list
- pairs_list_t::reverse_iterator sel_it = std::find(mItemPairs.rbegin(), mItemPairs.rend(), cur_sel_pair);
-
- for (;++sel_it != mItemPairs.rend();)
+ // Bases on given direction choose next item to select
+ if ( is_up_direction )
{
- // skip invisible items
- if ( (*sel_it)->first->getVisible() )
+ // Find current selected item position in mItemPairs list
+ pairs_list_t::reverse_iterator sel_it = std::find(mItemPairs.rbegin(), mItemPairs.rend(), cur_sel_pair);
+
+ for (;++sel_it != mItemPairs.rend();)
{
- to_sel_pair = *sel_it;
- break;
+ // skip invisible items
+ if ( (*sel_it)->first->getVisible() )
+ {
+ to_sel_pair = *sel_it;
+ break;
+ }
}
}
- }
- else
- {
- // Find current selected item position in mItemPairs list
- pairs_list_t::iterator sel_it = std::find(mItemPairs.begin(), mItemPairs.end(), cur_sel_pair);
-
- for (;++sel_it != mItemPairs.end();)
+ else
{
- // skip invisible items
- if ( (*sel_it)->first->getVisible() )
+ // Find current selected item position in mItemPairs list
+ pairs_list_t::iterator sel_it = std::find(mItemPairs.begin(), mItemPairs.end(), cur_sel_pair);
+
+ for (;++sel_it != mItemPairs.end();)
{
- to_sel_pair = *sel_it;
- break;
+ // skip invisible items
+ if ( (*sel_it)->first->getVisible() )
+ {
+ to_sel_pair = *sel_it;
+ break;
+ }
}
}
}
+ else
+ {
+ // If there weren't selected items then choose the first one bases on given direction
+ cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front();
+ // Force selection to first item
+ to_sel_pair = cur_sel_pair;
+ }
+
if ( to_sel_pair )
{
@@ -920,4 +931,23 @@ void LLFlatListView::onFocusLost()
mSelectedItemsBorder->setVisible(FALSE);
}
+//virtual
+void LLFlatListView::notify(const LLSD& info)
+{
+ if(info.has("action"))
+ {
+ std::string str_action = info["action"];
+ if(str_action == "select_first")
+ {
+ setFocus(true);
+ selectFirstItem();
+ }
+ else if(str_action == "select_last")
+ {
+ setFocus(true);
+ selectLastItem();
+ }
+ }
+}
+
//EOF
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 3867e910c0..9e1e0f90fc 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -279,6 +279,12 @@ public:
bool updateValue(const LLSD& old_value, const LLSD& new_value);
+
+ void selectFirstItem ();
+ void selectLastItem ();
+
+ virtual void notify(const LLSD& info) ;
+
protected:
/** Pairs LLpanel representing a single item LLPanel and LLSD associated with it */
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index d485244a05..c611e4c85f 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -514,6 +514,8 @@ public:
virtual void notifyParent(const LLSD& info);
virtual void notifyChildren(const LLSD& info);
+ virtual void notify(const LLSD& info) {};
+
static const LLViewDrawContext& getDrawContext();
protected:
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index fda3df43ae..18e5169930 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -58,6 +58,7 @@
#include "llbottomtray.h"
#include "llnearbychatbar.h"
#include "llfloaterreg.h"
+#include "lltrans.h"
static const S32 RESIZE_BAR_THICKNESS = 3;
@@ -131,6 +132,21 @@ void LLNearbyChat::applySavedVariables()
}
}
+std::string appendTime()
+{
+ time_t utc_time;
+ utc_time = time_corrected();
+ std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
+ +LLTrans::getString("TimeMin")+"] ";
+
+ LLSD substitution;
+
+ substitution["datetime"] = (S32) utc_time;
+ LLStringUtil::format (timeStr, substitution);
+
+ return timeStr;
+}
+
void LLNearbyChat::addMessage(const LLChat& chat,bool archive)
{
@@ -153,6 +169,11 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive)
}
}
+ LLChat& tmp_chat = const_cast<LLChat&>(chat);
+
+ if(tmp_chat.mTimeStr.empty())
+ tmp_chat.mTimeStr = appendTime();
+
bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory");
if (!chat.mMuted)
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 04e206fb99..169560f688 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -42,7 +42,6 @@
#include "llfloaterreg.h"//for LLFloaterReg::getTypedInstance
#include "llviewerwindow.h"//for screen channel position
-#include "lltrans.h"
//add LLNearbyChatHandler to LLNotificationsUI namespace
using namespace LLNotificationsUI;
@@ -319,20 +318,6 @@ void LLNearbyChatHandler::initChannel()
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
}
-std::string appendTime()
-{
- time_t utc_time;
- utc_time = time_corrected();
- std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
- +LLTrans::getString("TimeMin")+"] ";
-
- LLSD substitution;
-
- substitution["datetime"] = (S32) utc_time;
- LLStringUtil::format (timeStr, substitution);
-
- return timeStr;
-}
void LLNearbyChatHandler::processChat(const LLChat& chat_msg)
@@ -347,17 +332,18 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg)
LLChat& tmp_chat = const_cast<LLChat&>(chat_msg);
- if(tmp_chat.mTimeStr.empty())
- tmp_chat.mTimeStr = appendTime();
-
if (tmp_chat.mChatStyle == CHAT_STYLE_IRC)
{
- tmp_chat.mText = tmp_chat.mFromName + " " + tmp_chat.mText.substr(3);
+ if(!tmp_chat.mFromName.empty())
+ tmp_chat.mText = tmp_chat.mFromName + " " + tmp_chat.mText.substr(3);
+ else
+ tmp_chat.mText = tmp_chat.mText.substr(3);
}
{
- if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null)
- tmp_chat.mFromName = tmp_chat.mFromID.asString();
+ //sometimes its usefull to have no name at all...
+ //if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null)
+ // tmp_chat.mFromName = tmp_chat.mFromID.asString();
}
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());