From 8eba2a95b6aa25489c28eabfcd54e0389de78899 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 8 Mar 2000 01:36:00 +0000 Subject: Initial revision --- License.txt | 20 + README | 33 ++ bin/empty.txt | 1 + doc/Design.html | 247 ++++++++++++ doc/SciRest.jpg | Bin 0 -> 66 bytes doc/SciTEIco.png | 1 + doc/SciWord.jpg | Bin 0 -> 949 bytes doc/ScintillaDoc.html | 966 +++++++++++++++++++++++++++++++++++++++++++++ doc/ScintillaDownload.html | 83 ++++ doc/ScintillaHistory.html | 627 +++++++++++++++++++++++++++++ doc/ScintillaRelated.html | 113 ++++++ doc/ScintillaToDo.html | 124 ++++++ doc/ScintillaUsage.html | 375 ++++++++++++++++++ doc/index.html | 147 +++++++ gtk/PlatGTK.cxx | 751 +++++++++++++++++++++++++++++++++++ gtk/makefile | 69 ++++ tgzsrc | 5 + zipsrc.bat | 4 + 18 files changed, 3566 insertions(+) create mode 100644 License.txt create mode 100644 README create mode 100644 bin/empty.txt create mode 100644 doc/Design.html create mode 100644 doc/SciRest.jpg create mode 100644 doc/SciTEIco.png create mode 100644 doc/SciWord.jpg create mode 100644 doc/ScintillaDoc.html create mode 100644 doc/ScintillaDownload.html create mode 100644 doc/ScintillaHistory.html create mode 100644 doc/ScintillaRelated.html create mode 100644 doc/ScintillaToDo.html create mode 100644 doc/ScintillaUsage.html create mode 100644 doc/index.html create mode 100644 gtk/PlatGTK.cxx create mode 100644 gtk/makefile create mode 100644 tgzsrc create mode 100755 zipsrc.bat diff --git a/License.txt b/License.txt new file mode 100644 index 000000000..4c7deb821 --- /dev/null +++ b/License.txt @@ -0,0 +1,20 @@ +License for Scintilla and SciTE + +Copyright 1998-2000 by Neil Hodgson + +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. + +NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/README b/README new file mode 100644 index 000000000..0ac4f1ff1 --- /dev/null +++ b/README @@ -0,0 +1,33 @@ +README for building of Scintilla and SciTE + + +*** GTK+/Linux version *** + +You must first have GTK+ 1.2x and GCC (2.8 or better) installed. +GTK+ 1.0x will not work and when it did it was very slow. +Other C++ compilers may work but may require tweaking the make file. + +To build SciTE for GTK+/Linux, use the Makefile_gtk like this: + + make -f Makefile_gtk + +The current make file only supports static linking between SciTE and Scintilla. + +The SciTEGTK.properties file is better than the SciTEGlobal.properties for use +on Linux/GTK+ as it specifies fonts that are likely to be installed. +SciTE reads its SciTEGlobal.properties file from the user's home directory. + + +*** Windows version *** + +A C++ compiler is required. Mingw32 GCC 2.9.5 is the compiler used +for most development although Visual C++ is also supported. + +To compile with GCC, use make on the "makefile" file. + + make + +To compile with VC++, use nmake on the "makefile_vc" file. + + nmake /f makefile_vc + diff --git a/bin/empty.txt b/bin/empty.txt new file mode 100644 index 000000000..66183855a --- /dev/null +++ b/bin/empty.txt @@ -0,0 +1 @@ +This empty files ensures that the directory is created. \ No newline at end of file diff --git a/doc/Design.html b/doc/Design.html new file mode 100644 index 000000000..d6fd6ee06 --- /dev/null +++ b/doc/Design.html @@ -0,0 +1,247 @@ + + + + + + + + + Scintilla and SciTE + + + + + + + + +
+ Scintilla icon + + Scintilla + Component Design +
+

+ Top level structure +

+

+ Scintilla consists of three major layers of C++ code +

+ +

+ The primary purpose of this structure is to separate the platform dependent code from the + platform independent core code. This makes it easier to port Scintilla to a new platform and + ensures that most readers of the code do not have to deal with platform details. To minimise + portability problems and avoid code bloat, a conservative subset of C++ is used in Scintilla + with no exception handling, templates, run time type information or use of the standard C++ + library. +

+

+ The currently supported platforms, Windows and GTK+/Linux are fairly similar in many ways. + Each has windows, menus and bitmaps. These features generally work in similar ways so each + has a way to move a window or draw a red line. Sometimes one platform requires a sequence of + calls rather than a single call. At other times, the differences are more profound. Reading + the Windows clipboard occurs synchronously but reading the GTK+ clipboard requires a request + call that will be asynchronously answered with a message containing the clipboard data. +

+
+

+ Portability Library +

+

+ This is a fairly small and thin layer over the platform's native capabilities. +

+

+ The portability library is defined in Platform.h and is implemented once for each platform. + PlatWin.cxx defines the Windows variants of the methods and PlatGTK.cxx the GTK+ variants. +

+

+ Several of the classes here hold platform specific object identifiers and act as proxies to + these platform objects. Most client code can thus manipulate the platform objects without + caring which is the current platform. Sometimes client code needs access to the underlying + object identifiers and this is provided by the GetID method. The underlying types of the + platform specific identifiers are typedefed to common names to allow them to be transferred + around in client code where needed. +

+

+ Point, PRectangle +

+

+ These are simple classes provided to hold the commonly used geometric primitives. A + PRectangle follows the Mac / Windows convention of not including its bottom and right sides + instead of including all its sides as is normal in GTK+. It is not called Rectangle as this may be + the name of a macro on Windows. +

+

+ Colour, ColourPair, Palette +

+

+ Colour holds a platform specific colour identifier - COLORREF for Windows and GdkColor for + GTK+. The red, green and blue components that make up the colour are limited to the 8 bits of + precision available on Windows. ColourPairs are used because not all possible colours are + always available. Using an 8 bit colour mode, which is a common setting for both Windows and + GTK+, only 256 colours are possible on the display. Thus when an application asks for a dull + red, say #400000, it may only be allocated an already available colour such as #800000 or + #330000. With 16 or 2 colour modes even less choice is available and the application will + have to use the limited set of already available colours. +

+ A Palette object holds a set of colour pairs and can make the appropriate calls to ask to + allocate these colours and to see what the platform has decided will be allowed. +

+ Font +

+

+ Font holds a platform specific font identifier - HFONT for Windows, GdkFont* for GTK+. It + does not own the identifier and so will not delete the platform font object in its + destructor. Client code should call Destroy at appropriate times. +

+

+ Surface +

+

+ Surface is an abstraction over each platform's concept of somewhere that graphical drawing + operations can be done. It may wrap an already created drawing place such as a window or be + used to create a bitmap that can be drawn into and later copied onto another surface. On + Windows it wraps a HDC and possibly a HBITMAP. On GTK+ it wraps a GdkDrawable* and possibly a + GdkPixmap*. Other platform specific objects are created (and correctly destroyed) whenever + required to perform drawing actions. +

+

+ Drawing operations provided include drawing filled and unfilled polygons, lines, rectangles, + ellipses and text. The height and width of text as well as other details can be measured. + Operations can be clipped to a rectangle. Most of the calls are stateless with all parameters + being passed at each call. The exception to this is line drawing which is performed by + calling MoveTo and then LineTo. +

+

+ Window +

+

+ Window acts as a proxy to a platform window allowing operations such as showing, moving, + redrawing, and destroying to be performed. It contains a platform specific window identifier + - HWND for Windows, GtkWidget* for GTK+. +

+

+ ListBox +

+

+ ListBox is a subclass of Window and acts as a proxy to a platform listbox adding methods for + operations such as adding, retrieving, and selecting items. +

+

+ Menu +

+

+ Menu is a small helper class for constructing popup menus. It contains the platform specific + menu identifier - HMENU for Windows, GtkItemFactory* for GTK+. Most of the work in + constructing menus requires access to platform events and so is done in the Platform Events + and API layer. +

+

+ Platform +

+

+ The Platform class is used to access the facilities of the platform. System wide parameters + such as double click speed and chrome colour are available from Platform. Utility functions + such as DebugPrintf are also available from Platform. +

+

+ Core Code +

+

+ The bulk of Scintilla's code is platform independent. This is made up of the CellBuffer, + ContractionState, Document, Editor, Indicator, LineMarker, Style, ViewStyle, KeyMap, + ScintillaBase, CallTip, + and AutoComplete primary classes. +

+

+ CellBuffer +

+

+ A CellBuffer holds text and styling information, the undo stack, the assignment of line + markers to lines, and the fold structure. +

+

+ A cell contains a character byte and its associated style byte. The current state of the + cell buffer is the sequence of cells that make up the text and a sequence of line information + containing the starting position of each line and any markers assigned to each line. +

+

+ The undo stack holds a sequence of actions on the cell buffer. Each action is one of a text + insertion, a text deletion or an undo start action. The start actions are used to group + sequences of text insertions and deletions together so they can be undone together. To + perform an undo operation, each insertion or deletion is undone in reverse sequence. + Similarly, redo reapplies each action to the buffer in sequence. Whenever a character is + inserted in the buffer either directly through a call such as InsertString or through undo or + redo, its styling byte is initially set to zero. Client code is responsible for styling each + character whenever convenient. Styling information is not stored in undo actions. +

+

+ Document +

+

+ A document contains a CellBuffer and deals with some higher level abstractions such as + words, DBCS character sequences and line end character sequences. It is responsible for + managing the styling process and for notifying other objects when changes occur to the + document. +

+

+ Editor +

+

+ The Editor object is central to Scintilla. It is responsible for displaying a document and + responding to user actions and requests from the container. It uses ContractionState, Indicator, + LineMarker, Style, and ViewStyle objects to display the document and a KeyMap class to + map key presses to functions. + The visibility of each line is kept in the ContractionState which is also responsible for mapping + from display lines to documents lines and vice versa. +

+

+ There may be multiple Editor objects attached to one Document object. Changes to a + document are broadcast to the editors through the DocWatcher mechanism. +

+

+ ScintillaBase +

+

+ ScintillaBase is a subclass of Editor and adds extra windowing features including display of + calltips, autocompletion lists and context menus. These features use CallTip and AutoComplete + objects. This class is optional so a lightweight implementation of Scintilla may bypass it if + the added functionality is not required. +

+

+ Platform Events and API +

+

+ Each platform uses different mechanisms for receiving events. On Windows, events are + received through messages and COM. On GTK+, callback functions are used. +

+

+ For each platform, a class is derived from ScintillaBase (and thus from Editor). This is + ScintillaWin on Windows and ScintillaGTK on GTK+. These classes are responsible for + connecting to the platforms event mechanism and also to implement some virtual methods in + Editor and ScintillaBase which are different on the platforms. For example, this layer has to + support this difference between the synchronous Windows clipboard and the asynchronous GTK+ + clipboard. +

