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
ce7e8eb9
Commit
ce7e8eb9
authored
10 years ago
by
Pell Smit
Browse files
Options
Downloads
Patches
Plain Diff
fixed: bad behavior of input window
parent
ebd94bf0
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/llwindow/llopenglview-objc.h
+1
-0
1 addition, 0 deletions
indra/llwindow/llopenglview-objc.h
indra/llwindow/llopenglview-objc.mm
+44
-18
44 additions, 18 deletions
indra/llwindow/llopenglview-objc.mm
with
45 additions
and
18 deletions
indra/llwindow/llopenglview-objc.h
+
1
−
0
View file @
ce7e8eb9
...
@@ -79,6 +79,7 @@
...
@@ -79,6 +79,7 @@
@interface
LLNonInlineTextView
:
NSTextView
@interface
LLNonInlineTextView
:
NSTextView
{
{
LLOpenGLView
*
glview
;
LLOpenGLView
*
glview
;
unichar
mKeyPressed
;
}
}
-
(
void
)
setGLView
:(
LLOpenGLView
*
)
view
;
-
(
void
)
setGLView
:(
LLOpenGLView
*
)
view
;
...
...
This diff is collapsed.
Click to expand it.
indra/llwindow/llopenglview-objc.mm
+
44
−
18
View file @
ce7e8eb9
...
@@ -642,37 +642,63 @@ attributedStringInfo getSegments(NSAttributedString *str)
...
@@ -642,37 +642,63 @@ attributedStringInfo getSegments(NSAttributedString *str)
@implementation
LLNonInlineTextView
@implementation
LLNonInlineTextView
/* Input Window is a legacy of 20 century, so we want to remove related classes.
But unfortunately, Viwer web browser has no support for modern inline input,
we need to leave these classes...
We will be back to get rid of Input Window after fixing viewer web browser.
How Input Window should work:
1) Input Window must not be empty.
It must close when it become empty result of edithing.
2) Input Window must not close when it still has input data.
It must keep open user types next char before commit. by Pell Smit
*/
-
(
void
)
setGLView
:(
LLOpenGLView
*
)
view
-
(
void
)
setGLView
:(
LLOpenGLView
*
)
view
{
{
glview
=
view
;
glview
=
view
;
}
}
-
(
void
)
insertText
:(
id
)
insertString
-
(
void
)
keyDown
:(
NSEvent
*
)
theEvent
{
{
[[
self
inputContext
]
discardMarkedText
];
// mKeyPressed is used later to determine whethere Input Window should close or not
[
self
setString
:
@""
];
mKeyPressed
=
[[
theEvent
charactersIgnoringModifiers
]
characterAtIndex
:
0
];
[
_window
orderOut
:
_window
];
// setMarkedText and insertText is called indirectly from inside keyDown: method
[
self
insertText
:
insertString
replacementRange
:
NSMakeRange
(
0
,
[
insertString
length
])
];
[
super
keyDown
:
theEvent
];
}
}
-
(
void
)
insertText
:(
id
)
aString
replacementRange
:(
NSRange
)
replacementRange
// setMarkedText: is called for incomplete input(on the way to conversion).
-
(
void
)
setMarkedText
:(
id
)
aString
selectedRange
:(
NSRange
)
selectedRange
replacementRange
:(
NSRange
)
replacementRange
{
{
[
glview
insertText
:
aString
replacementRange
:
replacementRange
];
[
super
setMarkedText
:
aString
selectedRange
:
selectedRange
replacementRange
:
replacementRange
];
if
([
aString
length
]
==
0
)
// this means Input Widow becomes empty
{
[
_window
orderOut
:
_window
];
// Close this to avoid empty Input Window
}
}
}
-
(
void
)
insertNewline
:(
id
)
sender
// insertText: is called for inserting commited text.
// There are two ways to be called here:
// a) explicitly commited (must close)
// In case of user typed commit key(usually return key) or delete key or something
// b) automatically commited (must not close)
// In case of user typed next letter after conversion
-
(
void
)
insertText
:(
id
)
aString
replacementRange
:(
NSRange
)
replacementRange
{
{
[[
self
textStorage
]
setValue
:
@""
];
[[
self
inputContext
]
discardMarkedText
];
[[
self
inputContext
]
discardMarkedText
];
[
self
setString
:
@""
];
[
self
setString
:
@""
];
}
[
glview
insertText
:
aString
replacementRange
:
replacementRange
];
if
(
mKeyPressed
==
NSEnterCharacter
||
-
(
void
)
doCommandBySelector
:(
SEL
)
aSelector
mKeyPressed
==
NSBackspaceCharacter
||
{
mKeyPressed
==
NSTabCharacter
||
if
(
aSelector
==
@selector
(
insertNewline
:
))
mKeyPressed
==
NSNewlineCharacter
||
{
mKeyPressed
==
NSCarriageReturnCharacter
||
[
self
insertNewline
:
self
];
mKeyPressed
==
NSDeleteCharacter
||
}
(
mKeyPressed
>=
0xF700
&&
mKeyPressed
<=
0xF8FF
))
{
// this is case a) of above comment
[
_window
orderOut
:
_window
];
// to avoid empty Input Window
}
}
}
@end
@end
...
...
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