From 4fb56e77f6631f93c5d995096c104f40e80751f1 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 29 Aug 2009 11:52:59 -0700 Subject: Fixed OpenAL CMake error --- linden/indra/cmake/OPENAL.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linden') diff --git a/linden/indra/cmake/OPENAL.cmake b/linden/indra/cmake/OPENAL.cmake index 94fa75d..ad26d4c 100644 --- a/linden/indra/cmake/OPENAL.cmake +++ b/linden/indra/cmake/OPENAL.cmake @@ -11,7 +11,8 @@ if (OPENAL) # message(STATUS "Building with OpenAL audio support") # OPENAL_LIB - + use_prebuilt_binary(openal) + if (WINDOWS) find_library(OPENAL_LIB NAMES openal32 -- cgit v1.1 From 940e0079539e0d80c21b627caa6f83968629d02b Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 29 Aug 2009 12:26:40 -0700 Subject: Fixed CMake not finding GLib on windows --- linden/indra/cmake/GStreamer.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'linden') diff --git a/linden/indra/cmake/GStreamer.cmake b/linden/indra/cmake/GStreamer.cmake index 880233e..29896d0 100644 --- a/linden/indra/cmake/GStreamer.cmake +++ b/linden/indra/cmake/GStreamer.cmake @@ -11,6 +11,7 @@ if (WINDOWS) use_prebuilt_binary(libxml) use_prebuilt_binary(iconv) + use_prebuilt_binary(glib) use_prebuilt_binary(gstreamer-plugins) set(GSTREAMER_FOUND ON FORCE BOOL) set(GSTREAMER_INCLUDE_DIRS -- cgit v1.1 From 72c17631b8dca81b0cef03ed9c888541ee9101c4 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 4 Sep 2009 09:44:18 -0700 Subject: Updated GStreamer and Zlib windows libs --- linden/indra/cmake/CopyWinLibs.cmake | 8 ++++++++ linden/install.xml | 12 ++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'linden') diff --git a/linden/indra/cmake/CopyWinLibs.cmake b/linden/indra/cmake/CopyWinLibs.cmake index e10b0da..3adba60 100644 --- a/linden/indra/cmake/CopyWinLibs.cmake +++ b/linden/indra/cmake/CopyWinLibs.cmake @@ -26,6 +26,7 @@ set(debug_files windbgdlg.exe iconv.dll libxml2.dll + libcairo-2.dll libgio-2.0-0.dll libglib-2.0-0.dll libgmodule-2.0-0.dll @@ -55,6 +56,8 @@ set(debug_files libgstsdp.dll libgsttag.dll libgstvideo.dll + libjpeg.dll + libmp3lame-0.dll libneon-27.dll libogg-0.dll liboil-0.3-0.dll @@ -66,6 +69,7 @@ set(debug_files libvorbis-0.dll libvorbisenc-2.dll libxml2-2.dll + glew32.dll xvidcore.dll zlib1.dll ) @@ -97,6 +101,7 @@ set(release_files xul.dll iconv.dll libxml2.dll + libcairo-2.dll libgio-2.0-0.dll libglib-2.0-0.dll libgmodule-2.0-0.dll @@ -126,6 +131,8 @@ set(release_files libgstsdp.dll libgsttag.dll libgstvideo.dll + libjpeg.dll + libmp3lame-0.dll libneon-27.dll libogg-0.dll liboil-0.3-0.dll @@ -137,6 +144,7 @@ set(release_files libvorbis-0.dll libvorbisenc-2.dll libxml2-2.dll + glew32.dll xvidcore.dll zlib1.dll ) diff --git a/linden/install.xml b/linden/install.xml index b213b94..a713b0e 100644 --- a/linden/install.xml +++ b/linden/install.xml @@ -589,9 +589,9 @@ windows md5sum - f8db21e781735ba5dd84f3043d20e882 + 70ffd9d5e1c45a634be1beed70371784 url - http://imprudenceviewer.org/download/libs/gstreamer-0.10.22-windows-04172009.tar.bz2 + http://imprudenceviewer.org/download/libs/gstreamer-0.10.22-windows-20090903.tar.bz2 @@ -604,9 +604,9 @@ windows md5sum - 9693550810903d5bca10e018fccd7994 + 77b954b9313459cb7cd6046bf91de296 url - http://imprudenceviewer.org/download/libs/gstreamer-plugins-windows-20090608.tar.bz2 + http://imprudenceviewer.org/download/libs/gstreamer-plugins-windows-20090903.tar.bz2 @@ -1459,9 +1459,9 @@ anguage Infrstructure (CLI) international standard windows md5sum - 9cb8990204da692fd2a9b6530091d9a8 + 0efbf671a0d686bb0141895e91fbfc46 url - http://imprudenceviewer.org/download/libs/zlib-1.1.4-windows-20090608.tar.bz2 + http://imprudenceviewer.org/download/libs/zlib-1.1.4-windows-20090829.tar.bz2 -- cgit v1.1 From 546985431264353a40b5d670bbad9b1c04f55fb5 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 4 Sep 2009 10:11:36 -0700 Subject: Fixed inability to minimize chat history --- linden/indra/newview/skins/default/xui/en-us/floater_chat_history.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linden') diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_chat_history.xml b/linden/indra/newview/skins/default/xui/en-us/floater_chat_history.xml index d32832c..100c455 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_chat_history.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_chat_history.xml @@ -1,5 +1,5 @@ - -- cgit v1.1 From 5d99059dbcbb23966f14256c3704aaca1e84bb2e Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 4 Sep 2009 10:31:07 -0700 Subject: Rebranded startup loading page to Imprudence --- .../default/html/en-us/loading/imprudence_loading.png | Bin 0 -> 10714 bytes .../skins/default/html/en-us/loading/loading.html | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 linden/indra/newview/skins/default/html/en-us/loading/imprudence_loading.png (limited to 'linden') diff --git a/linden/indra/newview/skins/default/html/en-us/loading/imprudence_loading.png b/linden/indra/newview/skins/default/html/en-us/loading/imprudence_loading.png new file mode 100644 index 0000000..f9ea7a2 Binary files /dev/null and b/linden/indra/newview/skins/default/html/en-us/loading/imprudence_loading.png differ diff --git a/linden/indra/newview/skins/default/html/en-us/loading/loading.html b/linden/indra/newview/skins/default/html/en-us/loading/loading.html index 1c62d2f..97174b0 100644 --- a/linden/indra/newview/skins/default/html/en-us/loading/loading.html +++ b/linden/indra/newview/skins/default/html/en-us/loading/loading.html @@ -2,7 +2,7 @@ - loading... + loading... -- cgit v1.1 From 3f0082a9dda60432b8b759e09f19b495d9d5275c Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Mon, 8 Jun 2009 11:10:27 +0200 Subject: Linux middle mouse button paste/primary selection support and gtk clipboard handler (fixes crashbug using synergy mouse-keyboard-clipboard-sharing over lan) modified: linden/doc/contributions.txt modified: linden/indra/llui/llclipboard.cpp modified: linden/indra/llui/llclipboard.h modified: linden/indra/llui/llfloater.cpp modified: linden/indra/llui/llfloater.h modified: linden/indra/llui/lllineeditor.cpp modified: linden/indra/llui/lllineeditor.h modified: linden/indra/llui/lltexteditor.cpp modified: linden/indra/llui/lltexteditor.h modified: linden/indra/llui/llview.cpp modified: linden/indra/llui/llview.h modified: linden/indra/llwindow/CMakeLists.txt new file: linden/indra/llwindow/llmousehandler.cpp modified: linden/indra/llwindow/llmousehandler.h modified: linden/indra/llwindow/llwindow.cpp modified: linden/indra/llwindow/llwindow.h modified: linden/indra/llwindow/llwindowsdl.cpp modified: linden/indra/llwindow/llwindowsdl.h modified: linden/indra/newview/lltool.cpp modified: linden/indra/newview/lltool.h modified: linden/indra/newview/llviewertexteditor.cpp modified: linden/indra/newview/llviewertexteditor.h modified: linden/indra/newview/llviewerwindow.cpp modified: linden/indra/newview/llviewerwindow.h (cherry picked from commit 594f4830922f4294dda432fa748935adffaeed8f) --- linden/doc/contributions.txt | 3 + linden/indra/llui/llclipboard.cpp | 41 ++ linden/indra/llui/llclipboard.h | 11 +- linden/indra/llui/llfloater.cpp | 6 + linden/indra/llui/llfloater.h | 2 +- linden/indra/llui/lllineeditor.cpp | 83 +++- linden/indra/llui/lllineeditor.h | 13 +- linden/indra/llui/lltexteditor.cpp | 91 ++++- linden/indra/llui/lltexteditor.h | 8 + linden/indra/llui/llview.cpp | 78 ++++ linden/indra/llui/llview.h | 4 + linden/indra/llwindow/CMakeLists.txt | 1 + linden/indra/llwindow/llmousehandler.cpp | 59 +++ linden/indra/llwindow/llmousehandler.h | 21 +- linden/indra/llwindow/llwindow.cpp | 16 + linden/indra/llwindow/llwindow.h | 6 + linden/indra/llwindow/llwindowsdl.cpp | 570 +++++----------------------- linden/indra/llwindow/llwindowsdl.h | 13 +- linden/indra/newview/lltool.cpp | 15 +- linden/indra/newview/lltool.h | 3 + linden/indra/newview/llviewertexteditor.cpp | 79 ++-- linden/indra/newview/llviewertexteditor.h | 2 + linden/indra/newview/llviewerwindow.cpp | 479 ++++++----------------- linden/indra/newview/llviewerwindow.h | 9 +- 24 files changed, 696 insertions(+), 917 deletions(-) create mode 100644 linden/indra/llwindow/llmousehandler.cpp (limited to 'linden') diff --git a/linden/doc/contributions.txt b/linden/doc/contributions.txt index 9886640..a1c8624 100644 --- a/linden/doc/contributions.txt +++ b/linden/doc/contributions.txt @@ -61,11 +61,14 @@ Alissa Sabre VWR-7168 VWR-7087 VWR-7086 + VWR-9190 VWR-10728 Angus Boyd VWR-592 Argent Stonecutter VWR-68 +Armin Weatherwax + VWR-8436 Asuka Neely VWR-3434 Balp Allen diff --git a/linden/indra/llui/llclipboard.cpp b/linden/indra/llui/llclipboard.cpp index d5255e7..f33f3fa 100644 --- a/linden/indra/llui/llclipboard.cpp +++ b/linden/indra/llui/llclipboard.cpp @@ -92,3 +92,44 @@ BOOL LLClipboard::canPasteString() const { return LLView::getWindow()->isClipboardTextAvailable(); } + + +void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) +{ + mSourceID = source_id; + mString = src.substr(pos, len); + LLView::getWindow()->copyTextToPrimary( mString ); +} + + +const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id ) +{ + if( mSourceID.notNull() ) + { + LLWString temp_string; + LLView::getWindow()->pasteTextFromPrimary(temp_string); + + if( temp_string != mString ) + { + mSourceID.setNull(); + mString = temp_string; + } + } + else + { + LLView::getWindow()->pasteTextFromPrimary(mString); + } + + if( source_id ) + { + *source_id = mSourceID; + } + + return mString; +} + + +BOOL LLClipboard::canPastePrimaryString() const +{ + return LLView::getWindow()->isPrimaryTextAvailable(); +} diff --git a/linden/indra/llui/llclipboard.h b/linden/indra/llui/llclipboard.h index 706ed2a..7117f84 100644 --- a/linden/indra/llui/llclipboard.h +++ b/linden/indra/llui/llclipboard.h @@ -43,10 +43,19 @@ public: LLClipboard(); ~LLClipboard(); + /* We support two flavors of clipboard. The default is the explicitly + copy-and-pasted clipboard. The second is the so-called 'primary' clipboard + which is implicitly copied upon selection on platforms which expect this + (i.e. X11/Linux). */ + void copyFromSubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); BOOL canPasteString() const; const LLWString& getPasteWString(LLUUID* source_id = NULL); - + + void copyFromPrimarySubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); + BOOL canPastePrimaryString() const; + const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL); + private: LLUUID mSourceID; LLWString mString; diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index 2924c29..efe49eb 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp @@ -1187,6 +1187,12 @@ BOOL LLFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) return was_minimized || LLPanel::handleRightMouseDown( x, y, mask ); } +BOOL LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + bringToFront( x, y ); + return LLPanel::handleMiddleMouseDown( x, y, mask ); +} + // virtual BOOL LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask) diff --git a/linden/indra/llui/llfloater.h b/linden/indra/llui/llfloater.h index a6fe3cc..37081c2 100644 --- a/linden/indra/llui/llfloater.h +++ b/linden/indra/llui/llfloater.h @@ -178,7 +178,7 @@ public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(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 void draw(); virtual void onOpen() {} diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index 498ef26..f905774 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp @@ -493,6 +493,9 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // delay cursor flashing mKeystrokeTimer.reset(); + // take selection to 'primary' clipboard + updatePrimary(); + return TRUE; } @@ -575,6 +578,17 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) return TRUE; } +BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + // llinfos << "MiddleMouseDown" << llendl; + setFocus( TRUE ); + if( canPastePrimary() ) + { + setCursorAtLocalPos(x); + pastePrimary(); + } + return TRUE; +} BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) { @@ -669,6 +683,9 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) { // delay cursor flashing mKeystrokeTimer.reset(); + + // take selection to 'primary' clipboard + updatePrimary(); } return handled; @@ -872,7 +889,12 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } } - + if(handled) + { + // take selection to 'primary' clipboard + updatePrimary(); + } + return handled; } @@ -945,20 +967,42 @@ BOOL LLLineEditor::canPaste() const return !mReadOnly && gClipboard.canPasteString(); } - -// paste from clipboard void LLLineEditor::paste() { - if (canPaste()) + bool is_primary = false; + pasteHelper(is_primary); +} + +void LLLineEditor::pastePrimary() +{ + bool is_primary = true; + pasteHelper(is_primary); +} + +// paste from primary (is_primary==true) or clipboard (is_primary==false) +void LLLineEditor::pasteHelper(bool is_primary) +{ + bool can_paste_it; + if (is_primary) + can_paste_it = canPastePrimary(); + else + can_paste_it = canPaste(); + + if (can_paste_it) { - LLWString paste = gClipboard.getPasteWString(); + LLWString paste; + if (is_primary) + paste = gClipboard.getPastePrimaryWString(); + else + paste = gClipboard.getPasteWString(); + if (!paste.empty()) { // Prepare for possible rollback LLLineEditorRollback rollback(this); // Delete any selected characters - if (hasSelection()) + if ((!is_primary) && hasSelection()) { deleteSelection(); } @@ -994,7 +1038,7 @@ void LLLineEditor::paste() clean_string = clean_string.substr(0, wchars_that_fit); reportBadKeystroke(); } - + mText.insert(getCursor(), clean_string); setCursor( getCursor() + (S32)clean_string.length() ); deselect(); @@ -1015,7 +1059,30 @@ void LLLineEditor::paste() } } - +// copy selection to primary +void LLLineEditor::copyPrimary() +{ + if( canCopy() ) + { + S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); + S32 length = abs( mSelectionStart - mSelectionEnd ); + gClipboard.copyFromPrimarySubstring( mText.getWString(), left_pos, length ); + } +} + +BOOL LLLineEditor::canPastePrimary() const +{ + return !mReadOnly && gClipboard.canPastePrimaryString(); +} + +void LLLineEditor::updatePrimary() +{ + if(canCopy() ) + { + copyPrimary(); + } +} + BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { BOOL handled = FALSE; diff --git a/linden/indra/llui/lllineeditor.h b/linden/indra/llui/lllineeditor.h index 11cbcd9..b11f8b9 100644 --- a/linden/indra/llui/lllineeditor.h +++ b/linden/indra/llui/lllineeditor.h @@ -89,6 +89,7 @@ public: /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*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 handleKeyHere(KEY key, MASK mask ); /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); /*virtual*/ void onMouseCaptureLost(); @@ -96,13 +97,16 @@ public: // LLEditMenuHandler overrides virtual void cut(); virtual BOOL canCut() const; - virtual void copy(); virtual BOOL canCopy() const; - virtual void paste(); virtual BOOL canPaste() const; - + + virtual void updatePrimary(); + virtual void copyPrimary(); + virtual void pastePrimary(); + virtual BOOL canPastePrimary() const; + virtual void doDelete(); virtual BOOL canDoDelete() const; @@ -219,6 +223,9 @@ public: private: // private helper methods + + void pasteHelper(bool is_primary); + void removeChar(); void addChar(const llwchar c); void setCursorAtLocalPos(S32 local_mouse_x); diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index 3813e76..95cce60 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp @@ -1203,6 +1203,18 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) } +BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + setFocus( TRUE ); + if( canPastePrimary() ) + { + setCursorAtLocalPos( x, y, TRUE ); + pastePrimary(); + } + return TRUE; +} + + BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -1323,6 +1335,9 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) setCursorAtLocalPos( x, y, TRUE ); endSelection(); + + // take selection to primary clipboard + updatePrimary(); } if( !hasSelection() ) @@ -1330,6 +1345,9 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) handleMouseUpOverSegment( x, y, mask ); } + // take selection to 'primary' clipboard + updatePrimary(); + handled = TRUE; } @@ -1392,8 +1410,12 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // delay cursor flashing resetKeystrokeTimer(); + // take selection to 'primary' clipboard + updatePrimary(); + handled = TRUE; } + return handled; } @@ -1689,6 +1711,12 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) } } + if( handled ) + { + // take selection to 'primary' clipboard + updatePrimary(); + } + return handled; } @@ -1868,22 +1896,46 @@ BOOL LLTextEditor::canPaste() const return !mReadOnly && gClipboard.canPasteString(); } - // paste from clipboard void LLTextEditor::paste() { - if (!canPaste()) + bool is_primary = false; + pasteHelper(is_primary); +} + +// paste from primary +void LLTextEditor::pastePrimary() +{ + bool is_primary = true; + pasteHelper(is_primary); +} + +// paste from primary (itsprimary==true) or clipboard (itsprimary==false) +void LLTextEditor::pasteHelper(bool is_primary) +{ + bool can_paste_it; + if (is_primary) + can_paste_it = canPastePrimary(); + else + can_paste_it = canPaste(); + + if (!can_paste_it) { return; } LLUUID source_id; - LLWString paste = gClipboard.getPasteWString(&source_id); + LLWString paste; + if (is_primary) + paste = gClipboard.getPastePrimaryWString(&source_id); + else + paste = gClipboard.getPasteWString(&source_id); + if (paste.empty()) { return; } // Delete any selected characters (the paste replaces them) - if( hasSelection() ) + if( (!is_primary) && hasSelection() ) { deleteSelection(TRUE); } @@ -1917,6 +1969,32 @@ void LLTextEditor::paste() } + +// copy selection to primary +void LLTextEditor::copyPrimary() +{ + if( !canCopy() ) + { + return; + } + S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); + S32 length = abs( mSelectionStart - mSelectionEnd ); + gClipboard.copyFromPrimarySubstring(mWText, left_pos, length, mSourceID); +} + +BOOL LLTextEditor::canPastePrimary() const +{ + return !mReadOnly && gClipboard.canPastePrimaryString(); +} + +void LLTextEditor::updatePrimary() +{ + if (canCopy()) + { + copyPrimary(); + } +} + BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) { BOOL handled = FALSE; @@ -1992,6 +2070,11 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) } } + if (handled) + { + updatePrimary(); + } + return handled; } diff --git a/linden/indra/llui/lltexteditor.h b/linden/indra/llui/lltexteditor.h index 643b7c3..0777e5f 100644 --- a/linden/indra/llui/lltexteditor.h +++ b/linden/indra/llui/lltexteditor.h @@ -82,6 +82,8 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); + virtual BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); + virtual BOOL handleKeyHere(KEY key, MASK mask ); virtual BOOL handleUnicodeCharHere(llwchar uni_char); @@ -117,6 +119,10 @@ public: virtual BOOL canCopy() const; virtual void paste(); virtual BOOL canPaste() const; + virtual void updatePrimary(); + virtual void copyPrimary(); + virtual void pastePrimary(); + virtual BOOL canPastePrimary() const; virtual void doDelete(); virtual BOOL canDoDelete() const; virtual void selectAll(); @@ -425,6 +431,8 @@ private: // // Methods // + void pasteHelper(bool is_primary); + void updateSegments(); void pruneSegments(); diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp index 9cdf481..78bf168 100644 --- a/linden/indra/llui/llview.cpp +++ b/linden/indra/llui/llview.cpp @@ -981,6 +981,30 @@ BOOL LLView::handleRightMouseUp(S32 x, S32 y, MASK mask) } return handled; } + +BOOL LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + LLView* handled_view = childrenHandleMiddleMouseDown( x, y, mask ); + BOOL handled = (handled_view != NULL); + if( !handled && blockMouseEvent(x, y) ) + { + handled = TRUE; + handled_view = this; + } + + return handled; +} + +BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + BOOL handled = childrenHandleMiddleMouseUp( x, y, mask ) != NULL; + if( !handled && blockMouseEvent(x, y) ) + { + handled = TRUE; + } + return handled; +} + LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) { @@ -1142,6 +1166,34 @@ LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask) return handled_view; } +LLView* LLView::childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + LLView* handled_view = NULL; + + if (getVisible() && getEnabled() ) + { + for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + { + LLView* viewp = *child_it; + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if (viewp->pointInView(local_x, local_y) && + viewp->getVisible() && + viewp->getEnabled() && + viewp->handleMiddleMouseDown( local_x, local_y, mask )) + { + if (sDebugMouseHandling) + { + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; + } + handled_view = viewp; + break; + } + } + } + return handled_view; +} + LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) { LLView* handled_view = NULL; @@ -1227,6 +1279,32 @@ LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask) return handled_view; } +LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + LLView* handled_view = NULL; + if( getVisible() && getEnabled() ) + { + for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + { + LLView* viewp = *child_it; + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if (viewp->pointInView(local_x, local_y) && + viewp->getVisible() && + viewp->getEnabled() && + viewp->handleMiddleMouseUp( local_x, local_y, mask )) + { + if (sDebugMouseHandling) + { + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; + } + handled_view = viewp; + break; + } + } + } + return handled_view; +} void LLView::draw() { diff --git a/linden/indra/llui/llview.h b/linden/indra/llui/llview.h index 80dd348..da7f164 100644 --- a/linden/indra/llui/llview.h +++ b/linden/indra/llui/llview.h @@ -463,6 +463,8 @@ public: /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); @@ -596,6 +598,8 @@ protected: LLView* childrenHandleHover(S32 x, S32 y, MASK mask); LLView* childrenHandleMouseUp(S32 x, S32 y, MASK mask); LLView* childrenHandleMouseDown(S32 x, S32 y, MASK mask); + LLView* childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask); + LLView* childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask); LLView* childrenHandleDoubleClick(S32 x, S32 y, MASK mask); LLView* childrenHandleScrollWheel(S32 x, S32 y, S32 clicks); LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask); diff --git a/linden/indra/llwindow/CMakeLists.txt b/linden/indra/llwindow/CMakeLists.txt index 95e315f..afce0c0 100644 --- a/linden/indra/llwindow/CMakeLists.txt +++ b/linden/indra/llwindow/CMakeLists.txt @@ -46,6 +46,7 @@ set(llwindows_HEADER_FILES set(viewer_SOURCE_FILES llwindow.cpp + llmousehandler.cpp ) set(viewer_HEADER_FILES diff --git a/linden/indra/llwindow/llmousehandler.cpp b/linden/indra/llwindow/llmousehandler.cpp new file mode 100644 index 0000000..ae2f147 --- /dev/null +++ b/linden/indra/llwindow/llmousehandler.cpp @@ -0,0 +1,59 @@ +/** + * @file llmousehandler.cpp + * @brief LLMouseHandler class implementation + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llmousehandler.h" + +//virtual +BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) +{ + BOOL handled = FALSE; + if (down) + { + switch (clicktype) + { + case CLICK_LEFT: handled = handleMouseDown(x, y, mask); break; + case CLICK_RIGHT: handled = handleRightMouseDown(x, y, mask); break; + case CLICK_MIDDLE: handled = handleMiddleMouseDown(x, y, mask); break; + case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; + } + } + else + { + switch (clicktype) + { + case CLICK_LEFT: handled = handleMouseUp(x, y, mask); break; + case CLICK_RIGHT: handled = handleRightMouseUp(x, y, mask); break; + case CLICK_MIDDLE: handled = handleMiddleMouseUp(x, y, mask); break; + case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; + } + } + return handled; +} diff --git a/linden/indra/llwindow/llmousehandler.h b/linden/indra/llwindow/llmousehandler.h index dba1fc1..45f837b 100644 --- a/linden/indra/llwindow/llmousehandler.h +++ b/linden/indra/llwindow/llmousehandler.h @@ -32,9 +32,10 @@ #ifndef LL_MOUSEHANDLER_H #define LL_MOUSEHANDLER_H -#include "llstring.h" +#include "linden_common.h" +#include "llrect.h" -// Abstract interface. +// Mostly-abstract interface. // Intended for use via multiple inheritance. // A class may have as many interfaces as it likes, but never needs to inherit one more than once. @@ -48,13 +49,23 @@ public: SHOW_IF_NOT_BLOCKED, SHOW_ALWAYS, } EShowToolTip; + typedef enum { + CLICK_LEFT, + CLICK_MIDDLE, + CLICK_RIGHT, + CLICK_DOUBLELEFT + } EClickType; + virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + + virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; virtual const std::string& getName() const = 0; diff --git a/linden/indra/llwindow/llwindow.cpp b/linden/indra/llwindow/llwindow.cpp index 44908fb..b4c8ff0 100644 --- a/linden/indra/llwindow/llwindow.cpp +++ b/linden/indra/llwindow/llwindow.cpp @@ -307,6 +307,22 @@ void *LLWindow::getMediaWindow() return getPlatformWindow(); } +//virtual +BOOL LLWindow::isPrimaryTextAvailable() +{ + return FALSE; // no +} +//virtual +BOOL LLWindow::pasteTextFromPrimary(LLWString &dst) +{ + return FALSE; // fail +} +// virtual +BOOL LLWindow::copyTextToPrimary(const LLWString &src) +{ + return FALSE; // fail +} + // static std::string LLWindow::getFontListSans() { diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h index ffc117f..821de2f 100644 --- a/linden/indra/llwindow/llwindow.h +++ b/linden/indra/llwindow/llwindow.h @@ -184,9 +184,15 @@ public: virtual void captureMouse() = 0; virtual void releaseMouse() = 0; virtual void setMouseClipping( BOOL b ) = 0; + virtual BOOL isClipboardTextAvailable() = 0; virtual BOOL pasteTextFromClipboard(LLWString &dst) = 0; virtual BOOL copyTextToClipboard(const LLWString &src) = 0; + + virtual BOOL isPrimaryTextAvailable(); + virtual BOOL pasteTextFromPrimary(LLWString &dst); + virtual BOOL copyTextToPrimary(const LLWString &src); + virtual void flashIcon(F32 seconds) = 0; virtual F32 getGamma() = 0; virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp index 8111aaf..5209e6f 100644 --- a/linden/indra/llwindow/llwindowsdl.cpp +++ b/linden/indra/llwindow/llwindowsdl.cpp @@ -188,11 +188,12 @@ Display* LLWindowSDL::get_SDL_Display(void) LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width, - S32 height, U32 flags, - BOOL fullscreen, BOOL clearBg, - BOOL disable_vsync, BOOL use_gl, - BOOL ignore_pixel_depth, U32 fsaa_samples) - : LLWindow(fullscreen, flags), mGamma(1.0f) + S32 height, U32 flags, + BOOL fullscreen, BOOL clearBg, + BOOL disable_vsync, BOOL use_gl, + BOOL ignore_pixel_depth, U32 fsaa_samples) + : LLWindow(fullscreen, flags), Lock_Display(NULL), + Unlock_Display(NULL), mGamma(1.0f) { // Initialize the keyboard gKeyboard = new LLKeyboardSDL(); @@ -717,9 +718,33 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B #endif #if LL_X11 - init_x11clipboard(); + /* Grab the window manager specific information */ + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + if ( SDL_GetWMInfo(&info) ) + { + /* Save the information for later use */ + if ( info.subsystem == SDL_SYSWM_X11 ) + { + mSDL_Display = info.info.x11.display; + mSDL_XWindowID = info.info.x11.wmwindow; + Lock_Display = info.info.x11.lock_func; + Unlock_Display = info.info.x11.unlock_func; + } + else + { + llwarns << "We're not running under X11? Wild." + << llendl; + } + } + else + { + llwarns << "We're not running under any known WM. Wild." + << llendl; + } #endif // LL_X11 + //make sure multisampling is disabled by default glDisable(GL_MULTISAMPLE_ARB); @@ -763,8 +788,12 @@ BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL void LLWindowSDL::destroyContext() { llinfos << "destroyContext begins" << llendl; + #if LL_X11 - quit_x11clipboard(); + mSDL_Display = NULL; + mSDL_XWindowID = None; + Lock_Display = NULL; + Unlock_Display = NULL; #endif // LL_X11 // Clean up remaining GL state before blowing away window @@ -1212,523 +1241,125 @@ void LLWindowSDL::flashIcon(F32 seconds) #endif // LL_X11 } -#if LL_X11 -/* Lots of low-level X11 stuff to handle X11 copy-and-paste */ - -/* Our X11 clipboard support is a bit bizarre in various - organically-grown ways. Ideally it should be fixed to do - real string-type negotiation (this would make pasting to - xterm faster and pasting to UTF-8 emacs work properly), but - right now it has the rare and desirable trait of being - generally stable and working. */ - -typedef Atom x11clipboard_type; - -/* PRIMARY and CLIPBOARD are the two main kinds of - X11 clipboard. A third are the CUT_BUFFERs which an - obsolete holdover from X10 days and use a quite orthogonal - mechanism. CLIPBOARD is the type whose design most - closely matches SL's own win32-alike explicit copy-and-paste - paradigm. - - Pragmatically we support all three to varying degrees. When - we paste into SL, it is strictly from CLIPBOARD. When we copy, - we support (to as full an extent as the clipboard content type - allows) CLIPBOARD, PRIMARY, and CUT_BUFFER0. - */ -static x11clipboard_type get_x11_readwrite_clipboard_type(void) -{ - return XInternAtom(LLWindowSDL::get_SDL_Display(), "CLIPBOARD", False); -} - -static x11clipboard_type get_x11_write_clipboard_type(void) -{ - return XA_PRIMARY; -} - -/* This is where our own private cutbuffer goes - we don't use - a regular cutbuffer (XA_CUT_BUFFER0 etc) for intermediate - storage because their use isn't really defined for holding UTF8. */ -static x11clipboard_type get_x11_cutbuffer_clipboard_type(void) -{ - return XInternAtom(LLWindowSDL::get_SDL_Display(), "SECONDLIFE_CUTBUFFER", False); -} - -/* Some X11 atom-generators */ -static Atom get_x11_targets_atom(void) -{ - return XInternAtom(LLWindowSDL::get_SDL_Display(), "TARGETS", False); -} - -static Atom get_x11_text_atom(void) -{ - return XInternAtom(LLWindowSDL::get_SDL_Display(), "TEXT", False); -} - -/* These defines, and convert_data/convert_x11clipboard, - mostly exist to support non-text or unusually-encoded - clipboard data, which we don't really have a need for at - the moment. */ -#define SDLCLIPTYPE(A, B, C, D) (int)(((A)<<24)|((B)<<16)|((C)<<8)|((D)<<0)) -#define FORMAT_PREFIX "SECONDLIFE_x11clipboard_0x" - -static -x11clipboard_type convert_format(int type) +#if LL_GTK +BOOL LLWindowSDL::isClipboardTextAvailable() { - if (!gWindowImplementation) + if (ll_try_gtk_init()) { - llwarns << "!gWindowImplementation in convert_format()" - << llendl; - return XA_STRING; - } - - switch (type) - { - case SDLCLIPTYPE('T', 'E', 'X', 'T'): - // old-style X11 clipboard, strictly only ISO 8859-1 encoding - return XA_STRING; - case SDLCLIPTYPE('U', 'T', 'F', '8'): - // newer de-facto UTF8 clipboard atom - return XInternAtom(gWindowImplementation->mSDL_Display, - "UTF8_STRING", False); - default: - { - /* completely arbitrary clipboard types... we don't actually use - these right now, and support is skeletal. */ - char format[sizeof(FORMAT_PREFIX)+8+1]; /* Flawfinder: ignore */ - - snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type); - return XInternAtom(gWindowImplementation->mSDL_Display, - format, False); + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_NONE); + return gtk_clipboard_wait_is_text_available(clipboard) ? + TRUE : FALSE; } - } + return FALSE; // failure } -/* convert platform string to x11 clipboard format. for our - purposes this is pretty trivial right now. */ -static int -convert_data(int type, char *dst, const char *src, int srclen) +BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &text) { - int dstlen; - - dstlen = 0; - switch (type) + if (ll_try_gtk_init()) { - case SDLCLIPTYPE('T', 'E', 'X', 'T'): - case SDLCLIPTYPE('U', 'T', 'F', '8'): - if (src == NULL) - { - break; - } - if ( srclen == 0 ) - srclen = strlen(src); /* Flawfinder: ignore */ - - dstlen = srclen + 1; - - if ( dst ) // assume caller made it big enough by asking us + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_NONE); + gchar * const data = gtk_clipboard_wait_for_text(clipboard); + if (data) { - memcpy(dst, src, srclen); /* Flawfinder: ignore */ - dst[srclen] = '\0'; + text = LLWString(utf8str_to_wstring(data)); + g_free(data); + return TRUE; } - break; - - default: - llwarns << "convert_data: Unknown medium type" << llendl; - break; } - return(dstlen); + return FALSE; // failure } -/* Convert x11clipboard data to platform string. This too is - pretty trivial for our needs right now, and just about identical - to above. */ -static int -convert_x11clipboard(int type, char *dst, const char *src, int srclen) +BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text) { - int dstlen; - - dstlen = 0; - switch (type) + if (ll_try_gtk_init()) { - case SDLCLIPTYPE('U', 'T', 'F', '8'): - case SDLCLIPTYPE('T', 'E', 'X', 'T'): - if (src == NULL) - { - break; - } - if ( srclen == 0 ) - srclen = strlen(src); /* Flawfinder: ignore */ - - dstlen = srclen + 1; - - if ( dst ) // assume caller made it big enough by asking us - { - memcpy(dst, src, srclen); /* Flawfinder: ignore */ - dst[srclen] = '\0'; - } - break; - - default: - llwarns << "convert_x11clipboard: Unknown medium type" << llendl; - break; + const std::string utf8 = wstring_to_utf8str(text); + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_NONE); + gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length()); + return TRUE; } - return dstlen; -} - -int -LLWindowSDL::is_empty_x11clipboard(void) -{ - int retval; - - maybe_lock_display(); - retval = ( XGetSelectionOwner(mSDL_Display, get_x11_readwrite_clipboard_type()) == None ); - maybe_unlock_display(); - - return(retval); + return FALSE; // failure } -void -LLWindowSDL::put_x11clipboard(int type, int srclen, const char *src) +BOOL LLWindowSDL::isPrimaryTextAvailable() { - x11clipboard_type format; - int dstlen; - char *dst; - - format = convert_format(type); - dstlen = convert_data(type, NULL, src, srclen); - - dst = (char *)malloc(dstlen); - if ( dst != NULL ) + if (ll_try_gtk_init()) { - maybe_lock_display(); - Window root = DefaultRootWindow(mSDL_Display); - convert_data(type, dst, src, srclen); - // Cutbuffers are only allowed to have STRING atom types, - // but Emacs puts UTF8 inside them anyway. We cautiously - // don't. - if (type == SDLCLIPTYPE('T','E','X','T')) - { - // dstlen-1 so we don't include the trailing \0 - llinfos << "X11: Populating cutbuffer." <event.xevent; - - if ( (xevent.type == SelectionNotify)&& - (xevent.xselection.requestor == owner) ) - selection_response = 1; - } - } else { - llinfos << "X11: Waiting for SYSWM event..." << llendl; - } - } - llinfos << "X11: Clipboard arrived." <type != SDL_SYSWMEVENT ) - { - return(1); - } - - /* Handle window-manager specific clipboard events */ - switch (event->syswm.msg->event.xevent.type) { - /* Copy the selection from SECONDLIFE_CUTBUFFER to the requested property */ - case SelectionRequest: { - XSelectionRequestEvent *req; - XEvent sevent; - int seln_format; - unsigned long nbytes; - unsigned long overflow; - unsigned char *seln_data; - - req = &event->syswm.msg->event.xevent.xselectionrequest; - sevent.xselection.type = SelectionNotify; - sevent.xselection.display = req->display; - sevent.xselection.selection = req->selection; - sevent.xselection.target = None; - sevent.xselection.property = None; - sevent.xselection.requestor = req->requestor; - sevent.xselection.time = req->time; - if ( XGetWindowProperty(LLWindowSDL::get_SDL_Display(), DefaultRootWindow(LLWindowSDL::get_SDL_Display()), - get_x11_cutbuffer_clipboard_type(), 0, INT_MAX/4, False, req->target, - &sevent.xselection.target, &seln_format, - &nbytes, &overflow, &seln_data) == Success ) + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gchar * const data = gtk_clipboard_wait_for_text(clipboard); + if (data) { - if ( sevent.xselection.target == req->target) - { - if ( sevent.xselection.target == XA_STRING || - sevent.xselection.target == - convert_format(SDLCLIPTYPE('U','T','F','8')) ) - { - if ( seln_data[nbytes-1] == '\0' ) - --nbytes; - } - XChangeProperty(LLWindowSDL::get_SDL_Display(), req->requestor, req->property, - req->target, seln_format, PropModeReplace, - seln_data, nbytes); - sevent.xselection.property = req->property; - } else if (get_x11_targets_atom() == req->target) { - /* only advertise what we currently support */ - const int num_supported = 3; - Atom supported[num_supported] = { - XA_STRING, // will be over-written below - get_x11_text_atom(), - get_x11_targets_atom() - }; - supported[0] = sevent.xselection.target; - XChangeProperty(LLWindowSDL::get_SDL_Display(), req->requestor, - req->property, XA_ATOM, 32, PropModeReplace, - (unsigned char*)supported, - num_supported); - sevent.xselection.property = req->property; - llinfos << "Clipboard: An app asked us what selections format we offer." << llendl; - } else { - llinfos << "Clipboard: An app requested an unsupported selection format " << req->target << ", we have " << sevent.xselection.target << llendl; - sevent.xselection.target = None; - } - XFree(seln_data); + text = LLWString(utf8str_to_wstring(data)); + g_free(data); + return TRUE; } - int sendret = - XSendEvent(LLWindowSDL::get_SDL_Display(),req->requestor,False,0,&sevent); - if ((sendret==BadValue) || (sendret==BadWindow)) - llwarns << "Clipboard SendEvent failed" << llendl; - XSync(LLWindowSDL::get_SDL_Display(), False); - } - break; } - - /* Post the event for X11 clipboard reading above */ - return(1); + return FALSE; // failure } -int -LLWindowSDL::init_x11clipboard(void) +BOOL LLWindowSDL::copyTextToPrimary(const LLWString &text) { - SDL_SysWMinfo info; - int retval; - - /* Grab the window manager specific information */ - retval = -1; - SDL_SetError("SDL is not running on known window manager"); - - SDL_VERSION(&info.version); - if ( SDL_GetWMInfo(&info) ) + if (ll_try_gtk_init()) { - /* Save the information for later use */ - if ( info.subsystem == SDL_SYSWM_X11 ) - { - mSDL_Display = info.info.x11.display; - mSDL_XWindowID = info.info.x11.wmwindow; - Lock_Display = info.info.x11.lock_func; - Unlock_Display = info.info.x11.unlock_func; - - /* Enable the special window hook events */ - SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); - SDL_SetEventFilter(clipboard_filter_callback); - - retval = 0; - } - else - { - SDL_SetError("SDL is not running on X11"); - } + const std::string utf8 = wstring_to_utf8str(text); + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length()); + return TRUE; } - return(retval); -} - -void -LLWindowSDL::quit_x11clipboard(void) -{ - mSDL_Display = NULL; - mSDL_XWindowID = None; - Lock_Display = NULL; - Unlock_Display = NULL; - - SDL_SetEventFilter(NULL); // Stop custom event filtering + return FALSE; // failure } -/************************************************/ - +#else + BOOL LLWindowSDL::isClipboardTextAvailable() { - return !is_empty_x11clipboard(); + return FALSE; // unsupported } - + BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst) { - int cliplen; // seems 1 or 2 bytes longer than expected - char *cliptext = NULL; - get_x11clipboard(SDLCLIPTYPE('U','T','F','8'), &cliplen, &cliptext); - if (cliptext) - { - llinfos << "X11: Got UTF8 clipboard text." << llendl; - // at some future time we can use cliplen instead of relying on \0, - // if we ever grok non-ascii, non-utf8 encodings on the clipboard. - std::string clip_str(cliptext); - // we can't necessarily trust the incoming text to be valid UTF-8, - // but utf8str_to_wstring() seems to do an appropriate level of - // validation for avoiding over-reads. - dst = utf8str_to_wstring(clip_str); - /*llinfos << "X11 pasteTextFromClipboard: cliplen=" << cliplen << - " strlen(cliptext)=" << strlen(cliptext) << - " clip_str.length()=" << clip_str.length() << - " dst.length()=" << dst.length() << - llendl;*/ - free(cliptext); - return TRUE; // success - } - get_x11clipboard(SDLCLIPTYPE('T','E','X','T'), &cliplen, &cliptext); - if (cliptext) - { - llinfos << "X11: Got ISO 8859-1 clipboard text." << llendl; - std::string clip_str(cliptext); - std::string utf8_str = rawstr_to_utf8(clip_str); - dst = utf8str_to_wstring(utf8_str); - free(cliptext); - } - return FALSE; // failure + return FALSE; // unsupported } + BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) { - std::string utf8text = wstring_to_utf8str(s); - const char* cstr = utf8text.c_str(); - if (cstr == NULL) - { - return FALSE; - } - int cstrlen = strlen(cstr); /* Flawfinder: ignore */ - int i; - for (i=0; igetDocPos() == mScrollbar->getDocPosMax()); - if (mOnScrollEndCallback && was_scrolled_to_bottom) - { - mOnScrollEndCallback(mOnScrollEndData); - } - - if( !handled && mTakesNonScrollClicks) - { - if( mIsSelecting ) - { - // Finish selection - if( y > getTextRect().mTop ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 ); - } - else - if( y < getTextRect().mBottom ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 ); - } - - setCursorAtLocalPos( x, y, TRUE ); - endSelection(); - - updateScrollFromCursor(); - } - - if( !hasSelection() ) - { - handleMouseUpOverSegment( x, y, mask ); - } - - handled = TRUE; - } - - // Delay cursor flashing - resetKeystrokeTimer(); + BOOL handled = FALSE; - if( hasMouseCapture() ) + if( hasMouseCapture() ) { if (mDragItem) { @@ -956,8 +914,15 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) } } mDragItem = NULL; - gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + } + + 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; @@ -999,6 +964,24 @@ 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; @@ -1021,7 +1004,6 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) } } } - setCursorAtLocalPos( x, y, FALSE ); deselect(); @@ -1059,6 +1041,9 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // delay cursor flashing resetKeystrokeTimer(); + // take selection to 'primary' clipboard + updatePrimary(); + handled = TRUE; } return handled; diff --git a/linden/indra/newview/llviewertexteditor.h b/linden/indra/newview/llviewertexteditor.h index 4cd5850..062808a 100644 --- a/linden/indra/newview/llviewertexteditor.h +++ b/linden/indra/newview/llviewertexteditor.h @@ -58,6 +58,8 @@ public: // mousehandler overrides virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index 7e6c24f..3b23bb9 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp @@ -547,19 +547,42 @@ bool LLViewerWindow::shouldShowToolTipFor(LLMouseHandler *mh) return false; } -BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) { + std::string buttonname; + std::string buttonstatestr; + BOOL handled = FALSE; S32 x = pos.mX; S32 y = pos.mY; x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) + if (down) + buttonstatestr = "down" ; + else + buttonstatestr = "up" ; + + switch (clicktype) { - llinfos << "ViewerWindow left mouse down at " << x << "," << y << llendl; + case LLMouseHandler::CLICK_LEFT: + mLeftMouseDown = down; + buttonname = "Left"; + break; + case LLMouseHandler::CLICK_RIGHT: + mRightMouseDown = down; + buttonname = "Right"; + break; + case LLMouseHandler::CLICK_MIDDLE: + mMiddleMouseDown = down; + buttonname = "Middle"; + break; + case LLMouseHandler::CLICK_DOUBLELEFT: + mLeftMouseDown = down; + buttonname = "Left Double Click"; + break; } + + LLView::sMouseHandlerMessage.clear(); if (gMenuBarView) { @@ -567,7 +590,10 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask gMenuBarView->resetMenuTrigger(); } - mLeftMouseDown = TRUE; + if (gDebugClicks) + { + llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl; + } // Make sure we get a coresponding mouseup event, even if the mouse leaves the window mWindow->captureMouse(); @@ -576,9 +602,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask gMouseIdleTimer.reset(); // Hide tooltips on mousedown - mToolTipBlocked = TRUE; + mToolTipBlocked = down; - // Also hide hover info on mousedown + // Also hide hover info on mousedown/mouseup if (gHoverView) { gHoverView->cancelHover(); @@ -587,7 +613,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask // Don't let the user move the mouse out of the window until mouse up. if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) { - mWindow->setMouseClipping(TRUE); + mWindow->setMouseClipping(down); } LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); @@ -598,10 +624,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl; } - - return mouse_captor->handleMouseDown(local_x, local_y, mask); + return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down); } // Topmost view gets a chance before the hierarchy @@ -610,215 +635,95 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask { S32 local_x, local_y; top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) + if (down) { - return top_ctrl->handleMouseDown(local_x, local_y, mask); - } - else - { - gFocusMgr.setTopCtrl(NULL); + if (top_ctrl->pointInView(local_x, local_y)) + { + return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ; + } + else + { + gFocusMgr.setTopCtrl(NULL); + } } - } + else + handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); + + } // Give the UI views a chance to process the click - if( mRootView->handleMouseDown(x, y, mask) ) + if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) ) { if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl; } return TRUE; } else if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down not handled by view" << llendl; - } - - if (gDisconnected) - { - return FALSE; - } - - if(LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ) ) - { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } - - return FALSE; -} - -BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) -{ - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow left mouse double-click at " << x << "," << y << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl; } - - mLeftMouseDown = TRUE; - - // Hide tooltips - if( mToolTip ) + if (down) { - mToolTip->setVisible( FALSE ); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) + if (gDisconnected) { - llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; - } - - return mouse_captor->handleDoubleClick(local_x, local_y, mask); - } - - // Check for hit on UI. - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) - { - return top_ctrl->handleDoubleClick(local_x, local_y, mask); + return FALSE; } - else + + if(LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) ) { - gFocusMgr.setTopCtrl(NULL); + // This is necessary to force clicks in the world to cause edit + // boxes that might have keyboard focus to relinquish it, and hence + // cause a commit to update their value. JC + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; } } - - if (mRootView->handleDoubleClick(x, y, mask)) + else { - if (LLView::sDebugMouseHandling) + + mWindow->releaseMouse(); + + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + if( !handled ) { - llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; + handled = mRootView->handleAnyMouseClick(x, y, mask, clicktype, down); + } + + + + if( !handled ) + { + if (tool) + { + handled = tool->handleAnyMouseClick(x, y, mask, clicktype, down); + } } - return TRUE; - } - else if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Down not handled by view" << llendl; } - // Why is this here? JC 9/3/2002 - if (gNoRender) - { - return TRUE; - } + return (!down); +} - if(LLToolMgr::getInstance()->getCurrentTool()->handleDoubleClick( x, y, mask ) ) - { - return TRUE; - } +BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +{ + BOOL down = TRUE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); +} - // if we got this far and nothing handled a double click, pass a normal mouse down - return handleMouseDown(window, pos, mask); +BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) +{ + // try handling as a double-click first, then a single-click if that + // wasn't handled. + BOOL down = TRUE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_DOUBLELEFT,down) || + handleMouseDown(window, pos, mask); } BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow left mouse up" << llendl; - } - - mLeftMouseDown = FALSE; - - // Indicate mouse was active - gMouseIdleTimer.reset(); - - // Hide tooltips on mouseup - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mouseup - if (gHoverView) gHoverView->cancelHover(); - - BOOL handled = FALSE; - - mWindow->releaseMouse(); - - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Up handled by captor " << mouse_captor->getName() << llendl; - } - - return mouse_captor->handleMouseUp(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); - } - - if( !handled ) - { - handled = mRootView->handleMouseUp(x, y, mask); - } - - if (LLView::sDebugMouseHandling) - { - if (handled) - { - llinfos << "Left Mouse Up" << LLView::sMouseHandlerMessage << llendl; - } - else - { - llinfos << "Left Mouse Up not handled by view" << llendl; - } - } - - if( !handled ) - { - if (tool) - { - handled = tool->handleMouseUp(x, y, mask); - } - } - - // Always handled as far as the OS is concerned. - return TRUE; + BOOL down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); } @@ -829,91 +734,10 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl; - } - - if (gMenuBarView) - { - // stop ALT-key access to menu - gMenuBarView->resetMenuTrigger(); - } - - mRightMouseDown = TRUE; - - // Make sure we get a coresponding mouseup event, even if the mouse leaves the window - mWindow->captureMouse(); - - // Hide tooltips - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mousedown - if (gHoverView) - { - gHoverView->cancelHover(); - } - - // Don't let the user move the mouse out of the window until mouse up. - if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(TRUE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down handled by captor " << mouse_captor->getName() << llendl; - } - return mouse_captor->handleRightMouseDown(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) - { - return top_ctrl->handleRightMouseDown(local_x, local_y, mask); - } - else - { - gFocusMgr.setTopCtrl(NULL); - } - } - - if( mRootView->handleRightMouseDown(x, y, mask) ) - { - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl; - } - return TRUE; - } - else if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down not handled by view" << llendl; - } - - if(LLToolMgr::getInstance()->getCurrentTool()->handleRightMouseDown( x, y, mask ) ) - { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } + BOOL down = TRUE; + BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); + if (handle) + return handle; // *HACK: this should be rolled into the composite tool logic, not // hardcoded at the top level. @@ -931,107 +755,27 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - // Don't care about caps lock for mouse events. - if (gDebugClicks) - { - llinfos << "ViewerWindow right mouse up" << llendl; - } - - mRightMouseDown = FALSE; - - // Indicate mouse was active - gMouseIdleTimer.reset(); - - // Hide tooltips on mouseup - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mouseup - if (gHoverView) gHoverView->cancelHover(); - - BOOL handled = FALSE; - - mWindow->releaseMouse(); - - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Up handled by captor " << mouse_captor->getName() << llendl; - } - return mouse_captor->handleRightMouseUp(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleRightMouseUp(local_x, local_y, mask); - } - - if( !handled ) - { - handled = mRootView->handleRightMouseUp(x, y, mask); - } - - if (LLView::sDebugMouseHandling) - { - if (handled) - { - llinfos << "Right Mouse Up" << LLView::sMouseHandlerMessage << llendl; - } - else - { - llinfos << "Right Mouse Up not handled by view" << llendl; - } - } - - if( !handled ) - { - if (tool) - { - handled = tool->handleRightMouseUp(x, y, mask); - } - } - - // Always handled as far as the OS is concerned. - return TRUE; + BOOL down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); } BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = TRUE; gVoiceClient->middleMouseState(true); - - // Always handled as far as the OS is concerned. + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); + + // Always handled as far as the OS is concerned. return TRUE; } - + BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = FALSE; gVoiceClient->middleMouseState(false); - - // Always handled as far as the OS is concerned. + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); + + // Always handled as far as the OS is concerned. return TRUE; } @@ -1404,6 +1148,7 @@ LLViewerWindow::LLViewerWindow( mWindowRect(0, height, width, 0), mVirtualWindowRect(0, height, width, 0), mLeftMouseDown(FALSE), + mMiddleMouseDown(FALSE), mRightMouseDown(FALSE), mToolTip(NULL), mToolTipBlocked(FALSE), diff --git a/linden/indra/newview/llviewerwindow.h b/linden/indra/newview/llviewerwindow.h index ab2dd4e..40368f8 100644 --- a/linden/indra/newview/llviewerwindow.h +++ b/linden/indra/newview/llviewerwindow.h @@ -47,6 +47,7 @@ #include "lltimer.h" #include "llstat.h" #include "llalertdialog.h" +#include "llmousehandler.h" class LLView; class LLViewerObject; @@ -57,7 +58,6 @@ class LLVelocityBar; class LLTextBox; class LLImageRaw; class LLHUDIcon; -class LLMouseHandler; #define PICK_HALF_WIDTH 5 #define PICK_DIAMETER (2 * PICK_HALF_WIDTH + 1) @@ -81,7 +81,7 @@ public: static bool isFlora(LLViewerObject* object); - typedef enum e_pick_type + typedef enum { PICK_OBJECT, PICK_FLORA, @@ -150,6 +150,7 @@ public: /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask); /*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended + /*virtual*/ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down); /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleCloseRequest(LLWindow *window); @@ -212,6 +213,7 @@ public: LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; } LLStat * getMouseVelocityStat() { return &mMouseVelocityStat; } BOOL getLeftMouseDown() const { return mLeftMouseDown; } + BOOL getMiddleMouseDown() const { return mMiddleMouseDown; } BOOL getRightMouseDown() const { return mRightMouseDown; } const LLPickInfo& getLastPick() const { return mLastPick; } @@ -279,7 +281,7 @@ public: // snapshot functionality. // perhaps some of this should move to llfloatershapshot? -MG - typedef enum e_snapshot_type + typedef enum { SNAPSHOT_TYPE_COLOR, SNAPSHOT_TYPE_DEPTH, @@ -397,6 +399,7 @@ protected: LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame LLStat mMouseVelocityStat; BOOL mLeftMouseDown; + BOOL mMiddleMouseDown; BOOL mRightMouseDown; LLProgressView *mProgressView; -- cgit v1.1 From 73b8ee092e6f8a450e5bf71c43a0362c4986a005 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Sat, 11 Jul 2009 12:25:27 +0200 Subject: Teleport by double clicking into the viewer window. Port and bugfix of cv port of emerald greenlife viewer feature. TODO: find a nice place in prefs to switch off (defaults to on). (cherry picked from commit 86e186e40f6a128abab1c3a44f33520508b37f16) --- linden/indra/newview/app_settings/settings.xml | 11 ++++++ linden/indra/newview/lltoolpie.cpp | 2 +- linden/indra/newview/llviewermenu.cpp | 51 +++++++++++++++----------- 3 files changed, 42 insertions(+), 22 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 5c76185..a080be2 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -2245,6 +2245,17 @@ Value 0 + DoubleClickTeleport + + Comment + Enable double-click teleport + Persist + 1 + Type + Boolean + Value + 1 + DragAndDropToolTipDelay Comment diff --git a/linden/indra/newview/lltoolpie.cpp b/linden/indra/newview/lltoolpie.cpp index 27d1c4c..7f3bd82 100644 --- a/linden/indra/newview/lltoolpie.cpp +++ b/linden/indra/newview/lltoolpie.cpp @@ -635,7 +635,7 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) llinfos << "LLToolPie handleDoubleClick (becoming mouseDown)" << llendl; } - if (gSavedSettings.getBOOL("DoubleClickAutoPilot")) + if (gSavedSettings.getBOOL("DoubleClickAutoPilot") || gSavedSettings.getBOOL("DoubleClickTeleport")) { if (mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 2940bdd..51953b09 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -2106,32 +2106,41 @@ class LLObjectMute : public view_listener_t bool handle_go_to() { - // JAMESDEBUG try simulator autopilot - std::vector strings; - std::string val; LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal; - val = llformat("%g", pos.mdV[VX]); - strings.push_back(val); - val = llformat("%g", pos.mdV[VY]); - strings.push_back(val); - val = llformat("%g", pos.mdV[VZ]); - strings.push_back(val); - send_generic_message("autopilot", strings); - - LLViewerParcelMgr::getInstance()->deselectLand(); - - if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera")) + if (gSavedSettings.getBOOL("DoubleClickTeleport")) { - gAgent.setFocusGlobal(gAgent.getFocusTargetGlobal(), gAgent.getAvatarObject()->getID()); + LLVector3d hips_offset(0.0f, 0.0f, 1.2f); + gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + gAgent.teleportViaLocation(pos + hips_offset); } - else + else { - // Snap camera back to behind avatar - gAgent.setFocusOnAvatar(TRUE, ANIMATE); - } + // JAMESDEBUG try simulator autopilot + std::vector strings; + std::string val; + val = llformat("%g", pos.mdV[VX]); + strings.push_back(val); + val = llformat("%g", pos.mdV[VY]); + strings.push_back(val); + val = llformat("%g", pos.mdV[VZ]); + strings.push_back(val); + send_generic_message("autopilot", strings); + + LLViewerParcelMgr::getInstance()->deselectLand(); - // Could be first use - LLFirstUse::useGoTo(); + if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera")) + { + gAgent.setFocusGlobal(gAgent.getFocusTargetGlobal(), gAgent.getAvatarObject()->getID()); + } + else + { + // Snap camera back to behind avatar + gAgent.setFocusOnAvatar(TRUE, ANIMATE); + } + + // Could be first use + LLFirstUse::useGoTo(); + } return true; } -- cgit v1.1 From e31ae50534d752cf19a2bec3a86298bae3bb059a Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 4 Sep 2009 14:17:49 -0700 Subject: Added 'Go Here' to object pie menu --- linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'linden') diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml b/linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml index 8d059c1..765529d 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml @@ -54,7 +54,9 @@ - + + + -- cgit v1.1 From 88f111ae87c364a9934e9d3588bea07e2538c5ca Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Sat, 11 Jul 2009 13:38:17 +0200 Subject: fix NDOF linking issues when using cmake 2.6 on linux modified: linden/indra/newview/CMakeLists.txt (cherry picked from commit 9d14c7ab5c7519a4188c89b2ddeb8df30d858705) --- linden/indra/newview/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linden') diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index 34aa29f..fee4d4d 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt @@ -1385,6 +1385,7 @@ if (WINDOWS) endif (WINDOWS) target_link_libraries(${VIEWER_BINARY_NAME} + ${NDOF_LIBRARY} ${LLAUDIO_LIBRARIES} ${LLCHARACTER_LIBRARIES} ${LLIMAGE_LIBRARIES} @@ -1414,7 +1415,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${SDL_LIBRARY} ${SMARTHEAP_LIBRARY} ${UI_LIBRARIES} - ${NDOF_LIBRARY} ${WINDOWS_LIBRARIES} ${XMLRPCEPI_LIBRARIES} ${ELFIO_LIBRARIES} -- cgit v1.1 From e0450b604383f3a0276097496f1935e1b543ec5e Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 4 Sep 2009 18:53:30 -0700 Subject: Integrated 1.23's tool floater with link/unlink buttons --- linden/indra/newview/llfloatertelehub.cpp | 1 - linden/indra/newview/llfloatertools.cpp | 81 +++------- linden/indra/newview/llfloatertools.h | 4 - linden/indra/newview/llviewermenu.cpp | 1 - .../skins/default/xui/en-us/floater_tools.xml | 173 +++++++++++---------- 5 files changed, 107 insertions(+), 153 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llfloatertelehub.cpp b/linden/indra/newview/llfloatertelehub.cpp index 943bc36..062306b 100644 --- a/linden/indra/newview/llfloatertelehub.cpp +++ b/linden/indra/newview/llfloatertelehub.cpp @@ -68,7 +68,6 @@ void LLFloaterTelehub::show() // Find tools floater, glue to bottom if (gFloaterTools) { - gFloaterTools->showMore(FALSE); LLRect tools_rect = gFloaterTools->getRect(); S32 our_width = sInstance->getRect().getWidth(); S32 our_height = sInstance->getRect().getHeight(); diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp index 84a1edc..a99227d 100644 --- a/linden/indra/newview/llfloatertools.cpp +++ b/linden/indra/newview/llfloatertools.cpp @@ -54,6 +54,7 @@ #include "llpanelobject.h" #include "llpanelvolume.h" #include "llpanelpermissions.h" +#include "llresmgr.h" #include "llselectmgr.h" #include "llslider.h" #include "llstatusbar.h" @@ -329,14 +330,10 @@ BOOL LLFloaterTools::postBuild() // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here childSetValue( "slider force", log10(gSavedSettings.getF32("LandBrushForce"))); - childSetAction("button more", click_show_more, this); - childSetAction("button less", click_show_more, this); mTab = getChild("Object Info Tabs"); if(mTab) { - mTab->setVisible( gSavedSettings.getBOOL("ToolboxShowMore") ); mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); - mTab->setVisible( gSavedSettings.getBOOL("ToolboxShowMore") ); mTab->setBorderVisible(FALSE); mTab->selectFirstTab(); } @@ -436,19 +433,6 @@ LLFloaterTools::LLFloaterTools() factory_map["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo LLUICtrlFactory::getInstance()->buildFloater(this,"floater_tools.xml",&factory_map,FALSE); - - mLargeHeight = getRect().getHeight(); - mSmallHeight = mLargeHeight; - if (mTab) mSmallHeight -= mTab->getRect().getHeight(); - - // force a toggle initially. seems to be needed to correctly initialize - // both "more" and "less" cases. it also seems to be important to begin - // with the user's preference first so that it's initial position will - // be correct (SL-51192) -MG - BOOL show_more = gSavedSettings.getBOOL("ToolboxShowMore"); // get user's preference - gSavedSettings.setBOOL("ToolboxShowMore", show_more); // sets up forced toggle below - showMore( !show_more ); // does the toggle - showMore( show_more ); // reset the real user's preference } LLFloaterTools::~LLFloaterTools() @@ -492,6 +476,16 @@ void LLFloaterTools::refresh() mTab->enableTabButton(idx_face, all_volume); mTab->enableTabButton(idx_contents, all_volume); + // Refresh object and prim count labels + LLLocale locale(LLLocale::USER_LOCALE); + std::string obj_count_string; + LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount()); + childSetTextArg("obj_count", "[COUNT]", obj_count_string); + std::string prim_count_string; + LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount()); + childSetTextArg("prim_count", "[COUNT]", prim_count_string); + + // Refresh child tabs mPanelPermissions->refresh(); mPanelObject->refresh(); mPanelVolume->refresh(); @@ -799,8 +793,8 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mSliderDozerSize) { mSliderDozerSize ->setVisible( land_visible ); - childSetVisible("Brush:", land_visible); - childSetVisible("Brush Size:", land_visible); + childSetVisible("Bulldozer:", land_visible); + childSetVisible("Dozer Size:", land_visible); } if (mCheckShowOwners) { @@ -812,13 +806,10 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) childSetVisible("Strength:", land_visible); } - // - // More panel visibility - // - BOOL show_more = gSavedSettings.getBOOL("ToolboxShowMore"); - - mTab->setVisible(show_more && tool != LLToolBrushLand::getInstance() && tool != LLToolSelectLand::getInstance()); - mPanelLandInfo->setVisible(show_more && (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance())); + childSetVisible("obj_count", !land_visible); + childSetVisible("prim_count", !land_visible); + mTab->setVisible(!land_visible); + mPanelLandInfo->setVisible(land_visible); } @@ -873,46 +864,12 @@ void LLFloaterTools::onClose(bool app_quitting) // gMenuBarView->arrange(); } -void LLFloaterTools::showMore(BOOL show_more) -{ - BOOL showing_more = gSavedSettings.getBOOL("ToolboxShowMore"); - if (show_more == showing_more) - { - return; - } - - gSavedSettings.setBOOL("ToolboxShowMore", show_more); - - // Visibility updated next frame - JC - // mTab->setVisible(show_more); - - if (show_more) - { - reshape( getRect().getWidth(), mLargeHeight, TRUE); - translate( 0, mSmallHeight - mLargeHeight ); - } - else - { - reshape( getRect().getWidth(), mSmallHeight, TRUE); - translate( 0, mLargeHeight - mSmallHeight ); - } - childSetVisible("button less", show_more); - childSetVisible("button more", !show_more); -} - void LLFloaterTools::showPanel(EInfoPanel panel) { llassert(panel >= 0 && panel < PANEL_COUNT); mTab->selectTabByName(PANEL_NAMES[panel]); } -void click_show_more(void *userdata) -{ - LLFloaterTools *f = (LLFloaterTools *)userdata; - BOOL show_more = !gSavedSettings.getBOOL("ToolboxShowMore"); - f->showMore( show_more ); -} - void click_popup_info(void*) { // gBuildView->setPropertiesPanelOpen(TRUE); @@ -997,8 +954,8 @@ void click_popup_dozer_mode(LLUICtrl *, void *user) void commit_slider_dozer_size(LLUICtrl *ctrl, void*) { - S32 size = (S32)ctrl->getValue().asInteger(); - gSavedSettings.setS32("LandBrushSize", size); + F32 size = (F32)ctrl->getValue().asReal(); + gSavedSettings.setF32("LandBrushSize", size); } void commit_slider_dozer_force(LLUICtrl *ctrl, void*) diff --git a/linden/indra/newview/llfloatertools.h b/linden/indra/newview/llfloatertools.h index 8f88977..1b13b9f 100644 --- a/linden/indra/newview/llfloatertools.h +++ b/linden/indra/newview/llfloatertools.h @@ -95,14 +95,12 @@ public: /*virtual*/ void draw(); void dirty(); - void showMore(BOOL show_more); void showPanel(EInfoPanel panel); void setStatusText(const std::string& text); virtual void onFocusReceived(); static void setEditTool(void* data); void saveLastTool(); - private: static void setObjectType( void* data ); @@ -198,8 +196,6 @@ public: private: BOOL mDirty; - S32 mSmallHeight; - S32 mLargeHeight; std::map mStatusText; diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 51953b09..2e4f3f4 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -5410,7 +5410,6 @@ class LLLandEdit : public view_listener_t LLViewerParcelMgr::getInstance()->selectParcelAt( LLToolPie::getInstance()->getPick().mPosGlobal ); - gFloaterTools->showMore(TRUE); gFloaterView->bringToFront( gFloaterTools ); // Switch to land edit toolset diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml index 18d56b4..d9b51b1 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -1,6 +1,6 @@ - @@ -79,20 +79,24 @@ - - + + + - Ruler mode: + Ruler: - World @@ -112,16 +116,13 @@ font="SansSerifSmall" height="16" initial_value="true" label="Stretch Textures" left_delta="0" mouse_opaque="true" name="checkbox stretch textures" width="134" /> - - - + + @@ -289,18 +290,18 @@ - Brush: + hidden="false" mouse_opaque="true" name="Bulldozer:" v_pad="0" width="100"> + Bulldozer: + hidden="false" mouse_opaque="true" name="Dozer Size:" v_pad="0" width="100"> Size @@ -312,21 +313,23 @@ - - - - + mouse_opaque="true" name="slider force" width="80" /> + + Selected objects: [COUNT] + + + primitives: [COUNT] + - - 1 Object, 1 Primitive - - @@ -420,7 +417,7 @@ Deed... @@ -429,7 +426,7 @@ Deed @@ -517,37 +514,37 @@ B: O; G: E: N: F: @@ -764,12 +761,12 @@ Skew - - + + @@ -888,10 +885,10 @@ - + + mouse_opaque="true" name="Revolutions" width="68" /> - + width="100" /> + @@ -1236,22 +1236,10 @@ + - Modify Parcel - - - - Parcel Information @@ -1271,12 +1259,27 @@ height="20" label="About Land..." label_selected="About Land..." left="48" mouse_opaque="true" name="button about land" scale_image="TRUE" width="112" /> + + + Modify Parcel + + + + - Drag to move objects, Ctrl to lift, Ctrl-Shift to spin + Drag to move, Ctrl to lift, Ctrl-Shift to rotate - Click in the world to create, shift-click to select + Click inworld to build Click and drag to select land -- cgit v1.1 From 4c41534bb5aace61c05e22d675a104e0173d3098 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 4 Sep 2009 19:19:24 -0700 Subject: Fixed tree/grass label not hiding --- linden/indra/newview/llfloatertools.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp index a99227d..f3ffbe4 100644 --- a/linden/indra/newview/llfloatertools.cpp +++ b/linden/indra/newview/llfloatertools.cpp @@ -1043,15 +1043,15 @@ void LLFloaterTools::onFocusReceived() void LLFloaterTools::updateTreeGrassCombo(bool visible) { + LLTextBox* tree_grass_label = getChild("tree_grass_label"); if (visible) { LLPCode pcode = LLToolPlacer::getObjectType(); std::map::iterator it, end; std::string selected; - LLTextBox* tree_grass_label = getChild("tree_grass_label"); if (pcode == LLToolPlacerPanel::sTree) { - tree_grass_label->setVisible(true); + tree_grass_label->setVisible(visible); LLButton* button = getChild("ToolTree"); tree_grass_label->setText(button->getToolTip()); @@ -1061,7 +1061,7 @@ void LLFloaterTools::updateTreeGrassCombo(bool visible) } else if (pcode == LLToolPlacerPanel::sGrass) { - tree_grass_label->setVisible(true); + tree_grass_label->setVisible(visible); LLButton* button = getChild("ToolGrass"); tree_grass_label->setText(button->getToolTip()); @@ -1097,6 +1097,7 @@ void LLFloaterTools::updateTreeGrassCombo(bool visible) } mComboTreesGrass->setVisible(visible); + tree_grass_label->setVisible(visible); } // static -- cgit v1.1 From 5ef87f0115db707483699af0a468945f022fcfc6 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 6 Sep 2009 18:33:23 -0700 Subject: Ported sit anywhere feature from Emerald viewer --- linden/indra/newview/llviewermenu.cpp | 28 ++++++++++++++++++++++ .../skins/default/xui/en-us/menu_viewer.xml | 4 ++++ 2 files changed, 32 insertions(+) (limited to 'linden') diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 51953b09..727f357 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -7556,6 +7556,32 @@ class LLAdvancedCheckHUDInfo : public view_listener_t }; +////////////////////// +// FORCE GROUND SIT // +////////////////////// + +class LLAdvancedToggleSit: public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLChat chat; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + if(!gAgent.getAvatarObject()->mIsSitting) + { + gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); + chat.mText = "Forcing Ground Sit"; + } + else + { + gAgent.setControlFlags(!AGENT_CONTROL_SIT_ON_GROUND); + gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + chat.mText = "Standing up"; + } + LLFloaterChat::addChat(chat); + return true; + } +}; + /////////////////////// // CLEAR GROUP CACHE // @@ -9572,6 +9598,7 @@ void initialize_menus() addMenu(new LLWorldTeleportHome(), "World.TeleportHome"); addMenu(new LLWorldSetAway(), "World.SetAway"); addMenu(new LLWorldSetBusy(), "World.SetBusy"); + addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit"); addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark"); addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation"); @@ -9720,6 +9747,7 @@ void initialize_menus() addMenu(new LLAdvancedCheckConsole(), "Advanced.CheckConsole"); addMenu(new LLAdvancedDumpInfoToConsole(), "Advanced.DumpInfoToConsole"); addMenu(new LLAdvancedReloadSettingsOverrides(), "Advanced.ReloadSettingsOverrides"); + addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit"); // Advanced > HUD Info addMenu(new LLAdvancedToggleHUDInfo(), "Advanced.ToggleHUDInfo"); diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml index f837029..5ac1620 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -884,6 +884,10 @@ userdata="QuietSnapshotsToDisk" /> + + + event, const LLSD& userdata) + { + LLAgent::togglePhantom(); + BOOL ph = LLAgent::getPhantom(); + LLChat chat; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + chat.mText = llformat("%s%s","Phantom ",(ph ? "On" : "Off")); + LLFloaterChat::addChat(chat); + //gMenuHolder->findControl(userdata["control"].asString())->setValue(ph); + return true; + } + +}; + +class LLAdvancedCheckPhantom: public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(LLAgent::getPhantom()); + return true; + } +}; + + /////////////////////// // CLEAR GROUP CACHE // /////////////////////// @@ -9599,6 +9629,8 @@ void initialize_menus() addMenu(new LLWorldSetAway(), "World.SetAway"); addMenu(new LLWorldSetBusy(), "World.SetBusy"); addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit"); + addMenu(new LLAdvancedTogglePhantom(), "Advanced.TogglePhantom"); + addMenu(new LLAdvancedCheckPhantom(), "Advanced.CheckPhantom"); addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark"); addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation"); diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 5ac1620..86b5315 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -888,6 +888,11 @@ shortcut="control|alt|s"> + + + + JCFloaterAnimList::mObjectOwners; + +JCFloaterAnimList::JCFloaterAnimList(const LLSD& seed) : + LLFloater(std::string("animation list")), + mAnimList(0) +{ + BOOL no_open = FALSE; + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_animation_list.xml",&getFactoryMap(),no_open); +} + +JCFloaterAnimList::~JCFloaterAnimList() +{ +} + +//static +bool JCFloaterAnimList::visible(LLFloater* instance, const LLSD& key) +{ + return VisibilityPolicy::visible(instance, key); +} + +//static +void JCFloaterAnimList::show(LLFloater* instance, const LLSD& key) +{ + VisibilityPolicy::show(instance, key); +} + +//static +void JCFloaterAnimList::hide(LLFloater* instance, const LLSD& key) +{ + VisibilityPolicy::hide(instance, key); +} + +void JCFloaterAnimList::onVisibilityChange(BOOL new_visibility) +{ + if(!new_visibility) { + // *HACK: clean up memory on hiding + mObjectOwners.clear(); + } +} + +BOOL JCFloaterAnimList::postBuild() +{ + mAnimList = getChild("animation_list"); + mAnimList->setCallbackUserData(this); + mAnimList->setDoubleClickCallback(onDoubleClick); + mAnimList->sortByColumn("animation_uuid", TRUE); + + childSetAction("Stop Selected",StopSelected,this); + childSetAction("Revoke Selected",RevokeSelected,this); + childSetAction("Stop+Revoke Selected",StopRevokeSelected,this); + childSetAction("Open Owner Profile",OpenProfile,this); + + return 1; +} + +void JCFloaterAnimList::StopSelected(void *userdata ) +{ + JCFloaterAnimList *self = (JCFloaterAnimList*)userdata; + LLDynamicArray ids; + std::vector< LLScrollListItem * > items = self->mAnimList->getAllSelected(); + for( std::vector< LLScrollListItem * >::iterator itr = items.begin(); itr != items.end(); itr++ ) + { + LLScrollListItem *item = *itr; + const LLUUID &id = item->getColumn(LIST_ANIMATION_UUID)->getValue().asUUID(); + if( ids.find(id) == LLDynamicArray::FAIL ) + { + ids.put(id); + } + } + gAgent.sendAnimationRequests(ids,ANIM_REQUEST_STOP); +} + +void JCFloaterAnimList::RevokeSelected(void *userdata ) +{ + JCFloaterAnimList *self = (JCFloaterAnimList*)userdata; + LLDynamicArray ids; + std::vector< LLScrollListItem * > items = self->mAnimList->getAllSelected(); + for( std::vector< LLScrollListItem * >::iterator itr = items.begin(); itr != items.end(); itr++ ) + { + LLScrollListItem *item = *itr; + const LLUUID &id = item->getColumn(LIST_OBJECT_UUID)->getValue().asUUID(); + if( ids.find(id) == LLDynamicArray::FAIL ) + { + ids.put(id); + } + } + if( !ids.empty() ) + { + for(LLDynamicArray::iterator itr = ids.begin(); itr != ids.end(); ++itr) + { + LLUUID id = *itr; + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_RevokePermissions); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Data); + msg->addUUIDFast(_PREHASH_ObjectID, id); + msg->addU32Fast(_PREHASH_ObjectPermissions, U32_MAX); + gAgent.sendReliableMessage(); + } + } +} + +void JCFloaterAnimList::StopRevokeSelected(void *userdata ) +{ + StopSelected(userdata); + RevokeSelected(userdata); +} + +void JCFloaterAnimList::OpenProfile(void *userdata ) +{ + JCFloaterAnimList *self = (JCFloaterAnimList*)userdata; + std::vector< LLScrollListItem * > items = self->mAnimList->getAllSelected(); + if(!items.empty()) + { + //LLVOAvatar* avatarp = gAgent.getAvatarObject(); + for(std::vector< LLScrollListItem * >::iterator itr = items.begin(); itr != items.end(); ++itr) + { + LLScrollListItem *item = *itr; + const LLUUID &object_id = item->getColumn(LIST_OBJECT_UUID)->getValue().asUUID(); + LLFloaterAvatarInfo::showFromDirectory(self->mObjectOwners[object_id].owner_id); + } + } +} + +/*void JCFloaterAnimList::ReturnSelected(void *userdata ) +{ + JCFloaterAnimList *self = (JCFloaterAnimList*)userdata; + LLDynamicArray ids = self->mAnimList->getSelectedIDs(); + if(ids.size() > 0) + { + LLVOAvatar* avatarp = gAgent.getAvatarObject(); + for(LLDynamicArray::iterator itr = ids.begin(); itr != ids.end(); ++itr) + { + LLUUID id = *itr; + + } + } +}*/ + +void JCFloaterAnimList::draw() +{ + refresh(); + LLFloater::draw(); +} +//LLScrollListCtrl::getSelectedIDs(); +void JCFloaterAnimList::refresh() +{ + LLDynamicArray selected = mAnimList->getSelectedIDs(); + S32 scrollpos = mAnimList->getScrollPos(); + mAnimList->deleteAllItems(); + LLVOAvatar* avatarp = gAgent.getAvatarObject(); + if (avatarp) + { + LLVOAvatar::AnimSourceIterator ai; + + for(ai = avatarp->mAnimationSources.begin(); ai != avatarp->mAnimationSources.end(); ++ai) + { + LLSD element; + const LLUUID &aifirst = ai->first; + LLViewerInventoryItem* item = gInventory.getItem(findItemID(ai->second,0)); + + // *NOTE: conceal id to prevent bugs, use + // item->getColumn(LIST_ANIMATION_UUID)->getValue().asUUID() + // instead + element["id"] = LLUUID::null.combine(ai->second); + element["columns"][LIST_ANIMATION_NAME]["column"] = "Anim Name"; + element["columns"][LIST_ANIMATION_NAME]["type"] = "text"; + element["columns"][LIST_ANIMATION_NAME]["color"] = gColors.getColor("DefaultListText").getValue(); + if(item) + { + element["columns"][LIST_ANIMATION_NAME]["value"] = item->getName();//ai->second//"avatar_icon"; + }else + { + element["columns"][LIST_ANIMATION_NAME]["value"] = "Not in Inventory"; + } + element["columns"][LIST_ANIMATION_UUID]["column"] = "Animation UUID"; + element["columns"][LIST_ANIMATION_UUID]["type"] = "text"; + element["columns"][LIST_ANIMATION_UUID]["color"] = gColors.getColor("DefaultListText").getValue(); + element["columns"][LIST_ANIMATION_UUID]["value"] = ai->second; + element["columns"][LIST_OBJECT_UUID]["column"] = "Source Object UUID"; + element["columns"][LIST_OBJECT_UUID]["type"] = "text"; + element["columns"][LIST_OBJECT_UUID]["color"] = gColors.getColor("DefaultListText").getValue(); + element["columns"][LIST_OBJECT_UUID]["value"] = aifirst; + element["columns"][LIST_OBJECT_OWNER]["column"] = "Source Owner"; + element["columns"][LIST_OBJECT_OWNER]["type"] = "text"; + element["columns"][LIST_OBJECT_OWNER]["color"] = gColors.getColor("DefaultListText").getValue(); + std::string name("?"); + LLViewerObject *object = gObjectList.findObject(aifirst); + bool is_first = ( mObjectOwners.count( aifirst ) == 0 ); + bool just_shown = false; + LLUUID owner_id(LLUUID::null); + + if( !is_first ) + { + name = mObjectOwners[aifirst].owner_name; + owner_id = mObjectOwners[aifirst].owner_id; + } + + if( object ) + { + if( object->permYouOwner() ) + { + owner_id = gAgent.getID(); + gAgent.getName(name); + } + else + { + object = (LLViewerObject *) object->getRoot(); + if( object->isAvatar() ) + { + owner_id = object->getID(); + name = ((LLVOAvatar *)object)->getFullname(); + } + } + } + + { + AObjectData &data = mObjectOwners[aifirst]; + if( object ) + { + if( !data.in_object_list ) + { + just_shown = true; + data.in_object_list = true; + } + data.root_id = ( (LLViewerObject*)object->getRoot() )->getID(); + } + data.owner_name = name; + data.owner_id = owner_id; + } + + if( is_first || just_shown ) { + if( name == "?" && !aifirst.isNull()) { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addU32Fast(_PREHASH_RequestFlags, 0 ); + if( object ) + { + LL_INFOS("Avatar List") << "Sending RequestObjectPropertiesFamily packet for id( " << aifirst.asString() << " ) on object( " << object->getID().asString() << " )" << LL_ENDL; + msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); + } + else + { + LL_INFOS("Avatar List") << "Sending RequestObjectPropertiesFamily packet for id( " << aifirst.asString() << " )" << LL_ENDL; + msg->addUUIDFast(_PREHASH_ObjectID, aifirst); + } + gAgent.sendReliableMessage(); + } + } + element["columns"][LIST_OBJECT_OWNER]["value"] = name; + mAnimList->addElement(element, ADD_BOTTOM); + //LLViewerObject* objectp = gObjectList.findObject(ai->first); + //if(objectp) + //{ + // //objectp-> + //} + + //object_ids.insert(ai->first); + //animation_ids.insert(ai->second); + } + } + + mAnimList->sortItems(); + mAnimList->selectMultiple(selected); + mAnimList->setScrollPos(scrollpos); +} + +void JCFloaterAnimList::callbackLoadOwnerName(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data) +{ + LLUUID *oid = (LLUUID*)data; + JCFloaterAnimList *self = JCFloaterAnimList::getInstance(LLSD()); + if(self->mObjectOwners.count( *oid ) > 0) + { + self->mObjectOwners[*oid].owner_name = first + " " + last; + } + delete oid; +} + +void JCFloaterAnimList::processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data) +{ + if(!JCFloaterAnimList::instanceVisible(LLSD())) return; + JCFloaterAnimList *self = JCFloaterAnimList::getInstance(LLSD()); + LLUUID object_id; + U32 request_flags; + LLUUID creator_id; + LLUUID owner_id; + LLUUID group_id; + LLUUID extra_id; + U32 base_mask, owner_mask, group_mask, everyone_mask, next_owner_mask; + LLSaleInfo sale_info; + LLCategory category; + msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_RequestFlags, request_flags ); + msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, object_id ); + msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, owner_id ); + msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID, group_id ); + msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_BaseMask, base_mask ); + msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_OwnerMask, owner_mask ); + msg->getU32Fast(_PREHASH_ObjectData,_PREHASH_GroupMask, group_mask ); + msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_EveryoneMask, everyone_mask ); + msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_NextOwnerMask, next_owner_mask); + sale_info.unpackMessage(msg, _PREHASH_ObjectData); + category.unpackMessage(msg, _PREHASH_ObjectData); + LLUUID last_owner_id; + msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id ); + std::string name; + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name); + std::string desc; + msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, desc); + + for( std::map::iterator di = self->mObjectOwners.begin(); di != self->mObjectOwners.end(); di++ ) + { + const LLUUID &id = di->first; + const AObjectData &data = di->second; + + if(data.root_id == object_id || data.owner_id == object_id) + { + LLUUID* ref = new LLUUID(id); + self->mObjectOwners[id].owner_id = owner_id; + gCacheName->get(owner_id, FALSE, callbackLoadOwnerName, (void*)ref); + } + } +} + +const LLUUID& JCFloaterAnimList::findItemID(const LLUUID& asset_id, BOOL copyable_only) +{ + LLViewerInventoryCategory::cat_array_t cats; + LLViewerInventoryItem::item_array_t items; + LLAssetIDMatches asset_id_matches(asset_id); + gInventory.collectDescendentsIf(LLUUID::null, + cats, + items, + LLInventoryModel::INCLUDE_TRASH, + asset_id_matches); + + if (items.count()) + { + // search for copyable version first + for (S32 i = 0; i < items.count(); i++) + { + LLInventoryItem* itemp = items[i]; + LLPermissions item_permissions = itemp->getPermissions(); + if (item_permissions.allowCopyBy(gAgent.getID(), gAgent.getGroupID())) + { + return itemp->getUUID(); + } + } + // otherwise just return first instance, unless copyable requested + if (copyable_only) + { + return LLUUID::null; + } + else + { + return items[0]->getUUID(); + } + } + + return LLUUID::null; +} + +/*void JCFloaterAnimList::onClickCopyAnimationUUID(void *userdata) +{ + LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata; + LLScrollListItem *item = self->mAvatarList->getFirstSelected(); + + if ( NULL == item ) return; + + LLUUID agent_id = item->getUUID(); + + char buffer[UUID_STR_LENGTH]; + agent_id.toString(buffer); + + gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); +}*/ + +void JCFloaterAnimList::onDoubleClick(void *userdata) +{ + //JCFloaterAnimList *self = (JCFloaterAnimList*)userdata; + //LLScrollListItem *item = self->mAnimList->getFirstSelected(); + //if(!item)return; + //LLUUID agent_id = item->getUUID(); + + //gAgent.setFocusObject(gObjectList.findObject(agent_id)); + //gAgent.setFocusOnAvatar(FALSE, TRUE); +} + +void JCFloaterAnimList::close(bool app) +{ + //sInstance->setVisible(0); +//#ifdef RECONSTRUCT_ON_TOGGLE +// sInstance = NULL; + LLFloater::close(app); +//#else +// sInstance->setVisible(!(sInstance->getVisible())); +//#endif +} + diff --git a/linden/indra/newview/jcfloater_animation_list.h b/linden/indra/newview/jcfloater_animation_list.h new file mode 100644 index 0000000..d8262f0 --- /dev/null +++ b/linden/indra/newview/jcfloater_animation_list.h @@ -0,0 +1,88 @@ +/* Copyright (c) 2009 + * + * Modular Systems Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. Neither the name Modular Systems Ltd nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS LTD AND CONTRIBUTORS “AS IS” + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "llfloater.h" +#include "lluuid.h" +#include "llstring.h" + +struct AObjectData +{ + std::string owner_name; + LLUUID owner_id; + LLUUID root_id; + bool in_object_list; +}; + +class JCFloaterAnimList : public LLFloater, public LLUISingleton +{ +public: + JCFloaterAnimList(const LLSD& seed); + virtual ~JCFloaterAnimList(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); + /*virtual*/ void onVisibilityChange(BOOL new_visibility); + + /*virtual*/ void close(bool app = 0); + void refresh(); + + const LLUUID& findItemID(const LLUUID& asset_id, BOOL copyable_only); + + static void callbackLoadOwnerName(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data); + + static void processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data); + + static bool visible(LLFloater* instance, const LLSD& key); + static void show(LLFloater* instance, const LLSD& key); + static void hide(LLFloater* instance, const LLSD& key); + +private: + + enum ANIMATION_COLUMN_ORDER + { + LIST_ANIMATION_NAME, + LIST_ANIMATION_UUID, + LIST_OBJECT_UUID, + LIST_OBJECT_OWNER + }; + + LLScrollListCtrl* mAnimList; + + std::map mObjectOwners; + + static void StopSelected(void *userdata ); + static void RevokeSelected(void *userdata ); + static void StopRevokeSelected(void *userdata ); + static void OpenProfile(void *userdata ); + static void onDoubleClick(void *userdata); + +}; + diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 3be857e..b937894 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -210,6 +210,8 @@ #include "lltexlayer.h" +#include "jcfloater_animation_list.h" + void init_client_menu(LLMenuGL* menu); void init_server_menu(LLMenuGL* menu); @@ -5218,6 +5220,10 @@ class LLShowFloater : public view_listener_t { LLFloaterActiveSpeakers::toggleInstance(LLSD()); } + else if (floater_name == "animation list") + { + JCFloaterAnimList::toggleInstance(LLSD()); + } else if (floater_name == "inworld browser") { LLFloaterMediaBrowser::toggle(); diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_animation_list.xml b/linden/indra/newview/skins/default/xui/en-us/floater_animation_list.xml new file mode 100644 index 0000000..be7de86 --- /dev/null +++ b/linden/indra/newview/skins/default/xui/en-us/floater_animation_list.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 86b5315..b091be2 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -893,6 +893,10 @@ + + + + buildFloater(this, "floater_asset_browser.xml"); + + mInventoryPanel = getChild("inventory panel"); + + //Open all folders and close them in order to make item list up-to-date + //if(gInventory.getItemCount()==0) + mInventoryPanel->openAllFolders(); + + //gInventory.startBackgroundFetch(gInventory.findCategoryUUIDForType(LLAssetType::AT_TEXTURE)); + + + childSetAction("button next", onClickNext, this); + childSetAction("button previous", onClickPrevious, this); + childSetAction("button refresh", onClickRefresh, this); + + initialize(); + createThumbnails(); + mInventoryPanel->closeAllFolders(); +} + +// static +void LLFloaterAssetBrowser::show(void*) +{ + if (!sInstance) + sInstance = new LLFloaterAssetBrowser(); + + sInstance->open(); +} + +// virtual +LLFloaterAssetBrowser::~LLFloaterAssetBrowser() +{ + clearAssetInfoTexts(); + mTextureAssets.clear(); + mMaxIndex = 0; + mFirstIndex = 0; + mMouseOverIndex = 0; + mMouseOverUUID = LLUUID::null; + mMouseOverAssetUUID = LLUUID::null; + mFloaterTitle = ""; + clearNoAssetsText(); + sInstance=NULL; +} + +void LLFloaterAssetBrowser::initialize() +{ + mMaxIndex = ITEMS_PER_PAGE; + mFirstIndex = 0; + mAssetInfoLabelList.clear(); + mAssetInfoIndex = 0; + mFloaterHeight = getRect().getHeight(); + mFloaterWidth = getRect().getWidth(); + mMouseOverIndex = 0; + mMouseOverUUID = LLUUID::null; + mMouseOverAssetUUID = LLUUID::null; + mFloaterTitle = ""; + + S32 image_top = getRect().getHeight(); + S32 image_bottom = BTN_HEIGHT_SMALL; + S32 image_middle = (image_top + image_bottom) / 2; + S32 line_height = llround(LLFontGL::sSansSerifSmall->getLineHeight()); + + mNoAssetsLabel = new LLTextBox("mNoAssetsLabel.", + LLRect(getRect().getWidth()/2, + image_middle + line_height / 2, + getRect().getWidth(), + image_middle - line_height / 2 ), + "No assets found.", + LLFontGL::sSansSerifSmall ); + mNoAssetsLabel->setFollowsAll(); + addChild(mNoAssetsLabel); + mNoAssetsLabel->setVisible(FALSE); +} + +void LLFloaterAssetBrowser::createThumbnails() +{ + LLViewerInventoryCategory::cat_array_t cats; + LLViewerInventoryItem::item_array_t items; + LLIsType isType(LLAssetType::AT_TEXTURE); + + gInventory.collectDescendentsIf(LLUUID::null, + cats, + items, + LLInventoryModel::INCLUDE_TRASH, + isType); + + //Get UUID, asset UUID and name + for(S32 i = 0; i < items.count(); i++) + { + LLInventoryItem* itemp = items[i]; + LLAssetSelection temp; + temp.mAssetUUID = itemp->getAssetUUID(); + temp.mUUID = itemp->getUUID(); + temp.mName = itemp->getName(); + temp.mTexturep = NULL; + temp.mAssetRect = LLRect::null; + mTextureAssets.push_back(temp); + } + + //Get Texturep + for(S32 i = 0; i < items.count(); i++) + { + mTextureAssets[i].mTexturep = gImageList.getImage(mTextureAssets[i].mAssetUUID, MIPMAP_YES, IMMEDIATE_NO); + mTextureAssets[i].mTexturep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); + //mTextureAssets[i].mTexturep->processTextureStats(); + } + + //Generate the asset info text + /*for(S32 i = 0; i < items.count(); i++) + { + LLString asset_info; + LLString dimensions; + + asset_info.append(mTextureAssets[i].mName); + + //if(mTextureAssets[i].mTexturep->mFullWidth == 0 + //|| mTextureAssets[i].mTexturep->mFullHeight == 0) + + dimensions = llformat("\n%d x %d", + mTextureAssets[i].mTexturep->mFullWidth, + mTextureAssets[i].mTexturep->mFullHeight); + asset_info.append(dimensions); + + mTextureAssets[i].mAssetInfo = asset_info; + }*/ + + mFloaterTitle = llformat("Asset Browser (%d assets fetched)", mTextureAssets.size()); + setTitle(mFloaterTitle); +} + +// virtual +BOOL LLFloaterAssetBrowser::handleHover(S32 x, S32 y, MASK mask) +{ + if(mTextureAssets.size() > 0) + { + for(U32 i = mFirstIndex; i < mMaxIndex; i++) + { + if(i < mTextureAssets.size()) + { + if(mTextureAssets[i].mAssetRect.pointInRect(x,y)) + { + mMouseOverUUID = mTextureAssets[i].mUUID; + mMouseOverIndex = i; + + if(hasMouseCapture()) + { + S32 screen_x; + S32 screen_y; + LLUUID mObjectUUID= LLUUID::null; + const LLViewerInventoryItem *item = gInventory.getItem(mMouseOverUUID); + + localPointToScreen(x, y, &screen_x, &screen_y ); + + if(item && item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) + && LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y)) + { + EDragAndDropType type; + type = LLAssetType::lookupDragAndDropType(item->getType()); + LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_LIBRARY; + + if(!mObjectUUID.isNull()) + { + src = LLToolDragAndDrop::SOURCE_WORLD; + } + else if(item->getPermissions().getOwner() == gAgent.getID()) + { + src = LLToolDragAndDrop::SOURCE_AGENT; + } + LLToolDragAndDrop::getInstance()->beginDrag(type, + item->getUUID(), + src, + mObjectUUID); + return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask); + } + return TRUE; + } + return LLFloater::handleHover(x, y, mask); + } + } + } + return LLFloater::handleHover(x, y, mask); + } + else + { + mMouseOverUUID = LLUUID::null; + return LLFloater::handleHover(x, y, mask); + } +} + +// virtual +BOOL LLFloaterAssetBrowser::handleMouseDown(S32 x, S32 y, MASK mask) +{ + if(mTextureAssets.size() > 0) + { + if(mTextureAssets[mMouseOverIndex].mAssetRect.pointInRect(x,y)) + { + if(mMouseOverUUID.notNull()) + { + gFocusMgr.setMouseCapture(this); + S32 screen_x; + S32 screen_y; + localPointToScreen(x, y, &screen_x, &screen_y); + LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y); + return TRUE; + } + } + } + return LLFloater::handleMouseDown(x, y, mask); +} + +// virtual +BOOL LLFloaterAssetBrowser::handleMouseUp(S32 x, S32 y, MASK mask) +{ + if(hasMouseCapture()) + { + gFocusMgr.setMouseCapture(NULL); + return TRUE; + } + return LLFloater::handleMouseUp(x, y, mask); +} + +// virtual +BOOL LLFloaterAssetBrowser::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + if(mTextureAssets.size() > 0) + { + if(mTextureAssets[mMouseOverIndex].mAssetRect.pointInRect(x,y)) + { + if(mMouseOverUUID.notNull()) + { + open_texture(mMouseOverUUID, mTextureAssets[mMouseOverIndex].mName, FALSE); + return TRUE; + } + } + } + return LLFloater::handleDoubleClick(x, y, mask); +} + +// virtual +void LLFloaterAssetBrowser::draw() +{ + LLFloater::draw(); + + if(mTextureAssets.size() > 0) + { + S32 hor_pos = 0; + S32 ver_pos = 0; + U32 items_per_row = 0; + S32 height = getRect().getHeight()/8; + S32 width = height; + + for(U32 i = mFirstIndex; i < mMaxIndex; i++) + { + if(i < mTextureAssets.size()) + { + mTexturep = NULL; + mImageAssetID = mTextureAssets[i].mAssetUUID; + + if(mImageAssetID.notNull()) + { + mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO); + //mTexturep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); + mTexturep->processTextureStats(); + mTextureAssets[i].mWidth = mTexturep->mFullWidth; + mTextureAssets[i].mHeight = mTexturep->mFullHeight; + } + + if(isMinimized()) + { + return; + } + + //Border + LLRect border; + border.mLeft = START_POS + ver_pos; + border.mTop = getRect().getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD - hor_pos; + border.mRight = border.mLeft + width; + border.mBottom = border.mTop - height; + + //Save the rect for each thumbnail + mTextureAssets[i].mAssetRect = border; + + //Asset info rect + LLRect info_rect; + info_rect.mLeft = border.mLeft; + info_rect.mTop = border.mBottom - 3; + info_rect.mRight = border.mLeft + 130; + info_rect.mBottom = border.mBottom - 2*llround(LLFontGL::sSansSerifSmall->getLineHeight()); + + gl_rect_2d(border, LLColor4::black, FALSE); + + // Interior + LLRect interior = border; + interior.stretch(1); + + //Draw the image + if(mTexturep) + { + if(mTexturep->getComponents() == 4) + { + gl_rect_2d_checkerboard(interior); + } + + gl_draw_scaled_image(interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep); + // Pump the priority + mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight())); + + //Generate the asset info text + std::string asset_info; + asset_info.append(mTextureAssets[i].mName); + std::string dimensions = llformat("\n%d x %d", + mTexturep->mFullWidth /*mTextureAssets[i].mWidth*/, + mTexturep->mFullHeight /* mTextureAssets[i].mHeight*/); + asset_info.append(dimensions); + + // Draw material info below the asset + // LLTextBox object has to be drawn only once, not non-stop like image + if(mAssetInfoIndex < ITEMS_PER_PAGE && + mAssetInfoIndex < mTextureAssets.size() - mFirstIndex) + { + mAssetInfoLabel = new LLTextBox("Asset Info"/*mTextureAssets[i].mAssetInfo*/, + info_rect, + asset_info, + LLFontGL::sSansSerifSmall); + mAssetInfoLabel->setFollowsAll(); + mAssetInfoLabelList.push_back(mAssetInfoLabel); + addChild(mAssetInfoLabelList[mAssetInfoIndex]); + mAssetInfoLabelList[mAssetInfoIndex]->setVisible(TRUE); + mAssetInfoIndex++; + } + + } + else + { + // Draw X + gl_rect_2d(interior, LLColor4::grey, TRUE); + gl_draw_x(interior, LLColor4::black); + } + //Move to the right + ver_pos += getRect().getWidth()/6; + items_per_row++; + + //Change the row + if(items_per_row % 4 == 0) + { + ver_pos = 0; + hor_pos += getRect().getHeight()/4; + } + } + }//for + + //If the size of the floater has changed, clear the asset info texts + //in order to draw them again into the new position + if(getRect().getWidth() != mFloaterWidth || getRect().getHeight() != mFloaterHeight) + { + clearAssetInfoTexts(); + //Save the size of the current floater + mFloaterWidth = getRect().getWidth(); + mFloaterHeight = getRect().getHeight(); + } + if(mMaxIndex >= mTextureAssets.size()) + { + childDisable("button next"); + childEnable("button previous"); + } + else if(mFirstIndex <= 0) + { + childEnable("button next"); + childDisable("button previous"); + } + else + { + childEnable("button next"); + childEnable("button previous"); + } + } + else + { + //No assets found + mNoAssetsLabel->setVisible(TRUE); + childDisable("button next"); + childDisable("button previous"); + } +} + +void LLFloaterAssetBrowser::clearAssetInfoTexts() +{ + for(U32 i = 0; i < mAssetInfoLabelList.size(); i++) + { + delete mAssetInfoLabelList[i]; + mAssetInfoLabelList[i] = NULL; + } + mAssetInfoLabelList.clear(); + mAssetInfoIndex = 0; +} + +void LLFloaterAssetBrowser::clearNoAssetsText() +{ + if(mTextureAssets.size() > 0) + { + delete mNoAssetsLabel; + mNoAssetsLabel = NULL; + } +} + +// static +void LLFloaterAssetBrowser::onClickNext(void *userdata) +{ + LLFloaterAssetBrowser* self = (LLFloaterAssetBrowser*)userdata; + self->mFirstIndex = self->mMaxIndex; + self->mMaxIndex = self->mFirstIndex + ITEMS_PER_PAGE; + self->clearAssetInfoTexts(); +} + +// static +void LLFloaterAssetBrowser::onClickPrevious(void *userdata) +{ + LLFloaterAssetBrowser* self = (LLFloaterAssetBrowser*)userdata; + self->mFirstIndex = self->mMaxIndex - (2 * ITEMS_PER_PAGE); + self->mMaxIndex = self->mMaxIndex - ITEMS_PER_PAGE; + self->clearAssetInfoTexts(); +} + +// static +void LLFloaterAssetBrowser::onClickRefresh(void *userdata) +{ + LLFloaterAssetBrowser* self = (LLFloaterAssetBrowser*)userdata; + for(U32 i = 0; i < self->mTextureAssets.size(); i++) + { + self->mTextureAssets[i].mTexturep = NULL; + } + + self->mTextureAssets.clear(); + self->createThumbnails(); + self->clearNoAssetsText(); + self->clearAssetInfoTexts(); +} diff --git a/linden/indra/newview/llfloaterassetbrowser.h b/linden/indra/newview/llfloaterassetbrowser.h new file mode 100644 index 0000000..76eb3ba --- /dev/null +++ b/linden/indra/newview/llfloaterassetbrowser.h @@ -0,0 +1,84 @@ +/** + * @file llfloaterassetbrowser.h + * @brief LLFloaterAssetBrowser class implementation + * Phox wuz hurr + */ + +#ifndef LL_LLFLOATERASSETBROWSERVIEW_H +#define LL_LLFLOATERASSETBROWSERVIEW_H + +#include "llfloater.h" +#include "llinventorymodel.h" +#include "llview.h" +#include "llviewerimage.h" + +class LLInventoryPanel; + +struct LLAssetSelection +{ + LLUUID mUUID; + LLUUID mAssetUUID; + std::string mName; + std::string mAssetInfo; + S32 mWidth; + S32 mHeight; + LLTextBox* mAssetInfoTextBox; + LLPointer mTexturep; + LLRect mAssetRect; +}; + +class LLFloaterAssetBrowser : public LLFloater +{ +public: + LLFloaterAssetBrowser(); + + virtual ~LLFloaterAssetBrowser(); + + static void show(void*); + + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual void draw(); + + static LLFloaterAssetBrowser* getInstance(){ return sInstance; } + +private: + void initialize(); + void createThumbnails(); + void clearAssetInfoTexts(); + void clearNoAssetsText(); + + static void onClickNext(void *userdata); + static void onClickPrevious(void *userdata); + static void onClickRefresh(void *userdata); + + static LLFloaterAssetBrowser* sInstance; + +protected: + LLInventoryPanel* mInventoryPanel; + LLUUID mImageAssetID; + LLUUID mMouseOverUUID; + LLUUID mMouseOverAssetUUID; + LLPointer mTexturep; + std::vector mTextureAssets; + std::vector mAssetInfoLabelList; + U32 mLastIndex; + U32 mMaxIndex; + U32 mFirstIndex; + U32 mAssetInfoIndex; + S32 mFloaterHeight; + S32 mFloaterWidth; + S32 mMouseOverIndex; + LLTextBox* mNoAssetsLabel; + LLTextBox* mAssetInfoLabel; + std::string mFloaterTitle; +}; + +static const S32 HPAD = 4; +static const S32 BORDER_PAD = HPAD; +static const U32 ITEMS_PER_PAGE = 16; +static const S32 START_POS = 250; + +#endif diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index b937894..4c91a0a 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -211,6 +211,7 @@ #include "lltexlayer.h" #include "jcfloater_animation_list.h" +#include "llfloaterassetbrowser.h" void init_client_menu(LLMenuGL* menu); void init_server_menu(LLMenuGL* menu); @@ -7619,6 +7620,41 @@ class LLAdvancedCheckPhantom: public view_listener_t }; +/////////////////// +// ASSET BROWSER // +/////////////////// + +class LLAdvancedToggleAssetBrowser: public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + //open the floater + LLFloaterAssetBrowser::show(0); + + bool vis = false; + if(LLFloaterAssetBrowser::getInstance()) + { + vis = (bool)LLFloaterAssetBrowser::getInstance()->getVisible(); + } + return true; + } +}; + +class LLAdvancedCheckAssetBrowser: public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + bool vis = false; + if(LLFloaterAssetBrowser::getInstance()) + { + vis = (bool)LLFloaterAssetBrowser::getInstance()->getVisible(); + } + gMenuHolder->findControl(userdata["control"].asString())->setValue(vis); + return true; + } +}; + + /////////////////////// // CLEAR GROUP CACHE // /////////////////////// @@ -9634,9 +9670,6 @@ void initialize_menus() addMenu(new LLWorldTeleportHome(), "World.TeleportHome"); addMenu(new LLWorldSetAway(), "World.SetAway"); addMenu(new LLWorldSetBusy(), "World.SetBusy"); - addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit"); - addMenu(new LLAdvancedTogglePhantom(), "Advanced.TogglePhantom"); - addMenu(new LLAdvancedCheckPhantom(), "Advanced.CheckPhantom"); addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark"); addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation"); @@ -9786,6 +9819,10 @@ void initialize_menus() addMenu(new LLAdvancedDumpInfoToConsole(), "Advanced.DumpInfoToConsole"); addMenu(new LLAdvancedReloadSettingsOverrides(), "Advanced.ReloadSettingsOverrides"); addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit"); + addMenu(new LLAdvancedTogglePhantom(), "Advanced.TogglePhantom"); + addMenu(new LLAdvancedCheckPhantom(), "Advanced.CheckPhantom"); + addMenu(new LLAdvancedToggleAssetBrowser(),"Advanced.ToggleAssetBrowser"); + addMenu(new LLAdvancedCheckAssetBrowser(),"Advanced.CheckAssetBrowser"); // Advanced > HUD Info addMenu(new LLAdvancedToggleHUDInfo(), "Advanced.ToggleHUDInfo"); diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_asset_browser.xml b/linden/indra/newview/skins/default/xui/en-us/floater_asset_browser.xml new file mode 100644 index 0000000..13c6b6c --- /dev/null +++ b/linden/indra/newview/skins/default/xui/en-us/floater_asset_browser.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml index b091be2..5407061 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -897,6 +897,11 @@ + + + + LLScrollListCtrl::getAllSelected() const return ret; } +LLDynamicArray LLScrollListCtrl::getSelectedIDs() +{ + LLUUID selected_id; + LLDynamicArray ids; + std::vector selected = this->getAllSelected(); + for(std::vector::iterator itr = selected.begin(); itr != selected.end(); ++itr) + { + ids.push_back((*itr)->getUUID()); + } + return ids; +} + S32 LLScrollListCtrl::getFirstSelectedIndex() const { S32 CurSelectedIndex = 0; diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h index f276562..73f9a5b 100644 --- a/linden/indra/llui/llscrolllistctrl.h +++ b/linden/indra/llui/llscrolllistctrl.h @@ -517,6 +517,7 @@ public: LLScrollListItem* getFirstSelected() const; virtual S32 getFirstSelectedIndex() const; std::vector getAllSelected() const; + LLDynamicArray getSelectedIDs(); LLScrollListItem* getLastSelectedItem() const { return mLastSelected; } // iterate over all items -- cgit v1.1 From 3706bf4d5219ba607176f0465a805f29a1367ea6 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 6 Sep 2009 23:54:28 -0700 Subject: Fixed reference to missing colors.xml entry --- linden/indra/newview/jcfloater_animation_list.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/jcfloater_animation_list.cpp b/linden/indra/newview/jcfloater_animation_list.cpp index d913292..9f5c9bb 100644 --- a/linden/indra/newview/jcfloater_animation_list.cpp +++ b/linden/indra/newview/jcfloater_animation_list.cpp @@ -226,7 +226,7 @@ void JCFloaterAnimList::refresh() element["id"] = LLUUID::null.combine(ai->second); element["columns"][LIST_ANIMATION_NAME]["column"] = "Anim Name"; element["columns"][LIST_ANIMATION_NAME]["type"] = "text"; - element["columns"][LIST_ANIMATION_NAME]["color"] = gColors.getColor("DefaultListText").getValue(); + element["columns"][LIST_ANIMATION_NAME]["color"] = gColors.getColor("ScrollUnselectedColor").getValue(); if(item) { element["columns"][LIST_ANIMATION_NAME]["value"] = item->getName();//ai->second//"avatar_icon"; @@ -236,15 +236,15 @@ void JCFloaterAnimList::refresh() } element["columns"][LIST_ANIMATION_UUID]["column"] = "Animation UUID"; element["columns"][LIST_ANIMATION_UUID]["type"] = "text"; - element["columns"][LIST_ANIMATION_UUID]["color"] = gColors.getColor("DefaultListText").getValue(); + element["columns"][LIST_ANIMATION_UUID]["color"] = gColors.getColor("ScrollUnselectedColor").getValue(); element["columns"][LIST_ANIMATION_UUID]["value"] = ai->second; element["columns"][LIST_OBJECT_UUID]["column"] = "Source Object UUID"; element["columns"][LIST_OBJECT_UUID]["type"] = "text"; - element["columns"][LIST_OBJECT_UUID]["color"] = gColors.getColor("DefaultListText").getValue(); + element["columns"][LIST_OBJECT_UUID]["color"] = gColors.getColor("ScrollUnselectedColor").getValue(); element["columns"][LIST_OBJECT_UUID]["value"] = aifirst; element["columns"][LIST_OBJECT_OWNER]["column"] = "Source Owner"; element["columns"][LIST_OBJECT_OWNER]["type"] = "text"; - element["columns"][LIST_OBJECT_OWNER]["color"] = gColors.getColor("DefaultListText").getValue(); + element["columns"][LIST_OBJECT_OWNER]["color"] = gColors.getColor("ScrollUnselectedColor").getValue(); std::string name("?"); LLViewerObject *object = gObjectList.findObject(aifirst); bool is_first = ( mObjectOwners.count( aifirst ) == 0 ); -- cgit v1.1 From 056f41c8542e60ea57af83bd18caa01db44a15c5 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 7 Sep 2009 00:43:37 -0700 Subject: Fixed ground sit menu entry missing check --- linden/indra/newview/llviewermenu.cpp | 17 +++++++++++++++++ .../newview/skins/default/xui/en-us/menu_viewer.xml | 1 + 2 files changed, 18 insertions(+) (limited to 'linden') diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 4c91a0a..cfc9a14 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -7589,6 +7589,22 @@ class LLAdvancedToggleSit: public view_listener_t } }; +class LLAdvancedCheckSit : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + if(gAgent.getAvatarObject()->mIsSitting) + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(true); + } + else + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(false); + } + return true; + } +}; + ///////////// // PHANTOM // @@ -9819,6 +9835,7 @@ void initialize_menus() addMenu(new LLAdvancedDumpInfoToConsole(), "Advanced.DumpInfoToConsole"); addMenu(new LLAdvancedReloadSettingsOverrides(), "Advanced.ReloadSettingsOverrides"); addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit"); + addMenu(new LLAdvancedCheckSit(), "Emerald.CheckSit"); addMenu(new LLAdvancedTogglePhantom(), "Advanced.TogglePhantom"); addMenu(new LLAdvancedCheckPhantom(), "Advanced.CheckPhantom"); addMenu(new LLAdvancedToggleAssetBrowser(),"Advanced.ToggleAssetBrowser"); diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 5407061..a53e339 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -887,6 +887,7 @@ + -- cgit v1.1 From 72a0fb0963885ee0793854d84e79f272bd4f4f5f Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 7 Sep 2009 17:01:47 -0700 Subject: Fixed tool brush size --- linden/indra/newview/app_settings/settings.xml | 2 +- linden/indra/newview/llfloatertools.cpp | 2 +- linden/indra/newview/lltoolbrush.cpp | 45 +++++++++++++++++++------- linden/indra/newview/lltoolbrush.h | 5 ++- linden/scripts/messages/message_template.msg | 10 ++++-- 5 files changed, 46 insertions(+), 18 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index a080be2..a6a18e6 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -5791,7 +5791,7 @@ Persist 1 Type - S32 + F32 Value 0 diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp index f3ffbe4..b63138f 100644 --- a/linden/indra/newview/llfloatertools.cpp +++ b/linden/indra/newview/llfloatertools.cpp @@ -322,7 +322,7 @@ BOOL LLFloaterTools::postBuild() mSliderDozerSize = getChild("slider brush size"); childSetCommitCallback("slider brush size", commit_slider_dozer_size, (void*)0); - childSetValue( "slider brush size", gSavedSettings.getS32("LandBrushSize")); + childSetValue( "slider brush size", gSavedSettings.getF32("LandBrushSize")); mSliderDozerForce = getChild("slider force"); diff --git a/linden/indra/newview/lltoolbrush.cpp b/linden/indra/newview/lltoolbrush.cpp index 46b36d9..d23e29d 100644 --- a/linden/indra/newview/lltoolbrush.cpp +++ b/linden/indra/newview/lltoolbrush.cpp @@ -96,7 +96,24 @@ LLToolBrushLand::LLToolBrushLand() mGotHover(FALSE), mBrushSelected(FALSE) { - mBrushIndex = gSavedSettings.getS32("LandBrushSize"); + mBrushSize = gSavedSettings.getF32("LandBrushSize"); +} + + +U8 LLToolBrushLand::getBrushIndex() +{ + // find the best index for desired size + // (compatibility with old sims, brush_index is now depricated - DEV-8252) + U8 index = 0; + for (U8 i = 0; i < LAND_BRUSH_SIZE_COUNT; i++) + { + if (mBrushSize > LAND_BRUSH_SIZE[i]) + { + index = i; + } + } + + return index; } void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, @@ -157,7 +174,6 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce"); F32 x_pos = (F32)pos_region.mV[VX]; F32 y_pos = (F32)pos_region.mV[VY]; - U8 brush_size = (U8)mBrushIndex; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ModifyLand); msg->nextBlockFast(_PREHASH_AgentData); @@ -165,7 +181,7 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ModifyBlock); msg->addU8Fast(_PREHASH_Action, (U8)action); - msg->addU8Fast(_PREHASH_BrushSize, brush_size); + msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex()); msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); msg->nextBlockFast(_PREHASH_ParcelData); @@ -174,6 +190,8 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, msg->addF32Fast(_PREHASH_South, y_pos ); msg->addF32Fast(_PREHASH_East, x_pos ); msg->addF32Fast(_PREHASH_North, y_pos ); + msg->nextBlock("ModifyBlockExtended"); + msg->addF32("BrushSize", mBrushSize); msg->sendMessage(regionp->getHost()); } } @@ -294,7 +312,6 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() regionp->forceUpdate(); // tell the simulator what we've done - U8 brush_size = (U8)mBrushIndex; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ModifyLand); msg->nextBlockFast(_PREHASH_AgentData); @@ -302,7 +319,7 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ModifyBlock); msg->addU8Fast(_PREHASH_Action, (U8)action); - msg->addU8Fast(_PREHASH_BrushSize, brush_size); + msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex()); msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); @@ -327,6 +344,9 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() msg->addF32Fast(_PREHASH_East, max_region.mV[VX] ); msg->addF32Fast(_PREHASH_North, max_region.mV[VY] ); } + + msg->nextBlock("ModifyBlockExtended"); + msg->addF32("BrushSize", mBrushSize); msg->sendMessage(regionp->getHost()); } @@ -447,7 +467,8 @@ void LLToolBrushLand::render() spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 ); spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 ); - mBrushIndex = gSavedSettings.getS32("LandBrushSize"); + mBrushSize = gSavedSettings.getF32("LandBrushSize"); + region_list_t regions; determineAffectedRegions(regions, spot); @@ -499,7 +520,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region S32 i = (S32) pos_region.mV[VX]; S32 j = (S32) pos_region.mV[VY]; - S32 half_edge = llfloor(LAND_BRUSH_SIZE[mBrushIndex]); + S32 half_edge = llfloor(mBrushSize); S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); F32 force = gSavedSettings.getF32("LandBrushForce"); // .1 to 100? @@ -556,27 +577,27 @@ void LLToolBrushLand::determineAffectedRegions(region_list_t& regions, const LLVector3d& spot ) const { LLVector3d corner(spot); - corner.mdV[VX] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2); - corner.mdV[VY] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2); + corner.mdV[VX] -= (mBrushSize / 2); + corner.mdV[VY] -= (mBrushSize / 2); LLViewerRegion* region = NULL; region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); } - corner.mdV[VY] += LAND_BRUSH_SIZE[mBrushIndex]; + corner.mdV[VY] += mBrushSize; region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); } - corner.mdV[VX] += LAND_BRUSH_SIZE[mBrushIndex]; + corner.mdV[VX] += mBrushSize; region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); } - corner.mdV[VY] -= LAND_BRUSH_SIZE[mBrushIndex]; + corner.mdV[VY] -= mBrushSize; region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { diff --git a/linden/indra/newview/lltoolbrush.h b/linden/indra/newview/lltoolbrush.h index 8df4b67..f25d6b9 100644 --- a/linden/indra/newview/lltoolbrush.h +++ b/linden/indra/newview/lltoolbrush.h @@ -95,11 +95,14 @@ protected: F32 mStartingZ; S32 mMouseX; S32 mMouseY; - S32 mBrushIndex; + F32 mBrushSize; BOOL mGotHover; BOOL mBrushSelected; // Order doesn't matter and we do check for existance of regions, so use a set region_list_t mLastAffectedRegions; + +private: + U8 getBrushIndex(); }; diff --git a/linden/scripts/messages/message_template.msg b/linden/scripts/messages/message_template.msg index 6d90622..4a16cf8 100644 --- a/linden/scripts/messages/message_template.msg +++ b/linden/scripts/messages/message_template.msg @@ -594,7 +594,7 @@ version 2.0 // global x,y,z. Otherwise, use center of the AABB. // reliable { - PlacesReply Low 30 Trusted Zerocoded + PlacesReply Low 30 Trusted Zerocoded UDPDeprecated { AgentData Single { AgentID LLUUID } @@ -1036,7 +1036,7 @@ version 2.0 // dataserver -> simulator -> viewer // reliable { - DirLandReply Low 50 Trusted Zerocoded + DirLandReply Low 50 Trusted Zerocoded UDPDeprecated { AgentData Single { AgentID LLUUID } @@ -2589,6 +2589,10 @@ version 2.0 { East F32 } { North F32 } } + { + ModifyBlockExtended Variable + { BrushSize F32 } + } } @@ -8717,7 +8721,7 @@ version 2.0 // spaceserver -> simulator { - RpcScriptRequestInboundForward Low 416 Trusted Unencoded + RpcScriptRequestInboundForward Low 416 Trusted Unencoded UDPDeprecated { DataBlock Single { RPCServerIP IPADDR } -- cgit v1.1 From d6973dce3fd453599eccf5519c30672124d622d7 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 7 Sep 2009 18:09:25 -0700 Subject: Applied and tweaked last owner in tools window from Emerald viewer --- linden/indra/newview/llpanelpermissions.cpp | 65 +++++++++++----------- linden/indra/newview/llpanelpermissions.h | 1 + .../skins/default/xui/en-us/floater_tools.xml | 24 ++++++-- 3 files changed, 54 insertions(+), 36 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llpanelpermissions.cpp b/linden/indra/newview/llpanelpermissions.cpp index c430922..439d8b4 100644 --- a/linden/indra/newview/llpanelpermissions.cpp +++ b/linden/indra/newview/llpanelpermissions.cpp @@ -84,6 +84,7 @@ BOOL LLPanelPermissions::postBuild() this->childSetAction("button owner profile",LLPanelPermissions::onClickOwner,this); + this->childSetAction("button last owner profile",LLPanelPermissions::onClickLastOwner,this); this->childSetAction("button creator profile",LLPanelPermissions::onClickCreator,this); this->childSetAction("button set group",LLPanelPermissions::onClickGroup,this); @@ -177,6 +178,11 @@ void LLPanelPermissions::refresh() childSetEnabled("Owner Name",false); childSetEnabled("button owner profile",false); + childSetEnabled("Last Owner:",false); + childSetText("Last Owner Name",LLStringUtil::null); + childSetEnabled("Last Owner Name",false); + childSetEnabled("button last owner profile",false); + childSetEnabled("Group:",false); childSetText("Group Name",LLStringUtil::null); childSetEnabled("Group Name",false); @@ -190,9 +196,6 @@ void LLPanelPermissions::refresh() childSetEnabled("Description:",false); childSetText("Object Description",LLStringUtil::null); childSetEnabled("Object Description",false); - - childSetText("prim info",LLStringUtil::null); - childSetEnabled("prim info",false); childSetEnabled("Permissions:",false); @@ -299,6 +302,8 @@ void LLPanelPermissions::refresh() owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); // llinfos << "owners_identical " << (owners_identical ? "TRUE": "FALSE") << llendl; + std::string last_owner_name; + LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); if (mOwnerID.isNull()) { @@ -309,8 +314,8 @@ void LLPanelPermissions::refresh() else { // Display last owner if public - std::string last_owner_name; - LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); + //std::string last_owner_name; + //LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); // It should never happen that the last owner is null and the owner // is null, but it seems to be a bug in the simulator right now. JC @@ -326,6 +331,19 @@ void LLPanelPermissions::refresh() childSetEnabled("Owner Name",TRUE); childSetEnabled("button owner profile",owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); + if (owner_name != last_owner_name) + { + childSetText("Last Owner Name", last_owner_name); + childSetEnabled("Last Owner Name", TRUE); + childSetEnabled("button last owner profile", TRUE); + } + else + { + childSetText("Last Owner Name", LLStringUtil::null); + childSetEnabled("Last Owner Name", FALSE); + childSetEnabled("button last owner profile", FALSE); + } + // update group text field childSetEnabled("Group:",true); childSetText("Group Name",LLStringUtil::null); @@ -388,33 +406,6 @@ void LLPanelPermissions::refresh() childSetEnabled("Object Description",false); } - - // Pre-compute object info string - S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - S32 obj_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); - - std::string object_info_string; - if (1 == obj_count) - { - object_info_string.assign("1 Object, "); - } - else - { - object_info_string = llformat( "%d Objects, ", obj_count); - } - if (1 == prim_count) - { - object_info_string.append("1 Primitive"); - } - else - { - std::string buffer; - buffer = llformat( "%d Primitives", prim_count); - object_info_string.append(buffer); - } - childSetText("prim info",object_info_string); - childSetEnabled("prim info",true); - S32 total_sale_price = 0; S32 individual_sale_price = 0; BOOL is_for_sale_mixed = FALSE; @@ -865,6 +856,16 @@ void LLPanelPermissions::onClickOwner(void *data) } } +void LLPanelPermissions::onClickLastOwner(void *data) +{ + LLPanelPermissions *self = (LLPanelPermissions *)data; + + if ( self->mLastOwnerID.notNull() ) + { + LLFloaterAvatarInfo::showFromObject(self->mLastOwnerID); + } +} + void LLPanelPermissions::onClickGroup(void* data) { LLPanelPermissions* panelp = (LLPanelPermissions*)data; diff --git a/linden/indra/newview/llpanelpermissions.h b/linden/indra/newview/llpanelpermissions.h index 3b73254..57339ed 100644 --- a/linden/indra/newview/llpanelpermissions.h +++ b/linden/indra/newview/llpanelpermissions.h @@ -68,6 +68,7 @@ protected: static void onClickRelease(void*); static void onClickCreator(void*); static void onClickOwner(void*); + static void onClickLastOwner(void*); static void onClickGroup(void*); static void cbGroupID(LLUUID group_id, void* userdata); static void onClickDeedToGroup(void*); diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml index d9b51b1..411eec3 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -386,20 +386,36 @@ height="20" label="Profile..." label_selected="Profile..." left_delta="94" mouse_opaque="true" name="button owner profile" scale_image="TRUE" width="78" /> + + Last Owner: + + + Thrax Linden + + Group: The Lindens - Deed - Value 0.5 + ChatChannelSelect + + Comment + Toggle custom channel controls in the chat bar + Persist + 1 + Type + Boolean + Value + 0 + ChatFontSize Comment diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp index 59aa572..0178420 100644 --- a/linden/indra/newview/llchatbar.cpp +++ b/linden/indra/newview/llchatbar.cpp @@ -53,6 +53,7 @@ #include "llkeyboard.h" #include "lllineeditor.h" #include "llstatusbar.h" +#include "llspinctrl.h" #include "lltextbox.h" #include "lluiconstants.h" #include "llviewergesture.h" // for triggering gestures @@ -98,6 +99,7 @@ private: LLChatBar::LLChatBar() : LLPanel(LLStringUtil::null, LLRect(), BORDER_NO), + mChannelControl(FALSE), mInputEditor(NULL), mGestureLabelTimer(), mLastSpecialChatChannel(0), @@ -151,6 +153,8 @@ BOOL LLChatBar::postBuild() mInputEditor->setEnableLineHistory(TRUE); } + toggleChannelControl(); + mIsBuilt = TRUE; return TRUE; @@ -210,6 +214,7 @@ void LLChatBar::refresh() childSetValue("History", LLFloaterChat::instanceVisible(LLSD())); + childSetValue("channel_control",( 1.f * ((S32)(getChild("channel_control")->get()))) ); childSetEnabled("Say", mInputEditor->getText().size() > 0); childSetEnabled("Shout", mInputEditor->getText().size() > 0); @@ -370,8 +375,11 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) } else { - // This is normal chat. - *channel = 0; + if (!mChannelControl) + { + // This is normal chat. + *channel = 0; + } return mesg; } } @@ -387,7 +395,8 @@ void LLChatBar::sendChat( EChatType type ) // store sent line in history, duplicates will get filtered if (mInputEditor) mInputEditor->updateHistory(); // Check if this is destined for another channel - S32 channel = 0; + S32 channel = mChannelControl ? (S32)(getChild("channel_control")->get()) : 0; + stripChannelNumber(text, &channel); std::string utf8text = wstring_to_utf8str(text); @@ -425,6 +434,31 @@ void LLChatBar::sendChat( EChatType type ) } } +void LLChatBar::toggleChannelControl() +{ + LLRect input_rect = mInputEditor->getRect(); + S32 chan_width = getChild("channel_control")->getRect().getWidth(); + BOOL visible = gSavedSettings.getBOOL("ChatChannelSelect"); + BOOL control = getChild("channel_control")->getVisible(); + + if (visible && !control) + { + input_rect.setLeftTopAndSize(input_rect.mLeft+chan_width, input_rect.mTop, + input_rect.getWidth()-chan_width, input_rect.getHeight()); + } + else if (!visible && control) + { + input_rect.setLeftTopAndSize(input_rect.mLeft-chan_width, input_rect.mTop, + input_rect.getWidth()+chan_width, input_rect.getHeight()); + + } + mInputEditor->setRect(input_rect); + + childSetVisible("channel_control", visible); + childSetEnabled("channel_control", visible); + mChannelControl = visible; +} + //----------------------------------------------------------------------- // Static functions @@ -575,7 +609,8 @@ void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) { // Look for "/20 foo" channel chats. - S32 channel = 0; + S32 channel = mChannelControl ? (S32)(getChild("channel_control")->get()) : 0; + //S32 channel = (S32)(getChild("ChatChannel")->get()); LLWString out_text = stripChannelNumber(wtext, &channel); std::string utf8_out_text = wstring_to_utf8str(out_text); std::string utf8_text = wstring_to_utf8str(wtext); diff --git a/linden/indra/newview/llchatbar.h b/linden/indra/newview/llchatbar.h index 72c797a..53ac233 100644 --- a/linden/indra/newview/llchatbar.h +++ b/linden/indra/newview/llchatbar.h @@ -93,6 +93,8 @@ public: static void startChat(const char* line); static void stopChat(); + void toggleChannelControl(); + protected: void sendChat(EChatType type); void updateChat(); @@ -109,6 +111,9 @@ protected: LLComboBox* mGestureCombo; LLChatBarGestureObserver* mObserver; + +private: + BOOL mChannelControl; }; extern LLChatBar *gChatBar; diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp index 5117b8d..f624ec3 100644 --- a/linden/indra/newview/llfloaterchat.cpp +++ b/linden/indra/newview/llfloaterchat.cpp @@ -56,10 +56,11 @@ #include "llfloaterchatterbox.h" #include "llfloatermute.h" #include "llkeyboard.h" -//#include "lllineeditor.h" +#include "lllineeditor.h" #include "llmutelist.h" //#include "llresizehandle.h" #include "llchatbar.h" +#include "llspinctrl.h" #include "llstatusbar.h" #include "llviewertexteditor.h" #include "llviewergesture.h" // for triggering gestures @@ -223,6 +224,34 @@ void log_chat_text(const LLChat& chat) LLLogChat::saveHistory(std::string("chat"),histstr); } + +// static +void LLFloaterChat::toggleHistoryChannelControl() +{ + LLFloaterChat* chat_floater = LLFloaterChat::getInstance(LLSD()); + BOOL visible = gSavedSettings.getBOOL("ChatChannelSelect"); + BOOL control = chat_floater->getChild("channel_control")->getVisible(); + + LLLineEditor* input = chat_floater->getChild("Chat Editor"); + LLRect input_rect = input->getRect(); + S32 chan_width = chat_floater->getChild("channel_control")->getRect().getWidth(); + + if (visible && !control) + { + input_rect.setLeftTopAndSize(input_rect.mLeft+chan_width+4, input_rect.mTop, + input_rect.getWidth()-chan_width, input_rect.getHeight()); + } + else if (!visible && control) + { + input_rect.setLeftTopAndSize(input_rect.mLeft-chan_width-4, input_rect.mTop, + input_rect.getWidth()+chan_width, input_rect.getHeight()); + } + input->setRect(input_rect); + + chat_floater->childSetVisible("channel_control", visible); + chat_floater->childSetEnabled("channel_control", visible); +} + // static void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) { diff --git a/linden/indra/newview/llfloaterchat.h b/linden/indra/newview/llfloaterchat.h index 923fd9a..203a158 100644 --- a/linden/indra/newview/llfloaterchat.h +++ b/linden/indra/newview/llfloaterchat.h @@ -82,6 +82,8 @@ public: static void* createSpeakersPanel(void* data); static void* createChatPanel(void* data); + static void toggleHistoryChannelControl(); + // visibility policy for LLUISingleton static bool visible(LLFloater* instance, const LLSD& key); static void show(LLFloater* instance, const LLSD& key); diff --git a/linden/indra/newview/llprefschat.cpp b/linden/indra/newview/llprefschat.cpp index 4453751..82ae07c 100644 --- a/linden/indra/newview/llprefschat.cpp +++ b/linden/indra/newview/llprefschat.cpp @@ -32,6 +32,8 @@ #include "llviewerprecompiledheaders.h" +#include "llchatbar.h" +#include "llfloaterchat.h" #include "llprefschat.h" #include "lltexteditor.h" #include "llviewercontrol.h" @@ -45,10 +47,13 @@ class LLPrefsChatImpl : public LLPanel public: LLPrefsChatImpl(); /*virtual*/ ~LLPrefsChatImpl(){}; + /*virtual*/ BOOL postBuild(); void apply(); void cancel(); + static void onCheckToggleChannel(LLUICtrl* ctrl, void* user_data); + protected: S32 mChatSize; F32 mChatPersist; @@ -73,7 +78,6 @@ protected: F32 mBubbleOpacity; }; - LLPrefsChatImpl::LLPrefsChatImpl() : LLPanel(std::string("Chat Panel")) { @@ -128,6 +132,13 @@ LLPrefsChatImpl::LLPrefsChatImpl() mBubbleOpacity = gSavedSettings.getF32("ChatBubbleOpacity"); } +BOOL LLPrefsChatImpl::postBuild() +{ + childSetCommitCallback("toggle_channel_control",onCheckToggleChannel, this); + + return TRUE; +} + void LLPrefsChatImpl::cancel() { gSavedSettings.setS32("ChatFontSize", mChatSize); @@ -183,6 +194,16 @@ void LLPrefsChatImpl::apply() gSavedSettings.setF32("ChatBubbleOpacity", childGetValue("bubble_chat_opacity").asReal()); } +// static +void LLPrefsChatImpl::onCheckToggleChannel(LLUICtrl* ctrl, void* user_data) +{ + if (gChatBar) + { + gChatBar->toggleChannelControl(); + LLFloaterChat::toggleHistoryChannelControl(); + } +} + //--------------------------------------------------------------------------- LLPrefsChat::LLPrefsChat() diff --git a/linden/indra/newview/llprefsim.cpp b/linden/indra/newview/llprefsim.cpp index 39619b7..6115074 100644 --- a/linden/indra/newview/llprefsim.cpp +++ b/linden/indra/newview/llprefsim.cpp @@ -58,7 +58,7 @@ public: void cancel(); void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); void enableHistory(); - + static void onClickLogPath(void* user_data); static void onCommitLogging(LLUICtrl* ctrl, void* user_data); diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_chat_history.xml b/linden/indra/newview/skins/default/xui/en-us/floater_chat_history.xml index 100c455..dd66a83 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_chat_history.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_chat_history.xml @@ -59,10 +59,14 @@ Gestures + + - + diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_chat.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_chat.xml index 24753d1..0704666 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_chat.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_chat.xml @@ -131,30 +131,34 @@ follows="left|top" font="SansSerifSmall" height="16" initial_value="false" label="Close chat bar after hitting return" left="148" mouse_opaque="true" name="close_chat_on_return_check" radio_style="false" width="237" /> - - - + Bubble Chat: - - toggleChannelControl(); - LLFloaterChat::toggleHistoryChannelControl(); + if (gChatBar) + { + gChatBar->toggleChannelControl(); + LLFloaterChat::toggleHistoryChannelControl(); + } + mChatChannel = chan_check; } } + //--------------------------------------------------------------------------- LLPrefsChat::LLPrefsChat() diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_chat.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_chat.xml index 0704666..b0384cf 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_chat.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_chat.xml @@ -145,7 +145,7 @@ label="Play typing animation when chatting" left="148" mouse_opaque="true" name="play_typing_animation" radio_style="false" width="237" /> - + mouse_opaque="true" scale_image="TRUE" />--> -- cgit v1.1