merging of latest code

meow-7.2.2
Gilbert Gonzales 2012-08-02 09:45:59 -07:00
commit a87b27c41d
16 changed files with 155 additions and 185 deletions

View File

@ -324,7 +324,7 @@ public:
virtual void setDocked(bool docked, bool pop_on_undock = true);
virtual void setTornOff(bool torn_off) { mTornOff = torn_off; }
bool getTornOff() {return mTornOff;}
bool isTornOff() {return mTornOff;}
void setOpenPositioning(LLFloaterEnums::EOpenPositioning pos) {mPositioning = pos;}
// Return a closeable floater, if any, given the current focus.

View File

@ -717,33 +717,6 @@ void LLFolderView::closeRenamer( void )
}
}
bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector<LLFolderViewItem*>& selectedItems)
{
LLFolderViewItem* item_parent = dynamic_cast<LLFolderViewItem*>(item->getParent());
if (item_parent)
{
for(std::vector<LLFolderViewItem*>::const_iterator it = selectedItems.begin(); it != selectedItems.end(); ++it)
{
const LLFolderViewItem* const selected_item = (*it);
LLFolderViewItem* parent = item_parent;
while (parent)
{
if (selected_item == parent)
{
return true;
}
parent = dynamic_cast<LLFolderViewItem*>(parent->getParent());
}
}
}
return false;
}
void LLFolderView::removeSelectedItems()
{
if(getVisible() && getEnabled())
@ -815,7 +788,7 @@ void LLFolderView::removeSelectedItems()
if (!new_selection)
{
new_selection = last_item->getPreviousOpenNode(FALSE);
while (new_selection && (new_selection->isSelected() || isDescendantOfASelectedItem(new_selection, items)))
while (new_selection && (new_selection->isInSelection()))
{
new_selection = new_selection->getPreviousOpenNode(FALSE);
}
@ -1060,16 +1033,42 @@ void LLFolderView::cut()
if(getVisible() && getEnabled() && (count > 0))
{
LLFolderViewModelItem* listener = NULL;
LLFolderViewItem* last_item = *mSelectedItems.rbegin();;
LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE);
while(new_selection && new_selection->isSelected())
{
new_selection = new_selection->getNextOpenNode(FALSE);
}
if (!new_selection)
{
new_selection = last_item->getPreviousOpenNode(FALSE);
while (new_selection && (new_selection->isInSelection()))
{
new_selection = new_selection->getPreviousOpenNode(FALSE);
}
}
selected_items_t::iterator item_it;
for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
{
listener = (*item_it)->getViewModelItem();
LLFolderViewItem* item_to_cut = *item_it;
listener = item_to_cut->getViewModelItem();
if(listener)
{
listener->cutToClipboard();
listener->removeItem();
}
}
if (new_selection)
{
setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus());
}
else
{
setSelection(NULL, mParentPanel->hasFocus());
}
}
mSearchString.clear();
}

View File

@ -801,14 +801,20 @@ void LLFolderViewItem::draw()
}
const LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) const
{
{
return getRoot()->getFolderViewModel();
}
LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void )
{
{
return getRoot()->getFolderViewModel();
}
}
bool LLFolderViewItem::isInSelection() const
{
return mIsSelected || (mParentFolder && mParentFolder->isInSelection());
}
///----------------------------------------------------------------------------

View File

@ -164,6 +164,7 @@ public:
virtual void destroyView();
BOOL isSelected() const { return mIsSelected; }
bool isInSelection() const;
void setUnselected() { mIsSelected = FALSE; }

View File