+

+ The external API is defined in this layer as each platform has different preferred styles of + API - messages on Windows and function calls on GTK+. This also allows multiple APIs to be + defined on a platform. The currently available API on GTK+ is similar to the Windows API and + does not follow platform conventions well. A second API could be implemented here that did + follow platform conventions. +

+ + + diff --git a/doc/SciRest.jpg b/doc/SciRest.jpg new file mode 100644 index 000000000..2ddd0425d Binary files /dev/null and b/doc/SciRest.jpg differ diff --git a/doc/SciTEIco.png b/doc/SciTEIco.png new file mode 100644 index 000000000..f1ad7558e --- /dev/null +++ b/doc/SciTEIco.png @@ -0,0 +1 @@ +‰PNG diff --git a/doc/SciWord.jpg b/doc/SciWord.jpg new file mode 100644 index 000000000..e43a9bfce Binary files /dev/null and b/doc/SciWord.jpg differ diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html new file mode 100644 index 000000000..95f95a7e3 --- /dev/null +++ b/doc/ScintillaDoc.html @@ -0,0 +1,966 @@ + + + + + + + + + Scintilla and SciTE + + + + + + + + +
+ Scintilla icon + + + Scintilla +
+

+ Scintilla Documentation +

+

+ There is an overview of the internal design of Scintilla. +

+

+ Some notes on using Scintilla. +

+

+ For now, the best way to work out how to develop using Scintilla is to see how SciTE uses + it. SciTE exercises most of Scintilla's facilities. +

+

+ The Windows version of Scintilla is a Windows Control. As such, its primary programming + interface is through Windows messages. It responds to many of the messages defined for the + standard Edit and Richedit controls as well as a suite of its own for controlling syntax + styling, markers, auto-completion and call tips. +

+ The GTK+ version also uses messages in a similar way to the Windows version. This is different + to normal GTK+ practice but made it easier to implement rapidly. +

+ The messages are (with wParam and lParam use) +

+

+ Text retrieval and modification. +

+
+WM_GETTEXT(int length, char *text)
+WM_SETTEXT(<unused>, char *text)
+EM_GETLINE(int line, char *text)
+EM_REPLACESEL(<unused>, char *text)
+EM_SETREADONLY
+EM_GETTEXTRANGE(<unused>, TEXTRANGE *tr)
+SCI_ADDTEXT(char *s, int length)
+SCI_ADDSTYLEDTEXT(cell *s,int length)
+SCI_INSERTTEXT(int pos, char *text)
+SCI_CLEARALL
+SCI_GETCHARAT(int position)
+SCI_GETSTYLEAT(int position)
+SCI_GETSTYLEDTEXT(<unused>, TEXTRANGE *tr)
+SCI_SETSTYLEBITS(int bits)
+SCI_GETSTYLEBITS
+
+

+ Each character in a Scintilla document is followed by an associated byte of styling + information. The combination of a character byte and a style byte is called a cell. Style + bytes are interpreted as a style index in the low 5 bits and as 3 individual bits of + indicators. This allows 32 fundamental styles which is enough for most languages and three + independent indicators so that, for example, syntax errors, deprecated names and bad + indentation could all be displayed at once. Indicators may be displayed as simple underlines, + squiggly underlines or a line of small 'T' shapes. Additional indicators such as strike-out + or blurred could be defined in the future. The number of bits used for styles can be altered + with SCI_SETSTYLEBITS up to a maximum of 6 bits. + The remaining bits can be used for indicators. +

+

+ Positions within the Scintilla document refer to a character or the gap before that + character. The caret exists between character positions and can be located from before the + first character to after the last character. There are places where the caret can not go + where two character bytes make up one character. This occurs when a DBCS character from a + language like Japanese is included in the document or when line ends are marked with the CP/M + standard of a carriage return followed by a line feed. The INVALID_POSITION constant (-1) + represent an invalid position within the document. +

+

+ All lines of text in Scintilla are the same height, and this height is calculated from the + largest font in any current style. This restriction is for performance as if lines differed + in height then calculations involving positioning of text would require that text to be + styled first. +

+

+ Standard commands +

+
+WM_CUT
+WM_COPY
+WM_PASTE
+WM_CLEAR
+
+

+ Undo and Redo +

+
+WM_UNDO
+EM_CANUNDO
+EM_EMPTYUNDOBUFFER
+SCI_REDO
+SCI_CANREDO
+SCI_SETUNDOCOLLECTION(SC_UNDOCOLLECT_NONE | SC_UNDOCOLLECT_AUTOSTART | SC_UNDOCOLLECT_MANUALSTART)
+SCI_BEGINUNDOACTION
+SCI_ENDUNDOACTION
+SCI_APPENDUNDOSTARTACTION
+
+

+ Scintilla has multiple level undo and redo. It will continue to collect undoable actions + until memory runs out. Sequences of typing or deleting are compressed into single actions to + make it easier to undo and redo at a sensible level of detail. Sequences of actions can be + combined into actions that are undone as a unit. These sequences occur between + SCI_BEGINUNDOACTION and SCI_ENDUNDOACTION messages. These sequences can be nested and only + the top level sequences are undone as units.
+ If undo collection is put into manual mode, then the SCI_APPENDUNDOSTARTACTION message + finishes any current sequence and starts a new sequence. This message and the corresponding + SC_UNDOCOLLECT_MANUALSTART are deprecated and only included for backward compatibility. +

+

+ Selection and information +

+
+WM_GETTEXTLENGTH
+EM_GETFIRSTVISIBLELINE
+EM_GETLINECOUNT
+EM_GETMODIFY
+EM_SETMODIFY(bool ismodified)
+EM_GETRECT(RECT *rect)
+EM_GETSEL(int *start, int *end)
+EM_EXGETSEL(<unused>, CHARRANGE *cr)
+EM_SETSEL(int start, int end)
+EM_EXSETSEL(<unused>, CHARRANGE *cr)
+EM_GETSELTEXT(<unused>, char *text)
+EM_LINEFROMCHAR(int position)
+EM_EXLINEFROMCHAR(int position)
+EM_LINEINDEX(int line)
+EM_LINELENGTH(int position)
+EM_SCROLL(int line)
+EM_LINESCROLL(int column, int line)
+EM_SCROLLCARET()
+EM_CANPASTE
+EM_CHARFROMPOS(<unused>, POINT *location)
+EM_POSFROMCHAR(int position, POINT *location)
+EM_SELECTIONTYPE
+EM_HIDESELECTION(bool hide)
+SCI_GETLENGTH
+SCI_GETCURRENTPOS
+SCI_GETANCHOR
+SCI_SELECTALL
+SCI_CHANGEPOSITION(int delta, bool extendselection)
+SCI_PAGEMOVE(int cmdkey, bool extendselection)
+SCI_GOTOLINE(int line)
+SCI_GOTOPOS(int position)
+SCI_SETANCHOR(int position)
+SCI_GETCURLINE(int textlen, char *text)
+SCI_LINELENGTH(int line)
+SCI_SETCARETPOLICY(int policy)
+
+

+ Scintilla maintains a selection which stretches between two points, the anchor and the + current position. +

+

+ EM_SETMODIFY is no longer supported as whether the document is modified is determined by + whether the undo position is at the save point. +

+

+ SCI_GETCURLINE retrieves the text of the line containing the caret and returns the position + within the line of the caret. +

+

+ Searching +

+
+EM_FINDTEXT(int flags, FINDTEXTEX *ft)
+EM_FINDTEXTEX(int flags, FINDTEXTEX *ft)
+
+

+ Scintilla can find where a string is present in its document. +

+
+SCI_SEARCHANCHOR
+SCI_SEARCHNEXT(int flags, char *text)
+SCI_SEARCHPREV(int flags, char *text)
+
+

+ Relocatable search support. This allows + multiple incremental interactive searches to be macro recorded + while still setting the selection to found text so the find/select + operation is self-contained. +

+

+ Visible white space +

+
+SCI_GETVIEWWS
+SCI_SETVIEWWS(bool visisble)
+
+

+ White space can be made visible which may useful for languages in which whitespace is + significant, such as Python. Space characters appear as small centred dots and tab characters + as light arrows pointing to the right. +

+

+ Line endings +

+
+SCI_GETEOLMODE
+SCI_SETEOLMODE(SC_EOL_CRLF or SC_EOL_CR or SC_EOL_LF)
+SCI_GETVIEWEOL
+SCI_SETVIEWEOL(bool visible)
+SCI_CONVERTEOLS(SC_EOL_CRLF or SC_EOL_CR or SC_EOL_LF)
+
+

+ Scintilla can interpret any of the three major line end conventions, Macintosh (\r), Unix + (\n) and CP/M / DOS / Windows (\r\n). When the user presses the Enter key, one of these line + end strings is inserted into the buffer. The default is \r\n, but this can be changed with + the SCI_SETEOLMODE message taking a an argument of SC_EOL_CRLF, SC_EOL_CR, or SC_EOL_LF. The + SCI_GETEOLMODE message retrieves the current state. +

+

+ The characters that make up line ends can be made visible with the view EOL option. This + looks similar to (CR), (LF), or (CR)(LF). +

+

+ All of the line ends in the document may be changed by calling SCI_CONVERTEOLS with the + desired line ending. +

+

+ Styling +

+
+SCI_GETENDSTYLED
+SCI_STARTSTYLING(int position, int mask)
+SCI_SETSTYLING(int length, int style)
+SCI_SETSTYLINGEX(int length, stylesequence *s)
+
+

+ Scintilla keeps a record of the last character that is likely to be styled correctly. This + is moved forwards when characters after it are styled and moved backwards if changes are made + to the text of the document before it. Before drawing text, this position is checked to see + if any styling is needed and a notification message sent to the container if so. The + container can send SCI_GETENDSTYLED to work out where it needs to start styling. +

+

+ To perform the actual styling, SCI_STARTSTYLING is sent with the position to start at and a + mask indicating which bits of the style bytes can be set. The mask allows styling to occur + over several passes, with, for example, basic styling done on an initial pass to ensure that + the text of the code is seen quickly and correctly, and then a second slower pass, detecting + syntax errors and using indicators to show where these are. After SCI_STARTSTYLING, multiple + SCI_SETSTYLING messages are sent for each lexical entity to be styled. +

+

+ Style Definition +

+
+SCI_STYLECLEARALL
+SCI_STYLERESETDEFAULT
+SCI_STYLESETFORE(int stylenumber, int colour)
+SCI_STYLESETBACK(int stylenumber, int colour)
+SCI_STYLESETBOLD(int stylenumber, bool bold)
+SCI_STYLESETITALIC(int stylenumber, bool italic)
+SCI_STYLESETSIZE(int stylenumber, int sizeinpoints)
+SCI_STYLESETFONT(int stylenumber, char *fontname)
+SCI_STYLESETEOLFILLED(int stylenumber, bool eolfilled)
+
+

