diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/Accessor.h | 76 | ||||
| -rw-r--r-- | include/KeyWords.h | 8 | ||||
| -rw-r--r-- | include/Platform.h | 394 | ||||
| -rw-r--r-- | include/PropSet.h | 180 | ||||
| -rw-r--r-- | include/SciLexer.h | 172 | ||||
| -rw-r--r-- | include/Scintilla.h | 415 | ||||
| -rw-r--r-- | include/WinDefs.h | 218 | 
7 files changed, 1463 insertions, 0 deletions
| diff --git a/include/Accessor.h b/include/Accessor.h new file mode 100644 index 000000000..1bba4af55 --- /dev/null +++ b/include/Accessor.h @@ -0,0 +1,76 @@ +// SciTE - Scintilla based Text Editor +// Accessor.h - rapid easy access to contents of a Scintilla +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +class Accessor { +protected: +	// bufferSize is a trade off between time taken to copy the characters and SendMessage overhead +	// slopSize positions the buffer before the desired position in case there is some backtracking +	enum {bufferSize=4000, slopSize=bufferSize/8}; +	char buf[bufferSize+1]; +	WindowID id; +	PropSet &props; +	int startPos; +	int endPos; +	int lenDoc; +	int offset;	// Optional but including an offset makes GCC generate better code  +	void Fill(int position); +public: +	Accessor(WindowID id_, PropSet &props_, int offset_=0) :  +			id(id_), props(props_), startPos(0x7FFFFFFF), endPos(0),  +			lenDoc(-1), offset(offset_) { +	} +	char operator[](int position) { +		position += offset; +		if (position < startPos || position >= endPos) { +			Fill(position); +		} +		return buf[position - startPos]; +	} +	char SafeGetCharAt(int position, char chDefault=' ') { +		// Safe version of operator[], returning a defined value for invalid position  +		position += offset; +		if (position < startPos || position >= endPos) { +			Fill(position); +			if (position < startPos || position >= endPos) { +				// Position is outside range of document  +				return chDefault; +			} +		} +		return buf[position - startPos]; +	} +	char StyleAt(int position); +	int GetLine(int position); +	int LineStart(int line); +	int LevelAt(int line); +	int Length(); +	void Flush() { +		startPos = 0x7FFFFFFF; +		lenDoc = -1; +	} +	int GetLineState(int line); +	int SetLineState(int line, int state); +	PropSet &GetPropSet() { return props; } +}; + +class StylingContext : public Accessor { +	char styleBuf[bufferSize]; +	int validLen; +	char chFlags; +	char chWhile; +	unsigned int startSeg; +public: +	StylingContext(WindowID id_, PropSet &props_, int offset_=0) :  +		Accessor(id_,props_,offset_), validLen(0), chFlags(0) {} +	void StartAt(unsigned int start, char chMask=31); +	void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; +	void ColourSegment(unsigned int start, unsigned int end, int chAttr); +	unsigned int GetStartSegment() { return startSeg; } +	void StartSegment(unsigned int pos); +	void ColourTo(unsigned int pos, int chAttr); +	int GetLine(int position); +	void SetLevel(int line, int level); +	void Flush(); +}; + diff --git a/include/KeyWords.h b/include/KeyWords.h new file mode 100644 index 000000000..2cc03b788 --- /dev/null +++ b/include/KeyWords.h @@ -0,0 +1,8 @@ +// SciTE - Scintilla based Text Editor +// KeyWords.h - colourise for particular languages +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +void ColouriseDoc(int codePage, int startPos, int lengthDoc, int initStyle,  +	int language, WordList *keywordlists[], StylingContext &styler); + diff --git a/include/Platform.h b/include/Platform.h new file mode 100644 index 000000000..b077e2e34 --- /dev/null +++ b/include/Platform.h @@ -0,0 +1,394 @@ +// Scintilla source code edit control +// Platform.h - interface to platform facilities +// Also includes some basic utilities +// Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef PLATFORM_H +#define PLATFORM_H + +// PLAT_GTK = GTK+ on Linux, PLAT_WIN = Win32 API on Win32 OS +// PLAT_WX is wxWindows on any supported platform +// Could also have PLAT_GTKWIN = GTK+ on Win32 OS in future + +#define PLAT_GTK 0 +#define PLAT_WIN 0 +#define PLAT_WX  0 + +#if defined(__WX__) +#undef PLAT_WX +#define PLAT_WX  1 + +#elif defined(GTK) +#undef PLAT_GTK +#define PLAT_GTK 1 + +#else +#undef PLAT_WIN +#define PLAT_WIN 1 + +#endif + + +// Include the main header for each platform + +#if PLAT_GTK +#include <gtk/gtk.h> +#include <gdk/gdkkeysyms.h> +#endif + +#if PLAT_WIN +#define _WIN32_WINNT  0x0400 // Otherwise some required stuff gets ifdef'd out +// Vassili Bourdo: shut up annoying Visual C++ warnings: +#ifdef _MSC_VER +#pragma warning(disable: 4800 4244 4309) +#endif +#include <windows.h> +#include <richedit.h> +#endif + +#if PLAT_WX +#include <wx/wx.h> +#endif + +// Underlying the implementation of the platform classes are platform specific types. +// Sometimes these need to be passed around by client code so they are defined here + +#if PLAT_GTK +typedef GdkColor ColourID; +typedef GdkFont* FontID; +typedef GdkDrawable* SurfaceID; +typedef GtkWidget* WindowID; +typedef GtkItemFactory* MenuID; +#endif + +#if PLAT_WIN +typedef COLORREF ColourID; +typedef HFONT FontID; +typedef HDC SurfaceID; +typedef HWND WindowID; +typedef HMENU MenuID; +#endif + +#if PLAT_WX +typedef wxColour ColourID; +typedef wxFont* FontID; +typedef wxDC* SurfaceID; +typedef wxWindow* WindowID; +typedef wxMenu* MenuID; +#endif + +#if PLAT_GTK || PLAT_WX +#define SHIFT_PRESSED 1 +#define LEFT_CTRL_PRESSED 2 +#define LEFT_ALT_PRESSED 4 +#endif + +// Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably + +class Point { +public: +	int x; +	int y; +	 +	Point(int x_=0, int y_=0) : x(x_), y(y_) { +	} + +	// Other automatically defined methods (assignment, copy constructor, destructor) are fine +	 +	static Point FromLong(long lpoint); +}; + +// PRectangle is exactly the same as the Win32 RECT so can be used interchangeably +// PRectangles contain their top and left sides, but not their right and bottom sides +class PRectangle { +public: +	int left; +	int top; +	int right; +	int bottom; + +	PRectangle(int left_=0, int top_=0, int right_=0, int bottom_ = 0) : +		left(left_), top(top_), right(right_), bottom(bottom_) { +	} + +	// Other automatically defined methods (assignment, copy constructor, destructor) are fine + +	bool Contains(Point pt) { +		return (pt.x >= left) && (pt.x <= right) && +			(pt.y >= top) && (pt.y <= bottom); +	} +	bool Contains(PRectangle rc) { +		return (rc.left >= left) && (rc.right <= right) && +			(rc.top >= top) && (rc.bottom <= bottom); +	} +	bool Intersects(PRectangle other) { +		return (right >= other.left) && (left <= other.right) && +			(bottom >= other.top) && (top <= other.bottom); +	} +	int Width() { return right - left; } +	int Height() { return bottom - top; } +}; + +#if PLAT_WX +wxRect wxRectFromPRectangle(PRectangle prc); +PRectangle PRectangleFromwxRect(wxRect rc); +#endif + +class Colour { +	ColourID co; +public: +	Colour(long lcol=0); +	Colour(unsigned int red, unsigned int green, unsigned int blue); +	bool operator==(const Colour &other) const; +	long AsLong() const; +	unsigned int GetRed(); +	unsigned int GetGreen(); +	unsigned int GetBlue(); +	 +	friend class Surface; +	friend class Palette; +}; + +// Colour pairs hold a desired colour and the colour that the graphics engine +// allocates to approximate the desired colour. +// To make palette management more automatic, ColourPairs could register at  +// construction time with a palette management object. +struct ColourPair { +	Colour desired; +	Colour allocated; + +	ColourPair(Colour desired_=Colour(0,0,0)) { +		desired = desired_; +		allocated = desired; +	} +}; + +class Window;	// Forward declaration for Palette + +class Palette { +	int used; +	enum {numEntries = 100}; +	ColourPair entries[numEntries]; +#if PLAT_GTK +	GdkColor *allocatedPalette; +	int allocatedLen; +#elif PLAT_WIN +	HPALETTE hpal; +#elif PLAT_WX +	// wxPalette* pal;  // **** Is this needed? +#endif +public: +	bool allowRealization; +	 +	Palette(); +	~Palette(); + +	void Release(); +	 +	// This method either adds a colour to the list of wanted colours (want==true) +	// or retrieves the allocated colour back to the ColourPair. +	// This is one method to make it easier to keep the code for wanting and retrieving in sync. +	void WantFind(ColourPair &cp, bool want); + +	void Allocate(Window &w); +	 +	friend class Surface; +}; + +class Font { +	FontID id; +#if PLAT_WX +	int ascent; +#endif +	// Private so Font objects can not be copied +	Font(const Font &) {} +	Font &operator=(const Font &) { id=0; return *this; } +public: +	Font(); +	~Font(); + +	void Create(const char *faceName, int size, bool bold=false, bool italic=false); +	void Release(); + +	FontID GetID() { return id; } +	// Alias another font - caller guarantees not to Release +	void SetID(FontID id_) { id = id_; } +	friend class Surface; +}; + +// A surface abstracts a place to draw +class Surface { +private: +#if PLAT_GTK +	GdkDrawable *drawable; +	GdkGC *gc; +	GdkPixmap *ppixmap; +	int x; +	int y; +	bool inited; +	bool createdGC; +#elif PLAT_WIN +	HDC hdc; +	bool hdcOwned; +	HPEN pen; +	HPEN penOld; +	HBRUSH brush; +	HBRUSH brushOld; +	HFONT font; +	HFONT fontOld; +	HBITMAP bitmap; +	HBITMAP bitmapOld; +	HPALETTE paletteOld; +#elif PLAT_WX +	wxDC* hdc; +	bool hdcOwned; +	wxBitmap* bitmap; +	int x; +	int y; +#endif + +	// Private so Surface objects can not be copied +	Surface(const Surface &) {} +	Surface &operator=(const Surface &) { return *this; } +#if PLAT_WIN || PLAT_WX +	void BrushColor(Colour back); +	void SetFont(Font &font_); +#endif +public: +	Surface(); +	~Surface(); +	 +	void Init(); +	void Init(SurfaceID hdc_); +	void InitPixMap(int width, int height, Surface *surface_); + +	void Release(); +	bool Initialised(); +	void PenColour(Colour fore); +	int LogPixelsY(); +	void MoveTo(int x_, int y_); +	void LineTo(int x_, int y_); +	void Polygon(Point *pts, int npts, Colour fore, Colour back); +	void RectangleDraw(PRectangle rc, Colour fore, Colour back); +	void FillRectangle(PRectangle rc, Colour back); +	void FillRectangle(PRectangle rc, Surface &surfacePattern); +	void RoundedRectangle(PRectangle rc, Colour fore, Colour back); +	void Ellipse(PRectangle rc, Colour fore, Colour back); +	void Copy(PRectangle rc, Point from, Surface &surfaceSource); + +	void DrawText(PRectangle rc, Font &font_, int ybase, const char *s, int len, Colour fore, Colour back); +	void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, Colour fore, Colour back); +	void MeasureWidths(Font &font_, const char *s, int len, int *positions); +	int WidthText(Font &font_, const char *s, int len); +	int WidthChar(Font &font_, char ch); +	int Ascent(Font &font_); +	int Descent(Font &font_); +	int InternalLeading(Font &font_); +	int ExternalLeading(Font &font_); +	int Height(Font &font_); +	int AverageCharWidth(Font &font_); +	 +	int SetPalette(Palette *pal, bool inBackGround); +	void SetClip(PRectangle rc); +}; + +// Class to hide the details of window manipulation +// Does not own the window which will normally have a longer life than this object +class Window { +	friend class ListBox; +protected: +	WindowID id; +public: +	Window() : id(0) {} +	virtual ~Window(); +	Window &operator=(WindowID id_) { +		id = id_; +		return *this; +	} +	WindowID GetID() { return id; } +	bool Created() { return id != 0; } +	void Destroy(); +	bool HasFocus(); +	PRectangle GetPosition(); +	void SetPosition(PRectangle rc); +	void SetPositionRelative(PRectangle rc, Window relativeTo); +	PRectangle GetClientPosition(); +	void Show(bool show=true); +	void InvalidateAll(); +	void InvalidateRectangle(PRectangle rc); +	void SetFont(Font &font); +	enum Cursor { cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow }; +	void SetCursor(Cursor curs); +	void SetTitle(const char *s); +#if PLAT_WIN +	LRESULT SendMessage(UINT msg, WPARAM wParam=0, LPARAM lParam=0); +	int GetDlgCtrlID(); +	HINSTANCE GetInstance(); +#endif +}; + +class ListBox : public Window { +#if PLAT_GTK +	WindowID list; +	WindowID scroller; +	int current; +#endif +public: +	ListBox(); +	virtual ~ListBox(); +	ListBox &operator=(WindowID id_) { +		id = id_; +		return *this; +	} +	void Create(Window &parent, int ctrlID); +	void Clear(); +	void Append(char *s); +	int Length(); +	void Select(int n); +	int GetSelection(); +	int Find(const char *prefix); +	void GetValue(int n, char *value, int len); +	void Sort(); +}; + +class Menu { +	MenuID id; +public: +	Menu(); +	MenuID GetID() { return id; } +	void CreatePopUp(); +	void Destroy(); +	void Show(Point pt, Window &w); +}; + +// Platform class used to retrieve system wide parameters such as double click speed +// and chrome colour. Not a creatable object, more of a module with several functions. +class Platform { +	// Private so Platform objects can not be copied +	Platform(const Platform &) {} +	Platform &operator=(const Platform &) { return *this; } +public: +	// Should be private because no new Platforms are ever created +	// but gcc warns about this +	Platform() {} +	~Platform() {} +	static Colour Chrome(); +	static Colour ChromeHighlight(); +	static const char *DefaultFont(); +	static int DefaultFontSize(); +	static unsigned int DoubleClickTime(); +	static void DebugDisplay(const char *s); +	static bool IsKeyDown(int key); +	static long SendScintilla( +		WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0); +	 +	// These are utility functions not really tied to a platform +	static int Minimum(int a, int b); +	static int Maximum(int a, int b); +	static void DebugPrintf(const char *format, ...); +	static int Clamp(int val, int minVal, int maxVal); +}; + +#endif diff --git a/include/PropSet.h b/include/PropSet.h new file mode 100644 index 000000000..31da01f95 --- /dev/null +++ b/include/PropSet.h @@ -0,0 +1,180 @@ +// SciTE - Scintilla based Text Editor +// PropSet.h - a java style properties file module +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef PROPSET_H +#define PROPSET_H + +bool EqualCaseInsensitive(const char *a, const char *b); + +// Define another string class. +// While it would be 'better' to use std::string, that doubles the executable size. + +inline char *StringDup(const char *s) { +	if (!s) +		return 0; +	char *sNew = new char[strlen(s) + 1]; +	if (sNew) +		strcpy(sNew, s); +	return sNew; +} + +class SString { +	char *s; +public: +	SString() { +		s = 0; +	} +	SString(const SString &source) { +		s = StringDup(source.s); +	} +	SString(const char *s_) { +		s = StringDup(s_); +	} +	SString(int i) { +		char number[100]; +		sprintf(number, "%0d", i); +		//itoa(i, number, 10); +		s = StringDup(number); +	} +	~SString() { +		delete []s; +		s = 0; +	} +	SString &operator=(const SString &source) { +		if (this != &source) { +			delete []s; +			s = StringDup(source.s); +		} +		return *this; +	} +	bool operator==(const SString &other) const { +		if ((s == 0) && (other.s == 0)) +			return true; +		if ((s == 0) || (other.s == 0)) +			return false; +		return strcmp(s, other.s) == 0; +	} +	bool operator==(const char *sother) const { +		if ((s == 0) && (sother == 0)) +			return true; +		if ((s == 0) || (sother == 0)) +			return false; +		return strcmp(s, sother) == 0; +	} +	const char *c_str() const { +		if (s) +			return s; +		else +			return ""; +	} +	int length() const { +		if (s) +			return strlen(s); +		else +			return 0; +	} +	char operator[](int i) { +		if (s) +			return s[i]; +		else +			return '\0'; +	} +	SString &operator +=(const char *sother) { +		int len = length(); +		int lenOther = strlen(sother); +		char *sNew = new char[len + lenOther + 1]; +		if (sNew) { +			if (s) +				memcpy(sNew, s, len); +			memcpy(sNew + len, sother, lenOther); +			sNew[len + lenOther] = '\0'; +			delete []s; +			s = sNew; +		} +		return *this; +	} +	int value() { +		if (s) +			return atoi(s); +		else  +			return 0; +	} +}; + +class PropSet { +private: +	char **vals; +	int size; +	int used; +public: +	PropSet *superPS; +	PropSet(); +	~PropSet(); +	void EnsureCanAddEntry(); +	void Set(const char *key, const char *val); +	void Set(char *keyval); +	SString Get(const char *key); +	int GetInt(const char *key, int defaultValue=0); +	SString GetWild(const char *keybase, const char *filename); +	SString GetNewExpand(const char *keybase, const char *filename); +	void Clear(); +	void ReadFromMemory(const char *data, int len); +	void Read(const char *filename); +}; + +// This is a fixed length list of strings suitable for display  in combo boxes +// as a memory of user entries +template<int sz> +class EntryMemory { +	SString entries[sz]; +public: +	void Insert(SString s) { +		for (int i=0;i<sz;i++) { +			if (entries[i] == s) { +				for (int j=i;j>0;j--) { +					entries[j] = entries[j-1]; +				} +				entries[0] = s; +				return; +			} +		} +		for (int k=sz-1;k>0;k--) { +			entries[k] = entries[k-1]; +		} +		entries[0] = s; +	} +	int Length() const { +		int len = 0; +		for (int i=0;i<sz;i++) +			if (entries[i].length()) +				len++; +		return len; +	} +	SString At(int n) const { +		return entries[n]; +	} +}; + +class WordList { +public: +	// Each word contains at least one character - a empty word acts as sentinal at the end. +	char **words; +	char *list; +	int len; +	bool onlyLineEnds;	// Delimited by any white space or only line ends +	int starts[256]; +	WordList(bool onlyLineEnds_ = false) :  +		words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {} +	~WordList() { Clear(); } +	operator bool() { return list; } +	const char *operator[](int ind) { return words[ind]; } +	void Clear(); +	void Set(const char *s); +	char *Allocate(int size); +	void SetFromAllocated(); +	bool InList(const char *s); +}; + +#endif diff --git a/include/SciLexer.h b/include/SciLexer.h new file mode 100644 index 000000000..f3f97b7ae --- /dev/null +++ b/include/SciLexer.h @@ -0,0 +1,172 @@ +// Scintilla source code edit control +// SciLexer - interface to the added lexer functions in the SciLexer version of the edit control +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SCILEXER_H +#define SCILEXER_H + +// SciLexer features - not in standard Scintilla + +#define SCLEX_CONTAINER 0 +#define SCLEX_NULL 1 +#define SCLEX_PYTHON 2 +#define SCLEX_CPP 3 +#define SCLEX_HTML 4 +#define SCLEX_XML 5 +#define SCLEX_PERL 6 +#define SCLEX_SQL 7 +#define SCLEX_VB 8 +#define SCLEX_PROPERTIES 9 +#define SCLEX_ERRORLIST 10 +#define SCLEX_MAKEFILE 11 +#define SCLEX_BATCH 12 + +// Lexical states for SCLEX_PYTHON +#define SCE_P_DEFAULT 0 +#define SCE_P_COMMENTLINE 1 +#define SCE_P_NUMBER 2 +#define SCE_P_STRING 3 +#define SCE_P_CHARACTER 4 +#define SCE_P_WORD 5 +#define SCE_P_TRIPLE 6 +#define SCE_P_TRIPLEDOUBLE 7 +#define SCE_P_CLASSNAME 8 +#define SCE_P_DEFNAME 9 +#define SCE_P_OPERATOR 10 +#define SCE_P_IDENTIFIER 11 +#define SCE_P_COMMENTBLOCK 12 +#define SCE_P_STRINGEOL 13 + +// Lexical states for SCLEX_CPP, SCLEX_VB +#define SCE_C_DEFAULT 0 +#define SCE_C_COMMENT 1 +#define SCE_C_COMMENTLINE 2 +#define SCE_C_COMMENTDOC 3 +#define SCE_C_NUMBER 4 +#define SCE_C_WORD 5 +#define SCE_C_STRING 6 +#define SCE_C_CHARACTER 7 +#define SCE_C_PUNTUATION 8 +#define SCE_C_PREPROCESSOR 9 +#define SCE_C_OPERATOR 10 +#define SCE_C_IDENTIFIER 11 +#define SCE_C_STRINGEOL 12 + +// Lexical states for SCLEX_HTML, SCLEX_xML +#define SCE_H_DEFAULT 0 +#define SCE_H_TAG 1 +#define SCE_H_TAGUNKNOWN 2 +#define SCE_H_ATTRIBUTE 3 +#define SCE_H_ATTRIBUTEUNKNOWN 4 +#define SCE_H_NUMBER 5 +#define SCE_H_DOUBLESTRING 6 +#define SCE_H_SINGLESTRING 7 +#define SCE_H_OTHER 8 +#define SCE_H_COMMENT 9 +#define SCE_H_ENTITY 10 +// XML and ASP +#define SCE_H_TAGEND 11 +#define SCE_H_XMLSTART 12 +#define SCE_H_XMLEND 13 +#define SCE_H_SCRIPT 14 +#define SCE_H_ASP 15 +#define SCE_H_ASPAT 16 +// Embedded Javascript +#define SCE_HJ_START 40 +#define SCE_HJ_DEFAULT 41 +#define SCE_HJ_COMMENT 42 +#define SCE_HJ_COMMENTLINE 43 +#define SCE_HJ_COMMENTDOC 44 +#define SCE_HJ_NUMBER 45 +#define SCE_HJ_WORD 46 +#define SCE_HJ_KEYWORD 47 +#define SCE_HJ_DOUBLESTRING 48 +#define SCE_HJ_SINGLESTRING 49 +#define SCE_HJ_SYMBOLS 50 +#define SCE_HJ_STRINGEOL 51 +// ASP Javascript +#define SCE_HJA_START 55 +#define SCE_HJA_DEFAULT 56 +#define SCE_HJA_COMMENT 57 +#define SCE_HJA_COMMENTLINE 58 +#define SCE_HJA_COMMENTDOC 59 +#define SCE_HJA_NUMBER 60 +#define SCE_HJA_WORD 61 +#define SCE_HJA_KEYWORD 62 +#define SCE_HJA_DOUBLESTRING 63 +#define SCE_HJA_SINGLESTRING 64 +#define SCE_HJA_SYMBOLS 65 +#define SCE_HJA_STRINGEOL 66 +// Embedded VBScript +#define SCE_HB_START 70 +#define SCE_HB_DEFAULT 71 +#define SCE_HB_COMMENTLINE 72 +#define SCE_HB_NUMBER 73 +#define SCE_HB_WORD 74 +#define SCE_HB_STRING 75 +#define SCE_HB_IDENTIFIER 76 +#define SCE_HB_STRINGEOL 77 +// ASP VBScript +#define SCE_HBA_START 80 +#define SCE_HBA_DEFAULT 81 +#define SCE_HBA_COMMENTLINE 82 +#define SCE_HBA_NUMBER 83 +#define SCE_HBA_WORD 84 +#define SCE_HBA_STRING 85 +#define SCE_HBA_IDENTIFIER 86 +#define SCE_HBA_STRINGEOL 87 +// Embedded Python +#define SCE_HP_START 90 +#define SCE_HP_DEFAULT 91 +#define SCE_HP_COMMENTLINE 92 +#define SCE_HP_NUMBER 93 +#define SCE_HP_STRING 94 +#define SCE_HP_CHARACTER 95 +#define SCE_HP_WORD 96 +#define SCE_HP_TRIPLE 97 +#define SCE_HP_TRIPLEDOUBLE 98 +#define SCE_HP_CLASSNAME 99 +#define SCE_HP_DEFNAME 100 +#define SCE_HP_OPERATOR 101 +#define SCE_HP_IDENTIFIER 102 +// ASP Python +#define SCE_HPA_START 105 +#define SCE_HPA_DEFAULT 106 +#define SCE_HPA_COMMENTLINE 107 +#define SCE_HPA_NUMBER 108 +#define SCE_HPA_STRING 109 +#define SCE_HPA_CHARACTER 110 +#define SCE_HPA_WORD 111 +#define SCE_HPA_TRIPLE 112 +#define SCE_HPA_TRIPLEDOUBLE 113 +#define SCE_HPA_CLASSNAME 114 +#define SCE_HPA_DEFNAME 115 +#define SCE_HPA_OPERATOR 116 +#define SCE_HPA_IDENTIFIER 117 + +// Lexical states for SCLEX_PERL +#define SCE_PL_DEFAULT 0 +#define SCE_PL_HERE 1 +#define SCE_PL_COMMENTLINE 2 +#define SCE_PL_POD 3 +#define SCE_PL_NUMBER 4 +#define SCE_PL_WORD 5 +#define SCE_PL_STRING 6 +#define SCE_PL_CHARACTER 7 +#define SCE_PL_PUNCTUATION 8 +#define SCE_PL_PREPROCESSOR 9 +#define SCE_PL_OPERATOR 10 +#define SCE_PL_IDENTIFIER 11 +#define SCE_PL_SCALAR 12 +#define SCE_PL_ARRAY 13 +#define SCE_PL_HASH 14 +#define SCE_PL_SYMBOLTABLE 15 +#define SCE_PL_REF 16 +#define SCE_PL_REGEX 17 +#define SCE_PL_REGSUBST 18 +#define SCE_PL_LONGQUOTE 19 +#define SCE_PL_BACKTICKS 20 +#define SCE_PL_DATASECTION 21 +     +#endif diff --git a/include/Scintilla.h b/include/Scintilla.h new file mode 100644 index 000000000..35b5ad2e2 --- /dev/null +++ b/include/Scintilla.h @@ -0,0 +1,415 @@ +// Scintilla source code edit control +// Scintilla.h - interface to the edit control +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SCINTILLA_H +#define SCINTILLA_H + +// Compile-time configuration options +#define MACRO_SUPPORT 1  // Comment out to remove macro hooks + +#if PLAT_GTK +#include <gdk/gdk.h> +#include <gtk/gtkvbox.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define SCINTILLA(obj)          GTK_CHECK_CAST (obj, scintilla_get_type (), ScintillaObject) +#define SCINTILLA_CLASS(klass)  GTK_CHECK_CLASS_CAS	T (klass, scintilla_get_type (), ScintillaClass) +#define IS_SCINTILLA(obj)       GTK_CHECK_TYPE (obj, scintilla_get_type ()) + +	typedef struct _ScintillaObject ScintillaObject; +	typedef struct _ScintillaClass  ScintillaClass; + +	struct _ScintillaObject +	{ +		GtkFixed vbox; +		void *pscin; +	}; + +	struct _ScintillaClass +	{ +		GtkFixedClass parent_class; + +		void (* command) (ScintillaObject *ttt); +		void (* notify) (ScintillaObject *ttt); +	}; + +	guint		scintilla_get_type	(void); +	GtkWidget*	scintilla_new		(void); +	void		scintilla_set_id	(ScintillaObject *sci,int id); +	long 		scintilla_send_message	(ScintillaObject *sci,int iMessage,int wParam,int lParam); + +#include "WinDefs.h" + +#ifdef __cplusplus +} +#endif + +#endif + +#if PLAT_WX +#include "WinDefs.h" +#endif + +// Both GTK and Windows + +#define INVALID_POSITION -1  + +// Define start of Scintilla messages to be greater than all edit (EM_*) messages +// as many EM_ messages can be used. +#define SCI_START 2000 +#define SCI_OPTIONAL_START 3000 +#define SCI_LEXER_START 4000 + +#define SCI_ADDTEXT SCI_START + 1 +#define SCI_ADDSTYLEDTEXT SCI_START + 2 +#define SCI_INSERTTEXT SCI_START + 3 +#define SCI_CLEARALL SCI_START + 4 +#define SCI_GETLENGTH SCI_START + 6 +#define SCI_GETCHARAT SCI_START + 7 +#define SCI_GETCURRENTPOS SCI_START + 8 +#define SCI_GETANCHOR SCI_START + 9 +#define SCI_GETSTYLEAT SCI_START + 10 + +#define SCI_REDO SCI_START + 11 +#define SCI_SETUNDOCOLLECTION SCI_START + 12 +#define SCI_SELECTALL SCI_START + 13 +#define SCI_SETSAVEPOINT SCI_START + 14 +#define SCI_GETSTYLEDTEXT SCI_START + 15 +#define SCI_CANREDO SCI_START + 16 +#define SCI_MARKERLINEFROMHANDLE SCI_START + 17 +#define SCI_MARKERDELETEHANDLE SCI_START + 18 + +#define SC_UNDOCOLLECT_NONE 0 +#define SC_UNDOCOLLECT_AUTOSTART 1 + +#define SCI_GETVIEWWS SCI_START + 20 +#define SCI_SETVIEWWS SCI_START + 21 +#define SCI_CHANGEPOSITION SCI_START + 22 +#define SCI_GOTOLINE SCI_START + 24 +#define SCI_GOTOPOS SCI_START + 25 +#define SCI_SETANCHOR SCI_START + 26 +#define SCI_GETCURLINE SCI_START + 27 +#define SCI_GETENDSTYLED SCI_START + 28 +#define SCI_CONVERTEOLS SCI_START + 29 + +#define SCI_GETEOLMODE SCI_START + 30 +#define SCI_SETEOLMODE SCI_START + 31 + +#define SC_EOL_CRLF 0 +#define SC_EOL_CR 1 +#define SC_EOL_LF 2 + +#define SCI_STARTSTYLING SCI_START + 32 +#define SCI_SETSTYLING SCI_START + 33 + +#define SCI_SETBUFFEREDDRAW SCI_START + 35 +#define SCI_SETTABWIDTH SCI_START + 36 +#define SCI_SETCODEPAGE SCI_START + 37 +#define SCI_SETUSEPALETTE SCI_START + 39 + +#define MARKER_MAX 31 + +#define SC_MARK_CIRCLE 0 +#define SC_MARK_ROUNDRECT 1 +#define SC_MARK_ARROW 2 +#define SC_MARK_SMALLRECT 3 +#define SC_MARK_SHORTARROW 4 +#define SC_MARK_EMPTY 5 +#define SC_MARK_ARROWDOWN 6 +#define SC_MARK_MINUS 7 +#define SC_MARK_PLUS 8 + +#define SCI_MARKERDEFINE SCI_START + 40 +#define SCI_MARKERSETFORE SCI_START + 41 +#define SCI_MARKERSETBACK SCI_START + 42 +#define SCI_MARKERADD SCI_START + 43 +#define SCI_MARKERDELETE SCI_START + 44 +#define SCI_MARKERDELETEALL SCI_START + 45 +#define SCI_MARKERGET SCI_START + 46 +#define SCI_MARKERNEXT SCI_START + 47 +#define SCI_MARKERPREVIOUS SCI_START + 48 + +#define SC_MARKNUM_FOLDER 30 +#define SC_MARKNUM_FOLDEROPEN 31 + +#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | (1<<SC_MARKNUM_FOLDEROPEN)) + +#define SC_MARGIN_SYMBOL 0 +#define SC_MARGIN_NUMBER 1 + +#define SCI_SETMARGINTYPEN SCI_START + 240 +#define SCI_GETMARGINTYPEN SCI_START + 241 +#define SCI_SETMARGINWIDTHN SCI_START + 242 +#define SCI_GETMARGINWIDTHN SCI_START + 243 +#define SCI_SETMARGINMASKN SCI_START + 244 +#define SCI_GETMARGINMASKN SCI_START + 245 +#define SCI_SETMARGINSENSITIVEN SCI_START + 246 +#define SCI_GETMARGINSENSITIVEN SCI_START + 247 + +#define STYLE_DEFAULT 32 +#define STYLE_LINENUMBER 33 +#define STYLE_BRACELIGHT 34 +#define STYLE_BRACEBAD 35 +#define STYLE_CONTROLCHAR 36 +#define STYLE_MAX 127 + +#define SCI_STYLECLEARALL SCI_START + 50 +#define SCI_STYLESETFORE SCI_START + 51 +#define SCI_STYLESETBACK SCI_START + 52 +#define SCI_STYLESETBOLD SCI_START + 53 +#define SCI_STYLESETITALIC SCI_START + 54 +#define SCI_STYLESETSIZE SCI_START + 55 +#define SCI_STYLESETFONT SCI_START + 56 +#define SCI_STYLESETEOLFILLED SCI_START + 57 +#define SCI_STYLERESETDEFAULT SCI_START + 58 + +#define SCI_SETSELFORE SCI_START + 67 +#define SCI_SETSELBACK SCI_START + 68 +#define SCI_SETCARETFORE SCI_START + 69 + +#define SCI_ASSIGNCMDKEY SCI_START + 70 +#define SCI_CLEARCMDKEY SCI_START + 71 +#define SCI_CLEARALLCMDKEYS SCI_START + 72 + +#define SCI_SETSTYLINGEX SCI_START + 73 + +#define SCI_GETCARETPERIOD SCI_START + 75 +#define SCI_SETCARETPERIOD SCI_START + 76 +#define SCI_SETWORDCHARS SCI_START + 77 + +#define SCI_BEGINUNDOACTION SCI_START + 78 +#define SCI_ENDUNDOACTION SCI_START + 79 + +#define INDIC_MAX 7 + +#define INDIC_PLAIN 0 +#define INDIC_SQUIGGLE 1 +#define INDIC_TT 2 + +#define INDIC0_MASK 32 +#define INDIC1_MASK 64 +#define INDIC2_MASK 128 +#define INDICS_MASK (INDIC0_MASK | INDIC1_MASK | INDIC2_MASK) + +#define SCI_INDICSETSTYLE SCI_START + 80 +#define SCI_INDICGETSTYLE SCI_START + 81 +#define SCI_INDICSETFORE SCI_START + 82 +#define SCI_INDICGETFORE SCI_START + 83 + +#define SCI_SETSTYLEBITS SCI_START + 90 +#define SCI_GETSTYLEBITS SCI_START + 91 +#define SCI_SETLINESTATE SCI_START + 92 +#define SCI_GETLINESTATE SCI_START + 93 +#define SCI_GETMAXLINESTATE SCI_START + 94 + +#define SCI_AUTOCSHOW SCI_START + 100 +#define SCI_AUTOCCANCEL SCI_START + 101 +#define SCI_AUTOCACTIVE SCI_START + 102 +#define SCI_AUTOCPOSSTART SCI_START + 103 +#define SCI_AUTOCCOMPLETE SCI_START + 104 +#define SCI_AUTOCSTOPS SCI_START + 105 + +#define SCI_CALLTIPSHOW SCI_START + 200 +#define SCI_CALLTIPCANCEL SCI_START + 201 +#define SCI_CALLTIPACTIVE SCI_START + 202 +#define SCI_CALLTIPPOSSTART SCI_START + 203 +#define SCI_CALLTIPSETHLT SCI_START + 204 +#define SCI_CALLTIPSETBACK SCI_START + 205 + +#define SC_FOLDLEVELBASE 0x400 +#define SC_FOLDLEVELWHITEFLAG 0x1000 +#define SC_FOLDLEVELHEADERFLAG 0x2000 +#define SC_FOLDLEVELNUMBERMASK 0x0FFF + +#define SCI_VISIBLEFROMDOCLINE SCI_START + 220 +#define SCI_DOCLINEFROMVISIBLE SCI_START + 221 +#define SCI_SETFOLDLEVEL SCI_START + 222 +#define SCI_GETFOLDLEVEL SCI_START + 223 +#define SCI_GETLASTCHILD SCI_START + 224 +#define SCI_GETFOLDPARENT SCI_START + 225 +#define SCI_SHOWLINES SCI_START + 226 +#define SCI_HIDELINES SCI_START + 227 +#define SCI_GETLINEVISIBLE SCI_START + 228 +#define SCI_SETFOLDEXPANDED SCI_START + 229 +#define SCI_GETFOLDEXPANDED SCI_START + 230 +#define SCI_TOGGLEFOLD SCI_START + 231 +#define SCI_ENSUREVISIBLE SCI_START + 232 +#define SCI_SETFOLDFLAGS SCI_START + 233 + +// Key messages +#define SCI_LINEDOWN SCI_START + 300 +#define SCI_LINEDOWNEXTEND SCI_START + 301 +#define SCI_LINEUP SCI_START + 302 +#define SCI_LINEUPEXTEND SCI_START + 303 +#define SCI_CHARLEFT SCI_START + 304 +#define SCI_CHARLEFTEXTEND SCI_START + 305 +#define SCI_CHARRIGHT SCI_START + 306 +#define SCI_CHARRIGHTEXTEND SCI_START + 307 +#define SCI_WORDLEFT SCI_START + 308 +#define SCI_WORDLEFTEXTEND SCI_START + 309 +#define SCI_WORDRIGHT SCI_START + 310 +#define SCI_WORDRIGHTEXTEND SCI_START + 311 +#define SCI_HOME SCI_START + 312 +#define SCI_HOMEEXTEND SCI_START + 313 +#define SCI_LINEEND SCI_START + 314 +#define SCI_LINEENDEXTEND SCI_START + 315 +#define SCI_DOCUMENTSTART SCI_START + 316 +#define SCI_DOCUMENTSTARTEXTEND SCI_START + 317 +#define SCI_DOCUMENTEND SCI_START + 318 +#define SCI_DOCUMENTENDEXTEND SCI_START + 319 +#define SCI_PAGEUP SCI_START + 320 +#define SCI_PAGEUPEXTEND SCI_START + 321 +#define SCI_PAGEDOWN SCI_START + 322 +#define SCI_PAGEDOWNEXTEND SCI_START + 323 +#define SCI_EDITTOGGLEOVERTYPE SCI_START + 324 +#define SCI_CANCEL SCI_START + 325 +#define SCI_DELETEBACK SCI_START + 326 +#define SCI_TAB SCI_START + 327 +#define SCI_BACKTAB SCI_START + 328 +#define SCI_NEWLINE SCI_START + 329 +#define SCI_FORMFEED SCI_START + 330 +#define SCI_VCHOME SCI_START + 331 +#define SCI_VCHOMEEXTEND SCI_START + 332 +#define SCI_ZOOMIN SCI_START + 333 +#define SCI_ZOOMOUT SCI_START + 334 +#define SCI_DELWORDLEFT SCI_START + 335 +#define SCI_DELWORDRIGHT SCI_START + 336 + +#define SCI_LINELENGTH SCI_START + 350 +#define SCI_BRACEHIGHLIGHT SCI_START + 351 +#define SCI_BRACEBADLIGHT SCI_START + 352 +#define SCI_BRACEMATCH SCI_START + 353 +#define SCI_GETVIEWEOL SCI_START + 355 +#define SCI_SETVIEWEOL SCI_START + 356 +#define SCI_GETDOCPOINTER SCI_START + 357 +#define SCI_SETDOCPOINTER SCI_START + 358 +#define SCI_SETMODEVENTMASK SCI_START + 359 + +#define EDGE_NONE 0 +#define EDGE_LINE 1 +#define EDGE_BACKGROUND 2 + +#define SCI_GETEDGECOLUMN SCI_START + 360 +#define SCI_SETEDGECOLUMN SCI_START + 361 +#define SCI_GETEDGEMODE SCI_START + 362 +#define SCI_SETEDGEMODE SCI_START + 363 +#define SCI_GETEDGECOLOUR SCI_START + 364 +#define SCI_SETEDGECOLOUR SCI_START + 365 + +#define SCI_SEARCHANCHOR SCI_START + 366 +#define SCI_SEARCHNEXT SCI_START + 367 +#define SCI_SEARCHPREV SCI_START + 368 + +#define CARET_SLOP 0x01    // Show caret within N lines of edge when it's scrolled to view +#define CARET_CENTER 0x02  // Center caret on screen when it's scrolled to view +#define CARET_STRICT 0x04  // OR this with CARET_CENTER to reposition even when visible, or +                           // OR this with CARET_SLOP to reposition whenever outside slop border + +#define SCI_SETCARETPOLICY SCI_START + 369 + +// GTK+ Specific +#define SCI_GRABFOCUS SCI_START + 400 + +// Optional module for macro recording +#ifdef MACRO_SUPPORT +typedef void (tMacroRecorder)(UINT iMessage, WPARAM wParam, LPARAM lParam,  +                              void *userData); +#define SCI_STARTRECORD SCI_OPTIONAL_START + 1 +#define SCI_STOPRECORD SCI_OPTIONAL_START + 2 +#endif + +#define SCI_SETLEXER SCI_LEXER_START + 1 +#define SCI_GETLEXER SCI_LEXER_START + 2 +#define SCI_COLOURISE SCI_LEXER_START + 3 +#define SCI_SETPROPERTY SCI_LEXER_START + 4 +#define SCI_SETKEYWORDS SCI_LEXER_START + 5 + +// Notifications + +// Type of modification and the action which caused the modification +// These are defined as a bit mask to make it easy to specify which notifications are wanted. +// One bit is set from each of SC_MOD_* and SC_PERFORMED_*. +#define SC_MOD_INSERTTEXT 0x1 +#define SC_MOD_DELETETEXT 0x2 +#define SC_MOD_CHANGESTYLE 0x4 +#define SC_MOD_CHANGEFOLD 0x8 +#define SC_PERFORMED_USER 0x10 +#define SC_PERFORMED_UNDO 0x20 +#define SC_PERFORMED_REDO 0x40 +#define SC_LASTSTEPINUNDOREDO 0x100 + +#define SC_MODEVENTMASKALL 0x377 + +struct SCNotification { +	NMHDR nmhdr; +	int position;			// SCN_STYLENEEDED, SCN_MODIFIED +	int ch;					// SCN_CHARADDED, SCN_KEY +	int modifiers;			// SCN_KEY +  	int modificationType;	// SCN_MODIFIED + 	const char *text;		// SCN_MODIFIED + 	int length;				// SCN_MODIFIED + 	int linesAdded;	// SCN_MODIFIED +#ifdef MACRO_SUPPORT +	int message;	// SCN_MACRORECORD +	int wParam;	// SCN_MACRORECORD +	int lParam;	// SCN_MACRORECORD +#endif +	int line;			// SCN_MODIFIED +	int foldLevelNow;	// SCN_MODIFIED +	int foldLevelPrev;	// SCN_MODIFIED +	int margin;	// SCN_MARGINCLICK +}; + +#define SCN_STYLENEEDED 2000 +#define SCN_CHARADDED 2001 +#define SCN_SAVEPOINTREACHED 2002 +#define SCN_SAVEPOINTLEFT 2003 +#define SCN_MODIFYATTEMPTRO 2004 +// GTK+ Specific to work around focus and accelerator problems: +#define SCN_KEY 2005 +#define SCN_DOUBLECLICK 2006 +#define SCN_UPDATEUI 2007 +// The old name for SCN_UPDATEUI: +#define SCN_CHECKBRACE 2007 +#define SCN_MODIFIED 2008 +// Optional module for macro recording +#ifdef MACRO_SUPPORT +#define SCN_MACRORECORD 2009 +#endif +#define SCN_MARGINCLICK 2010 +#define SCN_NEEDSHOWN 2011 + +#ifdef STATIC_BUILD +void Scintilla_RegisterClasses(HINSTANCE hInstance); +#endif + +// 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 + +#ifdef INCLUDE_DEPRECATED_FEATURES + +// Default style settings. These are deprecated and will be removed in a future version. +#define SCI_SETFORE SCI_START + 60 +#define SCI_SETBACK SCI_START + 61 +#define SCI_SETBOLD SCI_START + 62 +#define SCI_SETITALIC SCI_START + 63 +#define SCI_SETSIZE SCI_START + 64 +#define SCI_SETFONT SCI_START + 65 + +#define SCI_APPENDUNDOSTARTACTION SCI_START + 74 + +#define SC_UNDOCOLLECT_MANUALSTART 2 + +// Deprecated in release 1.22 +#define SCI_SETMARGINWIDTH SCI_START + 34 +#define SCI_SETLINENUMBERWIDTH SCI_START + 38 + +#endif + +#endif diff --git a/include/WinDefs.h b/include/WinDefs.h new file mode 100644 index 000000000..0b125e731 --- /dev/null +++ b/include/WinDefs.h @@ -0,0 +1,218 @@ +// Scintilla source code edit control +// WinDefs.h - the subset of definitions from Windows needed by Scintilla for GTK+ +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef WINDEFS_H +#define WINDEFS_H + +#define WORD short +#define WPARAM unsigned long +#define LPARAM long +#define LRESULT long +#define DWORD long + +#define UINT unsigned int +#define LPSTR char * +#define LONG long + +/* RTF control */ +#define EM_CANPASTE	(1074) +#define EM_CANUNDO	(198) +#define EM_CHARFROMPOS	(215) +#define EM_DISPLAYBAND	(1075) +#define EM_EMPTYUNDOBUFFER	(205) +#define EM_EXGETSEL	(1076) +#define EM_EXLIMITTEXT	(1077) +#define EM_EXLINEFROMCHAR	(1078) +#define EM_EXSETSEL	(1079) +#define EM_FINDTEXT	(1080) +#define EM_FINDTEXTEX	(1103) +#define EM_FINDWORDBREAK	(1100) +#define EM_FMTLINES	(200) +#define EM_FORMATRANGE	(1081) +#define EM_GETCHARFORMAT	(1082) +#define EM_GETEVENTMASK	(1083) +#define EM_GETFIRSTVISIBLELINE	(206) +#define EM_GETHANDLE	(189) +#define EM_GETLIMITTEXT	(213) +#define EM_GETLINE	(196) +#define EM_GETLINECOUNT	(186) +#define EM_GETMARGINS	(212) +#define EM_GETMODIFY	(184) +#define EM_GETIMECOLOR	(1129) +#define EM_GETIMEOPTIONS	(1131) +#define EM_GETOPTIONS	(1102) +#define EM_GETOLEINTERFACE	(1084) +#define EM_GETPARAFORMAT	(1085) +#define EM_GETPASSWORDCHAR	(210) +#define EM_GETPUNCTUATION	(1125) +#define EM_GETRECT	(178) +#define EM_GETSEL	(176) +#define EM_GETSELTEXT	(1086) +#define EM_GETTEXTRANGE	(1099) +#define EM_GETTHUMB	(190) +#define EM_GETWORDBREAKPROC	(209) +#define EM_GETWORDBREAKPROCEX	(1104) +#define EM_GETWORDWRAPMODE	(1127) +#define EM_HIDESELECTION	(1087) +#define EM_LIMITTEXT	(197) +#define EM_LINEFROMCHAR	(201) +#define EM_LINEINDEX	(187) +#define EM_LINELENGTH	(193) +#define EM_LINESCROLL	(182) +#define EM_PASTESPECIAL	(1088) +#define EM_POSFROMCHAR	(214) +#define EM_REPLACESEL	(194) +#define EM_REQUESTRESIZE	(1089) +#define EM_SCROLL	(181) +#define EM_SCROLLCARET	(183) +#define EM_SELECTIONTYPE	(1090) +#define EM_SETBKGNDCOLOR	(1091) +#define EM_SETCHARFORMAT	(1092) +#define EM_SETEVENTMASK	(1093) +#define EM_SETHANDLE	(188) +#define EM_SETIMECOLOR	(1128) +#define EM_SETIMEOPTIONS	(1130) +#define EM_SETLIMITTEXT	(197) +#define EM_SETMARGINS	(211) +#define EM_SETMODIFY	(185) +#define EM_SETOLECALLBACK	(1094) +#define EM_SETOPTIONS	(1101) +#define EM_SETPARAFORMAT	(1095) +#define EM_SETPASSWORDCHAR	(204) +#define EM_SETPUNCTUATION	(1124) +#define EM_SETREADONLY	(207) +#define EM_SETRECT	(179) +#define EM_SETRECTNP	(180) +#define EM_SETSEL	(177) +#define EM_SETTABSTOPS	(203) +#define EM_SETTARGETDEVICE	(1096) +#define EM_SETWORDBREAKPROC	(208) +#define EM_SETWORDBREAKPROCEX	(1105) +#define EM_SETWORDWRAPMODE	(1126) +#define EM_STREAMIN	(1097) +#define EM_STREAMOUT	(1098) +#define EM_UNDO	(199) + +#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) + +#define EN_CHANGE	(768) +#define EN_KILLFOCUS (512) +#define EN_SETFOCUS (256) + +#define EC_LEFTMARGIN 1 +#define EC_RIGHTMARGIN 2 +#define EC_USEFONTINFO 0xffff + +#if PLAT_GTK +#define VK_DOWN GDK_Down +#define VK_UP GDK_Up +#define VK_LEFT GDK_Left +#define VK_RIGHT GDK_Right +#define VK_HOME GDK_Home +#define VK_END GDK_End +#define VK_PRIOR GDK_Page_Up +#define VK_NEXT GDK_Page_Down +#define VK_DELETE GDK_Delete +#define VK_INSERT GDK_Insert +#define VK_ESCAPE GDK_Escape +#define VK_BACK GDK_BackSpace +#define VK_TAB GDK_Tab +#define VK_RETURN GDK_Return +#define VK_ADD GDK_KP_Add +#define VK_SUBTRACT GDK_KP_Subtract +#endif + +#if PLAT_WX +#define VK_DOWN         WXK_DOWN +#define VK_UP           WXK_UP +#define VK_LEFT         WXK_LEFT +#define VK_RIGHT        WXK_RIGHT +#define VK_HOME         WXK_HOME +#define VK_END          WXK_END +#define VK_PRIOR        WXK_PRIOR +#define VK_NEXT         WXK_NEXT +#define VK_DELETE       WXK_DELETE +#define VK_INSERT       WXK_INSERT +#define VK_ESCAPE       WXK_ESCAPE +#define VK_BACK         WXK_BACK +#define VK_TAB          WXK_TAB +#define VK_RETURN       WXK_RETURN +#define VK_ADD          WXK_ADD +#define VK_SUBTRACT     WXK_SUBTRACT + +// Are these needed any more +#define LPSTR char * +#define LONG long +#define LPDWORD (long *) +#endif + +/* SELCHANGE structure */ +#define SEL_EMPTY	(0) +#define SEL_TEXT	(1) +#define SEL_OBJECT	(2) +#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; +	LONG right; +	LONG bottom; +}; + +struct CHARRANGE { +	LONG cpMin; +	LONG cpMax; +}; + +struct TEXTRANGE { +	CHARRANGE chrg; +	LPSTR lpstrText; +}; + +struct FINDTEXTEX { +	CHARRANGE chrg; +	LPSTR lpstrText; +	CHARRANGE chrgText; +}; + +struct NMHDR { +	WindowID hwndFrom; +	UINT idFrom; +	UINT code; +}; + +struct FORMATRANGE { +	SurfaceID hdc; +	SurfaceID hdcTarget; +	RECT rc; +	RECT rcPage; +	CHARRANGE chrg; +}; + +#define MAKELONG(a, b) ((a) | ((b) << 16)) +#define LOWORD(x) (x & 0xffff) +#define HIWORD(x) (x >> 16) + +#endif | 