@ -172,10 +172,11 @@ public:
virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet?
virtual void filter( LLFolderViewFilter& filter) = 0;
virtual bool filter( LLFolderViewFilter& filter) = 0;
virtual bool passedFilter(S32 filter_generation = -1) = 0;
virtual bool descendantsPassedFilter(S32 filter_generation = -1) = 0;
virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) = 0;
virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) = 0;
virtual void setPassedFolderFilter(bool passed, S32 filter_generation) = 0;
virtual void dirtyFilter() = 0;
virtual bool hasFilterStringMatch() = 0;
virtual std::string::size_type getFilterStringOffset() = 0;
@ -219,6 +220,7 @@ public:
mStringFilterSize(0),
mFolderViewItem(NULL),
mLastFilterGeneration(-1),
mLastFolderFilterGeneration(-1),
mMostFilteredDescendantGeneration(-1),
mParent(NULL),
mRootViewModel(root_view_model)
@ -231,9 +233,11 @@ public:
void setSortVersion(S32 version) { mSortVersion = version;}
S32 getLastFilterGeneration() const { return mLastFilterGeneration; }
S32 getLastFolderFilterGeneration() const { return mLastFolderFilterGeneration; }
void dirtyFilter()
{
mLastFilterGeneration = -1;
mLastFolderFilterGeneration = -1;
// bubble up dirty flag all the way to root
if (mParent)
@ -259,15 +263,20 @@ public:
dirtyFilter();
}
void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0)
void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0)
{
mPassedFilter = passed;
mPassedFolderFilter = passed_folder;
mLastFilterGeneration = filter_generation;
mStringMatchOffsetFilter = string_offset;
mStringFilterSize = string_size;
}
void setPassedFolderFilter(bool passed, S32 filter_generation)
{
mPassedFolderFilter = passed;
mLastFolderFilterGeneration = filter_generation;
}
virtual bool potentiallyVisible()
{
return passedFilter() // we've passed the filter
@ -280,7 +289,7 @@ public:
if (filter_generation < 0)
filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration();
bool passed_folder_filter = mPassedFolderFilter && mLastFilterGeneration >= filter_generation;
bool passed_folder_filter = mPassedFolderFilter && mLastFolderFilterGeneration >= filter_generation;
bool passed_filter = mPassedFilter && mLastFilterGeneration >= filter_generation;
return passed_folder_filter
&& (descendantsPassedFilter(filter_generation)
@ -304,6 +313,7 @@ protected:
std::string::size_type mStringFilterSize;
S32 mLastFilterGeneration;
S32 mLastFolderFilterGeneration;
S32 mMostFilteredDescendantGeneration;

View File

@ -288,7 +288,7 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
mTextBox->setText(p.message());
}
S32 text_width = llmin(p.max_width(), mTextBox->getTextPixelWidth());
S32 text_width = llmin(p.max_width(), mTextBox->getTextPixelWidth() + 1);
S32 text_height = mTextBox->getTextPixelHeight();
mTextBox->reshape(text_width, text_height);
if (mInfoButton)

View File

@ -125,9 +125,9 @@ void LLFolderViewModelItemInventory::requestSort()
}
}
void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size)
void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size)
{
LLFolderViewModelItemCommon::setPassedFilter(passed, passed_folder, filter_generation, string_offset, string_size);
LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size);
bool passed_filter_before = mPrevPassedAllFilters;
mPrevPassedAllFilters = passedFilter(filter_generation);
@ -143,14 +143,15 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_fo
}
}
void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter )
bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter )
{
S32 filter_generation = filter.getCurrentGeneration();
bool continue_filtering = true;
if (item->getLastFilterGeneration() < filter_generation)
{
// recursive application of the filter for child items
item->filter( filter );
continue_filtering = item->filter( filter );
}
// track latest generation to pass any child items, for each folder up to root
@ -164,22 +165,31 @@ void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite
view_model = static_cast<LLFolderViewModelItemInventory*>(view_model->mParent);
}
}
return continue_filtering;
}
void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
{
const S32 filter_generation = filter.getCurrentGeneration();
const S32 must_pass_generation = filter.getFirstRequiredGeneration();
if (getLastFilterGeneration() >= must_pass_generation
&& getLastFolderFilterGeneration() >= must_pass_generation
&& !passedFilter(must_pass_generation))
{
// failed to pass an earlier filter that was a subset of the current one
// go ahead and flag this item as done
setPassedFilter(false, false, filter_generation);
return;
setPassedFilter(false, filter_generation);
setPassedFolderFilter(false, filter_generation);
return true;
}
const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY)
? filter.checkFolder(this)
: true;
setPassedFolderFilter(passed_filter_folder, filter_generation);
if(!mChildren.empty()
&& (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass
|| descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement
@ -189,7 +199,10 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
iter != end_iter && filter.getFilterCount() > 0;
++iter)
{
filterChildItem((*iter), filter);
if (!filterChildItem((*iter), filter))
{
break;
}
}
}
@ -200,12 +213,13 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
{
filter.decrementFilterCount();
const BOOL passed_filter = filter.check(this);
const BOOL passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY)
? filter.checkFolder(this)
: true;
setPassedFilter(passed_filter, passed_filter_folder, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize());
const bool passed_filter = filter.check(this);
setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize());
return true;
}
else
{
return false;
}
}

