Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
3acb4caa
Commit
3acb4caa
authored
2 years ago
by
Kitty Barnett
Browse files
Options
Downloads
Patches
Plain Diff
Add emoji helper support to LLTextEditor
parent
dad25bcb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llui/lltexteditor.cpp
+18
-3
18 additions, 3 deletions
indra/llui/lltexteditor.cpp
indra/llui/lltexteditor.h
+2
-0
2 additions, 0 deletions
indra/llui/lltexteditor.h
with
20 additions
and
3 deletions
indra/llui/lltexteditor.cpp
+
18
−
3
View file @
3acb4caa
...
@@ -676,6 +676,21 @@ void LLTextEditor::selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_p
...
@@ -676,6 +676,21 @@ void LLTextEditor::selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_p
endSelection
();
endSelection
();
}
}
void
LLTextEditor
::
handleEmojiCommit
(
const
LLWString
&
wstr
)
{
LLWString
wtext
(
getWText
());
S32
shortCodePos
;
if
(
LLEmojiHelper
::
isCursorInEmojiCode
(
wtext
,
mCursorPos
,
&
shortCodePos
))
{
remove
(
shortCodePos
,
mCursorPos
-
shortCodePos
,
true
);
auto
styleParams
=
LLStyle
::
Params
();
styleParams
.
font
=
LLFontGL
::
getFontEmoji
();
insert
(
shortCodePos
,
wstr
,
false
,
new
LLEmojiTextSegment
(
new
LLStyle
(
styleParams
),
shortCodePos
,
shortCodePos
+
wstr
.
size
(),
*
this
));
setCursorPos
(
shortCodePos
+
1
);
}
}
BOOL
LLTextEditor
::
handleMouseDown
(
S32
x
,
S32
y
,
MASK
mask
)
BOOL
LLTextEditor
::
handleMouseDown
(
S32
x
,
S32
y
,
MASK
mask
)
{
{
BOOL
handled
=
FALSE
;
BOOL
handled
=
FALSE
;
...
@@ -1147,9 +1162,9 @@ void LLTextEditor::addChar(llwchar wc)
...
@@ -1147,9 +1162,9 @@ void LLTextEditor::addChar(llwchar wc)
LLWString
wtext
(
getWText
());
S32
shortCodePos
;
LLWString
wtext
(
getWText
());
S32
shortCodePos
;
if
(
LLEmojiHelper
::
isCursorInEmojiCode
(
wtext
,
mCursorPos
,
&
shortCodePos
))
if
(
LLEmojiHelper
::
isCursorInEmojiCode
(
wtext
,
mCursorPos
,
&
shortCodePos
))
{
{
const
LLRect
cursorRect
=
getLocalRectFromDocIndex
(
mCursorPos
);
const
LLRect
cursorRect
=
getLocalRectFromDocIndex
(
mCursorPos
-
1
);
const
LLWString
shortCode
=
wtext
.
substr
(
shortCodePos
,
mCursorPos
);
const
LLWString
shortCode
=
wtext
.
substr
(
shortCodePos
,
mCursorPos
-
shortCodePos
);
LLEmojiHelper
::
instance
().
showHelper
(
this
,
cursorRect
.
mLeft
,
cursorRect
.
mTop
,
wstring_to_utf8str
(
shortCode
));
LLEmojiHelper
::
instance
().
showHelper
(
this
,
cursorRect
.
mLeft
,
cursorRect
.
mTop
,
wstring_to_utf8str
(
shortCode
)
,
std
::
bind
(
&
LLTextEditor
::
handleEmojiCommit
,
this
,
std
::
placeholders
::
_1
)
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
indra/llui/lltexteditor.h
+
2
−
0
View file @
3acb4caa
...
@@ -92,6 +92,8 @@ class LLTextEditor :
...
@@ -92,6 +92,8 @@ class LLTextEditor :
static
S32
spacesPerTab
();
static
S32
spacesPerTab
();
void
handleEmojiCommit
(
const
LLWString
&
wstr
);
// mousehandler overrides
// mousehandler overrides
virtual
BOOL
handleMouseDown
(
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
handleMouseUp
(
S32
x
,
S32
y
,
MASK
mask
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment