diff options
author | nyamatongwe <devnull@localhost> | 2001-09-08 22:38:03 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2001-09-08 22:38:03 +0000 |
commit | c59d568edd77bd3f199f73fa8dc95babf35465f1 (patch) | |
tree | 9a939286cf4614e5e75db811325f9cfb7cdc2e47 | |
parent | 9179b488c0aacb3a624142dd9a3b2c7a7efe1569 (diff) | |
download | scintilla-mirror-c59d568edd77bd3f199f73fa8dc95babf35465f1.tar.gz |
Removed all traces of Win32 API from Scintilla API. Scintilla will no
longer process WM_* or EM_* messages.
-rw-r--r-- | include/Scintilla.iface | 168 | ||||
-rw-r--r-- | include/WinDefs.h | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 248 | ||||
-rw-r--r-- | src/Editor.h | 2 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 9 |
5 files changed, 9 insertions, 420 deletions
diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 3b7fc5594..6b8638cfe 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1577,171 +1577,3 @@ evt void DwellStart=2016(int position) evt void DwellEnd=2017(int position) cat Deprecated - -val SCFIND_DOWN=1 - -################################################ -# From WinDefs.h - -# ***** DEPRECATED from here to end of file ****** - -# Will a paste succeed? -fun bool EM_CanPaste=1074(,) - -# Are there any undoable actions in the undo history. -fun bool EM_CanUndo=198(,) - -# Find the position and line from a point within the window. -fun int EM_CharFromPos=215(,point pt) - -# Delete the undo history. -fun void EM_EmptyUndoBuffer=205(,) - -# Retrieve the selection range. -fun void EM_ExGetSel=1076(,charrangeresult cr) - -# Retrieve the line number of a position in the document. -get int EM_ExLineFromChar=1078(,position pos) - -# Select a range of text. -fun void EM_ExSetSel=1079(,charrange cr) - -# Find some text in the document. -fun position EM_FindText=1080(int flags, findtext ft) - -# Find some text in the document. Returns range of found text in ft argument. -fun position EM_FindTextEx=1103(int flags, findtextex ft) - -# On Windows will draw the document into a display context such as a printer. -fun void EM_FormatRange=1081(bool draw, formatrange fr) - -# Retrieve the line at the top of the display. -get int EM_GetFirstVisibleLine=206(,) - -# Retrieve the contents of a line. -# Returns the length of the line. -fun int EM_GetLine=196(int line, countedstring text) - -# Returns the number of lines in the document. There is always at least one. -fun int EM_GetLineCount=186(,) - -# Returns the size in pixels of left and right margins packed into one integer. -# The left margin is in the low half and the right margin in the high half. -fun int EM_GetMargins=212(,) - -# Is the document different from when it was last saved? -get bool EM_GetModify=184(,) - -# Get the area used to display the document. -fun void EM_GetRect=178(,rectangle r) - -# Return the selection packed into one integer with the start of the selection -# in the low half and the end in the high half. -fun int EM_GetSel=176(,) - -# Retrieve the selected text. -# Return the length of the text. -fun int EM_GetSelText=1086(,stringresult text) - -# Retrieve a range of text. -# Return the length of the text. -fun int EM_GetTextRange=1099(, textrange tr) - -# Draw the selection in normal style or with selection highlighted. -fun void EM_HideSelection=1087(bool normal,) - -# Retrieve the line of a position. -fun int EM_LineFromChar=201(position pos,) - -# Retrieve the position at the start of a line. -fun position EM_LineIndex=187(int line,) - -# Retrieve the number of characters on a line not including end of line characters. -fun int EM_LineLength=193(int line,) - -# Scroll horizontally and vertically. -fun void EM_LineScroll=182(int columns, int lines) - -# Retrieve the point in the window where a position is displayed. -fun void EM_PosFromChar=214(pointresult pt, position pos) - -# Replace the selected text with the argument text. -fun void EM_ReplaceSel=194(, string text) - -# Ensure the caret is visible. -fun void EM_ScrollCaret=183(,) - -# Returns SEL_EMPTY if selection contains no characters, otherwise SEL_TEXT. -fun void EM_SelectionType=1090(,) - -# Set the width of the left and right margins -fun void EM_SetMargins=211(int flags, int values) - -# Set to read only or read write. -set void EM_SetReadOnly=207(bool readOnly,) - -# Select the range of text from start to end. -fun void EM_SetSel=177(position start, position end) - -# Undo one action in the undo history. -fun void EM_Undo=199(,) - -# Null operation. -fun void WM_Null=0(,) - -# Clear the selection. -fun void WM_Clear=771(,) - -fun void WM_Command=273(,) - -# Copy the selection to the clipboard. -fun void WM_Copy=769(,) - -# Cut the selection to the clipboard. -fun void WM_Cut=768(,) - -# Retrieve all the text in the document. -# Returns number of characters retrieved. -fun int WM_GetText=13(int length, stringresult text) - -# Retrieve the number of characters in the document. -fun int WM_GetTextLength=14(,) - -# Notification back to container -fun void WM_Notify=78(int id, int stuff) - -# Paste the contents of the clipboard into the document replacing the selection. -fun void WM_Paste=770(,) - -# Replace the contents of the document with the argument text. -fun void WM_SetText=12(, string text) - -# Undo one action in the undo history. -fun void WM_Undo=772(,) - -# Notification codes -val EN_CHANGE=768 -val EN_KILLFOCUS=512 -val EN_SETFOCUS=256 - -# Flags for setting margins. -val EC_LEFTMARGIN=1 -val EC_RIGHTMARGIN=2 -val EC_USEFONTINFO=0xffff - -# Selection type. -val SEL_EMPTY=0 -val SEL_TEXT=1 - -# Find replace mask constants -val FR_MATCHCASE=0x4 -val FR_WHOLEWORD=0x2 -val FR_DOWN=0x1 - -# Key modifier flag. -val SHIFT_PRESSED=1 -val LEFT_CTRL_PRESSED=2 -val LEFT_ALT_PRESSED=4 - -#events -evt void EN_Change=768(void) diff --git a/include/WinDefs.h b/include/WinDefs.h index b3421c0bc..b13239a7c 100644 --- a/include/WinDefs.h +++ b/include/WinDefs.h @@ -5,6 +5,7 @@ // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. +#ifdef NEVER_EVER #ifndef WINDEFS_H #define WINDEFS_H @@ -195,3 +196,4 @@ struct FORMATRANGE { #endif /* !_MSC_VER */ #endif +#endif
\ No newline at end of file diff --git a/src/Editor.cxx b/src/Editor.cxx index fecd4b08e..8fbb94d71 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -14,10 +14,6 @@ #include "Scintilla.h" -#if PLAT_WX || PLAT_GTK -#include "WinDefs.h" -#endif - #include "ContractionState.h" #include "SVector.h" #include "CellBuffer.h" @@ -2141,10 +2137,6 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long case SCI_COPY: case SCI_PASTE: case SCI_CLEAR: - case WM_CUT: - case WM_COPY: - case WM_PASTE: - case WM_CLEAR: case SCI_REPLACESEL: case SCI_ADDTEXT: case SCI_INSERTTEXT: @@ -2655,7 +2647,6 @@ void Editor::Indent(bool forwards) { * @return The position of the found text, -1 if not found. */ long Editor::FindText( - unsigned int iMessage, ///< Can be @c EM_FINDTEXT or @c EM_FINDTEXTEX or @c SCI_FINDTEXT. unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, ///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP. long lParam) { ///< @c TextToFind structure: The text to search for in the given range. @@ -2669,10 +2660,8 @@ long Editor::FindText( wParam & SCFIND_REGEXP, &lengthFound); if (pos != -1) { - if (iMessage != EM_FINDTEXT) { - ft->chrgText.cpMin = pos; - ft->chrgText.cpMax = pos + lengthFound; - } + ft->chrgText.cpMin = pos; + ft->chrgText.cpMax = pos + lengthFound; } return pos; } @@ -3507,7 +3496,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { switch (iMessage) { - case WM_GETTEXT: case SCI_GETTEXT: { if (lParam == 0) @@ -3520,7 +3508,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return iChar; } - case WM_SETTEXT: case SCI_SETTEXT: { if (lParam == 0) @@ -3531,130 +3518,45 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return TRUE; } - case WM_GETTEXTLENGTH: case SCI_GETTEXTLENGTH: return pdoc->Length(); - 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; - // Edit control messages - - // Not supported (no-ops): - // EM_GETWORDBREAKPROC - // EM_GETWORDBREAKPROCEX - // EM_SETWORDBREAKPROC - // EM_SETWORDBREAKPROCEX - // EM_GETWORDWRAPMODE - // EM_SETWORDWRAPMODE - // EM_LIMITTEXT - // EM_EXLIMITTEXT - // EM_SETRECT - // EM_SETRECTNP - // EM_FMTLINES - // EM_GETHANDLE - // EM_SETHANDLE - // EM_GETPASSWORDCHAR - // EM_SETPASSWORDCHAR - // EM_SETTABSTOPS - // EM_FINDWORDBREAK - // EM_GETCHARFORMAT - // EM_SETCHARFORMAT - // EM_GETOLEINTERFACE - // EM_SETOLEINTERFACE - // EM_SETOLECALLBACK - // EM_GETPARAFORMAT - // EM_SETPARAFORMAT - // EM_PASTESPECIAL - // EM_REQUESTRESIZE - // EM_GETBKGNDCOLOR - // EM_SETBKGNDCOLOR - // EM_STREAMIN - // EM_STREAMOUT - // EM_GETIMECOLOR - // EM_SETIMECOLOR - // EM_GETIMEOPTIONS - // EM_SETIMEOPTIONS - // EM_GETOPTIONS - // EM_SETOPTIONS - // EM_GETPUNCTUATION - // EM_SETPUNCTUATION - // EM_GETTHUMB - // EM_SETTARGETDEVICE - - // Not supported but should be: - // EM_GETEVENTMASK - // EM_SETEVENTMASK - // For printing: - // EM_DISPLAYBAND - - case EM_CANUNDO: case SCI_CANUNDO: return pdoc->CanUndo() ? TRUE : FALSE; - case EM_UNDO: - Undo(); - SetLastXChosen(); - break; - - case EM_EMPTYUNDOBUFFER: case SCI_EMPTYUNDOBUFFER: pdoc->DeleteUndoHistory(); return 0; - case EM_GETFIRSTVISIBLELINE: case SCI_GETFIRSTVISIBLELINE: return topLine; - case EM_GETLINE: { - if (lParam == 0) { - return 0; - } - char *ptr = reinterpret_cast<char *>(lParam); - short *pBufSize = reinterpret_cast<short *>(lParam); - short bufSize = *pBufSize; - ptr[0] = '\0'; // If no characters copied, have to put a NUL into buffer - if (static_cast<int>(wParam) > pdoc->LinesTotal()) { - return 0; - } - int lineStart = pdoc->LineStart(wParam); - int lineEnd = pdoc->LineStart(wParam + 1); - // The first word of the buffer is the size, in TCHARs, of the buffer - int iPlace = 0; - for (int iChar = lineStart; iChar < lineEnd && iPlace < bufSize; iChar++) { - ptr[iPlace++] = pdoc->CharAt(iChar); - } - return iPlace; - } - - case SCI_GETLINE: { // Simpler than EM_GETLINE, but with risk of overwriting the end of the buffer + case SCI_GETLINE: { // Risk of overwriting the end of the buffer if (lParam == 0) { return 0; } @@ -3668,42 +3570,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { 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: - if (lParam == 0) - return 0; - *(reinterpret_cast<PRectangle *>(lParam)) = GetClientRectangle(); - break; - - case EM_GETSEL: - if (wParam) - *reinterpret_cast<int *>(wParam) = SelectionStart(); - if (lParam) - *reinterpret_cast<int *>(lParam) = SelectionEnd(); - return Platform::LongFromTwoShorts( - static_cast<short>(SelectionStart()), - static_cast<short>(SelectionEnd())); - - case EM_EXGETSEL: { - if (lParam == 0) - return 0; - CharacterRange *pCR = reinterpret_cast<CharacterRange *>(lParam); - pCR->cpMin = SelectionStart(); - pCR->cpMax = SelectionEnd(); - } - break; - - case EM_SETSEL: case SCI_SETSEL: { int nStart = static_cast<int>(wParam); int nEnd = static_cast<int>(lParam); @@ -3717,21 +3592,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { } break; - case EM_EXSETSEL: { - if (lParam == 0) - return 0; - CharacterRange *pCR = reinterpret_cast<CharacterRange *>(lParam); - selType = selStream; - if (pCR->cpMax == -1) { - SetSelection(pCR->cpMin, pdoc->Length()); - } else { - SetSelection(pCR->cpMin, pCR->cpMax); - } - EnsureCaretVisible(); - return pdoc->LineFromPosition(SelectionStart()); - } - - case EM_GETSELTEXT: case SCI_GETSELTEXT: { if (lParam == 0) return 0; @@ -3749,22 +3609,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return iChar; } - case EM_LINEFROMCHAR: - if (static_cast<int>(wParam) < 0) - wParam = SelectionStart(); - return pdoc->LineFromPosition(wParam); - - case EM_EXLINEFROMCHAR: - if (static_cast<int>(lParam) < 0) - 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()); @@ -3776,28 +3625,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { // return -1; return pdoc->LineStart(wParam); - case EM_LINELENGTH: { - if (static_cast<int>(wParam) < 0) // Who use this anyway? - return 0; // Should be... Too complex to describe here, see MS specs! - if (static_cast<int>(wParam) > pdoc->Length()) // Useful test, anyway... - return 0; - int line = pdoc->LineFromPosition(wParam); - int charsOnLine = 0; - for (int pos = pdoc->LineStart(line); pos < pdoc->LineStart(line + 1); pos++) { - if ((pdoc->CharAt(pos) != '\r') && (pdoc->CharAt(pos) != '\n')) - charsOnLine++; - } - return charsOnLine; - } - - // Replacement of the old Scintilla interpretation of EM_LINELENGTH + // Replacement of the old Scintilla interpretation of EM_LINELENGTH case SCI_LINELENGTH: if ((static_cast<int>(wParam) < 0) || (static_cast<int>(wParam) > pdoc->LineFromPosition(pdoc->Length()))) return 0; return pdoc->LineStart(wParam + 1) - pdoc->LineStart(wParam); - case EM_REPLACESEL: case SCI_REPLACESEL: { if (lParam == 0) return 0; @@ -3844,18 +3678,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETSEARCHFLAGS: return searchFlags; - 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; @@ -3863,33 +3694,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETREADONLY: return pdoc->IsReadOnly(); - case EM_CANPASTE: case SCI_CANPASTE: return CanPaste(); - case EM_CHARFROMPOS: { - if (lParam == 0) - return 0; - Point *ppt = reinterpret_cast<Point *>(lParam); - int pos = PositionFromLocation(*ppt); - int line = pdoc->LineFromPosition(pos); - return Platform::LongFromTwoShorts( - static_cast<short>(pos), static_cast < short > (line)); - } - - case EM_POSFROMCHAR: { - // The MS specs for this have changed 3 times: using the RichEdit 3 version - if (wParam == 0) - return 0; - Point *ppt = reinterpret_cast<Point *>(wParam); - if (lParam < 0) { - *ppt = Point(0, 0); - } else { - *ppt = LocationFromPosition(lParam); - } - return 0; - } - case SCI_POINTXFROMPOSITION: if (lParam < 0) { return 0; @@ -3906,14 +3713,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return pt.y; } - case EM_FINDTEXT: - return FindText(iMessage, wParam, lParam); - - case EM_FINDTEXTEX: case SCI_FINDTEXT: - return FindText(iMessage, wParam, lParam); + return FindText(wParam, lParam); - case EM_GETTEXTRANGE: case SCI_GETTEXTRANGE: { if (lParam == 0) return 0; @@ -3928,53 +3730,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return len; // Not including NUL } - - - 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; - Redraw(); - break; - - case EM_FORMATRANGE: case SCI_FORMATRANGE: return FormatRange(wParam, reinterpret_cast<RangeToFormat *>(lParam)); - case EM_GETMARGINS: - return Platform::LongFromTwoShorts(static_cast<short>(vs.leftMarginWidth), - static_cast<short>(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 = Platform::LowShortFromLong(lParam); - } - if (wParam & EC_RIGHTMARGIN) { - vs.rightMarginWidth = Platform::HighShortFromLong(lParam); - } - if (wParam == EC_USEFONTINFO) { - vs.leftMarginWidth = vs.aveCharWidth / 2; - vs.rightMarginWidth = vs.aveCharWidth / 2; - } - InvalidateStyleRedraw(); -#endif - break; - case SCI_SETMARGINLEFT: vs.leftMarginWidth = lParam; InvalidateStyleRedraw(); @@ -4661,7 +4425,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_CLEARCMDKEY: kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), - Platform::HighShortFromLong(wParam), WM_NULL); + Platform::HighShortFromLong(wParam), SCI_NULL); break; case SCI_CLEARALLCMDKEYS: diff --git a/src/Editor.h b/src/Editor.h index 658161088..a51fd86f9 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -296,7 +296,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void Indent(bool forwards); - long FindText(unsigned int iMessage, unsigned long wParam, long lParam); + long FindText(unsigned long wParam, long lParam); void SearchAnchor(); long SearchText(unsigned int iMessage, unsigned long wParam, long lParam); long SearchInTarget(const char *text, int length); diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index a26dcb9fd..ac826c0a7 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -668,15 +668,6 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam #endif return ::DefWindowProc(wMain.GetID(), iMessage, wParam, lParam); - case EM_CANPASTE: - return CanPaste(); - - case EM_SCROLL: { - int topStart = topLine; - ScrollMessage(wParam); - return MAKELONG(topLine - topStart, TRUE); - } - case WM_INPUTLANGCHANGE: //::SetThreadLocale(LOWORD(lParam)); return ::DefWindowProc(wMain.GetID(), iMessage, wParam, lParam); |