+ While the style setting messages mentioned above, change the style numbers associated with + text, these messages define how those style numbers are interpreted visually. The + STYLE_DEFAULT style defines the attributes that all styles will receive when + SCI_STYLECLEARALL is called. SCI_STYLERESETDEFAULT resets STYLE_DEFAULT to its state when + Scintilla was initialised. +

+

+ The EOLFILLED style allows to colourise from the end of the line to the right side of the + window. +

+

+ As well as the 32 fundamental lexer styles, there are also some predefined numbered styles + starting at 32, STYLE_DEFAULT, STYLE_LINENUMBER, STYLE_BRACELIGHT, STYLE_BRACEBAD, and + STYLE_CONTROLCHAR. These can be defined with the SCI_STYLESET* messages. +

+
+SCI_SETFORE(int colour)
+SCI_SETBACK(int colour)
+SCI_SETBOLD(bool bold)
+SCI_SETITALIC(bool italic)
+SCI_SETSIZE(int sizeinpoints)
+SCI_SETFONT(char *fontname)
+
+

+ These messages are responsible for global default styling and are used when no explicit + setting is defined for a style.
+ These messages are deprecated in favour of using the SCI_STYLESET* messages for + STYLE_DEFAULT. They will be removed in a future release. +

+
+SCI_SETSELFORE(bool useSelectionForeColour, int colour)
+SCI_SETSELBACK(bool useSelectionBackColour, int colour)
+SCI_SETCARETFORE(int colour)
+SCI_GETCARETPERIOD
+SCI_SETCARETPERIOD(int milliseconds)
+
+

+ The selection is shown by changing the foreground and / or background colours. If one of + these is not set then that attribute is not changed for the selection. The default is to show + the selection by changing the background to light grey and leaving the foreground the same as + when it was not selected. +

+

+ The colour of the caret can be set with SCI_SETCARETFORE. The rate at which the caret blinks + can be set with SCI_SETCARETPERIOD which determines the time in milliseconds that the caret + is visible or invisible before changing state. Setting the period to 0 stops the caret + blinking. +

+

+ Margins +

+
+EM_GETMARGINS 
+EM_SETMARGINS(EC_LEFTMARGIN or EC_RIGHTMARGIN or EC_USEFONTINFO, int val)
+
+

+ Gets or sets the width of the blank margin on both sides of the text. This defaults to one + pixel on each side. val contains a left margin size in its low word and a right margin size + in its high word. This is also the way that EM_GETMARGINS returns the current setting. + EC_LEFTMARGIN and EC_RIGHTMARGIN are bit flags that can be used individually or combined to + set both margins at once. EC_USEFONTINFO ignores val and sets both margins to be half the + average character width in the current default font. +

+
+SCI_SETMARGINTYPEN(int margin, SC_MARGIN_SYMBOL | SC_MARGIN_NUMBER)
+SCI_GETMARGINTYPEN(int margin)
+SCI_SETMARGINWIDTHN(int margin, int pixelwidth)
+SCI_GETMARGINWIDTHN(int margin)
+SCI_SETMARGINMASKN(int margin, int mask)
+SCI_GETMARGINMASKN(int margin)
+SCI_SETMARGINSENSITIVEN(int margin, bool sensitive)
+SCI_GETMARGINSENSITIVEN(int margin)
+
+

+ There may be up to three margins to the left of the text display. Each margin may contain + marker symbols and some may be set to display line numbers + (with SCI_SETMARGINTYPEN). The markers displayed in each margin are set with + SCI_SETMARGINMASKN. Any markers not associated with a visible margin will + be displayed as changes in background colour in the text. + A width in pixels can be set for each margin. Margins + with a zero width are ignored completely. Each margin may be made sensitive to mouse + clicks. A click in a sensitive margin will result in a SCN_MARGINCLICK notification being + sent to the container. Margins that are not sensitive act as selection margins which make it + easy to select ranges of lines. +

+

+ Earlier versions of Scintilla hard coded particular margin types and provided + SCI_SETMARGINWIDTH and SCI_SETLINENUMBERWIDTH which are + now deprecated. +

+

+ Other settings +

+
+SCI_SETUSEPALETTE(bool allowPaletteUse)
+
+

+ On 8 bit displays, which can only display a maximum of 256 colours, the graphics environment + mediates between the colour needs of applications through the use of palettes. On GTK+, + Scintilla always uses a palette. On Windows, there are some problems with visual flashing + when switching between applications with palettes and it is also necessary for the + application containing the Scintilla control to forward some messages to Scintilla for its + palette code to work. +

+

+ Because of these issues, the application must tell Scintilla to use a palette. If Scintilla + is not using a palette, then it will only be able to display in those colours already + available, which are often the 20 Windows system colours. +

+

+ To see an example of how to enable palette support in Scintilla, search the text of SciTE + for WM_PALETTECHANGED, WM_QUERYNEWPALETTE and SCI_SETUSEPALETTE. +

+
+SCI_SETBUFFEREDDRAW(bool isbuffered)
+
+

+ Turns on or off buffered drawing. Buffered drawing draws each line into a bitmap rather than + directly to the screen and then copies the bitmap to the screen. This avoids flickering + although it does take longer. The default is for drawing to be buffered. +

+
+SCI_SETTABWIDTH(int widthinchars)
+
+

+ Sets the size of a tab as a multiple of the size of a space character in the style of the + first style definition +

+
+SCI_SETCODEPAGE(int codepage)
+
+

+ Scintilla has some very simple Japanese DBCS (and probably Chinese and Korean) support. Use + this message with argument set to the code page number to set Scintilla to use code page + information to ensure double byte characters are treated as one character rather than two. + This also stops the caret from moving between the two bytes in a double byte character. Call + with argument set to zero to disable DBCS support. +

+
+SCI_SETWORDCHARS(<unused>, char *chars)
+
+

+ Scintilla has several functions that operate on words which are defined to be contiguous + sequences of characters from a particular set of characters. This message defines which + characters are members of that set. If chars is null then the default set, alphanumeric and + '_', is used. +

+
+SCI_GRABFOCUS
+
+

+ On GTK+, focus handling is more complicated than on Windows, so Scintilla can be told with + this message to grab the focus. +

+

+ Brace highlighting +

+
+SCI_BRACEHIGHLIGHT(int pos1, int pos2)
+SCI_BRACEBADLIGHT(int pos1)
+SCI_BRACEMATCH(int position, int maxReStyle)
+
+

+ Up to two characters can be highlighted in a 'brace highlighting style' which is defined as + style number 34. If there is no matching brace then the 'brace badlighting style', style + number 35, can be used to show the brace that is unmatched. Using a position of + INVALID_POSITION removes the highlight. +

+

+ The SCI_BRACEMATCH message finds a corresponding matching brace given the position of one + brace. The brace characters handled are '(', ')', '[', ']', '{', '}', '<', and '>'. A + match only occurs if the style of the matching brace is the same as the starting brace or the + matching brace is beyond the end of styling. Nested braces are handled correctly. The + maxReStyle parameter must currently be 0. +

+

+ Markers +

+
+SCI_MARKERDEFINE(int markernumber, int markersymbols)
+SCI_MARKERSETFORE(int markernumber, int colour)
+SCI_MARKERSETBACK(int markernumber, int colour)
+SCI_MARKERADD(int line, int markernumber)
+SCI_MARKERDELETE(int line, int markernumber)
+SCI_MARKERDELETEALL(int markernumber)
+SCI_MARKERGET(int line)
+SCI_MARKERNEXT(int lineStart, int markermask)
+SCI_MARKERPREVIOUS(int lineStart, int markermask)
+SCI_MARKERLINEFROMHANDLE(int handle)
+SCI_MARKERDELETEHANDLE(int handle)
+
+

+ Markers appear in the selection margin to the left of the text. They are small geometric + symbols often used in debuggers to indicate breakpoints and the current line. If the + selection margin is set to zero width then the background colour of the whole line is changed + instead. There may be upto 32 marker symbols defined and each line has a set of these markers + associated with it. The markers are drawn in the order of their numbers. Markers try to move + with their text by tracking where the start of their line moves. When a line is deleted, its + markers are combined, by an or operation, with the markers of the previous line. The + SCI_MARKERDELETEALL removes markers of the given number from all lines, and treats a + parameter of -1 as meaning delete all markers from all lines.
+ SCI_MARKERADD returns a marker handle number which may be used to find out where a marker + has moved to with the SCI_MARKERLINEFROMHANDLE message. SCI_MARKERDELETEHANDLE can be used to + delete a marker based upon its handle. +

+

+ SCI_MARKERGET retrieves the set of markers associated with a line. SCI_MARKERNEXT and + SCI_MARKERPREVIOUS can be used to efficiently search for lines that contain markers. They + return the next / previous line with a set of markers that includes some of the bits set in + the markermask parameter.
+ The markermask is equal to a OR of (1 << markernumber) for each marker of the desired + / retrieved set. +

+

+ The marker symbols currently available are SC_MARK_CIRCLE, SC_MARK_ROUNDRECT, SC_MARK_ARROW, + SC_MARK_SMALLRECT, SC_MARK_SHORTARROW, SC_MARK_EMPTY, SC_MARK_ARROWDOWN, + SC_MARK_MINUS, SC_MARK_PLUS. The SC_MARK_EMPTY symbol is invisible, + allowing client code to track the movement of lines. +

+

+ Indicators +

+
+SCI_INDICSETSTYLE(int indicatornumber, int indicatorstyle)
+SCI_INDICGETSTYLE(int indicatornumber)
+SCI_INDICSETFORE(int indicatornumber, int colour)
+SCI_INDICGETFORE(int indicatornumber)
+
+

+ These messages allow setting the visual appearance of the three (0, 1, and 2) available + indicators. +

+

+ The indicator styles currently available are INDIC_PLAIN, INDIC_SQUIGGLE, and INDIC_TT. +

+

+ The indicators are set using SCI_STARTSTYLING with a INDICS_MASK mask and SCI_SETSTYLING + with the values INDIC0_MASK, INDIC1_MASK and INDIC2_MASK. +

+

+ Autocompletion +

+
+SCI_AUTOCSHOW(<unused>,char *list)
+SCI_AUTOCCANCEL
+SCI_AUTOCACTIVE
+SCI_AUTOCPOSSTART
+SCI_AUTOCCOMPLETE
+SCI_AUTOCSTOPS(<unused>,char *chars)
+
+

+ Auto completion displays a list box based upon the users typing showing likely identifiers. + The SCI_AUTOCSHOW message causes this list to be displayed, with its argument being a list of + words separated by space characters. SCI_AUTOCPOSSTART returns the value of the current + position when SCI_AUTOCSHOW started display of the list. +

+

+ The current selection can be triggered with the SCI_AUTOCCOMPLETE message. This has the same + effect as the tab key. When in autocompletion mode, the list should disappear when the user + types a character that can not be part of the autocompletion, such as '.', '(' or '[' when + typing an identifier. A set of characters which will cancel autocompletion can be specified + with the SCI_AUTOCSTOPS. +

