diff options
Diffstat (limited to 'linden/indra/llui')
-rw-r--r-- | linden/indra/llui/llclipboard.cpp | 41 | ||||
-rw-r--r-- | linden/indra/llui/llclipboard.h | 11 | ||||
-rw-r--r-- | linden/indra/llui/llfloater.cpp | 6 | ||||
-rw-r--r-- | linden/indra/llui/llfloater.h | 2 | ||||
-rw-r--r-- | linden/indra/llui/lllineeditor.cpp | 83 | ||||
-rw-r--r-- | linden/indra/llui/lllineeditor.h | 13 | ||||
-rw-r--r-- | linden/indra/llui/lltexteditor.cpp | 91 | ||||
-rw-r--r-- | linden/indra/llui/lltexteditor.h | 8 | ||||
-rw-r--r-- | linden/indra/llui/llview.cpp | 78 | ||||
-rw-r--r-- | linden/indra/llui/llview.h | 4 |
10 files changed, 320 insertions, 17 deletions
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 | |||
92 | { | 92 | { |
93 | return LLView::getWindow()->isClipboardTextAvailable(); | 93 | return LLView::getWindow()->isClipboardTextAvailable(); |
94 | } | 94 | } |
95 | |||
96 | |||
97 | void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) | ||
98 | { | ||
99 | mSourceID = source_id; | ||
100 | mString = src.substr(pos, len); | ||
101 | LLView::getWindow()->copyTextToPrimary( mString ); | ||
102 | } | ||
103 | |||
104 | |||
105 | const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id ) | ||
106 | { | ||
107 | if( mSourceID.notNull() ) | ||
108 | { | ||
109 | LLWString temp_string; | ||
110 | LLView::getWindow()->pasteTextFromPrimary(temp_string); | ||
111 | |||
112 | if( temp_string != mString ) | ||
113 | { | ||
114 | mSourceID.setNull(); | ||
115 | mString = temp_string; | ||
116 | } | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | LLView::getWindow()->pasteTextFromPrimary(mString); | ||
121 | } | ||
122 | |||
123 | if( source_id ) | ||
124 | { | ||
125 | *source_id = mSourceID; | ||
126 | } | ||
127 | |||
128 | return mString; | ||
129 | } | ||
130 | |||
131 | |||
132 | BOOL LLClipboard::canPastePrimaryString() const | ||
133 | { | ||
134 | return LLView::getWindow()->isPrimaryTextAvailable(); | ||
135 | } | ||
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: | |||
43 | LLClipboard(); | 43 | LLClipboard(); |
44 | ~LLClipboard(); | 44 | ~LLClipboard(); |
45 | 45 | ||
46 | /* We support two flavors of clipboard. The default is the explicitly | ||
47 | copy-and-pasted clipboard. The second is the so-called 'primary' clipboard | ||
48 | which is implicitly copied upon selection on platforms which expect this | ||
49 | (i.e. X11/Linux). */ | ||
50 | |||
46 | void copyFromSubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); | 51 | void copyFromSubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); |
47 | BOOL canPasteString() const; | 52 | BOOL canPasteString() const; |
48 | const LLWString& getPasteWString(LLUUID* source_id = NULL); | 53 | const LLWString& getPasteWString(LLUUID* source_id = NULL); |
49 | 54 | ||
55 | void copyFromPrimarySubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); | ||
56 | BOOL canPastePrimaryString() const; | ||
57 | const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL); | ||
58 | |||
50 | private: | 59 | private: |
51 | LLUUID mSourceID; | 60 | LLUUID mSourceID; |
52 | LLWString mString; | 61 | 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) | |||
1187 | return was_minimized || LLPanel::handleRightMouseDown( x, y, mask ); | 1187 | return was_minimized || LLPanel::handleRightMouseDown( x, y, mask ); |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | BOOL LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) | ||
1191 | { | ||
1192 | bringToFront( x, y ); | ||
1193 | return LLPanel::handleMiddleMouseDown( x, y, mask ); | ||
1194 | } | ||
1195 | |||
1190 | 1196 | ||
1191 | // virtual | 1197 | // virtual |
1192 | BOOL LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask) | 1198 | 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: | |||
178 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | 178 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); |
179 | virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); | 179 | virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); |
180 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | 180 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); |
181 | 181 | virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); | |
182 | virtual void draw(); | 182 | virtual void draw(); |
183 | 183 | ||
184 | virtual void onOpen() {} | 184 | 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) | |||
493 | // delay cursor flashing | 493 | // delay cursor flashing |
494 | mKeystrokeTimer.reset(); | 494 | mKeystrokeTimer.reset(); |
495 | 495 | ||
496 | // take selection to 'primary' clipboard | ||
497 | updatePrimary(); | ||
498 | |||
496 | return TRUE; | 499 | return TRUE; |
497 | } | 500 | } |
498 | 501 | ||
@@ -575,6 +578,17 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) | |||
575 | return TRUE; | 578 | return TRUE; |
576 | } | 579 | } |
577 | 580 | ||
581 | BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) | ||
582 | { | ||
583 | // llinfos << "MiddleMouseDown" << llendl; | ||
584 | setFocus( TRUE ); | ||
585 | if( canPastePrimary() ) | ||
586 | { | ||
587 | setCursorAtLocalPos(x); | ||
588 | pastePrimary(); | ||
589 | } | ||
590 | return TRUE; | ||
591 | } | ||
578 | 592 | ||
579 | BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) | 593 | BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) |
580 | { | 594 | { |
@@ -669,6 +683,9 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) | |||
669 | { | 683 | { |
670 | // delay cursor flashing | 684 | // delay cursor flashing |
671 | mKeystrokeTimer.reset(); | 685 | mKeystrokeTimer.reset(); |
686 | |||
687 | // take selection to 'primary' clipboard | ||
688 | updatePrimary(); | ||
672 | } | 689 | } |
673 | 690 | ||
674 | return handled; | 691 | return handled; |
@@ -872,7 +889,12 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) | |||
872 | } | 889 | } |
873 | } | 890 | } |
874 | 891 | ||
875 | 892 | if(handled) | |
893 | { | ||
894 | // take selection to 'primary' clipboard | ||
895 | updatePrimary(); | ||
896 | } | ||
897 | |||
876 | return handled; | 898 | return handled; |
877 | } | 899 | } |
878 | 900 | ||
@@ -945,20 +967,42 @@ BOOL LLLineEditor::canPaste() const | |||
945 | return !mReadOnly && gClipboard.canPasteString(); | 967 | return !mReadOnly && gClipboard.canPasteString(); |
946 | } | 968 | } |
947 | 969 | ||
948 | |||
949 | // paste from clipboard | ||
950 | void LLLineEditor::paste() | 970 | void LLLineEditor::paste() |
951 | { | 971 | { |
952 | if (canPaste()) | 972 | bool is_primary = false; |
973 | pasteHelper(is_primary); | ||
974 | } | ||
975 | |||
976 | void LLLineEditor::pastePrimary() | ||
977 | { | ||
978 | bool is_primary = true; | ||
979 | pasteHelper(is_primary); | ||
980 | } | ||
981 | |||
982 | // paste from primary (is_primary==true) or clipboard (is_primary==false) | ||
983 | void LLLineEditor::pasteHelper(bool is_primary) | ||
984 | { | ||
985 | bool can_paste_it; | ||
986 | if (is_primary) | ||
987 | can_paste_it = canPastePrimary(); | ||
988 | else | ||
989 | can_paste_it = canPaste(); | ||
990 | |||
991 | if (can_paste_it) | ||
953 | { | 992 | { |
954 | LLWString paste = gClipboard.getPasteWString(); | 993 | LLWString paste; |
994 | if (is_primary) | ||
995 | paste = gClipboard.getPastePrimaryWString(); | ||
996 | else | ||
997 | paste = gClipboard.getPasteWString(); | ||
998 | |||
955 | if (!paste.empty()) | 999 | if (!paste.empty()) |
956 | { | 1000 | { |
957 | // Prepare for possible rollback | 1001 | // Prepare for possible rollback |
958 | LLLineEditorRollback rollback(this); | 1002 | LLLineEditorRollback rollback(this); |
959 | 1003 | ||
960 | // Delete any selected characters | 1004 | // Delete any selected characters |
961 | if (hasSelection()) | 1005 | if ((!is_primary) && hasSelection()) |
962 | { | 1006 | { |
963 | deleteSelection(); | 1007 | deleteSelection(); |
964 | } | 1008 | } |
@@ -994,7 +1038,7 @@ void LLLineEditor::paste() | |||
994 | clean_string = clean_string.substr(0, wchars_that_fit); | 1038 | clean_string = clean_string.substr(0, wchars_that_fit); |
995 | reportBadKeystroke(); | 1039 | reportBadKeystroke(); |
996 | } | 1040 | } |
997 | 1041 | ||
998 | mText.insert(getCursor(), clean_string); | 1042 | mText.insert(getCursor(), clean_string); |
999 | setCursor( getCursor() + (S32)clean_string.length() ); | 1043 | setCursor( getCursor() + (S32)clean_string.length() ); |
1000 | deselect(); | 1044 | deselect(); |
@@ -1015,7 +1059,30 @@ void LLLineEditor::paste() | |||
1015 | } | 1059 | } |
1016 | } | 1060 | } |
1017 | 1061 | ||
1018 | 1062 | // copy selection to primary | |
1063 | void LLLineEditor::copyPrimary() | ||
1064 | { | ||
1065 | if( canCopy() ) | ||
1066 | { | ||
1067 | S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); | ||
1068 | S32 length = abs( mSelectionStart - mSelectionEnd ); | ||
1069 | gClipboard.copyFromPrimarySubstring( mText.getWString(), left_pos, length ); | ||
1070 | } | ||
1071 | } | ||
1072 | |||
1073 | BOOL LLLineEditor::canPastePrimary() const | ||
1074 | { | ||
1075 | return !mReadOnly && gClipboard.canPastePrimaryString(); | ||
1076 | } | ||
1077 | |||
1078 | void LLLineEditor::updatePrimary() | ||
1079 | { | ||
1080 | if(canCopy() ) | ||
1081 | { | ||
1082 | copyPrimary(); | ||
1083 | } | ||
1084 | } | ||
1085 | |||
1019 | BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) | 1086 | BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) |
1020 | { | 1087 | { |
1021 | BOOL handled = FALSE; | 1088 | 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: | |||
89 | /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); | 89 | /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); |
90 | /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); | 90 | /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); |
91 | /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); | 91 | /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); |
92 | /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); | ||
92 | /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); | 93 | /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); |
93 | /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); | 94 | /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); |
94 | /*virtual*/ void onMouseCaptureLost(); | 95 | /*virtual*/ void onMouseCaptureLost(); |
@@ -96,13 +97,16 @@ public: | |||
96 | // LLEditMenuHandler overrides | 97 | // LLEditMenuHandler overrides |
97 | virtual void cut(); | 98 | virtual void cut(); |
98 | virtual BOOL canCut() const; | 99 | virtual BOOL canCut() const; |
99 | |||
100 | virtual void copy(); | 100 | virtual void copy(); |
101 | virtual BOOL canCopy() const; | 101 | virtual BOOL canCopy() const; |
102 | |||
103 | virtual void paste(); | 102 | virtual void paste(); |
104 | virtual BOOL canPaste() const; | 103 | virtual BOOL canPaste() const; |
105 | 104 | ||
105 | virtual void updatePrimary(); | ||
106 | virtual void copyPrimary(); | ||
107 | virtual void pastePrimary(); | ||
108 | virtual BOOL canPastePrimary() const; | ||
109 | |||
106 | virtual void doDelete(); | 110 | virtual void doDelete(); |
107 | virtual BOOL canDoDelete() const; | 111 | virtual BOOL canDoDelete() const; |
108 | 112 | ||
@@ -219,6 +223,9 @@ public: | |||
219 | 223 | ||
220 | private: | 224 | private: |
221 | // private helper methods | 225 | // private helper methods |
226 | |||
227 | void pasteHelper(bool is_primary); | ||
228 | |||
222 | void removeChar(); | 229 | void removeChar(); |
223 | void addChar(const llwchar c); | 230 | void addChar(const llwchar c); |
224 | void setCursorAtLocalPos(S32 local_mouse_x); | 231 | 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) | |||
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | 1205 | ||
1206 | BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) | ||
1207 | { | ||
1208 | setFocus( TRUE ); | ||
1209 | if( canPastePrimary() ) | ||
1210 | { | ||
1211 | setCursorAtLocalPos( x, y, TRUE ); | ||
1212 | pastePrimary(); | ||
1213 | } | ||
1214 | return TRUE; | ||
1215 | } | ||
1216 | |||
1217 | |||
1206 | BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) | 1218 | BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) |
1207 | { | 1219 | { |
1208 | BOOL handled = FALSE; | 1220 | BOOL handled = FALSE; |
@@ -1323,6 +1335,9 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) | |||
1323 | 1335 | ||
1324 | setCursorAtLocalPos( x, y, TRUE ); | 1336 | setCursorAtLocalPos( x, y, TRUE ); |
1325 | endSelection(); | 1337 | endSelection(); |
1338 | |||
1339 | // take selection to primary clipboard | ||
1340 | updatePrimary(); | ||
1326 | } | 1341 | } |
1327 | 1342 | ||
1328 | if( !hasSelection() ) | 1343 | if( !hasSelection() ) |
@@ -1330,6 +1345,9 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) | |||
1330 | handleMouseUpOverSegment( x, y, mask ); | 1345 | handleMouseUpOverSegment( x, y, mask ); |
1331 | } | 1346 | } |
1332 | 1347 | ||
1348 | // take selection to 'primary' clipboard | ||
1349 | updatePrimary(); | ||
1350 | |||
1333 | handled = TRUE; | 1351 | handled = TRUE; |
1334 | } | 1352 | } |
1335 | 1353 | ||
@@ -1392,8 +1410,12 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) | |||
1392 | // delay cursor flashing | 1410 | // delay cursor flashing |
1393 | resetKeystrokeTimer(); | 1411 | resetKeystrokeTimer(); |
1394 | 1412 | ||
1413 | // take selection to 'primary' clipboard | ||
1414 | updatePrimary(); | ||
1415 | |||
1395 | handled = TRUE; | 1416 | handled = TRUE; |
1396 | } | 1417 | } |
1418 | |||
1397 | return handled; | 1419 | return handled; |
1398 | } | 1420 | } |
1399 | 1421 | ||
@@ -1689,6 +1711,12 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) | |||
1689 | } | 1711 | } |
1690 | } | 1712 | } |
1691 | 1713 | ||
1714 | if( handled ) | ||
1715 | { | ||
1716 | // take selection to 'primary' clipboard | ||
1717 | updatePrimary(); | ||
1718 | } | ||
1719 | |||
1692 | return handled; | 1720 | return handled; |
1693 | } | 1721 | } |
1694 | 1722 | ||
@@ -1868,22 +1896,46 @@ BOOL LLTextEditor::canPaste() const | |||
1868 | return !mReadOnly && gClipboard.canPasteString(); | 1896 | return !mReadOnly && gClipboard.canPasteString(); |
1869 | } | 1897 | } |
1870 | 1898 | ||
1871 | |||
1872 | // paste from clipboard | 1899 | // paste from clipboard |
1873 | void LLTextEditor::paste() | 1900 | void LLTextEditor::paste() |
1874 | { | 1901 | { |
1875 | if (!canPaste()) | 1902 | bool is_primary = false; |
1903 | pasteHelper(is_primary); | ||
1904 | } | ||
1905 | |||
1906 | // paste from primary | ||
1907 | void LLTextEditor::pastePrimary() | ||
1908 | { | ||
1909 | bool is_primary = true; | ||
1910 | pasteHelper(is_primary); | ||
1911 | } | ||
1912 | |||
1913 | // paste from primary (itsprimary==true) or clipboard (itsprimary==false) | ||
1914 | void LLTextEditor::pasteHelper(bool is_primary) | ||
1915 | { | ||
1916 | bool can_paste_it; | ||
1917 | if (is_primary) | ||
1918 | can_paste_it = canPastePrimary(); | ||
1919 | else | ||
1920 | can_paste_it = canPaste(); | ||
1921 | |||
1922 | if (!can_paste_it) | ||
1876 | { | 1923 | { |
1877 | return; | 1924 | return; |
1878 | } | 1925 | } |
1879 | LLUUID source_id; | 1926 | LLUUID source_id; |
1880 | LLWString paste = gClipboard.getPasteWString(&source_id); | 1927 | LLWString paste; |
1928 | if (is_primary) | ||
1929 | paste = gClipboard.getPastePrimaryWString(&source_id); | ||
1930 | else | ||
1931 | paste = gClipboard.getPasteWString(&source_id); | ||
1932 | |||
1881 | if (paste.empty()) | 1933 | if (paste.empty()) |
1882 | { | 1934 | { |
1883 | return; | 1935 | return; |
1884 | } | 1936 | } |
1885 | // Delete any selected characters (the paste replaces them) | 1937 | // Delete any selected characters (the paste replaces them) |
1886 | if( hasSelection() ) | 1938 | if( (!is_primary) && hasSelection() ) |
1887 | { | 1939 | { |
1888 | deleteSelection(TRUE); | 1940 | deleteSelection(TRUE); |
1889 | } | 1941 | } |
@@ -1917,6 +1969,32 @@ void LLTextEditor::paste() | |||
1917 | } | 1969 | } |
1918 | 1970 | ||
1919 | 1971 | ||
1972 | |||
1973 | // copy selection to primary | ||
1974 | void LLTextEditor::copyPrimary() | ||
1975 | { | ||
1976 | if( !canCopy() ) | ||
1977 | { | ||
1978 | return; | ||
1979 | } | ||
1980 | S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); | ||
1981 | S32 length = abs( mSelectionStart - mSelectionEnd ); | ||
1982 | gClipboard.copyFromPrimarySubstring(mWText, left_pos, length, mSourceID); | ||
1983 | } | ||
1984 | |||
1985 | BOOL LLTextEditor::canPastePrimary() const | ||
1986 | { | ||
1987 | return !mReadOnly && gClipboard.canPastePrimaryString(); | ||
1988 | } | ||
1989 | |||
1990 | void LLTextEditor::updatePrimary() | ||
1991 | { | ||
1992 | if (canCopy()) | ||
1993 | { | ||
1994 | copyPrimary(); | ||
1995 | } | ||
1996 | } | ||
1997 | |||
1920 | BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) | 1998 | BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) |
1921 | { | 1999 | { |
1922 | BOOL handled = FALSE; | 2000 | BOOL handled = FALSE; |
@@ -1992,6 +2070,11 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) | |||
1992 | } | 2070 | } |
1993 | } | 2071 | } |
1994 | 2072 | ||
2073 | if (handled) | ||
2074 | { | ||
2075 | updatePrimary(); | ||
2076 | } | ||
2077 | |||
1995 | return handled; | 2078 | return handled; |
1996 | } | 2079 | } |
1997 | 2080 | ||
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: | |||
82 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); | 82 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); |
83 | virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); | 83 | virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); |
84 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); | 84 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); |
85 | virtual BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); | ||
86 | |||
85 | virtual BOOL handleKeyHere(KEY key, MASK mask ); | 87 | virtual BOOL handleKeyHere(KEY key, MASK mask ); |
86 | virtual BOOL handleUnicodeCharHere(llwchar uni_char); | 88 | virtual BOOL handleUnicodeCharHere(llwchar uni_char); |
87 | 89 | ||
@@ -117,6 +119,10 @@ public: | |||
117 | virtual BOOL canCopy() const; | 119 | virtual BOOL canCopy() const; |
118 | virtual void paste(); | 120 | virtual void paste(); |
119 | virtual BOOL canPaste() const; | 121 | virtual BOOL canPaste() const; |
122 | virtual void updatePrimary(); | ||
123 | virtual void copyPrimary(); | ||
124 | virtual void pastePrimary(); | ||
125 | virtual BOOL canPastePrimary() const; | ||
120 | virtual void doDelete(); | 126 | virtual void doDelete(); |
121 | virtual BOOL canDoDelete() const; | 127 | virtual BOOL canDoDelete() const; |
122 | virtual void selectAll(); | 128 | virtual void selectAll(); |
@@ -425,6 +431,8 @@ private: | |||
425 | // | 431 | // |
426 | // Methods | 432 | // Methods |
427 | // | 433 | // |
434 | void pasteHelper(bool is_primary); | ||
435 | |||
428 | void updateSegments(); | 436 | void updateSegments(); |
429 | void pruneSegments(); | 437 | void pruneSegments(); |
430 | 438 | ||
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) | |||
981 | } | 981 | } |
982 | return handled; | 982 | return handled; |
983 | } | 983 | } |
984 | |||
985 | BOOL LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) | ||
986 | { | ||
987 | LLView* handled_view = childrenHandleMiddleMouseDown( x, y, mask ); | ||
988 | BOOL handled = (handled_view != NULL); | ||
989 | if( !handled && blockMouseEvent(x, y) ) | ||
990 | { | ||
991 | handled = TRUE; | ||
992 | handled_view = this; | ||
993 | } | ||
994 | |||
995 | return handled; | ||
996 | } | ||
997 | |||
998 | BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) | ||
999 | { | ||
1000 | BOOL handled = childrenHandleMiddleMouseUp( x, y, mask ) != NULL; | ||
1001 | if( !handled && blockMouseEvent(x, y) ) | ||
1002 | { | ||
1003 | handled = TRUE; | ||
1004 | } | ||
1005 | return handled; | ||
1006 | } | ||
1007 | |||
984 | 1008 | ||
985 | LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) | 1009 | LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) |
986 | { | 1010 | { |
@@ -1142,6 +1166,34 @@ LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask) | |||
1142 | return handled_view; | 1166 | return handled_view; |
1143 | } | 1167 | } |
1144 | 1168 | ||
1169 | LLView* LLView::childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask) | ||
1170 | { | ||
1171 | LLView* handled_view = NULL; | ||
1172 | |||
1173 | if (getVisible() && getEnabled() ) | ||
1174 | { | ||
1175 | for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) | ||
1176 | { | ||
1177 | LLView* viewp = *child_it; | ||
1178 | S32 local_x = x - viewp->getRect().mLeft; | ||
1179 | S32 local_y = y - viewp->getRect().mBottom; | ||
1180 | if (viewp->pointInView(local_x, local_y) && | ||
1181 | viewp->getVisible() && | ||
1182 | viewp->getEnabled() && | ||
1183 | viewp->handleMiddleMouseDown( local_x, local_y, mask )) | ||
1184 | { | ||
1185 | if (sDebugMouseHandling) | ||
1186 | { | ||
1187 | sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; | ||
1188 | } | ||
1189 | handled_view = viewp; | ||
1190 | break; | ||
1191 | } | ||
1192 | } | ||
1193 | } | ||
1194 | return handled_view; | ||
1195 | } | ||
1196 | |||
1145 | LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) | 1197 | LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) |
1146 | { | 1198 | { |
1147 | LLView* handled_view = NULL; | 1199 | LLView* handled_view = NULL; |
@@ -1227,6 +1279,32 @@ LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask) | |||
1227 | return handled_view; | 1279 | return handled_view; |
1228 | } | 1280 | } |
1229 | 1281 | ||
1282 | LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask) | ||
1283 | { | ||
1284 | LLView* handled_view = NULL; | ||
1285 | if( getVisible() && getEnabled() ) | ||
1286 | { | ||
1287 | for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) | ||
1288 | { | ||
1289 | LLView* viewp = *child_it; | ||
1290 | S32 local_x = x - viewp->getRect().mLeft; | ||
1291 | S32 local_y = y - viewp->getRect().mBottom; | ||
1292 | if (viewp->pointInView(local_x, local_y) && | ||
1293 | viewp->getVisible() && | ||
1294 | viewp->getEnabled() && | ||
1295 | viewp->handleMiddleMouseUp( local_x, local_y, mask )) | ||
1296 | { | ||
1297 | if (sDebugMouseHandling) | ||
1298 | { | ||
1299 | sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; | ||
1300 | } | ||
1301 | handled_view = viewp; | ||
1302 | break; | ||
1303 | } | ||
1304 | } | ||
1305 | } | ||
1306 | return handled_view; | ||
1307 | } | ||
1230 | 1308 | ||
1231 | void LLView::draw() | 1309 | void LLView::draw() |
1232 | { | 1310 | { |
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: | |||
463 | /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); | 463 | /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); |
464 | /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); | 464 | /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); |
465 | /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); | 465 | /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); |
466 | /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); | ||
467 | /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); | ||
466 | /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | 468 | /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); |
467 | /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); | 469 | /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); |
468 | /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); | 470 | /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); |
@@ -596,6 +598,8 @@ protected: | |||
596 | LLView* childrenHandleHover(S32 x, S32 y, MASK mask); | 598 | LLView* childrenHandleHover(S32 x, S32 y, MASK mask); |
597 | LLView* childrenHandleMouseUp(S32 x, S32 y, MASK mask); | 599 | LLView* childrenHandleMouseUp(S32 x, S32 y, MASK mask); |
598 | LLView* childrenHandleMouseDown(S32 x, S32 y, MASK mask); | 600 | LLView* childrenHandleMouseDown(S32 x, S32 y, MASK mask); |
601 | LLView* childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask); | ||
602 | LLView* childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask); | ||
599 | LLView* childrenHandleDoubleClick(S32 x, S32 y, MASK mask); | 603 | LLView* childrenHandleDoubleClick(S32 x, S32 y, MASK mask); |
600 | LLView* childrenHandleScrollWheel(S32 x, S32 y, S32 clicks); | 604 | LLView* childrenHandleScrollWheel(S32 x, S32 y, S32 clicks); |
601 | LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask); | 605 | LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask); |