View File

@ -53,9 +53,9 @@ public:
virtual EInventorySortGroup getSortGroup() const = 0;
virtual LLInventoryObject* getInventoryObject() const = 0;
virtual void requestSort();
virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0);
virtual void filter( LLFolderViewFilter& filter);
virtual void filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter);
virtual void setPassedFilter(bool filtered, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0);
virtual bool filter( LLFolderViewFilter& filter);
virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter);
virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0;
virtual LLToolDragAndDrop::ESource getDragSource() const = 0;

View File

@ -94,12 +94,16 @@ BOOL LLIMConversation::postBuild()
mTearOffBtn->setCommitCallback(boost::bind(&LLIMConversation::onTearOffClicked, this));
mChatHistory = getChild<LLChatHistory>("chat_history");
mInputEditor = getChild<LLChatEntry>("chat_editor");
mInputEditor = getChild<LLChatEntry>("chat_editor");
mInputEditor->setTextExpandedCallback(boost::bind(&LLIMConversation::reshapeChatHistory, this));
mInputEditor->setCommitOnFocusLost( FALSE );
mInputEditor->setPassDelete(TRUE);
mInputEditor->setFont(LLViewerChat::getChatFont());
mInputEditorTopPad = mChatHistory->getRect().mBottom - mInputEditor->getRect().mTop;
if (!getTornOff())
if (!isTornOff())
{
setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
}
@ -221,18 +225,16 @@ bool LLIMConversation::onIMShowModesMenuItemEnable(const LLSD& userdata)
void LLIMConversation::hideOrShowTitle()
{
bool is_hosted = getHost() != NULL;
const LLFloater::Params& default_params = LLFloater::getDefaultParams();
S32 floater_header_size = default_params.header_height;
LLView* floater_contents = getChild<LLView>("contents_view");
LLRect floater_rect = getLocalRect();
S32 top_border_of_contents = floater_rect.mTop - (is_hosted? 0 : floater_header_size);
S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0);
LLRect handle_rect (0, floater_rect.mTop, floater_rect.mRight, top_border_of_contents);
LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom);
mDragHandle->setShape(handle_rect);
mDragHandle->setVisible(! is_hosted);
mDragHandle->setVisible(isTornOff());
floater_contents->setShape(contents_rect);
}
@ -250,9 +252,8 @@ void LLIMConversation::hideAllStandardButtons()
void LLIMConversation::updateHeaderAndToolbar()
{
bool is_hosted = getHost() != NULL;
if (is_hosted)
bool is_torn_off = isTornOff();
if (!is_torn_off)
{
hideAllStandardButtons();
}
@ -261,7 +262,7 @@ void LLIMConversation::updateHeaderAndToolbar()
// Participant list should be visible only in torn off floaters.
bool is_participant_list_visible =
!is_hosted
is_torn_off
&& gSavedSettings.getBOOL("IMShowControlPanel")
&& !mIsP2PChat;
@ -269,21 +270,21 @@ void LLIMConversation::updateHeaderAndToolbar()
// Display collapse image (<<) if the floater is hosted
// or if it is torn off but has an open control panel.
bool is_expanded = is_hosted || is_participant_list_visible;
bool is_expanded = !is_torn_off || is_participant_list_visible;
mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon"));
// toggle floater's drag handle and title visibility
if (mDragHandle)
{
mDragHandle->setTitleVisible(!is_hosted);
mDragHandle->setTitleVisible(is_torn_off);
}
// The button (>>) should be disabled for torn off P2P conversations.
mExpandCollapseBtn->setEnabled(is_hosted || !mIsP2PChat);
mExpandCollapseBtn->setEnabled(!is_torn_off || !mIsP2PChat);
mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon"));
mTearOffBtn->setImageOverlay(getString(is_torn_off? "return_icon" : "tear_off_icon"));
mCloseBtn->setVisible(is_hosted && !mIsNearbyChat);
mCloseBtn->setVisible(!is_torn_off && !mIsNearbyChat);
enableDisableCallBtn();

View File

@ -99,6 +99,10 @@ protected:
LLParticipantList* mParticipantList;
LLUUID mSessionID;
LLChatHistory* mChatHistory;
LLChatEntry* mInputEditor;
int mInputEditorTopPad; // padding between input field and chat history
LLButton* mExpandCollapseBtn;
LLButton* mTearOffBtn;
LLButton* mCloseBtn;
@ -117,10 +121,6 @@ private:
*/
void reshapeChatHistory();
LLChatHistory* mChatHistory;
LLChatEntry* mInputEditor;
int mInputEditorTopPad; // padding between input field and chat history
LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called.
};