+

+ Calltips +

+
+SCI_CALLTIPSHOW(<unused>, char *definition)
+SCI_CALLTIPCANCEL
+SCI_CALLTIPACTIVE
+SCI_CALLTIPPOSSTART
+SCI_CALLTIPSETHLT(int highlightstart, int highlightend)
+SCI_CALLTIPSETBACK(int colour)
+
+

+ Call tips are small windows displaying the arguments to a function and are displayed after + the user has typed the name of the function. As the user types values for each argument, the + name of the argument currently being entered is highlighted. +

+

+ SCI_CALLTIPSHOW starts the process by displaying the calltip window, with the definition + argument containing the text to display. SCI_CALLTIPPOSSTART returns the value of the current + position when SCI_CALLTIPSHOW started display of the list. SCI_CALLTIPSETHLT sets the region + of the calltip text displayed in a highlighted style. The background colour of calltips can + be set with SCI_CALLTIPSETBACK with the default being white. +

+

+ Keyboard Commands +

+
+SCI_LINEDOWN
+SCI_LINEDOWNEXTEND
+SCI_LINEUP
+SCI_LINEUPEXTEND
+SCI_CHARLEFT
+SCI_CHARLEFTEXTEND
+SCI_CHARRIGHT
+SCI_CHARRIGHTEXTEND
+SCI_WORDLEFT
+SCI_WORDLEFTEXTEND
+SCI_WORDRIGHT
+SCI_WORDRIGHTEXTEND
+SCI_HOME
+SCI_HOMEEXTEND
+SCI_LINEEND
+SCI_LINEENDEXTEND
+SCI_DOCUMENTSTART
+SCI_DOCUMENTSTARTEXTEND
+SCI_DOCUMENTEND
+SCI_DOCUMENTENDEXTEND
+SCI_PAGEUP
+SCI_PAGEUPEXTEND
+SCI_PAGEDOWN
+SCI_PAGEDOWNEXTEND
+SCI_EDITTOGGLEOVERTYPE
+SCI_CANCEL
+SCI_DELETEBACK
+SCI_TAB
+SCI_BACKTAB
+SCI_NEWLINE
+SCI_FORMFEED
+SCI_VCHOME
+SCI_VCHOMEEXTEND
+SCI_ZOOMIN
+SCI_ZOOMOUT
+SCI_DELWORDLEFT
+SCI_DELWORDRIGHT
+
+

+ To allow the container application to perform any of the actions available to the user with + keyboard, all the keyboard actions are messages. They do not take any parameters. +

+

+ These commands are also used when redefining the key bindings with the SCI_ASSIGNCMDKEY + message. +

+

+ Key Bindings +

+
+SCI_ASSIGNCMDKEY((short key,short modifiers), int message)
+SCI_CLEARCMDKEY((short key,short modifiers))
+SCI_CLEARALLCMDKEYS
+
+

+ There is a default binding of keys to commands in Scintilla which can be overridden with + these messages. To fit the parameters into a message, the first argument contains the key + code in the low word and the key modifiers (possibly shift and control) in the high word. The + key code is from the VK_* enumeration, and the modifiers are a combination of zero or more of + SHIFT_PRESSED and LEFT_CTRL_PRESSED. +

+

+ Macro Recording +

+
+SCI_STARTRECORD
+SCI_STOPRECORD
+
+

+ Starts and stops macro recording mode. +

+

+ Printing +

+
+EM_FORMATRANGE
+
+

+ On Windows EM_FORMATRANGE can be used to draw the text onto a display context which can + include a printer display context. +

+

+ Multiple Views +

+
+SCI_GETDOCPOINTER
+SCI_SETDOCPOINTER(<unused>,document *pdoc)
+
+

+ This is to allow simple split views of documents. Each Scintilla owns one default document + and has a pointer to a used document. Initially the used document is the default one. The + SCI_GETDOCPOINTER call returns a pointer to the default document. SCI_SETDOCPOINTER sets the + used document. SCI_SETDOCPOINTER(0) restores the use of the default document and should + always be called before closing the Scintilla that owns the current document (to avoid + calling methods on a deleted object). +

+

+ Folding +

+
+SCI_VISIBLEFROMDOCLINE(int docLine)
+SCI_DOCLINEFROMVISIBLE(int displayLine)
+SCI_SETFOLDLEVEL(int line, int level)
+SCI_GETFOLDLEVEL(int level)
+SCI_GETLASTCHILD(int line)
+SCI_GETFOLDPARENT(int line)
+SCI_SHOWLINES(int lineStart, int lineEnd)
+SCI_HIDELINES(int lineStart, int lineEnd)
+SCI_GETLINEVISIBLE(int line)
+SCI_SETFOLDEXPANDED(int line)
+SCI_GETFOLDEXPANDED(int line)
+SCI_TOGGLEFOLD(int line)
+SCI_ENSUREVISIBLE(int line)
+
+

+ The fundamental operation in folding is making lines invisible or visible. + Line visibility is a property of the view rather than the document so each + view may be displaying a different set of lines. SCI_SHOWLINES and + SCI_HIDELINES show or hide a range of lines. SCI_GETLINEVISIBLE + determines whether a line is visible. When some lines are hidden, then a + particular line in the document may be displayed at a different position to its + document position. SCI_VISIBLEFROMDOCLINE and + SCI_DOCLINEFROMVISIBLE map from document line to display line and + back. +

+

+ Generally the fold points of a document are based on the hierarchical structure + of the contents of the document. In Python, the hierarchy is determined by + indentation and in C++ by brace characters. This hierarchy can be represented + within a Scintilla document object by attaching a numeric level to each line. + The initial level of a file is SC_FOLDLEVELBASE to allow unsigned arithmetic + on levels. + There + are also two bit flags associated with each line. SC_FOLDLEVELWHITEFLAG + indicates that the line is blank and allows to be treated slightly different then its + level may indicate. For example, blank lines should generally not be fold points. + SC_FOLDLEVELHEADERFLAG indicates that the line is a header or fold point. +

+

+ The hierarchy can be navigated just through SCI_GETFOLDLEVEL, but it is + often useful to find the parent of a line (SCI_GETFOLDPARENT) or the line + that is the last child of a line (SCI_GETLASTCHILD). +

+

+ Each fold point may be either expanded, displaying all its child lines, or + contracted, hding all the child lines. This is per view state and can be + manipulated with SCI_SETFOLDEXPANDED and + SCI_GETFOLDEXPANDED. Using SCI_SETFOLDEXPANDED does not + show or hide any lines but only changes a state flag and the margin markers + that show the contractrion state. SCI_TOGGLEFOLD performs the expansion + or contraction of a fold point in the manner normally expected. +

+

+ A hidden line may be hidden because more than one of its parent lines is + contracted. SCI_ENSUREVISIBLE travels up the fold hierarchy, expanding any + contracted folds until it reaches the top level. The line will then be visible. +

+

+ Long Lines +

+
+SCI_GETEDGECOLUMN 
+SCI_SETEDGECOLUMN(int column)
+SCI_GETEDGEMODE
+SCI_SETEDGEMODE(int mode)
+SCI_GETEDGECOLOUR 
+SCI_SETEDGECOLOUR(int colour)
+
+

+ This mechanism marks lines that are longer than a specified length in one of two ways. A + vertical line can be displayed at the specified column number (EDGE_LINE) or characters after + that column can be displayed with a specified background colour (EDGE_BACKGROUND). The + vertical line works well for monospaced fonts but not for proportional fonts which should use + EDGE_BACKGROUND. The defaullt is to not have any form of long line marking (EDGE_NONE). +

+

+ Lexer +

+
+SCI_SETLEXER(int lexer)
+SCI_GETLEXER
+SCI_COLOURISE(int start, int end)
+SCI_SETPROPERTY(char *key, char *value)
+SCI_SETKEYWORDS(int keywordset, char *keywordlist)
+
+

+ If the SciLexer version of Scintilla is used, then lexing support for some programming languages + is included. A particular lexer may be chosen from the SCLEX* enumeration and it is invoked + automatically to dtyle the coument as required. + If the lexer is set to SCLEX_CONTAINER then the container is notified to perform styling + as is the case with the standard Scintilla.DLL version. Styling may be requested for a range + of the document by using SCI_COLOURISE. +

+

+ Settings can be communicated to the lexers using SCI_SETPROPERTY. Currently the "fold" + property is defined for the SCLEX_PYTHON, SCLEX_CPP, and SCLEX_SQL lexers to + set the fold stucture if set to "1". SCLEX_PYTHON understands "tab.timmy.whinge.level" + as a setting that determines how to indicate bad indentation. Many languages style a set of keywords + distinctly from other words. Some languages, such as HTML may contain embedded languages, + VBScript and Javascript are common for HTML. SCI_SETKEYWORDS specifies the keywords + separated by spaces. For HTML, key word set is for HTML, 1 is for Javascript and 2 is for VBScript. +

+

+ Notifications +

+

+ Notifications are sent (fired) from the Scintilla control to its container when an event has + occurred that may interest the container. Notifications are sent using the WM_NOTIFY message + with a structure containing information about the event. +

+
+SCN_STYLENEEDED(int endstyleneeded)
+
+

+ Before displaying a page or printing, this message is sent to the container. It is a good + opportunity for the container to ensure that syntax styling information for the visible text. +

+
+SCN_UPDATEUI
+SCN_CHECKBRACE
+
+

+ Either the text or styling of the document has changed or the selection + range has changed. Now would be a good time to update any container UI + elements that depend on document or view state. Was previously called + SCN_CHECKBRACE because a common use is to check whether the caret + is next to a brace and set highlights on this brace and its + corresponding matching brace. +

+
+SCN_CHARADDED(int charadded)
+
+

+ Fired when the user types an ordinary text character (as opposed to a command character) + which is entered into the text. Can be used by the container to decide to display a call tip + or auto completion list. +

+
+SCN_SAVEPOINTREACHED(int issavepoint)
+SCI_SETSAVEPOINT
+
+

+ Sent to the container when the savepoint is entered or left, allowing the container to to + display a dirty indicator and change its menues. The first parameter is 1 when entering the + save point, 0 when leaving. +

+

+ The container tells Scintilla where the save point is by sending the SCI_SETSAVEPOINT + message. +

+
+SCN_MODIFYATTEMPTRO
+
+

+ When in read-only mode, this notification is sent to the container should the user try to + edit the document. This can be used to check the document out of a version control system. +

+
+SCN_DOUBLECLICK
+
+

+ Mouse button was double clicked in editor. +

+
+SCN_KEY
+
+

+ Reports all keys pressed. Used on GTK+ because of some problems with keyboard focus. Not + sent by Windows version. +

+
+SCN_MODIFIED
+EN_CHANGE
+SCI_SETMODEVENTMASK(int eventmask)
+
+

+ SCN_MODIFIED is fired when the document has been changed including changes to both the text + and styling. The notification structure contains information about what changed, how the + change occurred and whether this changed the number of lines in the document. +

