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
8694f055
Commit
8694f055
authored
2 years ago
by
Kitty Barnett
Browse files
Options
Downloads
Patches
Plain Diff
Add emoji helper support to LLTextEditor
parent
063fe595
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llui/lltexteditor.cpp
+40
-0
40 additions, 0 deletions
indra/llui/lltexteditor.cpp
indra/llui/lltexteditor.h
+5
-0
5 additions, 0 deletions
indra/llui/lltexteditor.h
with
45 additions
and
0 deletions
indra/llui/lltexteditor.cpp
+
40
−
0
View file @
8694f055
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
#include
"llmath.h"
#include
"llmath.h"
#include
"llclipboard.h"
#include
"llclipboard.h"
#include
"llemojihelper.h"
#include
"llscrollbar.h"
#include
"llscrollbar.h"
#include
"llstl.h"
#include
"llstl.h"
#include
"llstring.h"
#include
"llstring.h"
...
@@ -238,6 +239,7 @@ LLTextEditor::Params::Params()
...
@@ -238,6 +239,7 @@ LLTextEditor::Params::Params()
default_color
(
"default_color"
),
default_color
(
"default_color"
),
commit_on_focus_lost
(
"commit_on_focus_lost"
,
false
),
commit_on_focus_lost
(
"commit_on_focus_lost"
,
false
),
show_context_menu
(
"show_context_menu"
),
show_context_menu
(
"show_context_menu"
),
show_emoji_helper
(
"show_emoji_helper"
),
enable_tooltip_paste
(
"enable_tooltip_paste"
)
enable_tooltip_paste
(
"enable_tooltip_paste"
)
{
{
addSynonym
(
prevalidate_callback
,
"text_type"
);
addSynonym
(
prevalidate_callback
,
"text_type"
);
...
@@ -259,6 +261,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
...
@@ -259,6 +261,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mPrevalidateFunc
(
p
.
prevalidate_callback
()),
mPrevalidateFunc
(
p
.
prevalidate_callback
()),
mContextMenu
(
NULL
),
mContextMenu
(
NULL
),
mShowContextMenu
(
p
.
show_context_menu
),
mShowContextMenu
(
p
.
show_context_menu
),
mShowEmojiHelper
(
p
.
show_emoji_helper
),
mEnableTooltipPaste
(
p
.
enable_tooltip_paste
),
mEnableTooltipPaste
(
p
.
enable_tooltip_paste
),
mPassDelete
(
FALSE
),
mPassDelete
(
FALSE
),
mKeepSelectionOnReturn
(
false
)
mKeepSelectionOnReturn
(
false
)
...
@@ -501,6 +504,15 @@ void LLTextEditor::getSegmentsInRange(LLTextEditor::segment_vec_t& segments_out,
...
@@ -501,6 +504,15 @@ void LLTextEditor::getSegmentsInRange(LLTextEditor::segment_vec_t& segments_out,
}
}
}
}
void
LLTextEditor
::
setShowEmojiHelper
(
bool
show
)
{
if
(
!
mShowEmojiHelper
)
{
LLEmojiHelper
::
instance
().
hideHelper
(
this
);
}
mShowEmojiHelper
=
show
;
}
BOOL
LLTextEditor
::
selectionContainsLineBreaks
()
BOOL
LLTextEditor
::
selectionContainsLineBreaks
()
{
{
if
(
hasSelection
())
if
(
hasSelection
())
...
@@ -930,6 +942,12 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
...
@@ -930,6 +942,12 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
S32
LLTextEditor
::
execute
(
TextCmd
*
cmd
)
S32
LLTextEditor
::
execute
(
TextCmd
*
cmd
)
{
{
if
(
!
mReadOnly
&&
mShowEmojiHelper
)
{
// Any change to our contents should always hide the helper
LLEmojiHelper
::
instance
().
hideHelper
(
this
);
}
S32
delta
=
0
;
S32
delta
=
0
;
if
(
cmd
->
execute
(
this
,
&
delta
)
)
if
(
cmd
->
execute
(
this
,
&
delta
)
)
{
{
...
@@ -1124,6 +1142,17 @@ void LLTextEditor::addChar(llwchar wc)
...
@@ -1124,6 +1142,17 @@ void LLTextEditor::addChar(llwchar wc)
setCursorPos
(
mCursorPos
+
addChar
(
mCursorPos
,
wc
));
setCursorPos
(
mCursorPos
+
addChar
(
mCursorPos
,
wc
));
if
(
!
mReadOnly
&&
mShowEmojiHelper
)
{
LLWString
wtext
(
getWText
());
S32
shortCodePos
;
if
(
LLEmojiHelper
::
isCursorInEmojiCode
(
wtext
,
mCursorPos
,
&
shortCodePos
))
{
const
LLRect
cursorRect
=
getLocalRectFromDocIndex
(
mCursorPos
);
const
LLWString
shortCode
=
wtext
.
substr
(
shortCodePos
,
mCursorPos
);
LLEmojiHelper
::
instance
().
showHelper
(
this
,
cursorRect
.
mLeft
,
cursorRect
.
mTop
,
wstring_to_utf8str
(
shortCode
));
}
}
if
(
!
mReadOnly
&&
mAutoreplaceCallback
!=
NULL
)
if
(
!
mReadOnly
&&
mAutoreplaceCallback
!=
NULL
)
{
{
// autoreplace the text, if necessary
// autoreplace the text, if necessary
...
@@ -1774,6 +1803,11 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
...
@@ -1774,6 +1803,11 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
}
}
else
else
{
{
if
(
!
mReadOnly
&&
mShowEmojiHelper
&&
LLEmojiHelper
::
instance
().
handleKey
(
this
,
key
,
mask
))
{
return
TRUE
;
}
if
(
mEnableTooltipPaste
&&
if
(
mEnableTooltipPaste
&&
LLToolTipMgr
::
instance
().
toolTipVisible
()
&&
LLToolTipMgr
::
instance
().
toolTipVisible
()
&&
KEY_TAB
==
key
)
KEY_TAB
==
key
)
...
@@ -1815,6 +1849,12 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
...
@@ -1815,6 +1849,12 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
{
{
resetCursorBlink
();
resetCursorBlink
();
needsScroll
();
needsScroll
();
if
(
mShowEmojiHelper
)
{
// Dismiss the helper whenever we handled a key that it didn't
LLEmojiHelper
::
instance
().
hideHelper
(
this
);
}
}
}
return
handled
;
return
handled
;
...
...
This diff is collapsed.
Click to expand it.
indra/llui/lltexteditor.h
+
5
−
0
View file @
8694f055
...
@@ -60,6 +60,7 @@ class LLTextEditor :
...
@@ -60,6 +60,7 @@ class LLTextEditor :
ignore_tab
,
ignore_tab
,
commit_on_focus_lost
,
commit_on_focus_lost
,
show_context_menu
,
show_context_menu
,
show_emoji_helper
,
enable_tooltip_paste
,
enable_tooltip_paste
,
auto_indent
;
auto_indent
;
...
@@ -201,6 +202,9 @@ class LLTextEditor :
...
@@ -201,6 +202,9 @@ class LLTextEditor :
void
setShowContextMenu
(
bool
show
)
{
mShowContextMenu
=
show
;
}
void
setShowContextMenu
(
bool
show
)
{
mShowContextMenu
=
show
;
}
bool
getShowContextMenu
()
const
{
return
mShowContextMenu
;
}
bool
getShowContextMenu
()
const
{
return
mShowContextMenu
;
}
void
setShowEmojiHelper
(
bool
show
);
bool
getShowEmojiHelper
()
const
{
return
mShowEmojiHelper
;
}
void
setPassDelete
(
BOOL
b
)
{
mPassDelete
=
b
;
}
void
setPassDelete
(
BOOL
b
)
{
mPassDelete
=
b
;
}
protected
:
protected
:
...
@@ -317,6 +321,7 @@ class LLTextEditor :
...
@@ -317,6 +321,7 @@ class LLTextEditor :
BOOL
mAllowEmbeddedItems
;
BOOL
mAllowEmbeddedItems
;
bool
mShowContextMenu
;
bool
mShowContextMenu
;
bool
mShowEmojiHelper
;
bool
mEnableTooltipPaste
;
bool
mEnableTooltipPaste
;
bool
mPassDelete
;
bool
mPassDelete
;
bool
mKeepSelectionOnReturn
;
// disabling of removing selected text after pressing of Enter
bool
mKeepSelectionOnReturn
;
// disabling of removing selected text after pressing of Enter
...
...
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