From 9ec432034dc3c45d7ce763eb02dae4cc7f6b8da8 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Sun, 21 Jun 2009 08:04:56 +0000 Subject: merge -r 122421-124917 viewer-2.0.0-2 -> viewer-2.0.0-3 ignore-dead-branch --- indra/newview/llviewertexteditor.cpp | 187 ++++++++--------------------------- 1 file changed, 43 insertions(+), 144 deletions(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index d64700b523..f4989ec4fe 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -32,13 +32,14 @@ #include "llviewerprecompiledheaders.h" +#include "llfloaterreg.h" #include "llfocusmgr.h" #include "audioengine.h" #include "llagent.h" #include "llinventory.h" +#include "llinventorybridge.h" #include "llinventorymodel.h" #include "llinventoryview.h" -#include "llinventorybridge.h" // for landmark prefix string #include "llviewertexteditor.h" @@ -51,6 +52,7 @@ #include "llpreviewlandmark.h" #include "llscrollbar.h" #include "lltooldraganddrop.h" +#include "lltrans.h" #include "llviewercontrol.h" #include "llviewerimagelist.h" #include "llviewerwindow.h" @@ -62,7 +64,7 @@ #include "llappviewer.h" // for gPacificDaylightTime -static LLRegisterWidget r("text_editor"); +static LLDefaultWidgetRegistry::Register r("text_editor"); ///---------------------------------------------------------------------------- /// Class LLEmbeddedNotecardOpener @@ -96,31 +98,9 @@ public: } else { - // See if we can bring an existing preview to the front - if(!LLPreview::show(item->getUUID(), true)) + if(!gSavedSettings.getBOOL("ShowNewInventory")) { - if(!gSavedSettings.getBOOL("ShowNewInventory")) - { - // There isn't one, so make a new preview - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("NotecardEditorRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - LLPreviewNotecard* preview; - preview = new LLPreviewNotecard("preview notecard", - rect, - std::string("Embedded Note: ") + item->getName(), - item->getUUID(), - LLUUID::null, - item->getAssetUUID(), - true, - (LLViewerInventoryItem*)item); - preview->setSourceID(LLUUID::null); - preview->setFocus(TRUE); - - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); - } + LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); } } } @@ -430,6 +410,8 @@ void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const case LLAssetType::AT_BODYPART: img_name = "inv_item_skin.tga"; break; case LLAssetType::AT_ANIMATION: img_name = "inv_item_animation.tga";break; case LLAssetType::AT_GESTURE: img_name = "inv_item_gesture.tga"; break; + //TODO need img_name + case LLAssetType::AT_FAVORITE: img_name = "inv_item_landmark.tga"; break; default: llassert(0); continue; } @@ -561,33 +543,15 @@ struct LLNotecardCopyInfo // // Member functions // - -LLViewerTextEditor::LLViewerTextEditor(const std::string& name, - const LLRect& rect, - S32 max_length, - const std::string& default_text, - const LLFontGL* font, - BOOL allow_embedded_items) - : LLTextEditor(name, rect, max_length, default_text, font, allow_embedded_items), - mDragItemChar(0), - mDragItemSaved(FALSE), - mInventoryCallback(new LLEmbeddedNotecardOpener) +LLViewerTextEditor::LLViewerTextEditor(const LLViewerTextEditor::Params& p) +: LLTextEditor(p), + mDragItemChar(0), + mDragItemSaved(FALSE), + mInventoryCallback(new LLEmbeddedNotecardOpener) { + mParseHTML = p.allow_html; mEmbeddedItemList = new LLEmbeddedItems(this); mInventoryCallback->setEditor(this); - - // *TODO: Add right click menus for SLURLs - // Build the right click menu - // make the popup menu available - - //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_slurl.xml", this); - //if (!menu) - //{ - // menu = new LLMenuGL(LLStringUtil::null); - //} - //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); - //// menu->setVisible(FALSE); - //mPopupMenuHandle = menu->getHandle(); } LLViewerTextEditor::~LLViewerTextEditor() @@ -781,6 +745,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) { + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); BOOL handled = FALSE; if (!mDragItem) @@ -825,7 +790,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) LLAssetType::lookupDragAndDropType( mDragItem->getType() ), mDragItem->getUUID(), LLToolDragAndDrop::SOURCE_NOTECARD, - getSourceID(), mObjectID); + mPreviewID, mObjectID); return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); } @@ -878,7 +843,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) if( !handled ) { lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; - if (!mScrollbar->getVisible() || x < getRect().getWidth() - SCROLLBAR_SIZE) + if (!mScrollbar->getVisible() || x < getRect().getWidth() - scrollbar_size) { getWindow()->setCursor(UI_CURSOR_IBEAM); } @@ -1134,6 +1099,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, *accept = ACCEPT_NO; if (tooltip_msg.empty()) { + // *TODO: Translate tooltip_msg.assign("Only items with unrestricted\n" "'next owner' permissions \n" "can be attached to notecards."); @@ -1246,18 +1212,16 @@ std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); + std::string timeStr ="[["+ LLTrans::getString("TimeHour")+"]:[" + +LLTrans::getString("TimeMin")+"]] "; - // There's only one internal tm buffer. - struct tm* timep; - - // Convert to Pacific, based on server's opinion of whether - // it's daylight savings time there. - timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); + LLSD substitution; - std::string text = llformat("[%d:%02d] ", timep->tm_hour, timep->tm_min); - appendColoredText(text, false, prepend_newline, LLColor4::grey); + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format (timeStr, substitution); + appendColoredText(timeStr, false, prepend_newline, LLColor4::grey); - return text; + return timeStr; } //---------------------------------------------------------------------------- @@ -1370,29 +1334,16 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item, llwchar wc) void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item, llwchar wc ) { - // See if we can bring an existing preview to the front // *NOTE: Just for embedded Texture , we should use getAssetUUID(), // not getUUID(), because LLPreviewTexture pass in AssetUUID into // LLPreview constructor ItemUUID parameter. - - if( !LLPreview::show( item->getAssetUUID() ) ) + if (!item) + return; + LLPreviewTexture* preview = LLFloaterReg::showTypedInstance("preview_texture", LLSD(item->getAssetUUID()), TAKE_FOCUS_YES); + if (preview) { - // There isn't one, so make a new preview - if(item) - { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - - LLPreviewTexture* preview = new LLPreviewTexture("preview texture", - rect, - item->getName(), - item->getAssetUUID(), - TRUE); - preview->setAuxItem( item ); - preview->setNotecardInfo(mNotecardInventoryID, mObjectID); - } + preview->setAuxItem( item ); + preview->setNotecardInfo(mNotecardInventoryID, mObjectID); } } @@ -1411,9 +1362,13 @@ void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item, llwchar wc ) void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item, llwchar wc ) { - std::string title = - std::string(" ") + LLLandmarkBridge::prefix() + item->getName(); - open_landmark((LLViewerInventoryItem*)item, title, FALSE, item->getUUID(), TRUE); + if (!item) + return; + LLPreviewLandmark* preview = LLFloaterReg::showTypedInstance("preview_landmark", LLSD(item->getUUID()), TAKE_FOCUS_YES); + if (preview) + { + preview->setItem( item ); + } } void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item, llwchar wc ) @@ -1435,9 +1390,11 @@ bool LLViewerTextEditor::onNotecardDialog(const LLSD& notification, const LLSD& S32 option = LLNotification::getSelectedOption(notification, response); if( option == 0 ) { - // itemptr is deleted by LLPreview::save - LLPointer* itemptr = new LLPointer(gInventory.getItem(notification["payload"]["item_id"].asUUID())); - LLPreview::save( notification["payload"]["notecard_id"].asUUID() , itemptr); + LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance("preview_notecard", notification["payload"]["notecard_id"]);; + if (preview) + { + preview->saveItem(); + } } return false; } @@ -1541,61 +1498,3 @@ BOOL LLViewerTextEditor::exportBuffer( std::string& buffer ) return TRUE; } -LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string name("text_editor"); - node->getAttributeString("name", name); - - LLRect rect; - createRect(node, rect, parent, LLRect()); - - U32 max_text_length = 255; - node->getAttributeU32("max_length", max_text_length); - - BOOL allow_embedded_items = FALSE; - node->getAttributeBOOL("embedded_items", allow_embedded_items); - - LLFontGL* font = LLView::selectFont(node); - - // std::string text = node->getValue(); - std::string text = node->getTextContents().substr(0, max_text_length - 1); - - if (text.size() > max_text_length) - { - // Erase everything from max_text_length on. - text.erase(max_text_length); - } - - LLViewerTextEditor* text_editor = new LLViewerTextEditor(name, - rect, - max_text_length, - LLStringUtil::null, - font, - allow_embedded_items); - - BOOL ignore_tabs = text_editor->tabsToNextField(); - node->getAttributeBOOL("ignore_tab", ignore_tabs); - text_editor->setTabsToNextField(ignore_tabs); - - text_editor->setTextEditorParameters(node); - - BOOL hide_scrollbar = FALSE; - node->getAttributeBOOL("hide_scrollbar",hide_scrollbar); - text_editor->setHideScrollbarForShortDocs(hide_scrollbar); - - BOOL hide_border = !text_editor->isBorderVisible(); - node->getAttributeBOOL("hide_border", hide_border); - text_editor->setBorderVisible(!hide_border); - - BOOL parse_html = text_editor->mParseHTML; - node->getAttributeBOOL("allow_html", parse_html); - text_editor->setParseHTML(parse_html); - text_editor->setParseHighlights(TRUE); - - text_editor->initFromXML(node, parent); - - // add text after all parameters have been set - text_editor->appendStyledText(text, FALSE, FALSE); - - return text_editor; -} -- cgit v1.2.3 From 52aeaa32841e7d0b37abab0a2a2540c2be2f16b7 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 7 Jul 2009 00:53:05 +0000 Subject: Merge skinning-14 to viewer-2, including refactoring many floaters to register them with LLFloaterReg, support for introspection of ParamBlock based UI widgets to dump XML schema, splitting llfolderview.cpp into three separate files to unravel dependencies and skeleton for for LLListView widget. Resolved conflicts in these files: lldraghandle.h, lluictrl.h, llchiclet.cpp, llfolderview.h/cpp, lliinventorybridge.cpp, llpanelpicks.cpp, llviewermenu.cpp, floater_mute.xml, floater_preferences.xml, notifications.xml, panel_preferences_audio.xml, panel_preferences_graphics1.xml, panel_region_general.xml svn merge -r124961:126284 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-14 --- indra/newview/llviewertexteditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index f4989ec4fe..399b7c6bc1 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -39,7 +39,7 @@ #include "llinventory.h" #include "llinventorybridge.h" #include "llinventorymodel.h" -#include "llinventoryview.h" +#include "llfloaterinventory.h" #include "llviewertexteditor.h" @@ -64,7 +64,7 @@ #include "llappviewer.h" // for gPacificDaylightTime -static LLDefaultWidgetRegistry::Register r("text_editor"); +static LLDefaultChildRegistry::Register r("text_editor"); ///---------------------------------------------------------------------------- /// Class LLEmbeddedNotecardOpener -- cgit v1.2.3 From 77f56a3f3db72b2938eadb0868fc7be975dabafa Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 10 Jul 2009 22:02:26 +0000 Subject: merge QAR-1579: texture-cleanup-1. --- indra/newview/llviewertexteditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 399b7c6bc1..23f3f46570 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -54,7 +54,7 @@ #include "lltooldraganddrop.h" #include "lltrans.h" #include "llviewercontrol.h" -#include "llviewerimagelist.h" +#include "llviewertexturelist.h" #include "llviewerwindow.h" #include "llviewerinventory.h" #include "lluictrlfactory.h" -- cgit v1.2.3 From f5ba6df4c2dc5a5e0842ed028dd4de01406dca3b Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Fri, 24 Jul 2009 16:20:15 +0000 Subject: svn merge -r 127369:127511 svn+ssh://svn.lindenlab.com/svn/linden/branches/avatar-pipeline/landmark-permissions__merge__viewer2.0.0.3-r127280 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3 includes post-merge fix for DEV-36563 : Remove mAcceptsCallingCardNames For DEV-36496 : Viewer merge for Landmark & Callingcard Permissions [VIEWER] For DEV-36563 : Remove mAcceptsCallingCardNames Test plans - EXTERNAL * [ Test against a 1.30 server ] * Test various permissions operations - both on items in inventory, and rezzed items and items that are embedded in objects. * Test creating landmarks. Test plans - INTERNAL * Test against any inventory permissions smoke tests. * See test plans in QAR-1644 for full Landmark&Callingcard Permissions test plan. --- indra/newview/llviewertexteditor.cpp | 199 ++++++++++++++++++----------------- 1 file changed, 105 insertions(+), 94 deletions(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 23f3f46570..902b59c732 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -44,6 +44,7 @@ #include "llviewertexteditor.h" #include "llfloaterchat.h" +#include "llfloateravatarinfo.h" #include "llfloaterworldmap.h" #include "llnotify.h" #include "llpreview.h" @@ -372,47 +373,61 @@ void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const const char* img_name; switch( item->getType() ) { - case LLAssetType::AT_TEXTURE: - if(item->getInventoryType() == LLInventoryType::IT_SNAPSHOT) - { - img_name = "inv_item_snapshot.tga"; - } - else - { - img_name = "inv_item_texture.tga"; - } + case LLAssetType::AT_TEXTURE: + if(item->getInventoryType() == LLInventoryType::IT_SNAPSHOT) + { + img_name = "inv_item_snapshot.tga"; + } + else + { + img_name = "inv_item_texture.tga"; + } - break; - case LLAssetType::AT_SOUND: img_name = "inv_item_sound.tga"; break; - case LLAssetType::AT_LANDMARK: - if (item->getFlags() & LLInventoryItem::II_FLAGS_LANDMARK_VISITED) - { - img_name = "inv_item_landmark_visited.tga"; - } - else - { - img_name = "inv_item_landmark.tga"; - } - break; - case LLAssetType::AT_CLOTHING: img_name = "inv_item_clothing.tga"; break; - case LLAssetType::AT_OBJECT: - if (item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) - { - img_name = "inv_item_object_multi.tga"; - } - else + break; + case LLAssetType::AT_SOUND: img_name = "inv_item_sound.tga"; break; + case LLAssetType::AT_LANDMARK: + if (item->getFlags() & LLInventoryItem::II_FLAGS_LANDMARK_VISITED) + { + img_name = "inv_item_landmark_visited.tga"; + } + else + { + img_name = "inv_item_landmark.tga"; + } + break; + case LLAssetType::AT_CALLINGCARD: { - img_name = "inv_item_object.tga"; + BOOL online; + online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()); + if (online) + { + img_name = "inv_item_callingcard_online.tga"; break; + } + else + { + img_name = "inv_item_callingcard_offline.tga"; break; + } + break; } - break; - case LLAssetType::AT_NOTECARD: img_name = "inv_item_notecard.tga"; break; - case LLAssetType::AT_LSL_TEXT: img_name = "inv_item_script.tga"; break; - case LLAssetType::AT_BODYPART: img_name = "inv_item_skin.tga"; break; - case LLAssetType::AT_ANIMATION: img_name = "inv_item_animation.tga";break; - case LLAssetType::AT_GESTURE: img_name = "inv_item_gesture.tga"; break; - //TODO need img_name - case LLAssetType::AT_FAVORITE: img_name = "inv_item_landmark.tga"; break; - default: llassert(0); continue; + case LLAssetType::AT_CLOTHING: img_name = "inv_item_clothing.tga"; break; + case LLAssetType::AT_OBJECT: + if (item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) + { + img_name = "inv_item_object_multi.tga"; + } + else + { + img_name = "inv_item_object.tga"; + } + break; + case LLAssetType::AT_NOTECARD: img_name = "inv_item_notecard.tga"; break; + case LLAssetType::AT_LSL_TEXT: img_name = "inv_item_script.tga"; break; + case LLAssetType::AT_BODYPART: img_name = "inv_item_skin.tga"; break; + case LLAssetType::AT_ANIMATION: img_name = "inv_item_animation.tga";break; + case LLAssetType::AT_GESTURE: img_name = "inv_item_gesture.tga"; break; + //TODO need img_name + case LLAssetType::AT_FAVORITE: img_name = "inv_item_landmark.tga"; break; + default: llassert(0); continue; } LLUIImagePtr image = LLUI::getUIImage(img_name); @@ -1019,8 +1034,6 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) } -// Allow calling cards to be dropped onto text fields. Append the name and -// a carriage return. // virtual BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, @@ -1043,33 +1056,17 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, { switch( cargo_type ) { - case DAD_CALLINGCARD: - if(acceptsCallingCardNames()) - { - if (drop) - { - LLInventoryItem *item = (LLInventoryItem *)cargo_data; - std::string name = item->getName(); - appendText(name, true, true); - } - *accept = ACCEPT_YES_COPY_SINGLE; - } - else - { - *accept = ACCEPT_NO; - } - break; - - case DAD_TEXTURE: - case DAD_SOUND: - case DAD_LANDMARK: - case DAD_SCRIPT: - case DAD_CLOTHING: - case DAD_OBJECT: - case DAD_NOTECARD: - case DAD_BODYPART: - case DAD_ANIMATION: - case DAD_GESTURE: + case DAD_CALLINGCARD: + case DAD_TEXTURE: + case DAD_SOUND: + case DAD_LANDMARK: + case DAD_SCRIPT: + case DAD_CLOTHING: + case DAD_OBJECT: + case DAD_NOTECARD: + case DAD_BODYPART: + case DAD_ANIMATION: + case DAD_GESTURE: { LLInventoryItem *item = (LLInventoryItem *)cargo_data; if( item && allowsEmbeddedItems() ) @@ -1101,8 +1098,8 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, { // *TODO: Translate tooltip_msg.assign("Only items with unrestricted\n" - "'next owner' permissions \n" - "can be attached to notecards."); + "'next owner' permissions \n" + "can be attached to notecards."); } } } @@ -1113,9 +1110,9 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, break; } - default: - *accept = ACCEPT_NO; - break; + default: + *accept = ACCEPT_NO; + break; } } else @@ -1301,32 +1298,36 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item, llwchar wc) switch( item->getType() ) { - case LLAssetType::AT_TEXTURE: - openEmbeddedTexture( item, wc ); - return TRUE; + case LLAssetType::AT_TEXTURE: + openEmbeddedTexture( item, wc ); + return TRUE; - case LLAssetType::AT_SOUND: - openEmbeddedSound( item, wc ); - return TRUE; + case LLAssetType::AT_SOUND: + openEmbeddedSound( item, wc ); + return TRUE; - case LLAssetType::AT_NOTECARD: - openEmbeddedNotecard( item, wc ); - return TRUE; + case LLAssetType::AT_NOTECARD: + openEmbeddedNotecard( item, wc ); + return TRUE; - case LLAssetType::AT_LANDMARK: - openEmbeddedLandmark( item, wc ); - return TRUE; + case LLAssetType::AT_LANDMARK: + openEmbeddedLandmark( item, wc ); + return TRUE; - case LLAssetType::AT_LSL_TEXT: - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_OBJECT: - case LLAssetType::AT_BODYPART: - case LLAssetType::AT_ANIMATION: - case LLAssetType::AT_GESTURE: - showCopyToInvDialog( item, wc ); - return TRUE; - default: - return FALSE; + case LLAssetType::AT_CALLINGCARD: + openEmbeddedCallingcard( item, wc ); + return TRUE; + + case LLAssetType::AT_LSL_TEXT: + case LLAssetType::AT_CLOTHING: + case LLAssetType::AT_OBJECT: + case LLAssetType::AT_BODYPART: + case LLAssetType::AT_ANIMATION: + case LLAssetType::AT_GESTURE: + showCopyToInvDialog( item, wc ); + return TRUE; + default: + return FALSE; } } @@ -1376,6 +1377,16 @@ void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item, llwchar wc copyInventory(item, gInventoryCallbacks.registerCB(mInventoryCallback)); } +void LLViewerTextEditor::openEmbeddedCallingcard( LLInventoryItem* item, llwchar wc ) +{ + if(item && !item->getCreatorUUID().isNull()) + { + BOOL online; + online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()); + LLFloaterAvatarInfo::showFromFriend(item->getCreatorUUID(), online); + } +} + void LLViewerTextEditor::showUnsavedAlertDialog( LLInventoryItem* item ) { LLSD payload; -- cgit v1.2.3 From e97f7728a90dd66014f6b3f0cd5e8d4c71f48691 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 30 Jul 2009 23:22:41 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0/indra@1170 https://svn.aws.productengine.com/secondlife/pe/stable-1/indra@1187 -> viewer-2.0.0-3 --- indra/newview/llviewertexteditor.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 902b59c732..0fadba1364 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -47,11 +47,13 @@ #include "llfloateravatarinfo.h" #include "llfloaterworldmap.h" #include "llnotify.h" +#include "llpanelplaces.h" #include "llpreview.h" #include "llpreviewtexture.h" #include "llpreviewnotecard.h" #include "llpreviewlandmark.h" #include "llscrollbar.h" +#include "llsidetray.h" #include "lltooldraganddrop.h" #include "lltrans.h" #include "llviewercontrol.h" @@ -1365,11 +1367,22 @@ void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item, llwchar wc { if (!item) return; - LLPreviewLandmark* preview = LLFloaterReg::showTypedInstance("preview_landmark", LLSD(item->getUUID()), TAKE_FOCUS_YES); - if (preview) + + LLSD key; + key["type"] = "landmark"; + key["id"] = item->getUUID(); + + LLPanelPlaces *panel = dynamic_cast(LLSideTray::getInstance()->showPanel("panel_places", key)); + if (panel) { - preview->setItem( item ); + panel->setItem(item); } + +// LLPreviewLandmark* preview = LLFloaterReg::showTypedInstance("preview_landmark", LLSD(item->getUUID()), TAKE_FOCUS_YES); +// if (preview) +// { +// preview->setItem( item ); +// } } void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item, llwchar wc ) -- cgit v1.2.3 From db5cda26676f376f18816013c0c5e3fbad5b20d0 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Mon, 3 Aug 2009 22:25:48 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1211 https://svn.aws.productengine.com/secondlife/pe/stable-1@1228 -> viewer-2.0.0-3 QA: New movement and camera controls. Test all movement and camera behavior against spec and expected behaviors, including sitting & standing. Many other changes to the bottom bar. Changes to local chat behavior. --- indra/newview/llviewertexteditor.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 0fadba1364..afee30293a 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -44,7 +44,6 @@ #include "llviewertexteditor.h" #include "llfloaterchat.h" -#include "llfloateravatarinfo.h" #include "llfloaterworldmap.h" #include "llnotify.h" #include "llpanelplaces.h" @@ -64,6 +63,7 @@ #include "llnotecard.h" #include "llmemorystream.h" #include "llmenugl.h" +#include "llavataractions.h" #include "llappviewer.h" // for gPacificDaylightTime @@ -1394,9 +1394,7 @@ void LLViewerTextEditor::openEmbeddedCallingcard( LLInventoryItem* item, llwchar { if(item && !item->getCreatorUUID().isNull()) { - BOOL online; - online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()); - LLFloaterAvatarInfo::showFromFriend(item->getCreatorUUID(), online); + LLAvatarActions::showProfile(item->getCreatorUUID()); } } -- cgit v1.2.3 From 0bf4b5f2222ffb8171be094613363427f3b8470a Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Wed, 12 Aug 2009 01:12:27 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll@1277 https://svn.aws.productengine.com/secondlife/pe/stable-1@1297 -> viewer-2-0 Fixes: EXT 208 EXT 366 EXT-211 EXT-245 EXT-246 EXT-278 EXT-279 EXT-280 EXT-298 EXT-301 EXT-304 EXT-311 EXT-317 EXT-318 EXT-319 EXT-339 EXT-343 EXT-344 EXT-346 EXT-349 EXT-350 EXT-351 EXT-354 EXT-355 EXT-358 EXT-360 EXT-362 EXT-369 EXT-372 EXT-374 EXT-381 EXT-382 EXT-383 EXT-395 EXT-396 EXT-412 Other changes: Movement & Caemra controls work Profile and Me panel refactoring Notification refactoring --- indra/newview/llviewertexteditor.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index afee30293a..9e0713b494 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -50,7 +50,6 @@ #include "llpreview.h" #include "llpreviewtexture.h" #include "llpreviewnotecard.h" -#include "llpreviewlandmark.h" #include "llscrollbar.h" #include "llsidetray.h" #include "lltooldraganddrop.h" @@ -1377,12 +1376,6 @@ void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item, llwchar wc { panel->setItem(item); } - -// LLPreviewLandmark* preview = LLFloaterReg::showTypedInstance("preview_landmark", LLSD(item->getUUID()), TAKE_FOCUS_YES); -// if (preview) -// { -// preview->setItem( item ); -// } } void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item, llwchar wc ) -- cgit v1.2.3 From 138bf1132262c479dbbd5c95195db46b1efd065f Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 24 Aug 2009 20:04:52 +0000 Subject: merge -r 130399-131510 skinning-21 -> viewer-2.0.0-3 DEV-11254 DEV-11254 DEV-2003: DEV-21567 DEV-37301 EXT-104 EXT-138 EXT-217 EXT-256 EXT-259 EXT-259 EXT-328 EXT-348 EXT-386 EXT-399 EXT-403 EXT-460 EXT-492 EXT-492 EXT-531 EXT-537 EXT-684 improved text editor (handles multiple fonts simultaneously as well as inline widgets) --- indra/newview/llviewertexteditor.cpp | 589 +++++++++++++---------------------- 1 file changed, 215 insertions(+), 374 deletions(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 9e0713b494..7565c86696 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -62,6 +62,7 @@ #include "llnotecard.h" #include "llmemorystream.h" #include "llmenugl.h" +#include "llscrollcontainer.h" #include "llavataractions.h" #include "llappviewer.h" // for gPacificDaylightTime @@ -108,6 +109,105 @@ public: } }; +// +// class LLEmbeddedItemSegment +// + +const S32 EMBEDDED_ITEM_LABEL_PADDING = 2; + +class LLEmbeddedItemSegment : public LLTextSegment +{ +public: + LLEmbeddedItemSegment(S32 pos, LLUIImagePtr image, LLPointer inv_item, LLTextEditor& editor) + : LLTextSegment(pos, pos + 1), + mImage(image), + mLabel(utf8str_to_wstring(inv_item->getName())), + mItem(inv_item), + mEditor(editor), + mHasMouseHover(false) + { + + mStyle = new LLStyle(LLStyle::Params().font(LLFontGL::getFontSansSerif())); + mToolTip = inv_item->getName() + '\n' + inv_item->getDescription(); + } + + /*virtual*/ S32 getWidth(S32 first_char, S32 num_chars) const + { + if (num_chars == 0) + { + return 0; + } + else + { + return EMBEDDED_ITEM_LABEL_PADDING + mImage->getWidth() + mStyle->getFont()->getWidth(mLabel.c_str()); + } + + } + //virtual S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; + //virtual void updateLayout(const class LLTextEditor& editor); + + /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const + { + return 1; + } + /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect) + { + LLRect image_rect = draw_rect; + image_rect.mRight = image_rect.mLeft + mImage->getWidth(); + image_rect.mTop = image_rect.mBottom + mImage->getHeight(); + mImage->draw(image_rect); + + LLColor4 color; + if (mEditor.getReadOnly()) + { + color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor"); + } + else + { + color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor"); + } + + F32 right_x; + mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mBottom, color, LLFontGL::LEFT, LLFontGL::BOTTOM, mHasMouseHover ? LLFontGL::UNDERLINE : 0, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x); + return right_x; + } + + /*virtual*/ S32 getMaxHeight() const + { + return llmax(mImage->getHeight(), llceil(mStyle->getFont()->getLineHeight())); + } + /*virtual*/ bool canEdit() const { return false; } + //virtual void unlinkFromDocument(class LLTextEditor* editor); + //virtual void linkToDocument(class LLTextEditor* editor); + + virtual void setHasMouseHover(bool hover) + { + mHasMouseHover = hover; + } + //virtual const LLColor4& getColor() const; + //virtual void setColor(const LLColor4 &color); + //virtual void setStyle(const LLStyleSP &style); + virtual BOOL getToolTip( std::string& msg ) const + { + msg = mToolTip; + return TRUE; + } + + /*virtual*/ const LLStyleSP getStyle() const { return mStyle; } + +private: + LLUIImagePtr mImage; + LLWString mLabel; + LLStyleSP mStyle; + std::string mToolTip; + LLPointer mItem; + LLTextEditor& mEditor; + bool mHasMouseHover; + +}; + + + //////////////////////////////////////////////////////////// // LLEmbeddedItems // @@ -130,13 +230,11 @@ public: // return true if there are no embedded items. bool empty(); - void bindEmbeddedChars(const LLFontGL* font) const; - void unbindEmbeddedChars(const LLFontGL* font) const; - BOOL insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new); BOOL removeEmbeddedItem( llwchar ext_char ); BOOL hasEmbeddedItem(llwchar ext_char); // returns TRUE if /this/ editor has an entry for this item + LLUIImagePtr getItemImage(llwchar ext_char) const; void getEmbeddedItemList( std::vector >& items ); void addItems(const std::vector >& items); @@ -351,27 +449,13 @@ BOOL LLEmbeddedItems::hasEmbeddedItem(llwchar ext_char) return FALSE; } -void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const -{ - if( sEntries.empty() ) - { - return; - } - for (std::set::const_iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1) +LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const +{ + LLInventoryItem* item = getEmbeddedItem(ext_char); + if (item) { - llwchar wch = *iter1; - item_map_t::iterator iter2 = sEntries.find(wch); - if (iter2 == sEntries.end()) - { - continue; - } - LLInventoryItem* item = iter2->second.mItem; - if (!item) - { - continue; - } - const char* img_name; + const char* img_name = ""; switch( item->getType() ) { case LLAssetType::AT_TEXTURE: @@ -428,27 +512,14 @@ void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const case LLAssetType::AT_GESTURE: img_name = "inv_item_gesture.tga"; break; //TODO need img_name case LLAssetType::AT_FAVORITE: img_name = "inv_item_landmark.tga"; break; - default: llassert(0); continue; + default: llassert(0); } - LLUIImagePtr image = LLUI::getUIImage(img_name); - - font->addEmbeddedChar( wch, image->getImage(), item->getName() ); + return LLUI::getUIImage(img_name); } + return LLUIImagePtr(); } -void LLEmbeddedItems::unbindEmbeddedChars( const LLFontGL* font ) const -{ - if( sEntries.empty() ) - { - return; - } - - for (std::set::const_iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1) - { - font->removeEmbeddedChar(*iter1); - } -} void LLEmbeddedItems::addItems(const std::vector >& items) { @@ -613,30 +684,16 @@ BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* s } const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); - if( cur_segment ) + if( cur_segment && cur_segment->getToolTip( msg ) ) { - BOOL has_tool_tip = FALSE; - if( cur_segment->getStyle()->getIsEmbeddedItem() ) - { - LLWString wtip; - has_tool_tip = getEmbeddedItemToolTipAtPos(cur_segment->getStart(), wtip); - msg = wstring_to_utf8str(wtip); - } - else - { - has_tool_tip = cur_segment->getToolTip( msg ); - } - if( has_tool_tip ) - { - // Just use a slop area around the cursor - // Convert rect local to screen coordinates - S32 SLOP = 8; - localPointToScreen( - x - SLOP, y - SLOP, - &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); - sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; - sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; - } + // Just use a slop area around the cursor + // Convert rect local to screen coordinates + S32 SLOP = 8; + localPointToScreen( + x - SLOP, y - SLOP, + &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); + sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; + sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; } return TRUE; } @@ -648,21 +705,8 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) // Let scrollbar have first dibs handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; - // enable I Agree checkbox if the user scrolled through entire text - BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); - if (mOnScrollEndCallback && was_scrolled_to_bottom) + if( !handled) { - mOnScrollEndCallback(mOnScrollEndData); - } - - if( !handled && mTakesNonScrollClicks) - { - if (!(mask & MASK_SHIFT)) - { - deselect(); - } - - BOOL start_select = TRUE; if( allowsEmbeddedItems() ) { setCursorAtLocalPos( x, y, FALSE ); @@ -685,192 +729,55 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) localPointToScreen(x, y, &screen_x, &screen_y ); LLToolDragAndDrop::getInstance()->setDragStart( screen_x, screen_y ); - start_select = FALSE; - } - else - { - mDragItem = NULL; - } - } - - if( start_select ) - { - // If we're not scrolling (handled by child), then we're selecting - if (mask & MASK_SHIFT) - { - S32 old_cursor_pos = mCursorPos; - setCursorAtLocalPos( x, y, TRUE ); - - if (hasSelection()) - { - /* Mac-like behavior - extend selection towards the cursor - if (mCursorPos < mSelectionStart - && mCursorPos < mSelectionEnd) - { - // ...left of selection - mSelectionStart = llmax(mSelectionStart, mSelectionEnd); - mSelectionEnd = mCursorPos; - } - else if (mCursorPos > mSelectionStart - && mCursorPos > mSelectionEnd) - { - // ...right of selection - mSelectionStart = llmin(mSelectionStart, mSelectionEnd); - mSelectionEnd = mCursorPos; - } - else - { - mSelectionEnd = mCursorPos; - } - */ - // Windows behavior - mSelectionEnd = mCursorPos; - } - else + if (hasTabStop()) { - mSelectionStart = old_cursor_pos; - mSelectionEnd = mCursorPos; + setFocus( TRUE ); } - // assume we're starting a drag select - mIsSelecting = TRUE; + handled = TRUE; } else { - setCursorAtLocalPos( x, y, TRUE ); - startSelection(); + mDragItem = NULL; } - gFocusMgr.setMouseCapture( this ); } - handled = TRUE; - } - - if (hasTabStop()) - { - setFocus(TRUE); - handled = TRUE; + if (!handled) + { + handled = LLTextEditor::handleMouseDown(x, y, mask); + } } - // Delay cursor flashing - resetKeystrokeTimer(); - return handled; } BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) { - static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); - BOOL handled = FALSE; + BOOL handled = LLTextEditor::handleHover(x, y, mask); - if (!mDragItem) + if(hasMouseCapture() && mDragItem) { - // leave hover segment active during drag and drop - mHoverSegment = NULL; - } - if(hasMouseCapture() ) - { - if( mIsSelecting ) - { - if (x != mLastSelectionX || y != mLastSelectionY) - { - mLastSelectionX = x; - mLastSelectionY = y; - } + S32 screen_x; + S32 screen_y; + localPointToScreen(x, y, &screen_x, &screen_y ); - if( y > getTextRect().mTop ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 ); - } - else - if( y < getTextRect().mBottom ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 ); - } + mScroller->autoScroll(x, y); - setCursorAtLocalPos( x, y, TRUE ); - mSelectionEnd = mCursorPos; - - updateScrollFromCursor(); - getWindow()->setCursor(UI_CURSOR_IBEAM); - } - else if( mDragItem ) + if( LLToolDragAndDrop::getInstance()->isOverThreshold( screen_x, screen_y ) ) { - S32 screen_x; - S32 screen_y; - localPointToScreen(x, y, &screen_x, &screen_y ); - if( LLToolDragAndDrop::getInstance()->isOverThreshold( screen_x, screen_y ) ) - { - LLToolDragAndDrop::getInstance()->beginDrag( - LLAssetType::lookupDragAndDropType( mDragItem->getType() ), - mDragItem->getUUID(), - LLToolDragAndDrop::SOURCE_NOTECARD, - mPreviewID, mObjectID); + LLToolDragAndDrop::getInstance()->beginDrag( + LLAssetType::lookupDragAndDropType( mDragItem->getType() ), + mDragItem->getUUID(), + LLToolDragAndDrop::SOURCE_NOTECARD, + mPreviewID, mObjectID); - return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); - } - getWindow()->setCursor(UI_CURSOR_HAND); + return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); } - - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; + getWindow()->setCursor(UI_CURSOR_HAND); handled = TRUE; } - if( !handled ) - { - // Pass to children - handled = LLView::childrenHandleHover(x, y, mask) != NULL; - } - - if( handled ) - { - // Delay cursor flashing - resetKeystrokeTimer(); - } - - // Opaque - if( !handled && mTakesNonScrollClicks) - { - // Check to see if we're over an HTML-style link - if( !mSegments.empty() ) - { - const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); - if( cur_segment ) - { - if(cur_segment->getStyle()->isLink()) - { - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (over link, inactive)" << llendl; - getWindow()->setCursor(UI_CURSOR_HAND); - handled = TRUE; - } - else - if(cur_segment->getStyle()->getIsEmbeddedItem()) - { - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (over embedded item, inactive)" << llendl; - getWindow()->setCursor(UI_CURSOR_HAND); - //getWindow()->setCursor(UI_CURSOR_ARROW); - handled = TRUE; - } - mHoverSegment = cur_segment; - } - } - - if( !handled ) - { - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; - if (!mScrollbar->getVisible() || x < getRect().getWidth() - scrollbar_size) - { - getWindow()->setCursor(UI_CURSOR_IBEAM); - } - else - { - getWindow()->setCursor(UI_CURSOR_ARROW); - } - handled = TRUE; - } - } - return handled; } @@ -903,13 +810,6 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) handled = LLTextEditor::handleMouseUp(x,y,mask); - // Used to enable I Agree checkbox if the user scrolled through entire text - BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); - if (mOnScrollEndCallback && was_scrolled_to_bottom) - { - mOnScrollEndCallback(mOnScrollEndData); - } - return handled; } @@ -949,24 +849,6 @@ BOOL LLViewerTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) return handled; } -BOOL LLViewerTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) -{ - BOOL handled = FALSE; - handled = childrenHandleMiddleMouseDown(x, y, mask) != NULL; - if (!handled) - { - handled = LLTextEditor::handleMiddleMouseDown(x, y, mask); - } - return handled; -} - -BOOL LLViewerTextEditor::handleMiddleMouseUp(S32 x, S32 y, MASK mask) -{ - BOOL handled = childrenHandleMiddleMouseUp(x, y, mask) != NULL; - - return handled; -} - BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -974,14 +856,15 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // let scrollbar have first dibs handled = LLView::childrenHandleDoubleClick(x, y, mask) != NULL; - if( !handled && mTakesNonScrollClicks) + if( !handled) { if( allowsEmbeddedItems() ) { - const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); - if( cur_segment && cur_segment->getStyle()->getIsEmbeddedItem() ) + S32 doc_index = getDocIndexFromLocalCoord(x, y, FALSE); + llwchar doc_char = getWText()[doc_index]; + if (mEmbeddedItemList->hasEmbeddedItem(doc_char)) { - if( openEmbeddedItemAtPos( cur_segment->getStart() ) ) + if( openEmbeddedItemAtPos( doc_index )) { deselect(); setFocus( FALSE ); @@ -989,47 +872,7 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) } } } - - setCursorAtLocalPos( x, y, FALSE ); - deselect(); - - const LLWString &text = getWText(); - - if( isPartOfWord( text[mCursorPos] ) ) - { - // Select word the cursor is over - while ((mCursorPos > 0) && isPartOfWord(text[mCursorPos-1])) - { - mCursorPos--; - } - startSelection(); - - while ((mCursorPos < (S32)text.length()) && isPartOfWord( text[mCursorPos] ) ) - { - mCursorPos++; - } - - mSelectionEnd = mCursorPos; - } - else if ((mCursorPos < (S32)text.length()) && !iswspace( text[mCursorPos]) ) - { - // Select the character the cursor is over - startSelection(); - mCursorPos++; - mSelectionEnd = mCursorPos; - } - - // We don't want handleMouseUp() to "finish" the selection (and thereby - // set mSelectionEnd to where the mouse is), so we finish the selection here. - mIsSelecting = FALSE; - - // delay cursor flashing - resetKeystrokeTimer(); - - // take selection to 'primary' clipboard - updatePrimary(); - - handled = TRUE; + handled = LLTextEditor::handleDoubleClick(x, y, mask); } return handled; } @@ -1051,80 +894,78 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, return FALSE; } - if (mTakesNonScrollClicks) + if (getEnabled() && acceptsTextInput()) { - if (getEnabled() && acceptsTextInput()) + switch( cargo_type ) { - switch( cargo_type ) + case DAD_CALLINGCARD: + case DAD_TEXTURE: + case DAD_SOUND: + case DAD_LANDMARK: + case DAD_SCRIPT: + case DAD_CLOTHING: + case DAD_OBJECT: + case DAD_NOTECARD: + case DAD_BODYPART: + case DAD_ANIMATION: + case DAD_GESTURE: { - case DAD_CALLINGCARD: - case DAD_TEXTURE: - case DAD_SOUND: - case DAD_LANDMARK: - case DAD_SCRIPT: - case DAD_CLOTHING: - case DAD_OBJECT: - case DAD_NOTECARD: - case DAD_BODYPART: - case DAD_ANIMATION: - case DAD_GESTURE: + LLInventoryItem *item = (LLInventoryItem *)cargo_data; + if( item && allowsEmbeddedItems() ) { - LLInventoryItem *item = (LLInventoryItem *)cargo_data; - if( item && allowsEmbeddedItems() ) + U32 mask_next = item->getPermissions().getMaskNextOwner(); + if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) { - U32 mask_next = item->getPermissions().getMaskNextOwner(); - if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) - { - if( drop ) - { - deselect(); - S32 old_cursor = mCursorPos; - setCursorAtLocalPos( x, y, TRUE ); - S32 insert_pos = mCursorPos; - setCursorPos(old_cursor); - BOOL inserted = insertEmbeddedItem( insert_pos, item ); - if( inserted && (old_cursor > mCursorPos) ) - { - setCursorPos(mCursorPos + 1); - } - - updateLineStartList(); - } - *accept = ACCEPT_YES_COPY_MULTI; - } - else + if( drop ) { - *accept = ACCEPT_NO; - if (tooltip_msg.empty()) + deselect(); + S32 old_cursor = mCursorPos; + setCursorAtLocalPos( x, y, TRUE ); + S32 insert_pos = mCursorPos; + setCursorPos(old_cursor); + BOOL inserted = insertEmbeddedItem( insert_pos, item ); + if( inserted && (old_cursor > mCursorPos) ) { - // *TODO: Translate - tooltip_msg.assign("Only items with unrestricted\n" - "'next owner' permissions \n" - "can be attached to notecards."); + setCursorPos(mCursorPos + 1); } + + needsReflow(); + } + *accept = ACCEPT_YES_COPY_MULTI; } else { *accept = ACCEPT_NO; + if (tooltip_msg.empty()) + { + // *TODO: Translate + tooltip_msg.assign("Only items with unrestricted\n" + "'next owner' permissions \n" + "can be attached to notecards."); + } } - break; } - - default: + else + { *accept = ACCEPT_NO; - break; + } + break; } - } - else - { - // Not enabled + + default: *accept = ACCEPT_NO; + break; } - - handled = TRUE; - lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLViewerTextEditor " << getName() << llendl; } + else + { + // Not enabled + *accept = ACCEPT_NO; + } + + handled = TRUE; + lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLViewerTextEditor " << getName() << llendl; return handled; } @@ -1244,33 +1085,33 @@ llwchar LLViewerTextEditor::pasteEmbeddedItem(llwchar ext_char) return LL_UNKNOWN_CHAR; // item not found or list full } -void LLViewerTextEditor::bindEmbeddedChars(const LLFontGL* font) const +void LLViewerTextEditor::onValueChange(S32 start, S32 end) { - mEmbeddedItemList->bindEmbeddedChars( font ); + updateSegments(); + findEmbeddedItemSegments(start, end); } -void LLViewerTextEditor::unbindEmbeddedChars(const LLFontGL* font) const +void LLViewerTextEditor::findEmbeddedItemSegments(S32 start, S32 end) { - mEmbeddedItemList->unbindEmbeddedChars( font ); -} + LLWString text = getWText(); -BOOL LLViewerTextEditor::getEmbeddedItemToolTipAtPos(S32 pos, LLWString &msg) const -{ - if (pos < getLength()) + LLColor4 text_color = ( mReadOnly ? mReadOnlyFgColor.get() : mFgColor.get() ); + + // Start with i just after the first embedded item + for(S32 idx = start; idx < end; idx++ ) { - LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem(getWChar(pos)); - if( item ) + llwchar embedded_char = text[idx]; + if( embedded_char >= FIRST_EMBEDDED_CHAR + && embedded_char <= LAST_EMBEDDED_CHAR + && mEmbeddedItemList->hasEmbeddedItem(embedded_char) ) { - msg = utf8str_to_wstring(item->getName()); - msg += '\n'; - msg += utf8str_to_wstring(item->getDescription()); - return TRUE; + LLInventoryItem* itemp = mEmbeddedItemList->getEmbeddedItem(embedded_char); + LLUIImagePtr image = mEmbeddedItemList->getItemImage(embedded_char); + insertSegment(new LLEmbeddedItemSegment(idx, image, itemp, *this)); } } - return FALSE; } - BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos) { if( pos < getLength()) -- cgit v1.2.3 From 745845f79987e4b4ab7f5728746a0eda8898930f Mon Sep 17 00:00:00 2001 From: Monroe Williams Date: Thu, 27 Aug 2009 19:00:18 +0000 Subject: svn merge -r 129841:129910 svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/pluginapi_05-merge@129910 svn merge -r 129913:131718 svn+ssh://svn.lindenlab.com/svn/linden/branches/pluginapi/pluginapi_05 Some branch shenannigans in the pluginapi_05 branch caused this to become a two-part merge. --- indra/newview/llviewertexteditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 7565c86696..7bbe2c89b4 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -34,7 +34,7 @@ #include "llfloaterreg.h" #include "llfocusmgr.h" -#include "audioengine.h" +#include "llaudioengine.h" #include "llagent.h" #include "llinventory.h" #include "llinventorybridge.h" -- cgit v1.2.3 From 0aa2bc4831674e61edf680887eba9acec9f997ed Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Fri, 28 Aug 2009 22:58:17 +0000 Subject: svn merge -r 1490-1500 https://svn.aws.productengine.com/secondlife/pe/stable-2 Bug Fixes: * EXT-637 EXT-595 Dev work: * EXT-694 QA: * Be sure feature works on other locales Known issues: * If old Calling Card of person who presents in the friend list is removed - "Do you want to remove ..." dialog is shown, if old Calling Card of non-friend is removed it is removed in the old way without any alerts. * It is possible to create 2 deep level subfolders under the Calling Cards/Friends/ subfolders. This should be disabled due to Accordion does not support tree hierarchy. * If friendship is removed when agent is offline, Friend Card is not removed from Inventory. --- indra/newview/llviewertexteditor.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llviewertexteditor.cpp') diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 7bbe2c89b4..de01e79803 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -39,7 +39,6 @@ #include "llinventory.h" #include "llinventorybridge.h" #include "llinventorymodel.h" -#include "llfloaterinventory.h" #include "llviewertexteditor.h" -- cgit v1.2.3