+

+ EN_CHANGE is fired when the text of the document has been changed for any reason. This + notification is sent using the WM_COMMAND message as this is the behaviour of the standard + edit control. +

+

+ Both these notifications can be masked by the SCI_SETMODEVENTMASK function which sets which + notification types are sent to the container. For example, a container may decide to see only + notifications about changes to text and not styling changes by calling + SCI_SETMODEVENTMASK(SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT). +

+
+SCN_MACRORECORD
+
+

+ Tells the container that an operation is being performed so that the container may choose + to record the fact if it is in a macro recording mode. +

+
+SCN_MARGINCLICK
+
+

+ Tells the container that the mouse was clicked inside a margin marked sensitive. + Can be used to perform folding or to place breakpoints. +

+
+SCN_NEEDSHOWN
+
+

+ Scintilla has determined that a range of lines that is currently invisible should be made visible. + An example of where this may be needed is if the end of line of a contracted fold point + is deleted. This message is sent to the container in case it wants to make the line + visible in some unusual way such as making the whole document visible. Most containers + will just ensure each line in the range is visible by calling SCI_ENSUREVISIBLE. +

+

+ Edit messages not supported by Scintilla +

+
+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
+
+

+ Scintilla tries to be a superset of the standard windows Edit and Richedit controls wherever + that makes sense. As it is not intended for use in a word processor, some edit messages can + not be sensibly handled. Unsupported messages have no effect. +

+
+EM_GETEVENTMASK
+EM_SETEVENTMASK
+EM_DISPLAYBAND
+EM_SETTARGETDEVICE
+
+

+ To support printing better and control the notifications fired, these messages should be + supported but are not yet. +

+

+ Building Scintilla on Windows +

+

+ Scintilla and SciTE have been developed using Mingw32 GCC 2.9.5 and most testing has + occurred on executables produced by this compiler. It may also be compiled with Visual C++ + which leads to smaller executables. It will no longer build with the older release of Mingw32 + EGCS 1.1.2 which used a different set of Windows headers to GCC 2.9.5. +

+

+ To compile with GCC, use make on the "makefile" file.
+

+

+ To compile with VC++, use nmake on the "makefile_vc" file. +

+

+ To compile with Borland C++ or C++ Builder, use make on the "makefile_bor" file. +

+

+ Scintilla can also be linked into an application statically. To do this, the symbol + STATIC_BUILD should be defined and the function Scintilla_RegisterClasses called to + initialise Scintilla. The Sc1.exe target in the makefile demonstrates building a statically + linked version of SciTE. +

+

+ Building Scintilla with GTK+ on Linux +

+

+ On Linux, Scintilla and SciTE have been built with GCC and linked with GTK+ 1.20. GTK+ 1.0x + will not work (and when it did it was very slow). The current make file only supports static + linking between SciTE and Scintilla. The Makefile_gtk file is used to build SciTE, it can be + invoked as:
+ make -f Makefile_gtk
+ The SciTEGTK.properties file is better than the SciTEGlobal.properties for use on Linux/GTK+ + as it specifies fonts that are likely to be installed. Under Linux, SciTE reads its + SciTEGlobal.properties file from the user's home directory. +

+ + + diff --git a/doc/ScintillaDownload.html b/doc/ScintillaDownload.html new file mode 100644 index 000000000..b67997c3b --- /dev/null +++ b/doc/ScintillaDownload.html @@ -0,0 +1,83 @@ + + + + + + + + + Download Scintilla and SciTE + + + + + + + + +
+ Scintilla icon + + Download + Scintilla and SciTE +
+ + + + +
+ Windows   + GTK+/Linux   +
+

+ Download. +

+

+ The license for using Scintilla is similar to that of Python + containing very few restrictions. +

+

+ Release 1.22 +

+

+ Windows +

+

+ You can download a ZIP file (410K) containing the C++ source code + and executables for Scintilla and SciTE. While a release version, it is likely that there are + still bugs in the code that could lead to loss of data. Please make sure you save often and + back up your source code.
+ After downloading the file, unzip it, and run SciTE.EXE. The files required to run SciTE are + SciTE.EXE, Scintilla.DLL, and SciTEGlobal.properties and these are best located in one + directory on the path. +

+

+ A single file executable called Sc1 (230K) does not need any DLL or + properties files as these are linked into the executable. You may still create properties + files if you wish. +

+

+ Linux and Linux compatible +

+

+ There is a GTK+/Linux version (250K). In the Linux tradition, this + download only contains source code and documentation and it is exactly the same source code + as in the Windows version. To build it, you will have to have a c++ compiler (I use gcc + 2.95.2, but older gcc or egcs should do just as well) and GTK+ 1.2.x installed (tested on + 1.2.6).
+ The Makefile_gtk file is used to build SciTE, it can be invoked as:
+ make -f Makefile_gtk
+ The SciTEGTK.properties file is better than the SciTEGlobal.properties for use on Linux/GTK+ + as it specifies fonts that are likely to be installed. Under Linux, SciTE reads its + SciTEGlobal.properties file from the user's home directory. The download file is available + under the name SciTETGZ.zip in case your browser does not want to + download a .tgz file. Despite the .zip extension, this is still a tarred gzipped file. +

+

+ Previous versions can be downloaded from the history + page. +

+ + + diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html new file mode 100644 index 000000000..9d8200d29 --- /dev/null +++ b/doc/ScintillaHistory.html @@ -0,0 +1,627 @@ + + + + + + + + + Scintilla and SciTE + + + + + + + + +
+ Scintilla icon + + Scintilla + and SciTE +
+

+ History of Scintilla and SciTE +

+

+ Contributors +

+

+ Thanks to all the people that have contributed patches, bug reports and suggestions. +

+

+ Source code and documentation have been contributed by +

+ +

+ Release 1.22 +

+ +

+ Release 1.21 +

+ +

+ Release 1.2 +

+ +

+ Release 1.15 +

+ +

+ Release 1.14 +

+ +

+ Release 1.13 +

+ +

+ Release 1.12 +

+ +

+ Release 1.11 +

+ +

+ Release 1.1 +

+ +

+ Release 1.02 +

+ +

+ Release 1.01 +

+ +

+ Release 1.0 +

+ +

+ Beta release 0.93 +

+ +

+ Beta release 0.92 +

+ +

+ Beta release 0.91 +

+ +

+ Beta release 0.90 +

+ +

+ Beta release 0.82 +

+ +

+ Beta release 0.81 +

+ +

+ Beta release 0.80 +

+ +

+ Beta releases of SciTE were called Tide +

+ + + diff --git a/doc/ScintillaRelated.html b/doc/ScintillaRelated.html new file mode 100644 index 000000000..3a6bfec09 --- /dev/null +++ b/doc/ScintillaRelated.html @@ -0,0 +1,113 @@ + + + + + + + + + Scintilla and SciTE + + + + + + + + +
+ Scintilla icon + + Scintilla + and SciTE +
+

+ Related Sites +

+

+ Projects using Scintilla +

+

+ PythonWin, a Win32 IDE for Python, uses + Scintilla for both its editing and interactive windows. +

+

+ A Python binding of the + GTK+ version of Scintilla, that can be used with pygtk. +

+

+ Editing Components +

+

+ Jedit is a good Open Source syntax colouring + editor written in and for Java. +

+

+ GTK+, the GIMP Toolkit, contains a rich text editing + widget.
+ Gedit is an editor for GTK+/GNOME.
+ GtkEditor is a source code editing + widget based on the GTK+ text widget.
+ GIDE is an IDE based on GTK+.
+ GtkExText is a source code + oriented text widget for GTK+. +

+

+ CodeGuru has source code for several Win32 MFC based + editors. +

+ mwEdit is a Win32 edit control written + in Delphi. +

+ SourceView is a commercial editing + component for Win32. +

+

+ Paper Documents +

+

+ Data Structures in a Bit-Mapped Text + Editor, Wilfred J. Hanson, Byte January 1987 +

+

+ Text Editors: Algorithms and Architectures, Ray Valdés, Dr. Dobbs Journal + April 1993 +

+

+ Macintosh User Interface Guidelines and TextEdit chapters of Inside Macintosh +

+

+ Development Tools +

+

+ Scintilla and SciTE were developed using the Mingw32 version of GCC. Mumit Khan's GNU Win32 + site is a good starting point for GCC and Mingw32 information and downloads. +

+

+ AStyle is a source code formatter for C++ and + Java code. SciTE has an Indent command defined for .cxx files that uses AStyle. +

+

+ Python is my favourite programming language. Scintilla + was started after I tried to improve the editor built into PythonWin, but was frustrated by the limitations of + the Windows Richedit control which PythonWin used. +

+

+ CodeMagic is a free generic IDE for Win32. + Strongly Perl focused but customisable for other languages. Has more user interface features + than SciTE. +

+

+ Coding frenzy musical inspiration provided by the Flower Kings. +

+

+ Get away from hacking without any of that tedious standing up bother: Virtual Tours ;). +

+ + + diff --git a/doc/ScintillaToDo.html b/doc/ScintillaToDo.html new file mode 100644 index 000000000..67f714ba6 --- /dev/null +++ b/doc/ScintillaToDo.html @@ -0,0 +1,124 @@ + + + + + + + + + Scintilla and SciTE + + + + + + + + +
+ Scintilla icon + + Scintilla + and SciTE +
+

+ Bugs and To Do List +

+

+ Scintilla Bugs +

+

+ At the end of italics style runs characters can be chopped off. An example is using Verdana + 12 point italics for strings makes an ending double quote half visible and an ending single + quote invisible. This is hard to solve completely, may be better to avoid these situations + by, for example, choosing a font like Times New Roman for strings. +

+

+ Dragging over bold text in some fonts will ripple because of the difference in size between + drawing all of a string at once and drawing it in parts. +

+

+ SciTE Bugs +

+

+ There has been a report of SciTE exiting as soon as the mouse is moved over it when launched + Start | Run. I have seen this once but can not find a way to reproduce it. +

+

+ One person has seen excessive waits (20 seconds) when using the file open dialog and + changing to the top directory. +

+

+ Windows Version Bugs +

+

+ No memory for input fields in find and replace dialogs. +

+

+ GTK+ Version Bugs +

+

+ No DBCS support. +

+

+ Scintilla To Do +

+

+ Simple pattern based styling. +

+

+ Line wrapping. +

+

+ Different height lines based upon tallest text on the line rather than on the tallest style + possible. +

+

+ COM control version on Windows +

+

+ Make GTK+ version be more consistent with other GTK+ widgets. +

+

+ Printing support on GTK+. Maybe Postscript output or use Gnome? +

+

+ Unicode (UCS 2). +

+

+ Stream folding which could be used to fold up the contents of HTML elements. +

+

+ SciTE To Do +

+

+ More lexers: IDL, and Delphi. Make the subset Perl lexer understand more Perl. +

+

+ Regular expressions in find functions. +

+

