aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaDoc.html27
-rw-r--r--include/Scintilla.h2
-rw-r--r--include/Scintilla.iface6
-rw-r--r--src/Editor.cxx11
-rw-r--r--src/Editor.h1
-rw-r--r--win32/ScintillaWin.cxx45
6 files changed, 67 insertions, 25 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index 8ed6dd9d1..8446cf895 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -79,7 +79,7 @@
<h1>Scintilla Documentation</h1>
- <p>Last edited 21/May/2011 NH</p>
+ <p>Last edited 13/June/2011 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br />
@@ -5831,11 +5831,12 @@ struct SCNotification {
</code>
<p>The following <code>SCI_*</code> messages are associated with these notifications:</p>
- <code><a class="message" href="#SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int
- eventMask)</a><br />
+ <code><a class="message" href="#SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</a><br />
<a class="message" href="#SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK</a><br />
- <a class="message" href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME</a><br />
+ <a class="message" href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</a><br />
<a class="message" href="#SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</a><br />
+ <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</a><br />
+ <a class="message" href="#SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</a><br />
</code>
<p>The following additional notifications are sent using the <code>WM_COMMAND</code> message on
@@ -5846,6 +5847,17 @@ struct SCNotification {
<a class="message" href="#SCEN_KILLFOCUS">SCEN_KILLFOCUS</a><br />
</code>
+ <p><b id="SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</b><br />
+ <b id="SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</b><br />
+ These two messages set and get the identifier of the Scintilla instance which is included in notifications as the
+ <code>ídFrom</code> field.
+ When an application creates multiple Scintilla widgets, this allows the source of each notification to be found.
+ On Windows, this value is initialised in the <code>CreateWindow</code> call and stored as the
+ <code>GWLP_ID</code> attribute of the window.
+ The value should be small, preferrably less than 16 bits,
+ rather than a pointer as some of the functions will only transmit 16 or 32 bits.
+ </p>
+
<p><b id="SCN_STYLENEEDED">SCN_STYLENEEDED</b><br />
If you used <code><a class="message"
href="#SCI_SETLEXER">SCI_SETLEXER</a>(SCLEX_CONTAINER)</code> to make the container act as the
@@ -6489,7 +6501,7 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
</table>
<br />
- <p><b id="SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME</b><br />
+ <p><b id="SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int milliseconds)</b><br />
<b id="SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME</b><br />
These two messages set and get the time the mouse must sit still, in milliseconds, to generate
a <code><a class="message" href="#SCN_DWELLSTART">SCN_DWELLSTART</a></code> notification. If
@@ -6582,9 +6594,8 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
<p><b id="scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</b><br />
Set the control ID which will be used in the idFrom field of the NotifyHeader structure of all
- notifications for this instance. When an application creates multiple Scintilla widgets, this allows
- the source of each notification to be found. The value should be small, preferrably less than 16 bits,
- rather than a pointer as some of the functions will only transmit 16 or 32 bits.</p>
+ notifications for this instance.
+ This is equivalent to <a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER</a>.</p>
<p><b id="scintilla_send_message">sptr_t scintilla_send_message(ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam)</b><br />
The main entry point allows sending any of the messages described in this document.</p>
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 8819b1b0c..d1f3c9dd2 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -807,6 +807,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_VERTICALCENTRECARET 2619
#define SCI_MOVESELECTEDLINESUP 2620
#define SCI_MOVESELECTEDLINESDOWN 2621
+#define SCI_SETIDENTIFIER 2622
+#define SCI_GETIDENTIFIER 2623
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 773e29427..6bfac5d98 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -2143,6 +2143,12 @@ fun void MoveSelectedLinesUp=2620(,)
# Move the selected lines down one line, shifting the line below before the selection
fun void MoveSelectedLinesDown=2621(,)
+# Set the identifier reported as idFrom in notification messages.
+set void SetIdentifier=2622(int identifier,)
+
+# Get the identifier.
+get int GetIdentifier=2623(,)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 160f94d7c..3f6e533b6 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -4303,6 +4303,10 @@ void Editor::DelCharBack(bool allowLineStartDeletion) {
void Editor::NotifyFocus(bool) {}
+void Editor::SetCtrlID(int identifier) {
+ ctrlID = identifier;
+}
+
void Editor::NotifyStyleToNeeded(int endStyleNeeded) {
SCNotification scn = {0};
scn.nmhdr.code = SCN_STYLENEEDED;
@@ -9119,6 +9123,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_CHANGELEXERSTATE:
pdoc->ChangeLexerState(wParam, lParam);
break;
+
+ case SCI_SETIDENTIFIER:
+ SetCtrlID(wParam);
+ break;
+
+ case SCI_GETIDENTIFIER:
+ return GetCtrlID();
default:
return DefWndProc(iMessage, wParam, lParam);
diff --git a/src/Editor.h b/src/Editor.h
index 48f4d1ccd..eccdb717f 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -422,6 +422,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void NotifyChange() = 0;
virtual void NotifyFocus(bool focus);
+ virtual void SetCtrlID(int identifier);
virtual int GetCtrlID() { return ctrlID; }
virtual void NotifyParent(SCNotification scn) = 0;
virtual void NotifyStyleToNeeded(int endStyleNeeded);
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index d4d3b24da..8092edcd8 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -102,6 +102,29 @@ const TCHAR callClassName[] = TEXT("CallTip");
using namespace Scintilla;
#endif
+// Take care of 32/64 bit pointers
+#ifdef GetWindowLongPtr
+static void *PointerFromWindow(HWND hWnd) {
+ return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0));
+}
+static void SetWindowPointer(HWND hWnd, void *ptr) {
+ ::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr));
+}
+static void SetWindowID(HWND hWnd, int identifier) {
+ ::SetWindowLongPtr(hWnd, GWLP_ID, identifier);
+}
+#else
+static void *PointerFromWindow(HWND hWnd) {
+ return reinterpret_cast<void *>(::GetWindowLong(hWnd, 0));
+}
+static void SetWindowPointer(HWND hWnd, void *ptr) {
+ ::SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(ptr));
+}
+static void SetWindowID(HWND hWnd, int identifier) {
+ ::SetWindowLong(hWnd, GWL_ID, identifier);
+}
+#endif
+
class ScintillaWin; // Forward declaration for COM interface subobjects
typedef void VFunction(void);
@@ -211,6 +234,7 @@ class ScintillaWin :
virtual bool ModifyScrollBars(int nMax, int nPage);
virtual void NotifyChange();
virtual void NotifyFocus(bool focus);
+ virtual void SetCtrlID(int identifier);
virtual int GetCtrlID();
virtual void NotifyParent(SCNotification scn);
virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt);
@@ -1278,6 +1302,10 @@ void ScintillaWin::NotifyFocus(bool focus) {
reinterpret_cast<LPARAM>(MainHWND()));
}
+void ScintillaWin::SetCtrlID(int identifier) {
+ ::SetWindowID(reinterpret_cast<HWND>(wMain.GetID()), identifier);
+}
+
int ScintillaWin::GetCtrlID() {
return ::GetDlgCtrlID(reinterpret_cast<HWND>(wMain.GetID()));
}
@@ -2628,23 +2656,6 @@ BOOL ScintillaWin::DestroySystemCaret() {
return retval;
}
-// Take care of 32/64 bit pointers
-#ifdef GetWindowLongPtr
-static void *PointerFromWindow(HWND hWnd) {
- return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0));
-}
-static void SetWindowPointer(HWND hWnd, void *ptr) {
- ::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr));
-}
-#else
-static void *PointerFromWindow(HWND hWnd) {
- return reinterpret_cast<void *>(::GetWindowLong(hWnd, 0));
-}
-static void SetWindowPointer(HWND hWnd, void *ptr) {
- ::SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(ptr));
-}
-#endif
-
sptr_t PASCAL ScintillaWin::CTWndProc(
HWND hWnd, UINT iMessage, WPARAM wParam, sptr_t lParam) {
// Find C++ object associated with window.