View File

@ -66,11 +66,9 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
: LLIMConversation(session_id),
mLastMessageIndex(-1),
mDialog(IM_NOTHING_SPECIAL),
mInputEditor(NULL),
mSavedTitle(),
mTypingStart(),
mShouldSendTypingState(false),
mChatHistory(NULL),
mMeTyping(false),
mOtherTyping(false),
mTypingTimer(),
@ -80,6 +78,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
mStartConferenceInSameFloater(false)
{
mIsNearbyChat = false;
initIMSession(session_id);
setOverlapsScreenChannel(true);
@ -313,9 +312,8 @@ void LLIMFloater::initIMFloater()
//virtual
BOOL LLIMFloater::postBuild()
{
LLIMConversation::postBuild();
BOOL result = LLIMConversation::postBuild();
mInputEditor = getChild<LLChatEntry>("chat_editor");
mInputEditor->setMaxTextLength(1023);
// enable line history support for instant message bar
// XXX stinson TODO : resolve merge by adding autoreplace to text editors
@ -323,19 +321,11 @@ BOOL LLIMFloater::postBuild()
// *TODO Establish LineEditor with autoreplace callback
mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2));
#endif
LLFontGL* font = LLViewerChat::getChatFont();
mInputEditor->setFont(font);
mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) );
mInputEditor->setKeystrokeCallback( boost::bind(onInputEditorKeystroke, _1, this) );
mInputEditor->setCommitOnFocusLost( FALSE );
mInputEditor->setPassDelete( TRUE );
mInputEditor->setCommitCallback(boost::bind(onSendMsg, _1, this));
mChatHistory = getChild<LLChatHistory>("chat_history");
setDocked(true);
@ -358,7 +348,7 @@ BOOL LLIMFloater::postBuild()
LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
im_box->addConversationListItem(getTitle(), getKey(), this);
return TRUE;
return result;
}
void LLIMFloater::onAddButtonClicked()
@ -1004,7 +994,7 @@ void LLIMFloater::onInputEditorKeystroke(LLTextEditor* caller, void* userdata)
// Deleting all text counts as stopping typing.
self->setTyping(!text.empty());
}
}
void LLIMFloater::setTyping(bool typing)
{

View File

@ -184,11 +184,8 @@ private:
LLIMModel::LLIMSession* mSession;
S32 mLastMessageIndex;
LLChatHistory* mChatHistory;
EInstantMessage mDialog;
LLUUID mOtherParticipantUUID;
LLChatEntry* mInputEditor;
bool mPositioned;
std::string mSavedTitle;

View File

@ -89,9 +89,9 @@ public:
virtual bool hasChildren() const { return FALSE; }
virtual bool potentiallyVisible() { return true; }
virtual void filter( LLFolderViewFilter& filter) { }
virtual bool filter( LLFolderViewFilter& filter) { return false; }
virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; }
virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { }
virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { }
virtual bool passedFilter(S32 filter_generation = -1) { return true; }
// The action callbacks

