aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewertexteditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewertexteditor.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/linden/indra/newview/llviewertexteditor.cpp b/linden/indra/newview/llviewertexteditor.cpp
index 00e25af..f84c875 100644
--- a/linden/indra/newview/llviewertexteditor.cpp
+++ b/linden/indra/newview/llviewertexteditor.cpp
@@ -72,6 +72,9 @@ public:
72 LLEmbeddedItems(const LLViewerTextEditor* editor); 72 LLEmbeddedItems(const LLViewerTextEditor* editor);
73 ~LLEmbeddedItems(); 73 ~LLEmbeddedItems();
74 void clear(); 74 void clear();
75
76 // return true if there are no embedded items.
77 bool empty();
75 78
76 void bindEmbeddedChars(const LLFontGL* font); 79 void bindEmbeddedChars(const LLFontGL* font);
77 void unbindEmbeddedChars(const LLFontGL* font); 80 void unbindEmbeddedChars(const LLFontGL* font);
@@ -134,6 +137,13 @@ void LLEmbeddedItems::clear()
134 removeEmbeddedItem(*nextiter); 137 removeEmbeddedItem(*nextiter);
135 } 138 }
136 mEmbeddedUsedChars.clear(); 139 mEmbeddedUsedChars.clear();
140 mEmbeddedIndexedChars.clear();
141}
142
143bool LLEmbeddedItems::empty()
144{
145 removeUnusedChars();
146 return mEmbeddedUsedChars.empty();
137} 147}
138 148
139// Inserts a new unique entry 149// Inserts a new unique entry
@@ -1386,10 +1396,11 @@ S32 LLViewerTextEditor::insertEmbeddedItem( S32 pos, LLInventoryItem* item )
1386 1396
1387bool LLViewerTextEditor::importStream(std::istream& str) 1397bool LLViewerTextEditor::importStream(std::istream& str)
1388{ 1398{
1389 LLNotecard nc(MAX_NOTECARD_SIZE); 1399 LLNotecard nc(LLNotecard::MAX_SIZE);
1390 bool success = nc.importStream(str); 1400 bool success = nc.importStream(str);
1391 if (success) 1401 if (success)
1392 { 1402 {
1403 mEmbeddedItemList->clear();
1393 const std::vector<LLPointer<LLInventoryItem> >& items = nc.getItems(); 1404 const std::vector<LLPointer<LLInventoryItem> >& items = nc.getItems();
1394 mEmbeddedItemList->addItems(items); 1405 mEmbeddedItemList->addItems(items);
1395 // Actually set the text 1406 // Actually set the text
@@ -1415,6 +1426,11 @@ void LLViewerTextEditor::copyInventory(LLInventoryItem* item)
1415 item); 1426 item);
1416} 1427}
1417 1428
1429bool LLViewerTextEditor::hasEmbeddedInventory()
1430{
1431 return (!(mEmbeddedItemList->empty()));
1432}
1433
1418//////////////////////////////////////////////////////////////////////////// 1434////////////////////////////////////////////////////////////////////////////
1419 1435
1420BOOL LLViewerTextEditor::importBuffer( const LLString& buffer ) 1436BOOL LLViewerTextEditor::importBuffer( const LLString& buffer )
@@ -1425,7 +1441,7 @@ BOOL LLViewerTextEditor::importBuffer( const LLString& buffer )
1425 1441
1426BOOL LLViewerTextEditor::exportBuffer( LLString& buffer ) 1442BOOL LLViewerTextEditor::exportBuffer( LLString& buffer )
1427{ 1443{
1428 LLNotecard nc(MAX_NOTECARD_SIZE); 1444 LLNotecard nc(LLNotecard::MAX_SIZE);
1429 1445
1430 std::vector<LLPointer<LLInventoryItem> > embedded_items; 1446 std::vector<LLPointer<LLInventoryItem> > embedded_items;
1431 mEmbeddedItemList->getEmbeddedItemList(embedded_items); 1447 mEmbeddedItemList->getEmbeddedItemList(embedded_items);