summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rwxr-xr-xindra/llui/llchatentry.cpp10
-rwxr-xr-xindra/llui/llfolderview.cpp36
-rwxr-xr-xindra/llui/llfolderview.h2
-rwxr-xr-xindra/llui/llfolderviewmodel.h33
-rwxr-xr-xindra/llui/lltexteditor.cpp8
-rwxr-xr-xindra/llui/lltexteditor.h2
6 files changed, 49 insertions, 42 deletions
diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp
index c04b70eb64..dac001afab 100755
--- a/indra/llui/llchatentry.cpp
+++ b/indra/llui/llchatentry.cpp
@@ -51,6 +51,7 @@ LLChatEntry::LLChatEntry(const Params& p)
mCurrentHistoryLine = mLineHistory.begin();
mAutoIndent = false;
+ keepSelectionOnReturn(true);
}
LLChatEntry::~LLChatEntry()
@@ -179,15 +180,6 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask)
{
BOOL handled = FALSE;
- // In the case of a chat entry, pressing RETURN when something is selected
- // should NOT erase the selection (unlike a notecard, for example)
- if (key == KEY_RETURN)
- {
- endOfDoc();
- startSelection();
- endSelection();
- }
-
LLTextEditor::handleSpecialKey(key, mask);
switch(key)
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index f32a52e6c6..c9ea0c0e1b 100755
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -629,6 +629,8 @@ bool LLFolderView::startDrag()
void LLFolderView::commitRename( const LLSD& data )
{
finishRenamingItem();
+ arrange( NULL, NULL );
+
}
void LLFolderView::draw()
@@ -1125,18 +1127,18 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
if((mSelectedItems.size() > 0) && mScrollContainer)
{
LLFolderViewItem* last_selected = getCurSelectedItem();
+ BOOL shift_select = mask & MASK_SHIFT;
+ // don't shift select down to children of folders (they are implicitly selected through parent)
+ LLFolderViewItem* next = last_selected->getNextOpenNode(!shift_select);
- if (!mKeyboardSelection)
+ if (!mKeyboardSelection || (!shift_select && (!next || next == last_selected)))
{
setSelection(last_selected, FALSE, TRUE);
mKeyboardSelection = TRUE;
}
- LLFolderViewItem* next = NULL;
- if (mask & MASK_SHIFT)
+ if (shift_select)
{
- // don't shift select down to children of folders (they are implicitly selected through parent)
- next = last_selected->getNextOpenNode(FALSE);
if (next)
{
if (next->isSelected())
@@ -1153,7 +1155,6 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
}
else
{
- next = last_selected->getNextOpenNode();
if( next )
{
if (next == last_selected)
@@ -1189,18 +1190,18 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
if((mSelectedItems.size() > 0) && mScrollContainer)
{
LLFolderViewItem* last_selected = mSelectedItems.back();
+ BOOL shift_select = mask & MASK_SHIFT;
+ // don't shift select down to children of folders (they are implicitly selected through parent)
+ LLFolderViewItem* prev = last_selected->getPreviousOpenNode(!shift_select);
- if (!mKeyboardSelection)
+ if (!mKeyboardSelection || (!shift_select && prev == this))
{
setSelection(last_selected, FALSE, TRUE);
mKeyboardSelection = TRUE;
}
- LLFolderViewItem* prev = NULL;
- if (mask & MASK_SHIFT)
+ if (shift_select)
{
- // don't shift select down to children of folders (they are implicitly selected through parent)
- prev = last_selected->getPreviousOpenNode(FALSE);
if (prev)
{
if (prev->isSelected())
@@ -1217,7 +1218,6 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
}
else
{
- prev = last_selected->getPreviousOpenNode();
if( prev )
{
if (prev == this)
@@ -1599,19 +1599,21 @@ void LLFolderView::update()
// until that inventory is loaded up.
LLFastTimer t2(FTM_INVENTORY);
- if (getFolderViewModel()->getFilter().isModified() && getFolderViewModel()->getFilter().isNotDefault())
+ LLFolderViewFilter& filter_object = getFolderViewModel()->getFilter();
+
+ if (filter_object.isModified() && filter_object.isNotDefault())
{
mNeedsAutoSelect = TRUE;
}
// Filter to determine visibility before arranging
- filter(getFolderViewModel()->getFilter());
+ filter(filter_object);
// Clear the modified setting on the filter only if the filter finished after running the filter process
// Note: if the filter count has timed out, that means the filter halted before completing the entire set of items
- if (getFolderViewModel()->getFilter().isModified() && (!getFolderViewModel()->getFilter().isTimedOut()))
+ if (filter_object.isModified() && (!filter_object.isTimedOut()))
{
- getFolderViewModel()->getFilter().clearModified();
+ filter_object.clearModified();
}
// automatically show matching items, and select first one if we had a selection
@@ -1630,7 +1632,7 @@ void LLFolderView::update()
// Open filtered folders for folder views with mAutoSelectOverride=TRUE.
// Used by LLPlacesFolderView.
- if (getFolderViewModel()->getFilter().showAllResults())
+ if (filter_object.showAllResults())
{
// these are named variables to get around gcc not binding non-const references to rvalues
// and functor application is inherently non-const to allow for stateful functors
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index 11fccdace4..c28660819f 100755
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -236,7 +236,7 @@ public:
virtual S32 notify(const LLSD& info) ;
bool useLabelSuffix() { return mUseLabelSuffix; }
- void updateMenu();
+ virtual void updateMenu();
private:
void updateMenuOptions(LLMenuGL* menu);
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index b1bcc8bbb4..a909d13f97 100755
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -386,27 +386,36 @@ template <typename SORT_TYPE, typename ITEM_TYPE, typename FOLDER_TYPE, typename
class LLFolderViewModel : public LLFolderViewModelCommon
{
public:
- LLFolderViewModel(){}
- virtual ~LLFolderViewModel() {}
-
typedef SORT_TYPE SortType;
typedef ITEM_TYPE ItemType;
typedef FOLDER_TYPE FolderType;
typedef FILTER_TYPE FilterType;
- virtual SortType& getSorter() { return mSorter; }
- virtual const SortType& getSorter() const { return mSorter; }
- virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); }
+ LLFolderViewModel(SortType* sorter, FilterType* filter)
+ : mSorter(sorter),
+ mFilter(filter)
+ {}
- virtual FilterType& getFilter() { return mFilter; }
- virtual const FilterType& getFilter() const { return mFilter; }
- virtual void setFilter(const FilterType& filter) { mFilter = filter; }
+ virtual ~LLFolderViewModel()
+ {
+ delete mSorter;
+ mSorter = NULL;
+ delete mFilter;
+ mFilter = NULL;
+ }
+
+ virtual SortType& getSorter() { return *mSorter; }
+ virtual const SortType& getSorter() const { return *mSorter; }
+ virtual void setSorter(const SortType& sorter) { mSorter = new SortType(sorter); requestSortAll(); }
+
+ virtual FilterType& getFilter() { return *mFilter; }
+ virtual const FilterType& getFilter() const { return *mFilter; }
+ virtual void setFilter(const FilterType& filter) { mFilter = new FilterType(filter); }
// By default, we assume the content is available. If a network fetch mechanism is implemented for the model,
// this method needs to be overloaded and return the relevant fetch status.
virtual bool contentsReady() { return true; }
-
struct ViewModelCompare
{
ViewModelCompare(const SortType& sorter)
@@ -438,8 +447,8 @@ public:
}
protected:
- SortType mSorter;
- FilterType mFilter;
+ SortType* mSorter;
+ FilterType* mFilter;
};
#endif // LLFOLDERVIEWMODEL_H
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 02c81c0744..6c4d031907 100755
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -264,7 +264,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mContextMenu(NULL),
mShowContextMenu(p.show_context_menu),
mEnableTooltipPaste(p.enable_tooltip_paste),
- mPassDelete(FALSE)
+ mPassDelete(FALSE),
+ mKeepSelectionOnReturn(false)
{
mSourceID.generate();
@@ -1664,7 +1665,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
case KEY_RETURN:
if (mask == MASK_NONE)
{
- if( hasSelection() )
+ if( hasSelection() && !mKeepSelectionOnReturn )
{
deleteSelection(FALSE);
}
@@ -2338,7 +2339,8 @@ void LLTextEditor::autoIndent()
S32 i;
LLWString text = getWText();
- while( ' ' == text[line_start] )
+ S32 offset = getLineOffsetFromDocIndex(mCursorPos);
+ while(( ' ' == text[line_start] ) && (space_count < offset))
{
space_count++;
line_start++;
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index d3b7bc0eb7..02a76d2f8a 100755
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -295,6 +295,7 @@ protected:
/*virtual*/ void updateSegments();
void updateLinkSegments();
+ void keepSelectionOnReturn(bool keep) { mKeepSelectionOnReturn = keep; }
private:
//
@@ -338,6 +339,7 @@ private:
bool mParseOnTheFly;
bool mEnableTooltipPaste;
bool mPassDelete;
+ bool mKeepSelectionOnReturn; // disabling of removing selected text after pressing of Enter
LLUUID mSourceID;