+ Smart indenting, based on the file syntax. +

+

+ Printing on GTK+. +

+

+ Directions +

+

+ The main point of this development is Scintilla, and this is where most effort will go. + SciTE will get new features, but only when they make my life easier - I am not intending to + make it grow up to be a huge full-function IDE like Visual Cafe. The lines I've currently + decided not to step over in SciTE are any sort of project facility and any configuration + dialogs. +

+

+ If you are interested in contributing code, do not feel any need to make it cross platform. + Just code it for your platform and I'll either reimplement for the other platform or ensure + that there is no effect on the other platform. +

+ + + diff --git a/doc/ScintillaUsage.html b/doc/ScintillaUsage.html new file mode 100644 index 000000000..e0ffb0bfc --- /dev/null +++ b/doc/ScintillaUsage.html @@ -0,0 +1,375 @@ + + + + + + + + + Scintilla Usage Notes + + + + + + + + + +
+ Scintilla icon + + Scintilla + Usage Notes +
+

+ Implementing Auto-Indent +

+

+ The key idea is to use the SCN_CHARADDED notification to add indentation after a newline. +

+

+ The lParam on the notification is a pointer to a SCNotification structure whose ch member + specifies the character added. If a newline was added, the previous line can be retrieved and + the same indentation can be added to the new line. +

+

+ Here is the relevant portion of code from SciTE: (SciTE.cxx SciTEWindow::CharAdded) +

