diff options
author | Ychebotarev ProductEngine <ychebotarev@productengine.com> | 2010-02-05 13:04:29 +0200 |
---|---|---|
committer | Ychebotarev ProductEngine <ychebotarev@productengine.com> | 2010-02-05 13:04:29 +0200 |
commit | a69a85544f628b7cd5a19f54a059eb02324419e4 (patch) | |
tree | b496d70a74983a14dc2a1189acf21c4cacdcf625 | |
parent | b79b8f87a37888decd3f82e9e255cce641a3955f (diff) | |
parent | 553cf40d136e70f4819cb2b72d0483287db81b17 (diff) |
merge
--HG--
branch : product-engine
-rw-r--r-- | indra/llui/lllineeditor.cpp | 42 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 9 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 8 | ||||
-rw-r--r-- | indra/llui/lltexteditor.h | 7 | ||||
-rw-r--r-- | indra/newview/llbottomtray.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llchiclet.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llfavoritesbar.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llfloatercolorpicker.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfloatersnapshot.cpp | 4 | ||||
-rw-r--r-- | indra/newview/lllocationinputctrl.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 18 | ||||
-rw-r--r-- | indra/newview/lloutputmonitorctrl.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.h | 5 | ||||
-rw-r--r-- | indra/newview/llparticipantlist.cpp | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_pick_list_item.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/text_editor.xml | 3 |
18 files changed, 131 insertions, 33 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index eb2b4f7705..00376cc4dd 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -55,6 +55,7 @@ #include "llui.h" #include "lluictrlfactory.h" #include "llclipboard.h" +#include "llmenugl.h" // // Imported globals @@ -164,7 +165,8 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mTentativeFgColor(p.text_tentative_color()), mHighlightColor(p.highlight_color()), mPreeditBgColor(p.preedit_bg_color()), - mGLFont(p.font) + mGLFont(p.font), + mContextMenuHandle() { llassert( mMaxLengthBytes > 0 ); @@ -191,6 +193,12 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) setCursor(mText.length()); setPrevalidate(p.prevalidate_callback()); + + LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile<LLContextMenu> + ("menu_text_editor.xml", + LLMenuGL::sMenuContainer, + LLMenuHolderGL::child_registry_t::instance()); + setContextMenu(menu); } LLLineEditor::~LLLineEditor() @@ -663,6 +671,16 @@ BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) return TRUE; } +BOOL LLLineEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + setFocus(TRUE); + if (!LLUICtrl::handleRightMouseDown(x, y, mask)) + { + showContextMenu(x, y); + } + return TRUE; +} + BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -2560,3 +2578,25 @@ LLWString LLLineEditor::getConvertedText() const } return text; } + +void LLLineEditor::showContextMenu(S32 x, S32 y) +{ + LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get()); + + if (menu) + { + gEditMenuHandler = this; + + S32 screen_x, screen_y; + localPointToScreen(x, y, &screen_x, &screen_y); + menu->show(screen_x, screen_y); + } +} + +void LLLineEditor::setContextMenu(LLContextMenu* new_context_menu) +{ + if (new_context_menu) + mContextMenuHandle = new_context_menu->getHandle(); + else + mContextMenuHandle.markDead(); +} diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 49e9539b16..a06a317f76 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -56,6 +56,7 @@ class LLFontGL; class LLLineEditorRollback; class LLButton; +class LLContextMenu; typedef boost::function<BOOL (const LLWString &wstr)> LLLinePrevalidateFunc; @@ -113,6 +114,7 @@ protected: LLLineEditor(const Params&); friend class LLUICtrlFactory; friend class LLFloaterEditUI; + void showContextMenu(S32 x, S32 y); public: virtual ~LLLineEditor(); @@ -122,6 +124,7 @@ public: /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); /*virtual*/ void onMouseCaptureLost(); @@ -249,7 +252,9 @@ public: void updateHistory(); // stores current line in history void setReplaceNewlinesWithSpaces(BOOL replace); - + + void setContextMenu(LLContextMenu* new_context_menu); + private: // private helper methods @@ -348,6 +353,8 @@ protected: std::vector<S32> mPreeditPositions; LLPreeditor::standouts_t mPreeditStandouts; + LLHandle<LLView> mContextMenuHandle; + private: // Instances that by default point to the statics but can be overidden in XML. LLPointer<LLUIImage> mBgImage; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3fdb48b3ca..ac5a0376fc 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -242,7 +242,8 @@ LLTextEditor::Params::Params() handle_edit_keys_directly("handle_edit_keys_directly", false), show_line_numbers("show_line_numbers", false), default_color("default_color"), - commit_on_focus_lost("commit_on_focus_lost", false) + commit_on_focus_lost("commit_on_focus_lost", false), + show_context_menu("show_context_menu") {} LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : @@ -258,7 +259,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : mMouseDownX(0), mMouseDownY(0), mTabsToNextField(p.ignore_tab), - mContextMenu(NULL) + mContextMenu(NULL), + mShowContextMenu(p.show_context_menu) { mDefaultFont = p.font; @@ -720,7 +722,7 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) } if (!LLTextBase::handleRightMouseDown(x, y, mask)) { - if(getMouseOpaque()) + if(getChowContextMenu()) { showContextMenu(x, y); } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index a136f9ccce..d96198d9ce 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -68,7 +68,8 @@ public: ignore_tab, handle_edit_keys_directly, show_line_numbers, - commit_on_focus_lost; + commit_on_focus_lost, + show_context_menu; //colors Optional<LLUIColor> default_color; @@ -200,6 +201,9 @@ public: const LLTextSegmentPtr getPreviousSegment() const; void getSelectedSegments(segment_vec_t& segments) const; + void setShowContextMenu(bool show) { mShowContextMenu = show; } + bool getChowContextMenu() const { return mShowContextMenu; } + protected: void showContextMenu(S32 x, S32 y); void drawPreeditMarker(); @@ -319,6 +323,7 @@ private: BOOL mTakesFocus; BOOL mAllowEmbeddedItems; + bool mShowContextMenu; LLUUID mSourceID; diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 4c8cec3d30..93b708f299 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -80,6 +80,14 @@ public: { mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar"); mGesturePanel = getChild<LLPanel>("gesture_panel"); + + // Hide "show_nearby_chat" button + LLLineEditor* chat_box = mNearbyChatBar->getChatBox(); + LLUICtrl* show_btn = mNearbyChatBar->getChild<LLUICtrl>("show_nearby_chat"); + S32 delta_width = show_btn->getRect().getWidth(); + show_btn->setVisible(FALSE); + chat_box->reshape(chat_box->getRect().getWidth() + delta_width, chat_box->getRect().getHeight()); + return TRUE; } @@ -433,6 +441,8 @@ BOOL LLBottomTray::postBuild() mObjectDefaultWidthMap[RS_BUTTON_CAMERA] = mCamPanel->getRect().getWidth(); mObjectDefaultWidthMap[RS_BUTTON_SPEAK] = mSpeakPanel->getRect().getWidth(); + mNearbyChatBar->getChatBox()->setContextMenu(NULL); + return TRUE; } diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index f646bcccb5..18bd7b725f 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -545,6 +545,7 @@ void LLIMChiclet::toggleSpeakerControl() } setRequiredWidth(); + mSpeakerCtrl->setSpeakerId(LLUUID::null); mSpeakerCtrl->setVisible(getShowSpeaker()); } @@ -954,7 +955,10 @@ LLIMGroupChiclet::~LLIMGroupChiclet() void LLIMGroupChiclet::draw() { - switchToCurrentSpeaker(); + if(getShowSpeaker()) + { + switchToCurrentSpeaker(); + } LLIMChiclet::draw(); } diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 90f6438980..0f52b30567 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -628,8 +628,8 @@ void LLFavoritesBarCtrl::draw() if (mShowDragMarker) { - S32 w = mImageDragIndication->getWidth() / 2; - S32 h = mImageDragIndication->getHeight() / 2; + S32 w = mImageDragIndication->getWidth(); + S32 h = mImageDragIndication->getHeight(); if (mLandingTab) { diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 73b79d8e13..b65457c4eb 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -586,7 +586,7 @@ void LLFloaterColorPicker::draw() gl_triangle_2d ( startX, startY, startX + mLumMarkerSize, startY - mLumMarkerSize, startX + mLumMarkerSize, startY + mLumMarkerSize, - LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), TRUE ); + LLColor4 ( 0.75f, 0.75f, 0.75f, 1.0f ), TRUE ); // draw luminance slider outline gl_rect_2d ( mLumRegionLeft, diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index b6e9fb3f6c..a0031f0193 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -2084,10 +2084,6 @@ void LLFloaterSnapshot::draw() S32 offset_x = (getRect().getWidth() - previewp->getThumbnailWidth()) / 2 ; S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ; - if (! gSavedSettings.getBOOL("AdvanceSnapshot")) - { - offset_y += getUIWinHeightShort() - getUIWinHeightLong(); - } glMatrixMode(GL_MODELVIEW); gl_draw_scaled_image(offset_x, offset_y, diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 4f40a0a532..1b7ad6ab7e 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -227,6 +227,7 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) params.commit_on_focus_lost(false); params.follows.flags(FOLLOWS_ALL); mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params); + mTextEntry->setContextMenu(NULL); addChild(mTextEntry); // LLLineEditor is replaced with LLLocationLineEditor diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index acb28bd46f..8fc11d3929 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -200,11 +200,16 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args) mMessageArchive.push_back(chat); if(mMessageArchive.size()>200) mMessageArchive.erase(mMessageArchive.begin()); + } - if (gSavedPerAccountSettings.getBOOL("LogChat")) - { - LLLogChat::saveHistory("chat", chat.mFromName, chat.mFromID, chat.mText); - } + if (args["do_not_log"].asBoolean()) + { + return; + } + + if (gSavedPerAccountSettings.getBOOL("LogChat")) + { + LLLogChat::saveHistory("chat", chat.mFromName, chat.mFromID, chat.mText); } } @@ -275,6 +280,9 @@ void LLNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue) void LLNearbyChat::loadHistory() { + LLSD do_not_log; + do_not_log["do_not_log"] = true; + std::list<LLSD> history; LLLogChat::loadAllHistory("chat", history); @@ -295,7 +303,7 @@ void LLNearbyChat::loadHistory() chat.mFromID = from_id; chat.mText = msg[IM_TEXT].asString(); chat.mTimeStr = msg[IM_TIME].asString(); - addMessage(chat); + addMessage(chat, true, do_not_log); it++; } diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 388fdeea7a..9857e37bc3 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -249,6 +249,11 @@ void LLOutputMonitorCtrl::draw() void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id) { + if (speaker_id.isNull() && mSpeakerId.notNull()) + { + LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this); + } + if (speaker_id.isNull() || speaker_id == mSpeakerId) return; if (mSpeakerId.notNull()) @@ -256,6 +261,7 @@ void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id) // Unregister previous registration to avoid crash. EXT-4782. LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this); } + mSpeakerId = speaker_id; LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 4a7cdfc856..d7c558d188 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -196,10 +196,9 @@ void LLPanelAvatarNotes::fillRightsData() childSetValue("map_check",LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); childSetValue("objects_check",LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE); - childSetEnabled("status_check",TRUE); - childSetEnabled("map_check",TRUE); - childSetEnabled("objects_check",TRUE); } + + enableCheckboxes(NULL != relation); } void LLPanelAvatarNotes::onCommitNotes() @@ -250,6 +249,17 @@ void LLPanelAvatarNotes::confirmModifyRights(bool grant, S32 rights) void LLPanelAvatarNotes::onCommitRights() { + const LLRelationship* buddy_relationship = + LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); + + if (NULL == buddy_relationship) + { + // Lets have a warning log message instead of having a crash. EXT-4947. + llwarns << "Trying to modify rights for non-friend avatar. Skipped." << llendl; + return; + } + + S32 rights = 0; if(childGetValue("status_check").asBoolean()) @@ -259,8 +269,6 @@ void LLPanelAvatarNotes::onCommitRights() if(childGetValue("objects_check").asBoolean()) rights |= LLRelationship::GRANT_MODIFY_OBJECTS; - const LLRelationship* buddy_relationship = - LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); bool allow_modify_objects = childGetValue("objects_check").asBoolean(); // if modify objects checkbox clicked @@ -304,9 +312,7 @@ void LLPanelAvatarNotes::resetControls() //Disable "Add Friend" button for friends. childSetEnabled("add_friend", TRUE); - childSetEnabled("status_check",FALSE); - childSetEnabled("map_check",FALSE); - childSetEnabled("objects_check",FALSE); + enableCheckboxes(false); } void LLPanelAvatarNotes::onAddFriendButtonClick() @@ -334,6 +340,13 @@ void LLPanelAvatarNotes::onShareButtonClick() //*TODO not implemented. } +void LLPanelAvatarNotes::enableCheckboxes(bool enable) +{ + childSetEnabled("status_check", enable); + childSetEnabled("map_check", enable); + childSetEnabled("objects_check", enable); +} + LLPanelAvatarNotes::~LLPanelAvatarNotes() { if(getAvatarId().notNull()) @@ -348,6 +361,9 @@ LLPanelAvatarNotes::~LLPanelAvatarNotes() void LLPanelAvatarNotes::changed(U32 mask) { childSetEnabled("teleport", LLAvatarTracker::instance().isBuddyOnline(getAvatarId())); + + // update rights to avoid have checkboxes enabled when friendship is terminated. EXT-4947. + fillRightsData(); } // virtual diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 632590aa27..52b4255e34 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -259,8 +259,8 @@ private: }; /** -* Panel for displaying Avatar's notes and modifying friend's rights. -*/ + * Panel for displaying Avatar's notes and modifying friend's rights. + */ class LLPanelAvatarNotes : public LLPanelProfileTab , public LLFriendObserver @@ -311,6 +311,7 @@ protected: void onCallButtonClick(); void onTeleportButtonClick(); void onShareButtonClick(); + void enableCheckboxes(bool enable); }; #endif // LL_LLPANELAVATAR_H diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index ad47e351ee..1c4004c37a 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -584,7 +584,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& { std::string item = userdata.asString(); if (item == "can_mute_text" || "can_block" == item || "can_share" == item || "can_im" == item - || "can_pay" == item || "can_add" == item) + || "can_pay" == item) { return mUUIDs.front() != gAgentID; } @@ -619,7 +619,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& for (;id != uuids_end; ++id) { - if ( LLAvatarActions::isFriend(*id) ) + if ( *id == gAgentID || LLAvatarActions::isFriend(*id) ) { result = false; break; diff --git a/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml b/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml index b881719e3a..9518151b72 100644 --- a/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml @@ -64,6 +64,7 @@ layout="topleft" left="103" name="description" + textbox.show_context_menu="false" top_pad="0" width="178" word_wrap="true" /> diff --git a/indra/newview/skins/default/xui/en/panel_pick_list_item.xml b/indra/newview/skins/default/xui/en/panel_pick_list_item.xml index e62c1278f9..9bcce1685e 100644 --- a/indra/newview/skins/default/xui/en/panel_pick_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_pick_list_item.xml @@ -64,7 +64,7 @@ layout="topleft" left="103" name="picture_descr" - textbox.mouse_opaque="false" + textbox.show_context_menu="false" top_pad="0" width="178" word_wrap="true" /> diff --git a/indra/newview/skins/default/xui/en/widgets/text_editor.xml b/indra/newview/skins/default/xui/en/widgets/text_editor.xml index 23ca8ea338..2ced8b1b4b 100644 --- a/indra/newview/skins/default/xui/en/widgets/text_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/text_editor.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <!-- Core parameters are in simple_text_editor.xml --> <text_editor - allow_html="false"/> + allow_html="false" + show_context_menu="true"/> |