aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-09-12 11:22:39 +1000
committerNeil <nyamatongwe@gmail.com>2014-09-12 11:22:39 +1000
commit044efe69724c92a538b9f6e6252ae5782f860153 (patch)
tree23073f0c77ce2b6b9c4d4c67355548a101545891
parent672a5e079386dbf0d648aac20790fecd17f16a61 (diff)
downloadscintilla-mirror-044efe69724c92a538b9f6e6252ae5782f860153.tar.gz
Allow choice between windowed and inline IME.
-rw-r--r--cocoa/ScintillaCocoa.mm5
-rw-r--r--doc/ScintillaDoc.html17
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--include/Scintilla.h4
-rw-r--r--include/Scintilla.iface10
-rw-r--r--qt/ScintillaEditBase/ScintillaQt.cpp6
-rw-r--r--src/EditModel.cxx1
-rw-r--r--src/EditModel.h2
-rw-r--r--src/Editor.cxx7
9 files changed, 54 insertions, 1 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index f8c53932c..5f5d68b73 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -395,6 +395,7 @@ ScintillaCocoa::ScintillaCocoa(SCIContentView* view, SCIMarginView* viewMargin)
idleTimer = NULL;
observer = NULL;
layerFindIndicator = NULL;
+ imeInteraction = imeInline;
for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast<TickReason>(tr+1))
{
timers[tr] = nil;
@@ -826,6 +827,10 @@ sptr_t ScintillaCocoa::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPar
case SCI_GETDIRECTPOINTER:
return reinterpret_cast<sptr_t>(this);
+ case SCI_SETIMEINTERACTION:
+ // Only inline IME supported on Cocoa
+ break;
+
case SCI_GRABFOCUS:
[[ContentView() window] makeFirstResponder:ContentView()];
break;
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index 0d1f33bcb..e71b39a4d 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -82,7 +82,7 @@
<h1>Scintilla Documentation</h1>
- <p>Last edited 4 September 2014 NH</p>
+ <p>Last edited 12 September 2014 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br />
@@ -3171,6 +3171,8 @@ struct Sci_TextToFind {
<a class="message" href="#SCI_GETFONTQUALITY">SCI_GETFONTQUALITY</a><br />
<a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</a><br />
<a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</a><br />
+ <a class="message" href="#SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</a><br />
+ <a class="message" href="#SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION</a><br />
<a class="message" href="#SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</a><br />
<a class="message" href="#SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</a><br />
<a class="message" href="#SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *characters)</a><br />
@@ -3281,6 +3283,19 @@ struct Sci_TextToFind {
949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab)
although these may require installation of language specific support.</p>
+ <p><b id="SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</b><br />
+ <b id="SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION</b><br />
+ When entering text in Chinese, Japanese, or Korean an Input Method Editor (IME) may be displayed.
+ The IME may be an extra window appearing above Scintilla or may be displayed by Scintilla itself
+ as text. On some platforms there is a choice between the two techniques.
+ A windowed IME <code>SC_IME_WINDOWED</code> (0) may be more similar in appearance and
+ behaviour to the IME in other applications.
+ An inline IME <code>SC_IME_INLINE</code> (1) may work better with some Scintilla features such as
+ rectangular and multiple selection.</p>
+ <p>The windowed behaviour can be chosen with <code>SCI_SETIMEINTERACTION(SC_IME_WINDOWED)</code>
+ and the inline behaviour with <code>SCI_SETIMEINTERACTION(SC_IME_INLINE)</code>.
+ Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.</p>
+
<p><b id="SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</b><br />
<b id="SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</b><br />
On Windows, character keys are normally handled differently depending on whether Scintilla is a wide
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index b2fa52fb2..daf06d14e 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -497,6 +497,9 @@
<a href="http://sourceforge.net/p/scintilla/bugs/1652/">Bug #1652</a>.
</li>
<li>
+ Allow choice between windowed and inline IME on some platforms.
+ </li>
+ <li>
On GTK+ cache autocomplete window to avoid platform bug where windows
were sometimes lost.
<a href="http://sourceforge.net/p/scintilla/bugs/1649/">Bug #1649</a>.
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 184bcacb7..74b0cefd5 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -97,6 +97,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETNEXTTABSTOP 2677
#define SC_CP_UTF8 65001
#define SCI_SETCODEPAGE 2037
+#define SC_IME_WINDOWED 0
+#define SC_IME_INLINE 1
+#define SCI_GETIMEINTERACTION 2678
+#define SCI_SETIMEINTERACTION 2679
#define MARKER_MAX 31
#define SC_MARK_CIRCLE 0
#define SC_MARK_ROUNDRECT 1
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 134078786..bf3fa0811 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -243,6 +243,16 @@ val SC_CP_UTF8=65001
# The SC_CP_UTF8 value can be used to enter Unicode mode.
set void SetCodePage=2037(int codePage,)
+enu IMEInteraction=SC_IME_
+val SC_IME_WINDOWED=0
+val SC_IME_INLINE=1
+
+# Is the IME displayed in a winow or inline?
+get int GetIMEInteraction=2678(,)
+
+# Choose to display the the IME in a winow or inline.
+set void SetIMEInteraction=2679(int imeInteraction,)
+
enu MarkerSymbol=SC_MARK_
val MARKER_MAX=31
val SC_MARK_CIRCLE=0
diff --git a/qt/ScintillaEditBase/ScintillaQt.cpp b/qt/ScintillaEditBase/ScintillaQt.cpp
index c2b250a3e..1c34a5b0b 100644
--- a/qt/ScintillaEditBase/ScintillaQt.cpp
+++ b/qt/ScintillaEditBase/ScintillaQt.cpp
@@ -38,6 +38,8 @@ ScintillaQt::ScintillaQt(QAbstractScrollArea *parent)
wMain = scrollArea->viewport();
+ imeInteraction = imeInline;
+
// On OS X drawing text into a pixmap moves it around 1 pixel to
// the right compared to drawing it directly onto a window.
// Buffered drawing turned off by default to avoid this.
@@ -651,6 +653,10 @@ sptr_t ScintillaQt::WndProc(unsigned int message, uptr_t wParam, sptr_t lParam)
try {
switch (message) {
+ case SCI_SETIMEINTERACTION:
+ // Only inline IME supported on Qt
+ break;
+
case SCI_GRABFOCUS:
scrollArea->setFocus(Qt::OtherFocusReason);
break;
diff --git a/src/EditModel.cxx b/src/EditModel.cxx
index 815d22781..8f66da463 100644
--- a/src/EditModel.cxx
+++ b/src/EditModel.cxx
@@ -61,6 +61,7 @@ EditModel::EditModel() {
bracesMatchStyle = STYLE_BRACEBAD;
highlightGuideColumn = 0;
primarySelection = true;
+ imeInteraction = imeWindowed;
foldFlags = 0;
hotspot = Range(invalidPosition);
wrapWidth = LineLayout::wrapWidthInfinite;
diff --git a/src/EditModel.h b/src/EditModel.h
index f7ca7497a..d8def3294 100644
--- a/src/EditModel.h
+++ b/src/EditModel.h
@@ -42,6 +42,8 @@ public:
Selection sel;
bool primarySelection;
+ enum IMEInteraction { imeWindowed, imeInline } imeInteraction;
+
int foldFlags;
ContractionState cs;
// Hotspot support
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 8f0f43b08..af9d92cdc 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -6251,6 +6251,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETCODEPAGE:
return pdoc->dbcsCodePage;
+ case SCI_SETIMEINTERACTION:
+ imeInteraction = static_cast<EditModel::IMEInteraction>(wParam);
+ break;
+
+ case SCI_GETIMEINTERACTION:
+ return imeInteraction;
+
#ifdef INCLUDE_DEPRECATED_FEATURES
case SCI_SETUSEPALETTE:
InvalidateStyleRedraw();