diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Document.h | 2 | ||||
| -rw-r--r-- | src/Editor.cxx | 157 | ||||
| -rw-r--r-- | src/Editor.h | 18 | ||||
| -rw-r--r-- | src/KeyMap.cxx | 98 | ||||
| -rw-r--r-- | src/KeyMap.h | 12 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 20 | ||||
| -rw-r--r-- | src/ScintillaBase.h | 4 | ||||
| -rw-r--r-- | src/WindowAccessor.cxx | 14 | 
8 files changed, 205 insertions, 120 deletions
| 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;  	}  } | 