View File

@ -281,13 +281,6 @@ void LLInventoryPanel::draw()
// Select the desired item (in case it wasn't loaded when the selection was requested)
updateSelection();
// Nudge the filter if the clipboard state changed
if (mClipboardState != LLClipboard::instance().getGeneration())
{
mClipboardState = LLClipboard::instance().getGeneration();
getFilter().setModified(LLClipboard::instance().isCutMode() ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);
}
LLPanel::draw();
}
@ -586,7 +579,6 @@ LLUUID LLInventoryPanel::getRootFolderID()
}
}
// static
void LLInventoryPanel::onIdle(void *userdata)
{
@ -608,6 +600,15 @@ void LLInventoryPanel::onIdle(void *userdata)
void LLInventoryPanel::idle(void* user_data)
{
LLInventoryPanel* panel = (LLInventoryPanel*)user_data;
// Nudge the filter if the clipboard state changed
if (panel->mClipboardState != LLClipboard::instance().getGeneration())
{
panel->mClipboardState = LLClipboard::instance().getGeneration();
panel->getFilter().setModified(LLClipboard::instance().isCutMode()
? LLInventoryFilter::FILTER_MORE_RESTRICTIVE
: LLInventoryFilter::FILTER_LESS_RESTRICTIVE);
}
panel->mFolderRoot->update();
// while dragging, update selection rendering to reflect single/multi drag status
if (LLToolDragAndDrop::getInstance()->hasMouseCapture())

View File

@ -125,30 +125,24 @@ static LLChatTypeTrigger sChatTypeTriggers[] = {
LLNearbyChat::LLNearbyChat(const LLSD& key)
: LLIMConversation(key),
mChatBox(NULL),
mChatHistory(NULL),
//mOutputMonitor(NULL),
mSpeakerMgr(NULL),
mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
{
mIsNearbyChat = true;
setIsChrome(TRUE);
mKey = LLSD();
mIsNearbyChat = true;
mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
}
//virtual
BOOL LLNearbyChat::postBuild()
{
mChatBox = getChild<LLChatEntry>("chat_editor");
mChatBox->setCommitCallback(boost::bind(&LLNearbyChat::onChatBoxCommit, this));
mChatBox->setKeystrokeCallback(boost::bind(&onChatBoxKeystroke, _1, this));
mChatBox->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this));
mChatBox->setFocusReceivedCallback(boost::bind(&LLNearbyChat::onChatBoxFocusReceived, this));
mChatBox->setCommitOnFocusLost( FALSE );
mChatBox->setPassDelete(TRUE);
mChatBox->setFont(LLViewerChat::getChatFont());
BOOL result = LLIMConversation::postBuild();
mInputEditor->setCommitCallback(boost::bind(&LLNearbyChat::onChatBoxCommit, this));
mInputEditor->setKeystrokeCallback(boost::bind(&onChatBoxKeystroke, _1, this));
mInputEditor->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this));
mInputEditor->setFocusReceivedCallback(boost::bind(&LLNearbyChat::onChatBoxFocusReceived, this));
// mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator");
// mOutputMonitor->setVisible(FALSE);
@ -180,7 +174,6 @@ BOOL LLNearbyChat::postBuild()
// obsolete, but may be needed for backward compatibility?
gSavedSettings.declareS32("nearbychat_showicons_and_names", 2, "NearByChat header settings", true);
mChatHistory = getChild<LLChatHistory>("chat_history");
if (gSavedPerAccountSettings.getBOOL("LogShowHistory"))
{
loadHistory();
@ -190,7 +183,7 @@ BOOL LLNearbyChat::postBuild()
LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
im_box->addConversationListItem(getTitle(), LLSD(), this);
return LLIMConversation::postBuild();
return result;
}
// virtual
@ -227,10 +220,6 @@ bool LLNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata)
return false;
}
void LLNearbyChat::getAllowedRect(LLRect& rect)
{
rect = gViewerWindow->getWorldViewRectScaled();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLNearbyChat::onFocusReceived()
@ -352,10 +341,8 @@ void LLNearbyChat::onTearOffClicked()
{
LLIMConversation::onTearOffClicked();
LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
// see CHUI-170: Save torn-off state of the nearby chat between sessions
BOOL in_the_multifloater = (getHost() == im_box);
BOOL in_the_multifloater = !isTornOff();
gSavedSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater);
}
@ -389,18 +376,12 @@ void LLNearbyChat::onOpen(const LLSD& key)
showTranslationCheckbox(LLTranslate::isTranslationConfigured());
}
bool LLNearbyChat::applyRectControl()
{
setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT);
return LLFloater::applyRectControl();
}
void LLNearbyChat::onChatFontChange(LLFontGL* fontp)
{
// Update things with the new font whohoo
if (mChatBox)
if (mInputEditor)
{
mChatBox->setFont(fontp);
mInputEditor->setFont(fontp);
}
}
@ -416,33 +397,20 @@ void LLNearbyChat::show()
{
openFloater(getKey());
}
setVisible(TRUE);
}
bool LLNearbyChat::isChatVisible() const
{
bool isVisible = false;
if (isChatMultiTab())
LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
// Is the IM floater container ever null?
llassert(im_box != NULL);
if (im_box != NULL)
{
LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
// Is the IM floater container ever null?
llassert(im_box != NULL);
if (im_box != NULL)
{
if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff"))
{
isVisible = (im_box->getVisible() && !im_box->isMinimized());
}
else
{
isVisible = (getVisible() && !isMinimized());
}
}
}
else
{
isVisible = (getVisible() && !isMinimized());
isVisible =
isChatMultiTab() && gSavedSettings.getBOOL("NearbyChatIsNotTornOff")?
im_box->getVisible() && !im_box->isMinimized() :
getVisible() && !isMinimized();
}
return isVisible;
@ -452,22 +420,11 @@ void LLNearbyChat::showHistory()
{
openFloater();
setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT);
bool is_torn_off = getHost() == NULL;
// Reshape and enable resize controls only if it's a torn off floater.
// Otherwise all the size changes should be handled by LLIMFloaterContainer.
if (is_torn_off)
{
reshape(getRect().getWidth(), mExpandedHeight);
enableResizeCtrls(true);
storeRectControl();
}
}
std::string LLNearbyChat::getCurrentChat()
{
return mChatBox ? mChatBox->getText() : LLStringUtil::null;
return mInputEditor ? mInputEditor->getText() : LLStringUtil::null;
}
// virtual
@ -516,7 +473,7 @@ void LLNearbyChat::onChatBoxKeystroke(LLTextEditor* caller, void* userdata)
LLNearbyChat* self = (LLNearbyChat *)userdata;
LLWString raw_text = self->mChatBox->getWText();
LLWString raw_text = self->mInputEditor->getWText();
// Can't trim the end, because that will cause autocompletion
// to eat trailing spaces that might be part of a gesture.
@ -563,17 +520,17 @@ void LLNearbyChat::onChatBoxKeystroke(LLTextEditor* caller, void* userdata)
if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
{
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
self->mChatBox->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
self->mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
// Select to end of line, starting from the character
// after the last one the user typed.
self->mChatBox->selectNext(rest_of_match, false);
self->mInputEditor->selectNext(rest_of_match, false);
}
else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str))
{
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
self->mChatBox->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part
self->mChatBox->endOfDoc();
self->mInputEditor->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part
self->mInputEditor->endOfDoc();
}
//llinfos << "GESTUREDEBUG " << trigger
@ -592,7 +549,7 @@ void LLNearbyChat::onChatBoxFocusLost(LLFocusableElement* caller, void* userdata
void LLNearbyChat::onChatBoxFocusReceived()
{
mChatBox->setEnabled(!gDisconnected);
mInputEditor->setEnabled(!gDisconnected);
}
EChatType LLNearbyChat::processChatTypeTriggers(EChatType type, std::string &str)
@ -629,9 +586,9 @@ EChatType LLNearbyChat::processChatTypeTriggers(EChatType type, std::string &str
void LLNearbyChat::sendChat( EChatType type )
{
if (mChatBox)
if (mInputEditor)
{
LLWString text = mChatBox->getWText();
LLWString text = mInputEditor->getWText();
LLWStringUtil::trim(text);
LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines.
if (!text.empty())
@ -664,7 +621,7 @@ void LLNearbyChat::sendChat( EChatType type )
}
}
mChatBox->setText(LLStringExplicit(""));
mInputEditor->setText(LLStringExplicit(""));
}
gAgent.stopTyping();
@ -735,7 +692,7 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
void LLNearbyChat::onChatBoxCommit()
{
if (mChatBox->getText().length() > 0)
if (mInputEditor->getText().length() > 0)
{
sendChat(CHAT_TYPE_NORMAL);
}
@ -837,15 +794,15 @@ void LLNearbyChat::startChat(const char* line)
cb->show();
cb->setVisible(TRUE);
cb->setFocus(TRUE);
cb->mChatBox->setFocus(TRUE);
cb->mInputEditor->setFocus(TRUE);
if (line)
{
std::string line_string(line);
cb->mChatBox->setText(line_string);
cb->mInputEditor->setText(line_string);
}
cb->mChatBox->endOfDoc();
cb->mInputEditor->endOfDoc();
}
}
@ -857,7 +814,7 @@ void LLNearbyChat::stopChat()
if (cb)
{
cb->mChatBox->setFocus(FALSE);
cb->mInputEditor->setFocus(FALSE);
// stop typing animation
gAgent.stopTyping();

View File

@ -39,7 +39,6 @@
#include "llpanel.h"
class LLResizeBar;
class LLChatHistory;
class LLNearbyChat
: public LLIMConversation
@ -73,7 +72,7 @@ public:
void onNearbyChatContextMenuItemClicked(const LLSD& userdata);
bool onNearbyChatCheckContextMenuItem(const LLSD& userdata);
LLChatEntry* getChatBox() { return mChatBox; }
LLChatEntry* getChatBox() { return mInputEditor; }
std::string getCurrentChat();
@ -98,8 +97,6 @@ protected:
void onChatBoxCommit();
void onChatFontChange(LLFontGL* fontp);
/* virtual */ bool applyRectControl();
/*virtual*/ void onTearOffClicked();
static LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
@ -113,7 +110,6 @@ protected:
// Which non-zero channel did we last chat on?
static S32 sLastSpecialChatChannel;
LLChatEntry* mChatBox;
LLOutputMonitorCtrl* mOutputMonitor;
LLLocalSpeakerMgr* mSpeakerMgr;
@ -121,7 +117,6 @@ protected:
private:
void getAllowedRect (LLRect& rect);
// prepare chat's params and out one message to chatHistory
void appendMessage(const LLChat& chat, const LLSD &args = 0);
void onNearbySpeakers ();
@ -130,7 +125,6 @@ private:
LLHandle<LLView> mPopupMenuHandle;
std::vector<LLChat> mMessageArchive;
LLChatHistory* mChatHistory;
};