+ if  (ch  ==  '\r'  ||  ch  ==  '\n')  {
+     
char  + linebuf[1000];
+     
int  + curLine  =  GetCurrentLineNumber();
+     
int  + lineLength  + =  SendEditor(SCI_LINELENGTH,  curLine);
+     
+ //Platform::DebugPrintf("[CR] %d len = %d\n", curLine, lineLength);
+     
if  (curLine  >  0  &&  + lineLength  + <=  2)  {
+     
int  + prevLineLength  + =  SendEditor(SCI_LINELENGTH,  curLine  -  1);
+     
if  (prevLineLength  <  sizeof(linebuf))  {
+         
WORD  buflen  =  sizeof(linebuf);
+         
memcpy(linebuf,  &buflen,  sizeof(buflen));
+         
+ SendEditor(EM_GETLINE,  curLine  -  1,
+                    
+ reinterpret_cast<LPARAM>(static_cast<char  *>(linebuf)));
+         
linebuf[prevLineLength]  =  '\0';
+         
for  (int  pos  =  0;  linebuf[pos];  pos++)  {
+             
if  (linebuf[pos]  !=  ' '  &&  + linebuf[pos]  !=  '\t')
+                 
+ linebuf[pos]  =  '\0';
+         
}
+         
+ SendEditor(EM_REPLACESEL,  0,  + reinterpret_cast<LPARAM>(static_cast<char  *>(linebuf)));
+     
}
+
}
+ +

+ Of course, fancier handling could be implemented. For example, if the previous line was the + start of a control construct, the next line could be automatically indented one tab further. + (Assuming that is your indenting style.) +

+

+ Implementing Syntax Styling +

+

+ Syntax styling is handled by the SCN_STYLENEEDED notification. Scintilla keeps track of the + end of the styled text - this is retrieved with SCI_GETENDSTYLED. In response to the + SCN_STYLENEEDED notification, you should apply styles to the text from ENDSTYLED to the + position specified by the notification. +

+

+ Here is the relevant portion of code from SciTE: (SciTE.cxx) +

+ void  + SciTEWindow::Notify(SCNotification  *notification)  {
+     
switch  + (notification->nmhdr.code)  {
+     
case  + SCN_STYLENEEDED:  {
+             
if  (notification->nmhdr.idFrom  ==  IDM_SRCWIN)  {
+                 
+ int  + endStyled  =  SendEditor(SCI_GETENDSTYLED);
+                 
+ int  + lineEndStyled  =  SendEditor(EM_LINEFROMCHAR,  + endStyled);
+                 
+ endStyled  + =  SendEditor(EM_LINEINDEX,  lineEndStyled);
+                 
+ Colourise(endStyled,  notification->position);
+ +

+ Colourize(start, end) retrieves the specified range of text and then calls ColourizeDoc in + keywords.cxx. It starts the process by calling: +

+     SendMessage(hwnd,  SCI_STARTSTYLING,  + startPos,  31);
+ +

+ and then for each token of the text, calling: +

+     SendMessage(hwnd,  SCI_SETSTYLING,  length,  style);
+ +

+ where style is a number from 0 to 31 whose appearance has been defined using the + SCI_STYLESET... messages. +

+

+ Implementing Calltips +

+

+ Again, the SCN_CHARADDED notification is used to catch when an opening parenthesis is added. + The preceding word can then be retrieved from the current line: +

+     char  linebuf[1000];
+
    int  current  =  SendEditor(SCI_GETCURLINE,  sizeof(linebuf),
+         
+ reinterpret_cast<LPARAM>(static_cast<char  *>(linebuf)));
+
    int  pos  =  SendEditor(SCI_GETCURRENTPOS);
+
+
    int  startword  =  current  -  1;
+
    while  + (startword  + >  0  &&  + isalpha(linebuf[startword  -  1]))
+         
+ startword--;
+
    linebuf[current  -  1]  =  '\0';
+
    char*  word  =  linebuf  +  startword;
+ +

+ Then if a calltip is available it can be displayed. The calltip appears immediately below + the position specified. The calltip can be multiple lines separated by newlines (\n). +

+     pos  =  SendMessage(hwnd,  SCI_GETCURRENTPOS,  0,  0);
+
    SendMessageText(hwnd,  SCI_CALLTIPSHOW,  pos  -  wordLen  -  1,  calltip);
+ +

+ The calltip can be removed when a closing parenthesis is entered: +

+     if  (SendMessage(hwnd,  SCI_CALLTIPACTIVE,  + 0,  0))
+         
+ SendMessage(hwnd,  + SCI_CALLTIPCANCEL,  0,  + 0);
+ +

+ Obviously, it is up the application to look after supplying the appropriate calltip text. +

+

+ SciTE goes one step further, counting the commas between arguments and highlighting the + corresponding part of the calltip. This code is in ContinueCallTip. +

+

+ Page contributed by Andrew McKinlay. +

+ + + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 000000000..d0d59c0b8 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,147 @@ + + + + + + + + + + + + Scintilla and SciTE + + + + + + + + + + +
+ Scintilla + + A free source code editing component for Win32 and + GTK+ + + Release version 1.22
+ Site last modified February 27 2000
+
+   +
+ + + + +
+ Sci Rest +
+ + + + + + + + + + +
+ Version 1.2 is a major release featuring multiple views + of one document and rectangular selection. +
+ Version 1.21 fixes bugs, enhances performance, and adds + margins to Scintilla and an XML lexer to SciTE. +
+ Version 1.22 adds line folding, macro recording and + a large number of smaller features. +
+ + + + +
+ Screenshot   Download   + Documentation   Bugs   SciTE   + History   Related   +
+

+ Scintilla is a free source code editing component. As well + as features found in standard text editing components, Scintilla includes features especially + useful when editing and debugging source code. These include support for syntax styling, + error indicators, code completion and call tips. The selection margin can contain markers + like those used in debuggers to indicate breakpoints and the current line. Styling choices + are more open than with many editors, allowing the use of proportional fonts, bold and + italics, multiple foreground and background colours and multiple fonts.
+ It comes with complete source code and may be used in any free project or commercial + product. +

+

+ SciTE is a SCIntilla based Text Editor. Originally built to + demonstrate Scintilla, it has grown to be a generally useful editor with facilities for + building and running programs. It is best used for jobs with simple configurations - I use it + for building test and demonstration programs as well as SciTE and Scintilla, themselves. +

+

+ Development of Scintilla started as an effort to improve the text editor in PythonWin. After + being frustrated by problems in the Richedit control used by PythonWin, it looked like the + best way forward was to write a new edit control. The biggest problem with Richedit and other + similar controls is that they treat styling changes as important persistent changes to the + document so they are saved into the undo stack and set the document's dirty flag. For source + code, styling should not be persisted as it can be mechanically recreated. +

+

+ Scintilla and SciTE are currently available for Intel Win32 and Linux compatible operating + systems with GTK+. They have been run on Windows 95, NT 4.0, Windows 2000, and on Red Hat + Linux 4.2, 6.1 and Solaris with GTK+ 1.2.0. Here is a screenshot of + SciTE.
+

+

+ You can download Scintilla and SciTE. +

+

+ Related sites. +

+

+ Bugs and To Do list. +

+

+ History and contribution credits. +

+

+ The Future Features of Scintilla are canvassed. Please tell me + what you want and don't want. +

+

+ You can write to me, Neil Hodgson, at + neilh@scintilla.org.
+ There is a + scintilla-interest + mailing list, + for discussion of Scintilla and SciTE and related projects, their bugs and future features. + It is unlikely that there will be a lot of + traffic in scintilla-interest, averaging less than 20 messages per week.
+

+ + + + diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx new file mode 100644 index 000000000..e074aed17 --- /dev/null +++ b/gtk/PlatGTK.cxx @@ -0,0 +1,751 @@ +// Scintilla source code edit control +// PlatGTK.cxx - implementation of platform facilities on GTK+/Linux +// Copyright 1998-2000 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include + +#include + +#include "Platform.h" + +#include "Scintilla.h" + +#define LOWORD(x) (x & 0xffff) +#define HIWORD(x) (x >> 16) + +Point Point::FromLong(long lpoint) { + return Point(LOWORD(lpoint), HIWORD(lpoint)); +} + +static GdkColor ColourfromRGB(unsigned int red, unsigned int green, unsigned int blue) { + GdkColor co; + co.red = red * (65535 / 255); + co.green = green * (65535 / 255); + co.blue = blue * (65535 / 255); + // the pixel value indicates the index in the colourmap of the colour. + // it is simply a combination of the RGB values we set earlier + co.pixel = (gulong)(red * 65536 + green * 256 + blue); + return co; +} + +Colour::Colour(long lcol) { + unsigned int red = lcol & 0xff; + unsigned int green = (lcol >> 8) & 0xff; + unsigned int blue = lcol >> 16; + co = ColourfromRGB(red, green, blue); +} + +Colour::Colour(unsigned int red, unsigned int green, unsigned int blue) { + co = ColourfromRGB(red, green, blue); +} + +bool Colour::operator==(const Colour &other) const { + return + co.red == other.co.red && + co.green == other.co.green && + co.blue == other.co.blue; +} + +unsigned int Colour::GetRed() { + return co.red; +} + +unsigned int Colour::GetGreen() { + return co.green; +} + +unsigned int Colour::GetBlue() { + return co.blue; +} + +long Colour::AsLong() const { + unsigned int red = co.red * 255 / 65535; + unsigned int green = co.green * 255 / 65535; + unsigned int blue = co.blue * 255 / 65535; + return (red + green*256 + blue*65536); +} + +Palette::Palette() { + used = 0; + allowRealization = false; + allocatedPalette = 0; + allocatedLen = 0; +} + +Palette::~Palette() { + Release(); +} + +void Palette::Release() { + used = 0; + delete []allocatedPalette; + allocatedPalette = 0; + allocatedLen = 0; +} + +// 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 Palette::WantFind(ColourPair &cp, bool want) { + if (want) { + for (int i=0; i < used; i++) { + if (entries[i].desired == cp.desired) + return; + } + + if (used < numEntries) { + entries[used].desired = cp.desired; + entries[used].allocated = cp.desired; + used++; + } + } else { + for (int i=0; i < used; i++) { + if (entries[i].desired == cp.desired) { + cp.allocated = entries[i].allocated; + return; + } + } + cp.allocated = cp.desired; + } +} + +void Palette::Allocate(Window &w) { + if (allocatedPalette) { + gdk_colormap_free_colors(gtk_widget_get_colormap(w.GetID()), + allocatedPalette, allocatedLen); + delete []allocatedPalette; + allocatedPalette = 0; + allocatedLen = 0; + } + allocatedPalette = new GdkColor[used]; + gboolean *successPalette = new gboolean[used]; + if (allocatedPalette) { + allocatedLen = used; + int iPal = 0; + for (iPal = 0; iPal < used; iPal++) { + allocatedPalette[iPal] = entries[iPal].desired.co; + } + gdk_colormap_alloc_colors(gtk_widget_get_colormap(w.GetID()), + allocatedPalette, allocatedLen, FALSE, TRUE, + successPalette); + for (iPal = 0; iPal < used; iPal++) { + entries[iPal].allocated.co = allocatedPalette[iPal]; + } + } + delete []successPalette; +} + +Font::Font() : id(0) {} + + +Font::~Font() {} + + +void Font::Create(const char *faceName, int size, bool bold, bool italic) { + Release(); + char fontspec[300]; + fontspec[0] = '\0'; + strcat(fontspec, "-*-"); + strcat(fontspec, faceName); + if (bold) + strcat(fontspec, "-bold"); + else + strcat(fontspec, "-medium"); + if (italic) + strcat(fontspec, "-i"); + else + strcat(fontspec, "-r"); + strcat(fontspec, "-*-*-*"); + char sizePts[100]; + sprintf(sizePts, "-%0d", size * 10); + strcat(fontspec, sizePts); + strcat(fontspec, "-*-*-*-*-*-*"); + id = gdk_font_load(fontspec); + if (!id) { + // Font not available so substitute a reasonable code font + // iso8859 appears to only allow western characters. + id = gdk_font_load("*-*-*-*-*-*-*-*-*-*-*-*-iso8859-*"); + } +} + +void Font::Release() { + if (id) + gdk_font_unref(id); + id = 0; +} + +Surface::Surface() : drawable(0), gc(0), ppixmap(0), +x(0), y(0), inited(false), createdGC(false) {} + + +Surface::~Surface() { + Release(); +} + +void Surface::Release() { + drawable = 0; + if (createdGC) { + createdGC = false; + gdk_gc_unref(gc); + } + gc = 0; + if (ppixmap) + gdk_pixmap_unref(ppixmap); + ppixmap = 0; + x = 0; + y = 0; + inited = false; + createdGC = false; +} + +bool Surface::Initialised() { + return inited; +} + +void Surface::Init() { + Release(); + inited = true; +} + +void Surface::Init(GdkDrawable *drawable_) { + Release(); + drawable = drawable_; + gc = gdk_gc_new(drawable_); + createdGC = true; + inited = true; +} + +void Surface::InitPixMap(int width, int height, Surface *surface_) { + Release(); + if (height > 0 && width > 0) + ppixmap = gdk_pixmap_new(surface_->drawable, width, height, -1); + drawable = ppixmap; + gc = gdk_gc_new(surface_->drawable); + createdGC = true; + inited = true; +} + +void Surface::PenColour(Colour fore) { + if (gc) + gdk_gc_set_foreground(gc, &fore.co); +} + +int Surface::LogPixelsY() { + return 72; +} + +void Surface::MoveTo(int x_, int y_) { + x = x_; + y = y_; +} + +void Surface::LineTo(int x_, int y_) { + gdk_draw_line(drawable, gc, + x, y, + x_, y_); + x = x_; + y = y_; +} + +void Surface::Polygon(Point *pts, int npts, Colour fore, + Colour back) { + // Nasty casts works because Point is exactly same as GdkPoint + // Oh no it doesn't... + GdkPoint gpts[20]; + if (npts < (sizeof(gpts)/sizeof(gpts[0]))) { + for (int i=0;i(pts), npts); + gdk_draw_polygon(drawable, gc, 1, gpts, npts); + PenColour(fore); + gdk_draw_polygon(drawable, gc, 0, gpts, npts); + } +} + +void Surface::RectangleDraw(PRectangle rc, Colour fore, Colour back) { + if (gc && drawable) { + PenColour(back); + gdk_draw_rectangle(drawable, gc, 1, + rc.left, rc.top, + rc.right - rc.left + 1, rc.bottom - rc.top + 1); + PenColour(fore); + gdk_draw_rectangle(drawable, gc, 0, + rc.left, rc.top, + rc.right - rc.left + 1, rc.bottom - rc.top + 1); + } +} + +void Surface::FillRectangle(PRectangle rc, Colour back) { + // GTK+ rectangles include their lower and right edges + rc.bottom--; + rc.right--; + PenColour(back); + if (drawable) { + gdk_draw_rectangle(drawable, gc, 1, + rc.left, rc.top, + rc.right - rc.left + 1, rc.bottom - rc.top + 1); + } +} + +void Surface::FillRectangle(PRectangle rc, Surface &surfacePattern) { + if (surfacePattern.drawable) { + // Tile pattern over rectangle + // Currently assumes 8x8 pattern + int widthPat = 8; + int heightPat = 8; + for (int xTile = rc.left; xTile < rc.right; xTile += widthPat) { + int widthx = (xTile + widthPat > rc.right) ? rc.right - xTile : widthPat; + for (int yTile = rc.top; yTile < rc.bottom; yTile += heightPat) { + int heighty = (yTile + heightPat > rc.bottom) ? rc.bottom - yTile : heightPat; + gdk_draw_pixmap(drawable, + gc, + surfacePattern.drawable, + 0, 0, + xTile, yTile, + widthx, heighty); + } + } + } else { + // Something is wrong so try to show anyway + // Shows up black because colour not allocated + FillRectangle(rc, Colour(0xff, 0, 0)); + } +} + +void Surface::RoundedRectangle(PRectangle rc, Colour fore, Colour back) { + if (((rc.right - rc.left) > 4) && ((rc.bottom - rc.top) > 4)) { + // Approximate a round rect with some cut off corners + Point pts[] = { + Point(rc.left + 2, rc.top), + Point(rc.right - 2, rc.top), + Point(rc.right, rc.top + 2), + Point(rc.right, rc.bottom - 2), + Point(rc.right - 2, rc.bottom), + Point(rc.left + 2, rc.bottom), + Point(rc.left, rc.bottom - 2), + Point(rc.left, rc.top + 2), + }; + Polygon(pts, sizeof(pts) / sizeof(pts[0]), fore, back); + } else { + RectangleDraw(rc, fore, back); + } +} + +void Surface::Ellipse(PRectangle rc, Colour fore, Colour back) { + PenColour(back); + gdk_draw_arc(drawable, gc, 1, + rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top, + 0, 32767); + PenColour(fore); + gdk_draw_arc(drawable, gc, 0, + rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top, + 0, 32767); +} + +void Surface::Copy(PRectangle rc, Point from, Surface &surfaceSource) { + if (surfaceSource.drawable) { + gdk_draw_pixmap(drawable, + gc, + surfaceSource.drawable, + from.x, from.y, + rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top); + } +} + +void Surface::DrawText(PRectangle rc, Font &font_, int ybase, const char *s, int len, + Colour fore, Colour back) { + FillRectangle(rc, back); + PenColour(fore); + if (gc && drawable) + gdk_draw_text(drawable, font_.id, gc, rc.left, ybase, s, len); +} + +// On GTK+, exactly same as DrawText +void Surface::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, + Colour fore, Colour back) { + FillRectangle(rc, back); + PenColour(fore); + if (gc && drawable) + gdk_draw_text(drawable, font_.id, gc, rc.left, ybase, s, len); +} + +void Surface::MeasureWidths(Font &font_, const char *s, int len, int *positions) { + int totalWidth = 0; + for (int i=0;i.?/1234567890" + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +const char sizeString[]= "`~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890" + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + +int Surface::Ascent(Font &font_) { +#ifdef FAST_WAY + return font_.id->ascent; +#else + gint lbearing; + gint rbearing; + gint width; + gint ascent; + gint descent; + + gdk_string_extents(font_.id, sizeString, + &lbearing, &rbearing, &width, &ascent, &descent); + return ascent; +#endif +} + +int Surface::Descent(Font &font_) { +#ifdef FAST_WAY + return font_.id->descent; +#else + gint lbearing; + gint rbearing; + gint width; + gint ascent; + gint descent; + + gdk_string_extents(font_.id, sizeString, + &lbearing, &rbearing, &width, &ascent, &descent); + return descent; +#endif +} + +int Surface::InternalLeading(Font &) { + return 0; +} + +int Surface::ExternalLeading(Font &) { + return 0; +} + +int Surface::Height(Font &font_) { + return Ascent(font_) + Descent(font_); +} + +int Surface::AverageCharWidth(Font &font_) { + return gdk_char_width(font_.id, 'n'); +} + +int Surface::SetPalette(Palette *, bool) { + // Handled in palette allocation for GTK so this does nothing + return 0; +} + +void Surface::SetClip(PRectangle rc) { + GdkRectangle area = {rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top}; + gdk_gc_set_clip_rectangle(gc, &area); +} + +Window::~Window() { +} + +void Window::Destroy() { + if (id) + gtk_widget_destroy(GTK_WIDGET(id)); + id = 0; +} + +bool Window::HasFocus() { + return GTK_WIDGET_HAS_FOCUS(id); +} + +PRectangle Window::GetPosition() { + // Before any size allocated pretend its 100 wide so not scrolled + PRectangle rc(0, 0, 100, 100); + if (id) { + rc.left = id->allocation.x; + rc.top = id->allocation.y; + if (id->allocation.width > 20) { + rc.right = rc.left + id->allocation.width; + rc.bottom = rc.top + id->allocation.height; + } + } + return rc; +} + +void Window::SetPosition(PRectangle rc) { + //gtk_widget_set_uposition(id, rc.left, rc.top); + GtkAllocation alloc; + alloc.x = rc.left; + alloc.y = rc.top; + alloc.width = rc.Width(); + alloc.height = rc.Height(); + gtk_widget_size_allocate(id, &alloc); +} + +void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { + int ox = 0; + int oy = 0; + gdk_window_get_origin(relativeTo.id->window, &ox, &oy); + + gtk_widget_set_uposition(id, rc.left + ox, rc.top + oy); + GtkAllocation alloc; + alloc.x = rc.left + ox; + alloc.y = rc.top + oy; + alloc.width = rc.right - rc.left; + alloc.height = rc.bottom - rc.top; + gtk_widget_size_allocate(id, &alloc); +} + +PRectangle Window::GetClientPosition() { + // On GTK+, the client position is the window position + return GetPosition(); +} + +void Window::Show(bool show) { + if (show) + gtk_widget_show(id); +} + +void Window::InvalidateAll() { + if (id) { + gtk_widget_queue_draw(id); + } +} + +void Window::InvalidateRectangle(PRectangle rc) { + if (id) { + gtk_widget_queue_draw_area(id, + rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top); + } +} + +void Window::SetFont(Font &) { + // TODO +} + +void Window::SetCursor(Cursor curs) { + switch (curs) { + case cursorText: + gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_XTERM)); + break; + case cursorArrow: + gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_ARROW)); + break; + case cursorUp: + gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_CENTER_PTR)); + break; + case cursorWait: + gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_WATCH)); + break; + case cursorReverseArrow: + gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_TOP_LEFT_ARROW)); + break; + default: + gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_ARROW)); + break; + } +} + +void Window::SetTitle(const char *s) { + gtk_window_set_title(GTK_WINDOW(id), s); +} + +ListBox::ListBox() : list(0), current(0) {} + +ListBox::~ListBox() {} + +static void SelectionAC(GtkWidget *, gint row, gint, + GdkEventButton *, gpointer p) { + int *pi = reinterpret_cast(p); + *pi = row; +} + +void ListBox::Create(Window &, int) { + id = gtk_window_new(GTK_WINDOW_POPUP); + scroller = gtk_scrolled_window_new(NULL, NULL); + gtk_container_set_border_width(GTK_CONTAINER(scroller), 1); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller), + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + + list = gtk_clist_new(1); + gtk_clist_set_column_auto_resize(GTK_CLIST(list), 0, TRUE); + gtk_container_add(GTK_CONTAINER(scroller), list); + + gtk_container_add(GTK_CONTAINER(GetID()), scroller); + + gtk_widget_show(list); + gtk_widget_show(scroller); + + gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE); + gtk_signal_connect(GTK_OBJECT(list), "select_row", + GTK_SIGNAL_FUNC(SelectionAC), ¤t); + gtk_clist_set_shadow_type(GTK_CLIST(list), GTK_SHADOW_OUT); + + gtk_widget_realize(id); +} + +void ListBox::Clear() { + gtk_clist_clear(GTK_CLIST(list)); +} + +void ListBox::Append(char *s) { + char *szs[] = { s, 0}; + gtk_clist_append(GTK_CLIST(list), szs); +} + +int ListBox::Length() { + return GTK_CLIST(list)->rows; +} + +void ListBox::Select(int n) { + gtk_clist_select_row(GTK_CLIST(list), n, 0); + gtk_clist_moveto(GTK_CLIST(list), n, 0, 0.5, 0.5); +} + +int ListBox::GetSelection() { + return current; +} + +int ListBox::Find(const char *prefix) { + int count = Length(); + for (int i = 0; i < count; i++) { + char *s = 0; + gtk_clist_get_text(GTK_CLIST(list), i, 0, &s); + if (s && (0 == strncmp(prefix, s, strlen(prefix)))) { + return i; + } + } + return - 1; +} + +void ListBox::GetValue(int n, char *value, int len) { + char *text = 0; + gtk_clist_get_text(GTK_CLIST(list), n, 0, &text); + if (text && len > 0) { + strncpy(value, text, len); + value[len - 1] = '\0'; + } else { + value[0] = '\0'; + } +} + +void ListBox::Sort() { + gtk_clist_sort(GTK_CLIST(list)); +} + +Menu::Menu() : id(0) {} + + +void Menu::CreatePopUp() { + Destroy(); + id = gtk_item_factory_new(GTK_TYPE_MENU, "
", NULL); +} + +void Menu::Destroy() { + if (id) + gtk_object_unref(GTK_OBJECT(id)); + id = 0; +} + +void Menu::Show(Point pt, Window &) { + gtk_item_factory_popup(id, pt.x - 4, pt.y, 3, 0); +} + +Colour Platform::Chrome() { + return Colour(0xe0, 0xe0, 0xe0); +} + +Colour Platform::ChromeHighlight() { + return Colour(0xff, 0xff, 0xff); +} + +const char *Platform::DefaultFont() { + return "lucidatypewriter"; +} + +int Platform::DefaultFontSize() { + return 12; +} + +unsigned int Platform::DoubleClickTime() { + return 500; // Half a second +} + +void Platform::DebugDisplay(const char *s) { + printf("%s", s); +} + +bool Platform::IsKeyDown(int) { + // TODO: discover state of keys in GTK+/X + return false; +} + +long Platform::SendScintilla( + WindowID w, unsigned int msg, unsigned long wParam, long lParam) { + return scintilla_send_message(SCINTILLA(w), msg, wParam, lParam); +} + +// These are utility functions not really tied to a platform + +int Platform::Minimum(int a, int b) { + if (a < b) + return a; + else + return b; +} + +int Platform::Maximum(int a, int b) { + if (a > b) + return a; + else + return b; +} + +//#define TRACE + +void Platform::DebugPrintf(const char *format, ...) { +#ifdef TRACE + char buffer[2000]; + va_list pArguments; + va_start(pArguments, format); + vsprintf(buffer, format, pArguments); + va_end(pArguments); + Platform::DebugDisplay(buffer); +#endif +} + +int Platform::Clamp(int val, int minVal, int maxVal) { + if (val > maxVal) + val = maxVal; + if (val < minVal) + val = minVal; + return val; +} diff --git a/gtk/makefile b/gtk/makefile new file mode 100644 index 000000000..9b34c08d7 --- /dev/null +++ b/gtk/makefile @@ -0,0 +1,69 @@ +# Make file for Scintilla on Linux or compatible OS +# Copyright 1998-2000 by Neil Hodgson +# The License.txt file describes the conditions under which this software may be distributed. +# This makefile assumes GCC 2.95.2 is used and changes will +# be needed to use other compilers. + +.SUFFIXES: .cxx .o .h .a +CC = g++ +AR = ar + +COMPLIB=../bin/scintilla.a + +vpath %.h ../src ../include +vpath %.cxx ../src + +#CXXFLAGS= -g -DGTK -DSCI_LEXER -Wwrite-strings +INCLUDEDIRS=-I ../include -I ../src +CXXFLAGS= -DGTK -DSCI_LEXER + +.cxx.o: + $(CC) `gtk-config --cflags` $(INCLUDEDIRS) $(CXXFLAGS) -c $< -o $@ + +all: $(COMPLIB) + +$(COMPLIB): Accessor.o KeyWords.o Document.o CallTip.o \ + ScintillaBase.o ContractionState.o Editor.o PropSet.o PlatGTK.o \ + KeyMap.o LineMarker.o ScintillaGTK.o CellBuffer.o ViewStyle.o \ + Style.o Indicator.o AutoComplete.o + $(AR) rc $@ $^ + +Accessor.o: Accessor.cxx Platform.h PropSet.h Accessor.h Scintilla.h \ + WinDefs.h +AutoComplete.o: AutoComplete.cxx Platform.h AutoComplete.h +CallTip.o: CallTip.cxx Platform.h CallTip.h +CellBuffer.o: CellBuffer.cxx Platform.h Scintilla.h WinDefs.h \ + CellBuffer.h +ContractionState.o: ContractionState.cxx Platform.h ContractionState.h +Document.o: Document.cxx Platform.h Scintilla.h WinDefs.h CellBuffer.h \ + Document.h +Editor.o: Editor.cxx Platform.h Scintilla.h WinDefs.h \ + ContractionState.h CellBuffer.h KeyMap.h Indicator.h LineMarker.h \ + Style.h ViewStyle.h Document.h Editor.h +Indicator.o: Indicator.cxx Platform.h Scintilla.h WinDefs.h \ + Indicator.h +KeyMap.o: KeyMap.cxx Platform.h Scintilla.h WinDefs.h KeyMap.h +KeyWords.o: KeyWords.cxx Platform.h PropSet.h Accessor.h KeyWords.h \ + Scintilla.h WinDefs.h SciLexer.h +LineMarker.o: LineMarker.cxx Platform.h Scintilla.h WinDefs.h \ + LineMarker.h +PlatGTK.o: PlatGTK.cxx Platform.h Scintilla.h WinDefs.h +PropSet.o: PropSet.cxx Platform.h PropSet.h +SciTEBase.o: SciTEBase.cxx Platform.h WinDefs.h SciTE.h PropSet.h \ + Accessor.h KeyWords.h Scintilla.h SciLexer.h SciTEBase.h +SciTEGTK.o: SciTEGTK.cxx Platform.h WinDefs.h SciTE.h PropSet.h \ + Accessor.h KeyWords.h Scintilla.h SciTEBase.h +ScintillaBase.o: ScintillaBase.cxx Platform.h Scintilla.h WinDefs.h \ + SciLexer.h PropSet.h Accessor.h KeyWords.h ContractionState.h \ + CellBuffer.h CallTip.h KeyMap.h Indicator.h LineMarker.h Style.h \ + ViewStyle.h AutoComplete.h Document.h Editor.h ScintillaBase.h +ScintillaGTK.o: ScintillaGTK.cxx Platform.h Scintilla.h WinDefs.h \ + SciLexer.h PropSet.h Accessor.h KeyWords.h ContractionState.h \ + CellBuffer.h CallTip.h KeyMap.h Indicator.h LineMarker.h Style.h \ + AutoComplete.h ViewStyle.h Document.h Editor.h ScintillaBase.h +Style.o: Style.cxx Platform.h Style.h +ViewStyle.o: ViewStyle.cxx Platform.h Scintilla.h WinDefs.h \ + Indicator.h LineMarker.h Style.h ViewStyle.h + +clean: + rm -f *.o SciTE diff --git a/tgzsrc b/tgzsrc new file mode 100644 index 000000000..5c3ed1767 --- /dev/null +++ b/tgzsrc @@ -0,0 +1,5 @@ +cd .. +rm -f scintilla.zip +tar --create scintilla/* \ + --exclude=*.o --exclude=*.obj --exclude=*.dll --exclude=*.exe --exclude=*.a \ + | gzip -c >scintilla.tgz diff --git a/zipsrc.bat b/zipsrc.bat new file mode 100755 index 000000000..a89649789 --- /dev/null +++ b/zipsrc.bat @@ -0,0 +1,4 @@ +cd .. +del/q scintilla.zip +zip scintilla.zip scintilla\*.* scintilla\*\*.* -x *.o -x *.obj -x *.dll +cd scintilla -- cgit v1.2.3