merged 2.2 branch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2000-07-15 19:51:35 +00:00
parent 8a693e6e04
commit f6bcfd974e
1835 changed files with 237729 additions and 67990 deletions

View File

@@ -0,0 +1,181 @@
// 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
#define SCLEX_XCODE 13
#define SCLEX_LATEX 14
// 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_UUID 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
// Lexical states for SCLEX_LATEX
#define SCE_L_DEFAULT 0
#define SCE_L_COMMAND 1
#define SCE_L_TAG 2
#define SCE_L_MATH 3
#define SCE_L_COMMENT 4
#endif

View File

@@ -22,7 +22,7 @@
#include <wx/wx.h>
#include "SciLexer.h"
//----------------------------------------------------------------------
// constants and stuff
@@ -53,7 +53,7 @@ const int wxSTC_STYLE_LINENUMBER = 33;
const int wxSTC_STYLE_BRACELIGHT = 34;
const int wxSTC_STYLE_BRACEBAD = 35;
const int wxSTC_STYLE_CONTROLCHAR = 36;
const int wxSTC_STYLE_MAX = 63;
const int wxSTC_STYLE_MAX = 127;
const int wxSTC_STYLE_MASK = 31;
const int wxSTC_MARKER_MAX = 31;
@@ -63,16 +63,32 @@ const int wxSTC_MARK_ARROW = 2;
const int wxSTC_MARK_SMALLRECT = 3;
const int wxSTC_MARK_SHORTARROW = 4;
const int wxSTC_MARK_EMPTY = 5;
const int wxSTC_MARK_ARROWDOWN = 6;
const int wxSTC_MARK_MINUS = 7;
const int wxSTC_MARK_PLUS = 8;
const int wxSTC_MARKNUM_FOLDER = 30;
const int wxSTC_MARKNUM_FOLDEROPEN= 31;
const int wxSTC_MASK_FOLDERS = ((1 << wxSTC_MARKNUM_FOLDER) | (1 << wxSTC_MARKNUM_FOLDEROPEN));
const int wxSTC_INDIC_MAX = 7;
const int wxSTC_INDIC_PLAIN = 0;
const int wxSTC_INDIC_SQUIGGLE = 1;
const int wxSTC_INDIC_TT = 2;
const int wxSTC_INDIC_DIAGONAL = 3;
const int wxSTC_INDIC_STRIKE = 4;
const int wxSTC_INDIC0_MASK = 32;
const int wxSTC_INDIC1_MASK = 64;
const int wxSTC_INDIC2_MASK = 128;
const int wxSTC_INDICS_MASK = (wxSTC_INDIC0_MASK | wxSTC_INDIC1_MASK | wxSTC_INDIC2_MASK);
const int wxSTC_FOLDLEVELBASE = 0x0400;
const int wxSTC_FOLDLEVELWHITEFLAG = 0x1000;
const int wxSTC_FOLDLEVELHEADERFLAG = 0x2000;
const int wxSTC_FOLDLEVELNUMBERMASK = 0x0FFF;
// key commands
enum {
wxSTC_CMD_LINEDOWN = 2300,
@@ -111,7 +127,14 @@ enum {
wxSTC_CMD_ZOOMIN,
wxSTC_CMD_ZOOMOUT,
wxSTC_CMD_DELWORDLEFT,
wxSTC_CMD_DELWORDRIGHT
wxSTC_CMD_DELWORDRIGHT,
wxSTC_CMD_LINECUT,
wxSTC_CMD_LINEDELETE,
wxSTC_CMD_LINETRANSPOSE,
wxSTC_CMD_LOWERCASE,
wxSTC_CMD_UPPERCASE,
wxSTC_CMD_LINESCROLLDOWN,
wxSTC_CMD_LINESCROLLUP
};
@@ -129,6 +152,8 @@ enum wxSTC_LEX {
wxSTC_LEX_ERRORLIST,
wxSTC_LEX_MAKEFILE,
wxSTC_LEX_BATCH,
wxSTC_LEX_XCODE,
wxSTC_LEX_LATEX
};
@@ -153,13 +178,23 @@ extern const wxChar* wxSTCNameStr;
class wxStyledTextCtrl : public wxControl {
public:
#ifdef SWIG
wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const char* name = "styledtext");
#else
wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = wxSTCNameStr);
~wxStyledTextCtrl();
#endif
#ifndef SWIG
~wxStyledTextCtrl();
#endif
// Text retrieval and modification
wxString GetText();
@@ -170,8 +205,10 @@ public:
bool GetReadOnly();
wxString GetTextRange(int startPos, int endPos);
wxString GetStyledTextRange(int startPos, int endPos);
#ifndef SWIG
void GetTextRange(int startPos, int endPos, char* buff);
void GetStyledTextRange(int startPos, int endPos, char* buff);
#endif
void AddText(const wxString& text);
void AddStyledText(const wxString& text);
void InsertText(int pos, const wxString& text);
@@ -203,7 +240,11 @@ public:
// Selection and information
#ifdef SWIG
void GetSelection(int* OUTPUT, int* OUTPUT);
#else
void GetSelection(int* startPos, int* endPos);
#endif
void SetSelection(int startPos, int endPos);
wxString GetSelectedText();
void HideSelection(bool hide);
@@ -218,7 +259,11 @@ public:
int GetLineStartPos(int line);
int GetLineLengthAtPos(int pos);
int GetLineLength(int line);
wxString GetCurrentLineText(int* linePos=NULL);
#ifdef SWIG
wxString GetCurrentLineText(int* OUTPUT);
#else
wxString GetCurrentLineText(int* linePos);
#endif
int GetCurrentLine();
int PositionFromPoint(wxPoint pt);
int LineFromPoint(wxPoint pt);
@@ -239,7 +284,10 @@ public:
void EnsureCaretVisible();
void SetCaretPolicy(int policy, int slop=0);
int GetSelectionType();
int GetLinesOnScreen();
bool IsSelectionRectangle();
void SetUseHorizontalScrollBar(bool use);
bool GetUseHorizontalScrollBar();
// Searching
@@ -268,6 +316,8 @@ public:
void StartStyling(int pos, int mask);
void SetStyleFor(int length, int style);
void SetStyleBytes(int length, char* styleBytes);
void SetLineState(int line, int value);
int GetLineState(int line);
// Style Definition
@@ -277,12 +327,13 @@ public:
void StyleSetForeground(int styleNum, const wxColour& colour);
void StyleSetBackground(int styleNum, const wxColour& colour);
void StyleSetFont(int styleNum, wxFont& font);
void StyleSetFontAttr(int styleNum, int size, const wxString& faceName, bool bold, bool italic);
void StyleSetFontAttr(int styleNum, int size, const wxString& faceName, bool bold=FALSE, bool italic=FALSE, bool underline=FALSE);
void StyleSetBold(int styleNum, bool bold);
void StyleSetItalic(int styleNum, bool italic);
void StyleSetFaceName(int styleNum, const wxString& faceName);
void StyleSetSize(int styleNum, int pointSize);
void StyleSetEOLFilled(int styleNum, bool fillEOL);
void StyleSetUnderline(int styleNum, bool underline);
// Margins in the edit area
@@ -313,8 +364,15 @@ public:
// Other settings
void SetBufferedDraw(bool isBuffered);
void SetTabWidth(int numChars);
void SetIndent(int numChars);
void SetUseTabs(bool usetabs);
void SetLineIndentation(int line, int indentation);
int GetLineIndentation(int line);
int GetLineIndentationPos(int line);
void SetWordChars(const wxString& wordChars);
void SetUsePop(bool usepopup);
// Brace highlighting
void BraceHighlight(int pos1, int pos2);
@@ -352,7 +410,9 @@ public:
int AutoCompPosAtStart();
void AutoCompComplete();
void AutoCompStopChars(const wxString& stopChars);
void AutoCompSetSeparator(char separator);
char AutoCompGetSeparator();
void AutoCompSelect(const wxString& stringtoselect);
// Call tips
void CallTipShow(int pos, const wxString& text);
@@ -391,15 +451,23 @@ public:
int DocLineFromVisible(int displayLine);
int SetFoldLevel(int line, int level);
int GetFoldLevel(int line);
int GetLastChild(int line);
int GetLastChild(int line, int level);
int GetFoldParent(int line);
void ShowLines(int lineStart, int lineEnd);
void HideLines(int lineStart, int lineEnd);
bool GetLineVisible(int line);
void SetFoldExpanded(int line);
void SetFoldExpanded(int line, bool expanded);
bool GetFoldExpanded(int line);
void ToggleFold(int line);
void EnsureVisible(int line);
void SetFoldFlags(int flags);
// Zooming
void ZoomIn();
void ZoomOut();
void SetZoom(int zoom);
int GetZoom();
// Long Lines
@@ -419,7 +487,11 @@ public:
void SetKeywords(int keywordSet, const wxString& keywordList);
// Event mask for Modified Event
void SetModEventMask(int mask);
//int GetModEventMask();
#ifndef SWIG
private:
// Event handlers
void OnPaint(wxPaintEvent& evt);
@@ -430,11 +502,13 @@ private:
void OnMouseLeftUp(wxMouseEvent& evt);
void OnMouseRightUp(wxMouseEvent& evt);
void OnChar(wxKeyEvent& evt);
void OnKeyDown(wxKeyEvent& evt);
void OnLoseFocus(wxFocusEvent& evt);
void OnGainFocus(wxFocusEvent& evt);
void OnSysColourChanged(wxSysColourChangedEvent& evt);
void OnEraseBackground(wxEraseEvent& evt);
void OnMenu(wxCommandEvent& evt);
void OnListBox(wxCommandEvent& evt);
// Turn notifications from Scintilla into events
@@ -445,6 +519,7 @@ private:
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxStyledTextCtrl)
ScintillaWX* m_swx;
wxStopWatch m_stopWatch;
@@ -454,13 +529,14 @@ private:
friend class ScintillaWX;
friend class Platform;
#endif
};
//----------------------------------------------------------------------
class wxStyledTextEvent : public wxCommandEvent {
public:
wxStyledTextEvent(wxEventType commandType, int id);
wxStyledTextEvent(wxEventType commandType=0, int id=0);
~wxStyledTextEvent() {}
void SetPosition(int pos) { m_position = pos; }
@@ -499,7 +575,10 @@ public:
void CopyObject(wxObject& obj) const;
#ifndef SWIG
private:
DECLARE_DYNAMIC_CLASS(wxStyledTextEvent)
int m_position;
int m_key;
int m_modifiers;
@@ -517,11 +596,11 @@ private:
int m_message; // wxEVT_STC_MACRORECORD
int m_wParam;
int m_lParam;
#endif
};
// Event types
enum {
wxEVT_STC_CHANGE = 1650,
wxEVT_STC_STYLENEEDED,
@@ -538,6 +617,21 @@ enum {
wxEVT_STC_NEEDSHOWN
};
// Modification and action types
const int wxSTC_MOD_INSERTTEXT = 0x1;
const int wxSTC_MOD_DELETETEXT = 0x2;
const int wxSTC_MOD_CHANGESTYLE = 0x4;
const int wxSTC_MOD_CHANGEFOLD = 0x8;
const int wxSTC_PERFORMED_USER = 0x10;
const int wxSTC_PERFORMED_UNDO = 0x20;
const int wxSTC_PERFORMED_REDO = 0x40;
const int wxSTC_LASTSTEPINUNDOREDO = 0x100;
const int wxSTC_MOD_CHANGEMARKER = 0x200;
const int wxSTC_MOD_BEFOREINSERT = 0x400;
const int wxSTC_MOD_BEFOREDELETE = 0x800;
#ifndef SWIG
typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#define EVT_STC_CHANGE(id, fn) { wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
@@ -549,9 +643,12 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#define EVT_STC_ROMODIFYATTEMPT(id, fn) { wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
#define EVT_STC_DOUBLECLICK(id, fn) { wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
#define EVT_STC_MODIFIED(id, fn) { wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
#define EVT_STC_CMDKEY(id, fn) { wxEVT_STC_CMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
#define EVT_STC_UNKNOWNCMDKEY(id, fn) { wxEVT_STC_UNKNOWNCMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
#define EVT_STC_KEY(id, fn) { wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
#define EVT_STC_MACRORECORD(id, fn) { wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
#define EVT_STC_MARGINCLICK(id, fn) { wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
#define EVT_STC_NEEDSHOWN(id, fn) { wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
#endif
//----------------------------------------------------------------------
//----------------------------------------------------------------------