aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gtk/ScintillaGTK.cxx56
-rw-r--r--include/Scintilla.h118
-rw-r--r--include/WinDefs.h37
-rw-r--r--src/Document.h2
-rw-r--r--src/Editor.cxx157
-rw-r--r--src/Editor.h18
-rw-r--r--src/KeyMap.cxx98
-rw-r--r--src/KeyMap.h12
-rw-r--r--src/ScintillaBase.cxx20
-rw-r--r--src/ScintillaBase.h4
-rw-r--r--src/WindowAccessor.cxx14
-rw-r--r--win32/ScintillaWin.cxx42
12 files changed, 396 insertions, 182 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 675962e1d..bd4c98ccc 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -59,9 +59,9 @@ private:
virtual void Finalise();
virtual void StartDrag();
public: // Public for scintilla_send_message
- virtual LRESULT WndProc(UINT iMessage,WPARAM wParam,LPARAM lParam);
+ virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
private:
- virtual LRESULT DefWndProc(UINT iMessage,WPARAM wParam,LPARAM lParam);
+ virtual long DefWndProc(unsigned int iMessage, unsigned long wParam, long lParam);
virtual void SetTicking(bool on);
virtual void SetMouseCapture(bool on);
virtual bool HaveMouseCapture();
@@ -320,7 +320,7 @@ void ScintillaGTK::StartDrag() {
reinterpret_cast<GdkEvent *>(&evbtn));
}
-LRESULT ScintillaGTK::WndProc(UINT iMessage,WPARAM wParam,LPARAM lParam) {
+long ScintillaGTK::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
switch (iMessage) {
case SCI_GRABFOCUS:
@@ -333,7 +333,7 @@ LRESULT ScintillaGTK::WndProc(UINT iMessage,WPARAM wParam,LPARAM lParam) {
return 0l;
}
-LRESULT ScintillaGTK::DefWndProc(UINT, WPARAM, LPARAM) {
+long ScintillaGTK::DefWndProc(unsigned int, unsigned long, long) {
return 0;
}
@@ -464,12 +464,12 @@ void ScintillaGTK::ReconfigureScrollBars() {
void ScintillaGTK::NotifyChange() {
gtk_signal_emit(GTK_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL],
- MAKELONG(ctrlID, EN_CHANGE), wMain.GetID());
+ MAKELONG(ctrlID, SCEN_CHANGE), wMain.GetID());
}
void ScintillaGTK::NotifyFocus(bool focus) {
gtk_signal_emit(GTK_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL],
- MAKELONG(ctrlID, focus ? EN_SETFOCUS : EN_KILLFOCUS), wMain.GetID());
+ MAKELONG(ctrlID, focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), wMain.GetID());
}
void ScintillaGTK::NotifyParent(SCNotification scn) {
@@ -718,7 +718,7 @@ gint ScintillaGTK::MoveResize(GtkWidget *, GtkAllocation *allocation, ScintillaG
}
gint ScintillaGTK::Press(GtkWidget *, GdkEventButton *event, ScintillaGTK *sciThis) {
- //Platform::DebugPrintf("Press %x time=%d state = %x button = %x\n",sciThis,event->time, event->state, event->button);
+ Platform::DebugPrintf("Press %x time=%d state = %x button = %x\n",sciThis,event->time, event->state, event->button);
// Do not use GTK+ double click events as Scintilla has its own double click detection
if (event->type != GDK_BUTTON_PRESS)
return FALSE;
@@ -821,18 +821,36 @@ gint ScintillaGTK::Motion(GtkWidget *, GdkEventMotion *event, ScintillaGTK *sciT
// Map the keypad keys to their equivalent functions
static int KeyTranslate(int keyIn) {
switch (keyIn) {
- case GDK_ISO_Left_Tab: return GDK_Tab;
- case GDK_KP_Down: return GDK_Down;
- case GDK_KP_Up: return GDK_Up;
- case GDK_KP_Left: return GDK_Left;
- case GDK_KP_Right: return GDK_Right;
- case GDK_KP_Home: return GDK_Home;
- case GDK_KP_End: return GDK_End;
- case GDK_KP_Page_Up: return GDK_Page_Up;
- case GDK_KP_Page_Down: return GDK_Page_Down;
- case GDK_KP_Delete: return GDK_Delete;
- case GDK_KP_Insert: return GDK_Insert;
- case GDK_KP_Enter: return GDK_Return;
+ case GDK_ISO_Left_Tab: return SCK_TAB;
+ case GDK_KP_Down: return SCK_DOWN;
+ case GDK_KP_Up: return SCK_UP;
+ case GDK_KP_Left: return SCK_LEFT;
+ case GDK_KP_Right: return SCK_RIGHT;
+ case GDK_KP_Home: return SCK_HOME;
+ case GDK_KP_End: return SCK_END;
+ case GDK_KP_Page_Up: return SCK_PRIOR;
+ case GDK_KP_Page_Down: return SCK_NEXT;
+ case GDK_KP_Delete: return SCK_DELETE;
+ case GDK_KP_Insert: return SCK_INSERT;
+ case GDK_KP_Enter: return SCK_RETURN;
+
+ case GDK_Down: return SCK_DOWN;
+ case GDK_Up: return SCK_UP;
+ case GDK_Left: return SCK_LEFT;
+ case GDK_Right: return SCK_RIGHT;
+ case GDK_Home: return SCK_HOME;
+ case GDK_End: return SCK_END;
+ case GDK_Page_Up: return SCK_PRIOR;
+ case GDK_Page_Down: return SCK_NEXT;
+ case GDK_Delete: return SCK_DELETE;
+ case GDK_Insert: return SCK_INSERT;
+ case GDK_Escape: return SCK_ESCAPE;
+ case GDK_BackSpace: return SCK_BACK;
+ case GDK_Tab: return SCK_TAB;
+ case GDK_Return: return SCK_RETURN;
+ case GDK_KP_Add: return SCK_ADD;
+ case GDK_KP_Subtract: return SCK_SUBTRACT;
+ case GDK_KP_Divide: return SCK_DIVIDE;
default: return keyIn;
}
}
diff --git a/include/Scintilla.h b/include/Scintilla.h
index d79441309..4a812fc0e 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -9,10 +9,6 @@
// Compile-time configuration options
#define MACRO_SUPPORT 1 // Comment out to remove macro hooks
-#if PLAT_WX || PLAT_GTK
-#include "WinDefs.h"
-#endif
-
#if PLAT_WIN
#ifdef STATIC_BUILD
void Scintilla_RegisterClasses(HINSTANCE hInstance);
@@ -371,8 +367,8 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance);
// Optional module for macro recording
#ifdef MACRO_SUPPORT
-typedef void (tMacroRecorder)(UINT iMessage, WPARAM wParam, LPARAM lParam,
- void *userData);
+typedef void (tMacroRecorder)(unsigned int iMessage, unsigned long wParam,
+ long lParam, void *userData);
#define SCI_STARTRECORD SCI_OPTIONAL_START + 1
#define SCI_STOPRECORD SCI_OPTIONAL_START + 2
#endif
@@ -421,10 +417,49 @@ typedef void (tMacroRecorder)(UINT iMessage, WPARAM wParam, LPARAM lParam,
#define SCN_MARGINCLICK 2010
#define SCN_NEEDSHOWN 2011
+// For compatibility, these go through the COMMAND notification rather than NOTIFY
+#define SCEN_CHANGE 768
+#define SCEN_SETFOCUS 512
+#define SCEN_KILLFOCUS 256
+
// End of definitions that could be generated from Scintilla.iface
+// These structures are defined to be exactly the same shape as the Win32
+// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
+// So older code that treats Scintilla as a RichEdit will work.
+
+struct CharacterRange {
+ long cpMin;
+ long cpMax;
+};
+
+struct TextRange {
+ CharacterRange chrg;
+ char *lpstrText;
+};
+
+struct TextToFind {
+ CharacterRange chrg;
+ char *lpstrText;
+ CharacterRange chrgText;
+};
+
+struct RangeToFormat {
+ SurfaceID hdc;
+ SurfaceID hdcTarget;
+ PRectangle rc;
+ PRectangle rcPage;
+ CharacterRange chrg;
+};
+
+struct NotifyHeader {
+ WindowID hwndFrom;
+ unsigned int idFrom;
+ unsigned int code;
+};
+
struct SCNotification {
- NMHDR nmhdr;
+ NotifyHeader nmhdr;
int position; // SCN_STYLENEEDED, SCN_MODIFIED
int ch; // SCN_CHARADDED, SCN_KEY
int modifiers; // SCN_KEY
@@ -445,6 +480,75 @@ struct SCNotification {
#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | (1<<SC_MARKNUM_FOLDEROPEN))
+// Moving from WM_* and EM_*
+#define SCI_CANPASTE 5000
+#define SCI_CANUNDO 5001
+#define SCI_POINTXFROMPOSITION 5034
+#define SCI_POINTYFROMPOSITION 5035
+#define SCI_EMPTYUNDOBUFFER 5003
+#define SCI_GETSEL 5004
+#define SCI_SETSEL 5005
+#define SCI_LINEFROMPOSITION 5006
+#define SCI_FINDTEXT 5036
+#define SCI_FORMATRANGE 5037
+#define SCI_GETFIRSTVISIBLELINE 5007
+#define SCI_GETLINE 5028
+#define SCI_GETLINECOUNT 5008
+//#define SCI_GETMARGINS (212)
+#define SCI_GETMARGINLEFT 5030
+#define SCI_GETMARGINRIGHT 5031
+#define SCI_SETMARGINLEFT 5032
+#define SCI_SETMARGINRIGHT 5033
+#define SCI_GETMODIFY 5009
+#define SCI_GETSELTEXT 5010
+#define SCI_GETTEXTRANGE 5011
+#define SCI_HIDESELECTION 5012
+#define SCI_POSITIONFROMLINE 5013
+#define SCI_LINESCROLL 5014
+#define SCI_REPLACESEL 5015
+#define SCI_SCROLLCARET 5016
+#define SCI_SETMARGINS 5017
+#define SCI_SETREADONLY 5018
+#define SCI_UNDO 5019
+
+#define SCI_NULL 5020
+#define SCI_CLEAR 5021
+#define SCI_COPY 5022
+#define SCI_CUT 5023
+#define SCI_GETTEXT 5024
+#define SCI_GETTEXTLENGTH 5025
+#define SCI_PASTE 5026
+#define SCI_SETTEXT 5027
+
+#define SCFIND_MATCHCASE 4
+#define SCFIND_WHOLEWORD 2
+#define SCFIND_DOWN 1
+
+// Symbolic key codes
+
+#define SCK_DOWN 40
+#define SCK_UP 38
+#define SCK_LEFT 37
+#define SCK_RIGHT 39
+#define SCK_HOME 36
+#define SCK_END 35
+#define SCK_PRIOR 33
+#define SCK_NEXT 34
+#define SCK_DELETE 46
+#define SCK_INSERT 45
+#define SCK_ESCAPE 27
+#define SCK_BACK 8
+#define SCK_TAB 9
+#define SCK_RETURN 13
+#define SCK_ADD 107
+#define SCK_SUBTRACT 109
+#define SCK_DIVIDE 111
+
+#define SCMOD_SHIFT 16
+#define SCMOD_CTRL 8
+#define SCMOD_ALT 2
+
+
// Deprecation section listing all API features that are deprecated and will
// will be removed completely in a future version.
// To enable these features define INCLUDE_DEPRECATED_FEATURES
diff --git a/include/WinDefs.h b/include/WinDefs.h
index d1c25a595..c56f02d81 100644
--- a/include/WinDefs.h
+++ b/include/WinDefs.h
@@ -16,6 +16,7 @@
#define LPSTR char *
#define LONG long
+//#if 0
/* RTF control */
#define EM_CANPASTE (1074)
#define EM_CANUNDO (198)
@@ -52,12 +53,10 @@
#define WM_NULL (0)
#define WM_CLEAR (771)
-#define WM_COMMAND (273)
#define WM_COPY (769)
#define WM_CUT (768)
#define WM_GETTEXT (13)
#define WM_GETTEXTLENGTH (14)
-#define WM_NOTIFY (78)
#define WM_PASTE (770)
#define WM_SETTEXT (12)
#define WM_UNDO (772)
@@ -70,6 +69,9 @@
#define EC_RIGHTMARGIN 2
#define EC_USEFONTINFO 0xffff
+//#endif
+
+#if 0
#if PLAT_GTK
#define VK_DOWN GDK_Down
#define VK_UP GDK_Up
@@ -109,12 +111,16 @@
#define VK_SUBTRACT WXK_SUBTRACT
//TODO:
#define VK_DIVIDE WXK_DIVIDE
+#endif
+
+#define SHIFT_PRESSED 1
+#define LEFT_CTRL_PRESSED 2
+#define LEFT_ALT_PRESSED 4
// Are these needed any more
#define LPSTR char *
#define LONG long
#define LPDWORD (long *)
-#endif
/* SELCHANGE structure */
#define SEL_EMPTY (0)
@@ -123,15 +129,6 @@
#define SEL_MULTICHAR (4)
#define SEL_MULTIOBJECT (8)
-/* FINDREPLACE structure */
-#define FR_MATCHCASE (0x4)
-#define FR_WHOLEWORD (0x2)
-#define FR_DOWN (0x1)
-
-#define SHIFT_PRESSED 1
-#define LEFT_CTRL_PRESSED 2
-#define LEFT_ALT_PRESSED 4
-
struct RECT {
LONG left;
LONG top;
@@ -139,6 +136,15 @@ struct RECT {
LONG bottom;
};
+/* FINDREPLACE structure */
+
+#define FR_MATCHCASE (0x4)
+#define FR_WHOLEWORD (0x2)
+#define FR_DOWN (0x1)
+
+#endif
+
+#if 0
struct CHARRANGE {
LONG cpMin;
LONG cpMax;
@@ -168,9 +174,10 @@ struct FORMATRANGE {
RECT rcPage;
CHARRANGE chrg;
};
+#endif
-#define MAKELONG(a, b) ((a) | ((b) << 16))
-#define LOWORD(x) (x & 0xffff)
-#define HIWORD(x) (x >> 16)
+//#define MAKELONG(a, b) ((a) | ((b) << 16))
+//#define LOWORD(x) (x & 0xffff)
+//#define HIWORD(x) (x >> 16)
#endif
diff --git a/src/Document.h b/src/Document.h
index 524cce605..76f0e101b 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -165,7 +165,7 @@ public:
int NextWordStart(int pos, int delta);
int Length() { return cb.Length(); }
long FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word);
- long FindText(WORD iMessage,WPARAM wParam,LPARAM lParam);
+ long FindText(int iMessage, unsigned long wParam, long lParam);
int LinesTotal();
void ChangeCase(Range r, bool makeUpperCase);
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 118bc42d2..4a7b4c5b4 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -11,6 +11,14 @@
#include "Platform.h"
#include "Scintilla.h"
+
+#if PLAT_WX || PLAT_GTK
+#include "WinDefs.h"
+#define MAKELONG(a, b) ((a) | ((b) << 16))
+#define LOWORD(x) (x & 0xffff)
+#define HIWORD(x) (x >> 16)
+#endif
+
#include "ContractionState.h"
#include "SVector.h"
#include "CellBuffer.h"
@@ -1281,7 +1289,7 @@ Colour InvertedLight(Colour orig) {
// This is mostly copied from the Paint method but with some things omitted
// such as the margin markers, line numbers, selection and caret
// Should be merged back into a combined Draw method.
-long Editor::FormatRange(bool draw, FORMATRANGE *pfr) {
+long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
if (!pfr)
return 0;
@@ -1614,7 +1622,7 @@ void Editor::NotifyChar(char ch) {
char txt[2];
txt[0] = ch;
txt[1] = '\0';
- NotifyMacroRecord(EM_REPLACESEL, 0, (LPARAM) txt);
+ NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
}
#endif
}
@@ -1819,15 +1827,15 @@ void Editor::NotifyDeleted(Document *, void *) {
}
#ifdef MACRO_SUPPORT
-void Editor::NotifyMacroRecord(UINT iMessage, WPARAM wParam, LPARAM lParam) {
+void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam) {
// Enumerates all macroable messages
switch (iMessage) {
- case WM_CUT:
- case WM_COPY:
- case WM_PASTE:
- case WM_CLEAR:
- case EM_REPLACESEL:
+ case SCI_CUT:
+ case SCI_COPY:
+ case SCI_PASTE:
+ case SCI_CLEAR:
+ case SCI_REPLACESEL:
case SCI_ADDTEXT:
case SCI_INSERTTEXT:
case SCI_CLEARALL:
@@ -1969,7 +1977,7 @@ void Editor::LineTranspose() {
void Editor::CancelModes() {
}
-int Editor::KeyCommand(UINT iMessage) {
+int Editor::KeyCommand(unsigned int iMessage) {
Point pt = LocationFromPosition(currentPos);
switch (iMessage) {
@@ -2249,12 +2257,12 @@ void Editor::Indent(bool forwards) {
}
}
-long Editor::FindText(UINT iMessage, WPARAM wParam, LPARAM lParam) {
- FINDTEXTEX *ft = reinterpret_cast<FINDTEXTEX *>(lParam);
+long Editor::FindText(unsigned int iMessage, unsigned long wParam, long lParam) {
+ TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText,
- wParam & FR_MATCHCASE, wParam & FR_WHOLEWORD);
+ wParam & SCFIND_MATCHCASE, wParam & SCFIND_WHOLEWORD);
if (pos != -1) {
- if (iMessage == EM_FINDTEXTEX) {
+ if (iMessage != EM_FINDTEXT) {
ft->chrgText.cpMin = pos;
ft->chrgText.cpMax = pos + strlen(ft->lpstrText);
}
@@ -2278,18 +2286,18 @@ void Editor::SearchAnchor() {
// Accepts both SCI_SEARCHNEXT and SCI_SEARCHPREV.
// wParam contains search modes : ORed FR_MATCHCASE and FR_WHOLEWORD.
// lParam contains the text to search for.
-long Editor::SearchText(UINT iMessage, WPARAM wParam, LPARAM lParam) {
+long Editor::SearchText(unsigned int iMessage, unsigned long wParam, long lParam) {
const char *txt = reinterpret_cast<char *>(lParam);
int pos;
if (iMessage == SCI_SEARCHNEXT) {
pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt,
- wParam & FR_MATCHCASE,
- wParam & FR_WHOLEWORD);
+ wParam & SCFIND_MATCHCASE,
+ wParam & SCFIND_WHOLEWORD);
} else {
pos = pdoc->FindText(searchAnchor, 0, txt,
- wParam & FR_MATCHCASE,
- wParam & FR_WHOLEWORD);
+ wParam & SCFIND_MATCHCASE,
+ wParam & SCFIND_WHOLEWORD);
}
if (pos != -1) {
@@ -2940,12 +2948,12 @@ void Editor::EnsureLineVisible(int line) {
}
}
-static bool ValidMargin(WPARAM wParam) {
+static bool ValidMargin(unsigned long wParam) {
return wParam < ViewStyle::margins;
}
-LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
+long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
//Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam);
// Optional macro recording hook
@@ -2957,6 +2965,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
switch (iMessage) {
case WM_GETTEXT:
+ case SCI_GETTEXT:
{
if (lParam == 0)
return 0;
@@ -2969,6 +2978,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
}
case WM_SETTEXT:
+ case SCI_SETTEXT:
{
if (lParam == 0)
return FALSE;
@@ -2979,33 +2989,35 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
}
case WM_GETTEXTLENGTH:
+ case SCI_GETTEXTLENGTH:
return pdoc->Length();
- case WM_NOTIFY:
- //Platform::DebugPrintf("S notify %d %d\n", wParam, lParam);
- break;
-
case WM_CUT:
+ case SCI_CUT:
Cut();
SetLastXChosen();
break;
case WM_COPY:
+ case SCI_COPY:
Copy();
break;
case WM_PASTE:
+ case SCI_PASTE:
Paste();
SetLastXChosen();
EnsureCaretVisible();
break;
case WM_CLEAR:
+ case SCI_CLEAR:
Clear();
SetLastXChosen();
break;
case WM_UNDO:
+ case SCI_UNDO:
Undo();
SetLastXChosen();
break;
@@ -3061,6 +3073,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
// EM_DISPLAYBAND
case EM_CANUNDO:
+ case SCI_CANUNDO:
return pdoc->CanUndo() ? TRUE : FALSE;
case EM_UNDO:
@@ -3069,10 +3082,12 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
break;
case EM_EMPTYUNDOBUFFER:
+ case SCI_EMPTYUNDOBUFFER:
pdoc->DeleteUndoHistory();
return 0;
case EM_GETFIRSTVISIBLELINE:
+ case SCI_GETFIRSTVISIBLELINE:
return topLine;
case EM_GETLINE: {
@@ -3081,7 +3096,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
int lineStart = pdoc->LineStart(wParam);
int lineEnd = pdoc->LineStart(wParam + 1);
char *ptr = reinterpret_cast<char *>(lParam);
- WORD *pBufSize = reinterpret_cast<WORD *>(lParam);
+ short *pBufSize = reinterpret_cast<short *>(lParam);
if (*pBufSize < lineEnd - lineStart) {
ptr[0] = '\0'; // If no characters copied have to put a NUL into buffer
return 0;
@@ -3092,13 +3107,27 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
return iPlace;
}
+ case SCI_GETLINE: {
+ if (lParam == 0)
+ return 0;
+ int lineStart = pdoc->LineStart(wParam);
+ int lineEnd = pdoc->LineStart(wParam + 1);
+ char *ptr = reinterpret_cast<char *>(lParam);
+ int iPlace = 0;
+ for (int iChar = lineStart; iChar < lineEnd; iChar++)
+ ptr[iPlace++] = pdoc->CharAt(iChar);
+ return iPlace;
+ }
+
case EM_GETLINECOUNT:
+ case SCI_GETLINECOUNT:
if (pdoc->LinesTotal() == 0)
return 1;
else
return pdoc->LinesTotal();
case EM_GETMODIFY:
+ case SCI_GETMODIFY:
return !pdoc->IsSavePoint();
case EM_GETRECT:
@@ -3117,13 +3146,15 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
case EM_EXGETSEL: {
if (lParam == 0)
return 0;
- CHARRANGE *pCR = reinterpret_cast<CHARRANGE *>(lParam);
+ CharacterRange *pCR = reinterpret_cast<CharacterRange *>(lParam);
pCR->cpMin = SelectionStart();
pCR->cpMax = SelectionEnd();
}
break;
- case EM_SETSEL: {
+ case EM_SETSEL:
+ case SCI_SETSEL:
+ {
int nStart = static_cast<int>(wParam);
int nEnd = static_cast<int>(lParam);
if (nEnd < 0)
@@ -3139,7 +3170,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
case EM_EXSETSEL: {
if (lParam == 0)
return 0;
- CHARRANGE *pCR = reinterpret_cast<CHARRANGE *>(lParam);
+ CharacterRange *pCR = reinterpret_cast<CharacterRange *>(lParam);
selType = selStream;
if (pCR->cpMax == -1) {
SetSelection(pCR->cpMin, pdoc->Length());
@@ -3150,7 +3181,8 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
return pdoc->LineFromPosition(SelectionStart());
}
- case EM_GETSELTEXT: {
+ case EM_GETSELTEXT:
+ case SCI_GETSELTEXT: {
if (lParam == 0)
return 0;
char *ptr = reinterpret_cast<char *>(lParam);
@@ -3176,7 +3208,13 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
lParam = SelectionStart(); // Not specified, but probably OK
return pdoc->LineFromPosition(lParam);
+ case SCI_LINEFROMPOSITION:
+ if (static_cast<int>(wParam) < 0)
+ return 0;
+ return pdoc->LineFromPosition(wParam);
+
case EM_LINEINDEX:
+ case SCI_POSITIONFROMLINE:
if (static_cast<int>(wParam) < 0)
wParam = pdoc->LineFromPosition(SelectionStart());
if (wParam == 0)
@@ -3209,7 +3247,9 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
return 0;
return pdoc->LineStart(wParam + 1) - pdoc->LineStart(wParam);
- case EM_REPLACESEL: {
+ case EM_REPLACESEL:
+ case SCI_REPLACESEL:
+ {
if (lParam == 0)
return 0;
pdoc->BeginUndoAction();
@@ -3223,15 +3263,18 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
break;
case EM_LINESCROLL:
+ case SCI_LINESCROLL:
ScrollTo(topLine + lParam);
HorizontalScrollTo(xOffset + wParam * vs.spaceWidth);
return TRUE;
case EM_SCROLLCARET:
+ case SCI_SCROLLCARET:
EnsureCaretVisible();
break;
case EM_SETREADONLY:
+ case SCI_SETREADONLY:
pdoc->SetReadOnly(wParam);
return TRUE;
@@ -3263,16 +3306,35 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
return 0;
}
+ case SCI_POINTXFROMPOSITION:
+ if (lParam < 0) {
+ return 0;
+ } else {
+ Point pt = LocationFromPosition(lParam);
+ return pt.x;
+ }
+
+ case SCI_POINTYFROMPOSITION:
+ if (lParam < 0) {
+ return 0;
+ } else {
+ Point pt = LocationFromPosition(lParam);
+ return pt.y;
+ }
+
case EM_FINDTEXT:
return FindText(iMessage, wParam, lParam);
case EM_FINDTEXTEX:
+ case SCI_FINDTEXT:
return FindText(iMessage, wParam, lParam);
- case EM_GETTEXTRANGE: {
+ case EM_GETTEXTRANGE:
+ case SCI_GETTEXTRANGE:
+ {
if (lParam == 0)
return 0;
- TEXTRANGE *tr = reinterpret_cast<TEXTRANGE *>(lParam);
+ TextRange *tr = reinterpret_cast<TextRange *>(lParam);
int cpMax = tr->chrg.cpMax;
if (cpMax == -1)
cpMax = pdoc->Length();
@@ -3284,10 +3346,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
}
case EM_SELECTIONTYPE:
+#ifdef SEL_EMPTY
if (currentPos == anchor)
return SEL_EMPTY;
else
return SEL_TEXT;
+#else
+ return 0;
+#endif
case EM_HIDESELECTION:
hideSelection = wParam;
@@ -3295,12 +3361,20 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
break;
case EM_FORMATRANGE:
- return FormatRange(wParam, reinterpret_cast<FORMATRANGE *>(lParam));
+ case SCI_FORMATRANGE:
+ return FormatRange(wParam, reinterpret_cast<RangeToFormat *>(lParam));
case EM_GETMARGINS:
return MAKELONG(vs.leftMarginWidth, vs.rightMarginWidth);
+
+ case SCI_GETMARGINLEFT:
+ return vs.leftMarginWidth;
+
+ case SCI_GETMARGINRIGHT:
+ return vs.rightMarginWidth;
case EM_SETMARGINS:
+#ifdef EC_LEFTMARGIN
if (wParam & EC_LEFTMARGIN) {
vs.leftMarginWidth = LOWORD(lParam);
}
@@ -3312,6 +3386,17 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
vs.rightMarginWidth = vs.aveCharWidth / 2;
}
InvalidateStyleRedraw();
+#endif
+ break;
+
+ case SCI_SETMARGINLEFT:
+ vs.leftMarginWidth = lParam;
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_SETMARGINRIGHT:
+ vs.rightMarginWidth = lParam;
+ InvalidateStyleRedraw();
break;
// Control specific mesages
@@ -3457,7 +3542,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
case SCI_GETSTYLEDTEXT: {
if (lParam == 0)
return 0;
- TEXTRANGE *tr = reinterpret_cast<TEXTRANGE *>(lParam);
+ TextRange *tr = reinterpret_cast<TextRange *>(lParam);
int iPlace = 0;
for (int iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) {
tr->lpstrText[iPlace++] = pdoc->CharAt(iChar);
@@ -4050,7 +4135,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
break;
case SCI_GETDOCPOINTER:
- return reinterpret_cast<LRESULT>(pdoc);
+ return reinterpret_cast<long>(pdoc);
case SCI_SETDOCPOINTER:
SetDocPointer(reinterpret_cast<Document *>(lParam));
@@ -4059,7 +4144,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
case SCI_CREATEDOCUMENT: {
Document *doc = new Document();
doc->AddRef();
- return reinterpret_cast<LRESULT>(doc);
+ return reinterpret_cast<long>(doc);
}
case SCI_ADDREFDOCUMENT:
diff --git a/src/Editor.h b/src/Editor.h
index 6297c5de7..e34d38707 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -196,7 +196,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout &ll);
void Paint(Surface *surfaceWindow, PRectangle rcArea);
- long FormatRange(bool draw, FORMATRANGE *pfr);
+ long FormatRange(bool draw, RangeToFormat *pfr);
virtual void SetVerticalScrollPos() = 0;
virtual void SetHorizontalScrollPos() = 0;
@@ -209,7 +209,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void AddCharUTF(char *s, unsigned int len);
void ClearSelection();
void ClearAll();
- void ClearDocumentStyle();
+ void ClearDocumentStyle();
void Cut();
void PasteRectangular(int pos, const char *ptr, int len);
virtual void Copy() = 0;
@@ -242,14 +242,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
#ifdef MACRO_SUPPORT
- void NotifyMacroRecord(UINT iMessage, WPARAM wParam, LPARAM lParam);
+ void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
#endif
void PageMove(int direction, bool extend=false);
void ChangeCaseOfSelection(bool makeUpperCase);
void LineTranspose();
- virtual void CancelModes();
- virtual int KeyCommand(UINT iMessage);
+ virtual void CancelModes();
+ virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
int KeyDown(int key, bool shift, bool ctrl, bool alt);
@@ -258,9 +258,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
void Indent(bool forwards);
- long FindText(UINT iMessage,WPARAM wParam,LPARAM lParam);
+ long FindText(unsigned int iMessage, unsigned long wParam, long lParam);
void SearchAnchor();
- long SearchText(UINT iMessage,WPARAM wParam,LPARAM lParam);
+ long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
void GoToLine(int lineNo);
char *CopyRange(int start, int end);
@@ -294,11 +294,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
void ToggleContraction(int line);
void EnsureLineVisible(int line);
- virtual LRESULT DefWndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) = 0;
+ virtual long DefWndProc(unsigned int iMessage, unsigned long wParam, long lParam) = 0;
public:
// Public so scintilla_send_message can use it
- virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
+ virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
// Public so scintilla_set_id can use it
int ctrlID;
};
diff --git a/src/KeyMap.cxx b/src/KeyMap.cxx
index f16c21b31..d2a6660f3 100644
--- a/src/KeyMap.cxx
+++ b/src/KeyMap.cxx
@@ -28,7 +28,7 @@ void KeyMap::Clear() {
alloc = 0;
}
-void KeyMap::AssignCmdKey(int key, int modifiers, UINT msg) {
+void KeyMap::AssignCmdKey(int key, int modifiers, unsigned int msg) {
if ((len+1) >= alloc) {
KeyToCommand *ktcNew = new KeyToCommand[alloc + 5];
if (!ktcNew)
@@ -51,7 +51,7 @@ void KeyMap::AssignCmdKey(int key, int modifiers, UINT msg) {
len++;
}
-UINT KeyMap::Find(int key, int modifiers) {
+unsigned int KeyMap::Find(int key, int modifiers) {
for (int i=0; i < len; i++) {
if ((key == kmap[i].key) && (modifiers == kmap[i].modifiers)) {
return kmap[i].msg;
@@ -61,55 +61,55 @@ UINT KeyMap::Find(int key, int modifiers) {
}
KeyToCommand KeyMap::MapDefault[] = {
- {VK_DOWN, SCI_NORM, SCI_LINEDOWN},
- {VK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND},
- {VK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN},
- {VK_UP, SCI_NORM, SCI_LINEUP},
- {VK_UP, SCI_SHIFT, SCI_LINEUPEXTEND},
- {VK_UP, SCI_CTRL, SCI_LINESCROLLUP},
- {VK_LEFT, SCI_NORM, SCI_CHARLEFT},
- {VK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND},
- {VK_LEFT, SCI_CTRL, SCI_WORDLEFT},
- {VK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND},
- {VK_RIGHT, SCI_NORM, SCI_CHARRIGHT},
- {VK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND},
- {VK_RIGHT, SCI_CTRL, SCI_WORDRIGHT},
- {VK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND},
- {VK_HOME, SCI_NORM, SCI_VCHOME},
- {VK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND},
- {VK_HOME, SCI_CTRL, SCI_DOCUMENTSTART},
- {VK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND},
- {VK_END, SCI_NORM, SCI_LINEEND},
- {VK_END, SCI_SHIFT, SCI_LINEENDEXTEND},
- {VK_END, SCI_CTRL, SCI_DOCUMENTEND},
- {VK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND},
- {VK_PRIOR, SCI_NORM, SCI_PAGEUP},
- {VK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND},
- {VK_NEXT, SCI_NORM, SCI_PAGEDOWN},
- {VK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND},
- {VK_DELETE, SCI_NORM, WM_CLEAR},
- {VK_DELETE, SCI_SHIFT, WM_CUT},
- {VK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT},
- {VK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE},
- {VK_INSERT, SCI_SHIFT, WM_PASTE},
- {VK_INSERT, SCI_CTRL, WM_COPY},
- {VK_ESCAPE, SCI_NORM, SCI_CANCEL},
- {VK_BACK, SCI_NORM, SCI_DELETEBACK},
- {VK_BACK, SCI_SHIFT, SCI_DELETEBACK},
- {VK_BACK, SCI_CTRL, SCI_DELWORDLEFT},
- {VK_BACK, SCI_ALT, WM_UNDO},
- {'Z', SCI_CTRL, WM_UNDO},
+ {SCK_DOWN, SCI_NORM, SCI_LINEDOWN},
+ {SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND},
+ {SCK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN},
+ {SCK_UP, SCI_NORM, SCI_LINEUP},
+ {SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND},
+ {SCK_UP, SCI_CTRL, SCI_LINESCROLLUP},
+ {SCK_LEFT, SCI_NORM, SCI_CHARLEFT},
+ {SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND},
+ {SCK_LEFT, SCI_CTRL, SCI_WORDLEFT},
+ {SCK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND},
+ {SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT},
+ {SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND},
+ {SCK_RIGHT, SCI_CTRL, SCI_WORDRIGHT},
+ {SCK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND},
+ {SCK_HOME, SCI_NORM, SCI_VCHOME},
+ {SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND},
+ {SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART},
+ {SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND},
+ {SCK_END, SCI_NORM, SCI_LINEEND},
+ {SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND},
+ {SCK_END, SCI_CTRL, SCI_DOCUMENTEND},
+ {SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND},
+ {SCK_PRIOR, SCI_NORM, SCI_PAGEUP},
+ {SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND},
+ {SCK_NEXT, SCI_NORM, SCI_PAGEDOWN},
+ {SCK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND},
+ {SCK_DELETE, SCI_NORM, SCI_CLEAR},
+ {SCK_DELETE, SCI_SHIFT, SCI_CUT},
+ {SCK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT},
+ {SCK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE},
+ {SCK_INSERT, SCI_SHIFT, SCI_PASTE},
+ {SCK_INSERT, SCI_CTRL, SCI_COPY},
+ {SCK_ESCAPE, SCI_NORM, SCI_CANCEL},
+ {SCK_BACK, SCI_NORM, SCI_DELETEBACK},
+ {SCK_BACK, SCI_SHIFT, SCI_DELETEBACK},
+ {SCK_BACK, SCI_CTRL, SCI_DELWORDLEFT},
+ {SCK_BACK, SCI_ALT, SCI_UNDO},
+ {'Z', SCI_CTRL, SCI_UNDO},
{'Y', SCI_CTRL, SCI_REDO},
- {'X', SCI_CTRL, WM_CUT},
- {'C', SCI_CTRL, WM_COPY},
- {'V', SCI_CTRL, WM_PASTE},
+ {'X', SCI_CTRL, SCI_CUT},
+ {'C', SCI_CTRL, SCI_COPY},
+ {'V', SCI_CTRL, SCI_PASTE},
{'A', SCI_CTRL, SCI_SELECTALL},
- {VK_TAB, SCI_NORM, SCI_TAB},
- {VK_TAB, SCI_SHIFT, SCI_BACKTAB},
- {VK_RETURN, SCI_NORM, SCI_NEWLINE},
- {VK_ADD, SCI_CTRL, SCI_ZOOMIN},
- {VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT},
- {VK_DIVIDE, SCI_CTRL, SCI_SETZOOM},
+ {SCK_TAB, SCI_NORM, SCI_TAB},
+ {SCK_TAB, SCI_SHIFT, SCI_BACKTAB},
+ {SCK_RETURN, SCI_NORM, SCI_NEWLINE},
+ {SCK_ADD, SCI_CTRL, SCI_ZOOMIN},
+ {SCK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT},
+ {SCK_DIVIDE, SCI_CTRL, SCI_SETZOOM},
//'L', SCI_CTRL, SCI_FORMFEED,
{'L', SCI_CTRL, SCI_LINECUT},
{'L', SCI_CSHIFT, SCI_LINEDELETE},
diff --git a/src/KeyMap.h b/src/KeyMap.h
index bc435e197..c84310417 100644
--- a/src/KeyMap.h
+++ b/src/KeyMap.h
@@ -7,9 +7,9 @@
#define KEYTOCOMMAND_H
#define SCI_NORM 0
-#define SCI_SHIFT SHIFT_PRESSED
-#define SCI_CTRL LEFT_CTRL_PRESSED
-#define SCI_ALT LEFT_ALT_PRESSED
+#define SCI_SHIFT SCMOD_SHIFT
+#define SCI_CTRL SCMOD_CTRL
+#define SCI_ALT SCMOD_ALT
#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
@@ -17,7 +17,7 @@ class KeyToCommand {
public:
int key;
int modifiers;
- UINT msg;
+ unsigned int msg;
};
class KeyMap {
@@ -29,8 +29,8 @@ public:
KeyMap();
~KeyMap();
void Clear();
- void AssignCmdKey(int key, int modifiers, UINT msg);
- UINT Find(int key, int modifiers); // 0 returned on failure
+ void AssignCmdKey(int key, int modifiers, unsigned int msg);
+ unsigned int Find(int key, int modifiers); // 0 returned on failure
};
#endif
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index 0d5226f4d..8d42f0b7b 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -76,7 +76,7 @@ void ScintillaBase::Command(int cmdId) {
break;
case idcmdUndo:
- WndProc(WM_UNDO, 0, 0);
+ WndProc(SCI_UNDO, 0, 0);
break;
case idcmdRedo:
@@ -84,19 +84,19 @@ void ScintillaBase::Command(int cmdId) {
break;
case idcmdCut:
- WndProc(WM_CUT, 0, 0);
+ WndProc(SCI_CUT, 0, 0);
break;
case idcmdCopy:
- WndProc(WM_COPY, 0, 0);
+ WndProc(SCI_COPY, 0, 0);
break;
case idcmdPaste:
- WndProc(WM_PASTE, 0, 0);
+ WndProc(SCI_PASTE, 0, 0);
break;
case idcmdDelete:
- WndProc(WM_CLEAR, 0, 0);
+ WndProc(SCI_CLEAR, 0, 0);
break;
case idcmdSelectAll:
@@ -105,7 +105,7 @@ void ScintillaBase::Command(int cmdId) {
}
}
-int ScintillaBase::KeyCommand(UINT iMessage) {
+int ScintillaBase::KeyCommand(unsigned int iMessage) {
// Most key commands cancel autocompletion mode
if (ac.Active()) {
switch (iMessage) {
@@ -273,7 +273,7 @@ void ScintillaBase::ContextMenu(Point pt) {
AddToPopUp("");
AddToPopUp("Cut", idcmdCut, currentPos != anchor);
AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
- AddToPopUp("Paste", idcmdPaste, WndProc(EM_CANPASTE, 0, 0));
+ AddToPopUp("Paste", idcmdPaste, WndProc(SCI_CANPASTE, 0, 0));
AddToPopUp("Delete", idcmdDelete, currentPos != anchor);
AddToPopUp("");
AddToPopUp("Select All", idcmdSelectAll);
@@ -315,8 +315,8 @@ void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
#ifdef SCI_LEXER
if (lexLanguage != SCLEX_CONTAINER) {
int endStyled = Platform::SendScintilla(wMain.GetID(), SCI_GETENDSTYLED, 0, 0);
- int lineEndStyled = Platform::SendScintilla(wMain.GetID(), EM_LINEFROMCHAR, endStyled, 0);
- endStyled = Platform::SendScintilla(wMain.GetID(), EM_LINEINDEX, lineEndStyled, 0);
+ int lineEndStyled = Platform::SendScintilla(wMain.GetID(), SCI_LINEFROMPOSITION, endStyled, 0);
+ endStyled = Platform::SendScintilla(wMain.GetID(), SCI_POSITIONFROMLINE, lineEndStyled, 0);
Colourise(endStyled, endStyleNeeded);
return;
}
@@ -324,7 +324,7 @@ void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
Editor::NotifyStyleToNeeded(endStyleNeeded);
}
-LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
+long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
switch (iMessage) {
case SCI_AUTOCSHOW:
AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h
index 23d31dfd1..80db7137e 100644
--- a/src/ScintillaBase.h
+++ b/src/ScintillaBase.h
@@ -48,7 +48,7 @@ protected:
virtual void AddCharUTF(char *s, unsigned int len);
void Command(int cmdId);
virtual void CancelModes();
- virtual int KeyCommand(UINT iMessage);
+ virtual int KeyCommand(unsigned int iMessage);
void AutoCompleteStart(int lenEntered, const char *list);
void AutoCompleteCancel();
@@ -67,7 +67,7 @@ protected:
virtual void NotifyStyleToNeeded(int endStyleNeeded);
public:
// Public so scintilla_send_message can use it
- virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
+ virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
};
#endif
diff --git a/src/WindowAccessor.cxx b/src/WindowAccessor.cxx
index b16735658..96581ef59 100644
--- a/src/WindowAccessor.cxx
+++ b/src/WindowAccessor.cxx
@@ -36,7 +36,7 @@ bool WindowAccessor::InternalIsLeadByte(char ch) {
void WindowAccessor::Fill(int position) {
if (lenDoc == -1)
- lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0);
+ lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0);
startPos = position - slopSize;
if (startPos + bufferSize > lenDoc)
startPos = lenDoc - bufferSize;
@@ -46,8 +46,8 @@ void WindowAccessor::Fill(int position) {
if (endPos > lenDoc)
endPos = lenDoc;
- TEXTRANGE tr = {{startPos, endPos}, buf};
- Platform::SendScintilla(id, EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr));
+ TextRange tr = {{startPos, endPos}, buf};
+ Platform::SendScintilla(id, SCI_GETTEXTRANGE, 0, reinterpret_cast<long>(&tr));
}
char WindowAccessor::StyleAt(int position) {
@@ -56,11 +56,11 @@ char WindowAccessor::StyleAt(int position) {
}
int WindowAccessor::GetLine(int position) {
- return Platform::SendScintilla(id, EM_LINEFROMCHAR, position, 0);
+ return Platform::SendScintilla(id, SCI_LINEFROMPOSITION, position, 0);
}
int WindowAccessor::LineStart(int line) {
- return Platform::SendScintilla(id, EM_LINEINDEX, line, 0);
+ return Platform::SendScintilla(id, SCI_POSITIONFROMLINE, line, 0);
}
int WindowAccessor::LevelAt(int line) {
@@ -69,7 +69,7 @@ int WindowAccessor::LevelAt(int line) {
int WindowAccessor::Length() {
if (lenDoc == -1)
- lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0);
+ lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0);
return lenDoc;
}
@@ -122,7 +122,7 @@ void WindowAccessor::Flush() {
lenDoc = -1;
if (validLen > 0) {
Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen,
- reinterpret_cast<LPARAM>(styleBuf));
+ reinterpret_cast<long>(styleBuf));
validLen = 0;
}
}
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 31419127f..bd4254830 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -120,8 +120,8 @@ class ScintillaWin :
HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam);
virtual void StartDrag();
- virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
- virtual LRESULT DefWndProc(UINT iMessage, WPARAM wParam, LPARAM lParam);
+ virtual LRESULT WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
+ virtual LRESULT DefWndProc(unsigned int iMessage, unsigned long wParam, long lParam);
virtual void SetTicking(bool on);
virtual void SetMouseCapture(bool on);
virtual bool HaveMouseCapture();
@@ -258,7 +258,7 @@ static int InputCodePage() {
return atoi(sCodePage);
}
-LRESULT ScintillaWin::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
+LRESULT ScintillaWin::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
switch (iMessage) {
case WM_CREATE:
@@ -537,23 +537,23 @@ LRESULT ScintillaWin::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
return ::DefWindowProc(wMain.GetID(), iMessage, wParam, lParam);
case WM_ERASEBKGND:
- return 1; // Avoid any background erasure as whole window painted.
+ return 1; // Avoid any background erasure as whole window painted.
// These are not handled in Scintilla and its faster to dispatch them here.
// Also moves time out to here so profile doesn't count lots of empty message calls.
- case WM_MOVE:
- case WM_MOUSEACTIVATE:
+ case WM_MOVE:
+ case WM_MOUSEACTIVATE:
case WM_NCHITTEST:
- case WM_NCCALCSIZE:
+ case WM_NCCALCSIZE:
case WM_NCPAINT:
- case WM_NCMOUSEMOVE:
- case WM_NCLBUTTONDOWN:
- case WM_CAPTURECHANGED:
- case WM_IME_SETCONTEXT:
- case WM_IME_NOTIFY:
- case WM_SYSCOMMAND:
- case WM_WINDOWPOSCHANGING:
- case WM_WINDOWPOSCHANGED:
+ case WM_NCMOUSEMOVE:
+ case WM_NCLBUTTONDOWN:
+ case WM_CAPTURECHANGED:
+ case WM_IME_SETCONTEXT:
+ case WM_IME_NOTIFY:
+ case WM_SYSCOMMAND:
+ case WM_WINDOWPOSCHANGING:
+ case WM_WINDOWPOSCHANGED:
return ::DefWindowProc(wMain.GetID(), iMessage, wParam, lParam);
default:
@@ -562,7 +562,7 @@ LRESULT ScintillaWin::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
return 0l;
}
-LRESULT ScintillaWin::DefWndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
+long ScintillaWin::DefWndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
return ::DefWindowProc(wMain.GetID(), iMessage, wParam, lParam);
}
@@ -645,13 +645,13 @@ bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) {
void ScintillaWin::NotifyChange() {
::SendMessage(GetParent(wMain.GetID()), WM_COMMAND,
- MAKELONG(wMain.GetDlgCtrlID(), EN_CHANGE),
+ MAKELONG(wMain.GetDlgCtrlID(), SCEN_CHANGE),
reinterpret_cast<LPARAM>(wMain.GetID()));
}
void ScintillaWin::NotifyFocus(bool focus) {
::SendMessage(GetParent(wMain.GetID()), WM_COMMAND,
- MAKELONG(wMain.GetDlgCtrlID(), focus ? EN_SETFOCUS : EN_KILLFOCUS),
+ MAKELONG(wMain.GetDlgCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS),
reinterpret_cast<LPARAM>(wMain.GetID()));
}
@@ -1507,12 +1507,12 @@ LRESULT PASCAL ScintillaWin::CTWndProc(
reinterpret_cast<LONG>(pCreate->lpCreateParams));
return 0;
} else {
- return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
+ return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
}
} else {
if (iMessage == WM_DESTROY) {
SetWindowLong(hWnd, 0, 0);
- return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
+ return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
} else if (iMessage == WM_PAINT) {
PAINTSTRUCT ps;
::BeginPaint(hWnd, &ps);
@@ -1523,7 +1523,7 @@ LRESULT PASCAL ScintillaWin::CTWndProc(
::EndPaint(hWnd, &ps);
return 0;
} else {
- return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
+ return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
}
}
}