summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llclipboard.cpp6
-rw-r--r--indra/llui/llclipboard.h15
-rw-r--r--indra/llui/lllineeditor.cpp14
-rw-r--r--indra/llui/llscrolllistctrl.cpp2
-rw-r--r--indra/llui/lltexteditor.cpp14
5 files changed, 19 insertions, 32 deletions
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp
index 6910b962a1..984c4ec5fb 100644
--- a/indra/llui/llclipboard.cpp
+++ b/indra/llui/llclipboard.cpp
@@ -40,7 +40,6 @@ LLClipboard gClipboard;
LLClipboard::LLClipboard()
{
- mSourceItem = NULL;
}
@@ -135,8 +134,3 @@ BOOL LLClipboard::canPastePrimaryString() const
{
return LLView::getWindow()->isPrimaryTextAvailable();
}
-
-void LLClipboard::setSourceObject(const LLUUID& source_id, LLAssetType::EType type)
-{
- mSourceItem = new LLInventoryObject (source_id, LLUUID::null, type, "");
-}
diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h
index 9371b94284..2567eaab48 100644
--- a/indra/llui/llclipboard.h
+++ b/indra/llui/llclipboard.h
@@ -31,10 +31,10 @@
#include "llstring.h"
#include "lluuid.h"
#include "stdenums.h"
+#include "llsingleton.h"
#include "llinventory.h"
-
-class LLClipboard
+class LLClipboard : public LLSingleton<LLClipboard>
{
public:
LLClipboard();
@@ -54,19 +54,12 @@ public:
BOOL canPastePrimaryString() const;
const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL);
- // Support clipboard for object known only by their uuid and asset type
- void setSourceObject(const LLUUID& source_id, LLAssetType::EType type);
- const LLInventoryObject* getSourceObject() { return mSourceItem; }
+ // Support clipboard for object known only by their uuid
+ void setSourceObject(const LLUUID& source_id) { mSourceID = source_id; }
private:
LLUUID mSourceID;
LLWString mString;
- LLInventoryObject* mSourceItem;
};
-
-// Global singleton
-extern LLClipboard gClipboard;
-
-
#endif // LL_LLCLIPBOARD_H
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 06dfc90d83..9292158b7c 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -1047,7 +1047,7 @@ void LLLineEditor::cut()
// Prepare for possible rollback
LLLineEditorRollback rollback( this );
- gClipboard.copyFromSubstring( mText.getWString(), left_pos, length );
+ LLClipboard::getInstance()->copyFromSubstring( mText.getWString(), left_pos, length );
deleteSelection();
// Validate new string and rollback the if needed.
@@ -1078,13 +1078,13 @@ void LLLineEditor::copy()
{
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
- gClipboard.copyFromSubstring( mText.getWString(), left_pos, length );
+ LLClipboard::getInstance()->copyFromSubstring( mText.getWString(), left_pos, length );
}
}
BOOL LLLineEditor::canPaste() const
{
- return !mReadOnly && gClipboard.canPasteString();
+ return !mReadOnly && LLClipboard::getInstance()->canPasteString();
}
void LLLineEditor::paste()
@@ -1117,11 +1117,11 @@ void LLLineEditor::pasteHelper(bool is_primary)
LLWString paste;
if (is_primary)
{
- paste = gClipboard.getPastePrimaryWString();
+ paste = LLClipboard::getInstance()->getPastePrimaryWString();
}
else
{
- paste = gClipboard.getPasteWString();
+ paste = LLClipboard::getInstance()->getPasteWString();
}
if (!paste.empty())
@@ -1209,13 +1209,13 @@ void LLLineEditor::copyPrimary()
{
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
- gClipboard.copyFromPrimarySubstring( mText.getWString(), left_pos, length );
+ LLClipboard::getInstance()->copyFromPrimarySubstring( mText.getWString(), left_pos, length );
}
}
BOOL LLLineEditor::canPastePrimary() const
{
- return !mReadOnly && gClipboard.canPastePrimaryString();
+ return !mReadOnly && LLClipboard::getInstance()->canPastePrimaryString();
}
void LLLineEditor::updatePrimary()
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 466fac33ea..8cbc2a8f99 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -2504,7 +2504,7 @@ void LLScrollListCtrl::copy()
{
buffer += (*itor)->getContentsCSV() + "\n";
}
- gClipboard.copyFromSubstring(utf8str_to_wstring(buffer), 0, buffer.length());
+ LLClipboard::getInstance()->copyFromSubstring(utf8str_to_wstring(buffer), 0, buffer.length());
}
// virtual
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 3a23ce1cac..22a577cda8 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -1332,7 +1332,7 @@ void LLTextEditor::cut()
}
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
- gClipboard.copyFromSubstring( getWText(), left_pos, length, mSourceID );
+ LLClipboard::getInstance()->copyFromSubstring( getWText(), left_pos, length, mSourceID );
deleteSelection( FALSE );
onKeyStroke();
@@ -1352,12 +1352,12 @@ void LLTextEditor::copy()
}
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
- gClipboard.copyFromSubstring(getWText(), left_pos, length, mSourceID);
+ LLClipboard::getInstance()->copyFromSubstring(getWText(), left_pos, length, mSourceID);
}
BOOL LLTextEditor::canPaste() const
{
- return !mReadOnly && gClipboard.canPasteString();
+ return !mReadOnly && LLClipboard::getInstance()->canPasteString();
}
// paste from clipboard
@@ -1397,11 +1397,11 @@ void LLTextEditor::pasteHelper(bool is_primary)
LLWString paste;
if (is_primary)
{
- paste = gClipboard.getPastePrimaryWString(&source_id);
+ paste = LLClipboard::getInstance()->getPastePrimaryWString(&source_id);
}
else
{
- paste = gClipboard.getPasteWString(&source_id);
+ paste = LLClipboard::getInstance()->getPasteWString(&source_id);
}
if (paste.empty())
@@ -1475,12 +1475,12 @@ void LLTextEditor::copyPrimary()
}
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
- gClipboard.copyFromPrimarySubstring(getWText(), left_pos, length, mSourceID);
+ LLClipboard::getInstance()->copyFromPrimarySubstring(getWText(), left_pos, length, mSourceID);
}
BOOL LLTextEditor::canPastePrimary() const
{
- return !mReadOnly && gClipboard.canPastePrimaryString();
+ return !mReadOnly && LLClipboard::getInstance()->canPastePrimaryString();
}
void LLTextEditor::updatePrimary()