diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llviewertexteditor.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llviewertexteditor.cpp | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/linden/indra/newview/llviewertexteditor.cpp b/linden/indra/newview/llviewertexteditor.cpp index 3e2cc19..1fd31a0 100644 --- a/linden/indra/newview/llviewertexteditor.cpp +++ b/linden/indra/newview/llviewertexteditor.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -147,8 +148,8 @@ public: | |||
147 | // return true if there are no embedded items. | 148 | // return true if there are no embedded items. |
148 | bool empty(); | 149 | bool empty(); |
149 | 150 | ||
150 | void bindEmbeddedChars(LLFontGL* font) const; | 151 | void bindEmbeddedChars(const LLFontGL* font) const; |
151 | void unbindEmbeddedChars(LLFontGL* font) const; | 152 | void unbindEmbeddedChars(const LLFontGL* font) const; |
152 | 153 | ||
153 | BOOL insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new); | 154 | BOOL insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new); |
154 | BOOL removeEmbeddedItem( llwchar ext_char ); | 155 | BOOL removeEmbeddedItem( llwchar ext_char ); |
@@ -368,7 +369,7 @@ BOOL LLEmbeddedItems::hasEmbeddedItem(llwchar ext_char) | |||
368 | return FALSE; | 369 | return FALSE; |
369 | } | 370 | } |
370 | 371 | ||
371 | void LLEmbeddedItems::bindEmbeddedChars( LLFontGL* font ) const | 372 | void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const |
372 | { | 373 | { |
373 | if( sEntries.empty() ) | 374 | if( sEntries.empty() ) |
374 | { | 375 | { |
@@ -438,7 +439,7 @@ void LLEmbeddedItems::bindEmbeddedChars( LLFontGL* font ) const | |||
438 | } | 439 | } |
439 | } | 440 | } |
440 | 441 | ||
441 | void LLEmbeddedItems::unbindEmbeddedChars( LLFontGL* font ) const | 442 | void LLEmbeddedItems::unbindEmbeddedChars( const LLFontGL* font ) const |
442 | { | 443 | { |
443 | if( sEntries.empty() ) | 444 | if( sEntries.empty() ) |
444 | { | 445 | { |
@@ -1285,12 +1286,12 @@ llwchar LLViewerTextEditor::pasteEmbeddedItem(llwchar ext_char) | |||
1285 | return LL_UNKNOWN_CHAR; // item not found or list full | 1286 | return LL_UNKNOWN_CHAR; // item not found or list full |
1286 | } | 1287 | } |
1287 | 1288 | ||
1288 | void LLViewerTextEditor::bindEmbeddedChars(LLFontGL* font) const | 1289 | void LLViewerTextEditor::bindEmbeddedChars(const LLFontGL* font) const |
1289 | { | 1290 | { |
1290 | mEmbeddedItemList->bindEmbeddedChars( font ); | 1291 | mEmbeddedItemList->bindEmbeddedChars( font ); |
1291 | } | 1292 | } |
1292 | 1293 | ||
1293 | void LLViewerTextEditor::unbindEmbeddedChars(LLFontGL* font) const | 1294 | void LLViewerTextEditor::unbindEmbeddedChars(const LLFontGL* font) const |
1294 | { | 1295 | { |
1295 | mEmbeddedItemList->unbindEmbeddedChars( font ); | 1296 | mEmbeddedItemList->unbindEmbeddedChars( font ); |
1296 | } | 1297 | } |
@@ -1420,58 +1421,50 @@ void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item ) | |||
1420 | 1421 | ||
1421 | void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item ) | 1422 | void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item ) |
1422 | { | 1423 | { |
1423 | //if (saved) | ||
1424 | //{ | ||
1425 | // An LLInventoryItem needs to be in an inventory to be opened. | ||
1426 | // This will give the item to the viewer's agent. | ||
1427 | // The callback will attempt to open it if its not already opened. | ||
1428 | copyInventory(item, gInventoryCallbacks.registerCB(mInventoryCallback)); | 1424 | copyInventory(item, gInventoryCallbacks.registerCB(mInventoryCallback)); |
1429 | |||
1430 | //} | ||
1431 | //else | ||
1432 | //{ | ||
1433 | // LLNotecardCopyInfo *info = new LLNotecardCopyInfo(this, item); | ||
1434 | // gViewerWindow->alertXml("ConfirmNotecardSave", | ||
1435 | // LLViewerTextEditor::onNotecardDialog, (void*)info); | ||
1436 | //} | ||
1437 | } | 1425 | } |
1438 | 1426 | ||
1439 | void LLViewerTextEditor::showUnsavedAlertDialog( LLInventoryItem* item ) | 1427 | void LLViewerTextEditor::showUnsavedAlertDialog( LLInventoryItem* item ) |
1440 | { | 1428 | { |
1441 | LLNotecardCopyInfo *info = new LLNotecardCopyInfo(this, item); | 1429 | LLSD payload; |
1442 | gViewerWindow->alertXml( "ConfirmNotecardSave", | 1430 | payload["item_id"] = item->getUUID(); |
1443 | LLViewerTextEditor::onNotecardDialog, (void*)info); | 1431 | payload["notecard_id"] = mNotecardInventoryID; |
1432 | LLNotifications::instance().add( "ConfirmNotecardSave", LLSD(), payload, LLViewerTextEditor::onNotecardDialog); | ||
1444 | } | 1433 | } |
1434 | |||
1445 | // static | 1435 | // static |
1446 | void LLViewerTextEditor::onNotecardDialog( S32 option, void* userdata ) | 1436 | bool LLViewerTextEditor::onNotecardDialog(const LLSD& notification, const LLSD& response ) |
1447 | { | 1437 | { |
1448 | LLNotecardCopyInfo *info = (LLNotecardCopyInfo *)userdata; | 1438 | S32 option = LLNotification::getSelectedOption(notification, response); |
1449 | if( option == 0 ) | 1439 | if( option == 0 ) |
1450 | { | 1440 | { |
1451 | // itemptr is deleted by LLPreview::save | 1441 | // itemptr is deleted by LLPreview::save |
1452 | LLPointer<LLInventoryItem>* itemptr = new LLPointer<LLInventoryItem>(info->mItem); | 1442 | LLPointer<LLInventoryItem>* itemptr = new LLPointer<LLInventoryItem>(gInventory.getItem(notification["payload"]["item_id"].asUUID())); |
1453 | LLPreview::save( info->mTextEd->mNotecardInventoryID, itemptr); | 1443 | LLPreview::save( notification["payload"]["notecard_id"].asUUID() , itemptr); |
1454 | } | 1444 | } |
1445 | return false; | ||
1455 | } | 1446 | } |
1456 | 1447 | ||
1457 | 1448 | ||
1458 | 1449 | ||
1459 | void LLViewerTextEditor::showCopyToInvDialog( LLInventoryItem* item ) | 1450 | void LLViewerTextEditor::showCopyToInvDialog( LLInventoryItem* item ) |
1460 | { | 1451 | { |
1461 | LLNotecardCopyInfo *info = new LLNotecardCopyInfo(this, item); | 1452 | LLSD payload; |
1462 | gViewerWindow->alertXml( "ConfirmItemCopy", | 1453 | payload["item_id"] = item->getUUID(); |
1463 | LLViewerTextEditor::onCopyToInvDialog, (void*)info); | 1454 | payload["notecard_id"] = mNotecardInventoryID; |
1455 | LLNotifications::instance().add( "ConfirmItemCopy", LLSD(), payload, | ||
1456 | boost::bind(&LLViewerTextEditor::onCopyToInvDialog, this, _1, _2)); | ||
1464 | } | 1457 | } |
1465 | 1458 | ||
1466 | // static | 1459 | bool LLViewerTextEditor::onCopyToInvDialog(const LLSD& notification, const LLSD& response) |
1467 | void LLViewerTextEditor::onCopyToInvDialog( S32 option, void* userdata ) | ||
1468 | { | 1460 | { |
1469 | LLNotecardCopyInfo *info = (LLNotecardCopyInfo *)userdata; | 1461 | S32 option = LLNotification::getSelectedOption(notification, response); |
1470 | if( 0 == option ) | 1462 | if( 0 == option ) |
1471 | { | 1463 | { |
1472 | info->mTextEd->copyInventory(info->mItem); | 1464 | LLInventoryItem* itemp = gInventory.getItem(notification["payload"]["item_id"].asUUID()); |
1465 | copyInventory(itemp); | ||
1473 | } | 1466 | } |
1474 | delete info; | 1467 | return false; |
1475 | } | 1468 | } |
1476 | 1469 | ||
1477 | 1470 | ||
@@ -1596,6 +1589,7 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF | |||
1596 | BOOL parse_html = text_editor->mParseHTML; | 1589 | BOOL parse_html = text_editor->mParseHTML; |
1597 | node->getAttributeBOOL("allow_html", parse_html); | 1590 | node->getAttributeBOOL("allow_html", parse_html); |
1598 | text_editor->setParseHTML(parse_html); | 1591 | text_editor->setParseHTML(parse_html); |
1592 | text_editor->setParseHighlights(TRUE); | ||
1599 | 1593 | ||
1600 | text_editor->initFromXML(node, parent); | 1594 | text_editor->initFromXML(node, parent); |
1601 | 1595 | ||