From 55f55e8a8d7a725ddbb5fd4196036caf6a815cfe Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 18 Jul 2003 06:37:25 +0000 Subject: [PATCH] Update to Scintilla 1.53 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@22079 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/stc/stc.h | 47 +++ contrib/src/stc/Makefile.in | 3 + contrib/src/stc/PlatWX.cpp | 7 + contrib/src/stc/ScintillaWX.cpp | 23 +- contrib/src/stc/ScintillaWX.h | 2 + contrib/src/stc/makefile.b32 | 3 + contrib/src/stc/makefile.g95 | 3 + contrib/src/stc/makefile.vc | 3 + contrib/src/stc/makefile.wat | 3 + contrib/src/stc/scintilla/README.txt | 2 +- contrib/src/stc/scintilla/include/Platform.h | 18 ++ contrib/src/stc/scintilla/include/PropSet.h | 2 +- contrib/src/stc/scintilla/include/SciLexer.h | 26 ++ contrib/src/stc/scintilla/include/Scintilla.h | 5 + .../src/stc/scintilla/include/Scintilla.iface | 49 ++- contrib/src/stc/scintilla/src/Document.cxx | 37 +-- contrib/src/stc/scintilla/src/Editor.cxx | 87 ++++-- contrib/src/stc/scintilla/src/Editor.h | 19 +- .../src/stc/scintilla/src/ExternalLexer.cxx | 256 ++++++++++++++++ contrib/src/stc/scintilla/src/ExternalLexer.h | 103 +++++++ contrib/src/stc/scintilla/src/KeyMap.cxx | 1 + contrib/src/stc/scintilla/src/KeyWords.cxx | 15 +- contrib/src/stc/scintilla/src/LexCPP.cxx | 285 +++--------------- contrib/src/stc/scintilla/src/LexEScript.cxx | 270 +++++++++++++++++ contrib/src/stc/scintilla/src/LexLout.cxx | 208 +++++++++++++ contrib/src/stc/scintilla/src/LexOthers.cxx | 11 + contrib/src/stc/scintilla/src/PropSet.cxx | 32 +- contrib/src/stc/scintilla/src/RESearch.cxx | 4 +- contrib/src/stc/stc.cpp | 31 +- src/stc/makefile.b32 | 3 + src/stc/makefile.g95 | 3 + src/stc/makefile.vc | 3 + src/stc/makefile.wat | 3 + wxPython/contrib/stc/gtk/stc_.cpp | 187 ++++++++++++ wxPython/contrib/stc/gtk/stc_.py | 41 +++ 35 files changed, 1457 insertions(+), 338 deletions(-) create mode 100644 contrib/src/stc/scintilla/src/ExternalLexer.cxx create mode 100644 contrib/src/stc/scintilla/src/ExternalLexer.h create mode 100644 contrib/src/stc/scintilla/src/LexEScript.cxx create mode 100644 contrib/src/stc/scintilla/src/LexLout.cxx diff --git a/contrib/include/wx/stc/stc.h b/contrib/include/wx/stc/stc.h index 193376418f..2f54e83f76 100644 --- a/contrib/include/wx/stc/stc.h +++ b/contrib/include/wx/stc/stc.h @@ -329,6 +329,8 @@ #define wxSTC_LEX_F77 37 #define wxSTC_LEX_CSS 38 #define wxSTC_LEX_POV 39 +#define wxSTC_LEX_LOUT 40 +#define wxSTC_LEX_ESCRIPT 41 // When a lexer specifies its language as SCLEX_AUTOMATIC it receives a // value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -370,6 +372,7 @@ #define wxSTC_C_WORD2 16 #define wxSTC_C_COMMENTDOCKEYWORD 17 #define wxSTC_C_COMMENTDOCKEYWORDERROR 18 +#define wxSTC_C_GLOBALCLASS 19 // Lexical states for SCLEX_HTML, SCLEX_XML #define wxSTC_H_DEFAULT 0 @@ -811,6 +814,33 @@ #define wxSTC_POV_BRACE 9 #define wxSTC_POV_WORD2 10 +// Lexical states for SCLEX_LOUT +#define wxSTC_LOUT_DEFAULT 0 +#define wxSTC_LOUT_COMMENT 1 +#define wxSTC_LOUT_NUMBER 2 +#define wxSTC_LOUT_WORD 3 +#define wxSTC_LOUT_WORD2 4 +#define wxSTC_LOUT_WORD3 5 +#define wxSTC_LOUT_WORD4 6 +#define wxSTC_LOUT_STRING 7 +#define wxSTC_LOUT_OPERATOR 8 +#define wxSTC_LOUT_IDENTIFIER 9 +#define wxSTC_LOUT_STRINGEOL 10 + +// Lexical states for SCLEX_ESCRIPT +#define wxSTC_ESCRIPT_DEFAULT 0 +#define wxSTC_ESCRIPT_COMMENT 1 +#define wxSTC_ESCRIPT_COMMENTLINE 2 +#define wxSTC_ESCRIPT_COMMENTDOC 3 +#define wxSTC_ESCRIPT_NUMBER 4 +#define wxSTC_ESCRIPT_WORD 5 +#define wxSTC_ESCRIPT_STRING 6 +#define wxSTC_ESCRIPT_OPERATOR 7 +#define wxSTC_ESCRIPT_IDENTIFIER 8 +#define wxSTC_ESCRIPT_BRACE 9 +#define wxSTC_ESCRIPT_WORD2 10 +#define wxSTC_ESCRIPT_WORD3 11 + //----------------------------------------- // Commands that can be bound to keystrokes @@ -1880,6 +1910,9 @@ public: // caret position. void LineEndDisplayExtend(); + // Copy the line containing the caret. + void LineCopy(); + // Move the caret inside current view if it's not there already. void MoveCaretInsideView(); @@ -2056,6 +2089,20 @@ public: // Enable / Disable underlining active hotspots. void SetHotspotActiveUnderline(bool underline); + // Given a valid document position, return the previous position taking code + // page into account. Returns 0 if passed 0. + int PositionBefore(int pos); + + // Given a valid document position, return the next position taking code + // page into account. Maximum value returned is the last position in the document. + int PositionAfter(int pos); + + // Copy a range of text to the clipboard. Positions are clipped into the document. + void CopyRange(int start, int end); + + // Copy argument text to the clipboard. + void CopyText(int length, const wxString& text); + // Start notifying the container of all key presses and commands. void StartRecord(); diff --git a/contrib/src/stc/Makefile.in b/contrib/src/stc/Makefile.in index 9df25a3db2..a04ccde08f 100644 --- a/contrib/src/stc/Makefile.in +++ b/contrib/src/stc/Makefile.in @@ -30,6 +30,7 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \ Document.o \ DocumentAccessor.o \ Editor.o \ + ExternalLexer.o \ Indicator.o \ KeyMap.o \ KeyWords.o \ @@ -44,9 +45,11 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \ LexCrontab.o \ LexCSS.o \ LexEiffel.o \ + LexEScript.o \ LexFortran.o \ LexHTML.o \ LexLisp.o \ + LexLout.o \ LexLua.o \ LexOthers.o \ LexPOV.o \ diff --git a/contrib/src/stc/PlatWX.cpp b/contrib/src/stc/PlatWX.cpp index 8f2f37afa5..82544a1657 100644 --- a/contrib/src/stc/PlatWX.cpp +++ b/contrib/src/stc/PlatWX.cpp @@ -1062,6 +1062,13 @@ void Menu::Show(Point pt, Window &w) { //---------------------------------------------------------------------- +DynamicLibrary *DynamicLibrary::Load(const char *modulePath) { + wxFAIL_MSG(wxT("Dynamic lexer loading not implemented yet")); + return NULL; +} + +//---------------------------------------------------------------------- + ColourDesired Platform::Chrome() { wxColour c; c = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index 059dd4afaa..3e5ebf0aa6 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -16,6 +16,7 @@ #include "ScintillaWX.h" +#include "ExternalLexer.h" #include "wx/stc/stc.h" #include "PlatWX.h" @@ -337,12 +338,7 @@ void ScintillaWX::Copy() { if (currentPos != anchor) { SelectionText st; CopySelectionRange(&st); - if (wxTheClipboard->Open()) { - wxTheClipboard->UsePrimarySelection(FALSE); - wxString text = stc2wx(st.s, st.len); - wxTheClipboard->SetData(new wxTextDataObject(text)); - wxTheClipboard->Close(); - } + CopyToClipboard(st); } } @@ -372,6 +368,16 @@ void ScintillaWX::Paste() { } +void ScintillaWX::CopyToClipboard(const SelectionText& st) { + if (wxTheClipboard->Open()) { + wxTheClipboard->UsePrimarySelection(FALSE); + wxString text = stc2wx(st.s, st.len); + wxTheClipboard->SetData(new wxTextDataObject(text)); + wxTheClipboard->Close(); + } +} + + bool ScintillaWX::CanPaste() { bool canPaste = FALSE; bool didOpen; @@ -474,6 +480,11 @@ long ScintillaWX::WndProc(unsigned int iMessage, unsigned long wParam, long lPar break; } +#ifdef SCI_LEXER + case SCI_LOADLEXERLIBRARY: + LexerManager::GetInstance()->Load((const char*)lParam); + break; +#endif default: return ScintillaBase::WndProc(iMessage, wParam, lParam); } diff --git a/contrib/src/stc/ScintillaWX.h b/contrib/src/stc/ScintillaWX.h index 4c6b35c6e3..506fa252d5 100644 --- a/contrib/src/stc/ScintillaWX.h +++ b/contrib/src/stc/ScintillaWX.h @@ -100,6 +100,8 @@ public: virtual bool ModifyScrollBars(int nMax, int nPage); virtual void Copy(); virtual void Paste(); + virtual void CopyToClipboard(const SelectionText &selectedText); + virtual void CreateCallTipWindow(PRectangle rc); virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true); virtual void ClaimSelection(); diff --git a/contrib/src/stc/makefile.b32 b/contrib/src/stc/makefile.b32 index ac6a1b59c3..6ce6044a8b 100644 --- a/contrib/src/stc/makefile.b32 +++ b/contrib/src/stc/makefile.b32 @@ -29,6 +29,7 @@ OBJECTS = \ Document.obj \ DocumentAccessor.obj \ Editor.obj \ + ExternalLexer.obj \ Indicator.obj \ KeyMap.obj \ KeyWords.obj \ @@ -43,9 +44,11 @@ OBJECTS = \ LexCrontab.obj \ LexCSS.obj \ LexEiffel.obj \ + LexEScript.obj \ LexFortran.obj \ LexHTML.obj \ LexLisp.obj \ + LexLout.obj \ LexLua.obj \ LexOthers.obj \ LexPOV.obj \ diff --git a/contrib/src/stc/makefile.g95 b/contrib/src/stc/makefile.g95 index 25dd4ad0cd..6f23b518da 100644 --- a/contrib/src/stc/makefile.g95 +++ b/contrib/src/stc/makefile.g95 @@ -17,6 +17,7 @@ OBJECTS = \ $(S)/Document.$(OBJSUFF) \ $(S)/DocumentAccessor.$(OBJSUFF) \ $(S)/Editor.$(OBJSUFF) \ + $(S)/ExternalLexer.$(OBJSUFF) \ $(S)/Indicator.$(OBJSUFF) \ $(S)/KeyMap.$(OBJSUFF) \ $(S)/KeyWords.$(OBJSUFF) \ @@ -31,9 +32,11 @@ OBJECTS = \ $(S)/LexCrontab.$(OBJSUFF) \ $(S)/LexCSS.$(OBJSUFF) \ $(S)/LexEiffel.$(OBJSUFF) \ + $(S)/LexEScript.$(OBJSUFF) \ $(S)/LexFortran.$(OBJSUFF) \ $(S)/LexHTML.$(OBJSUFF) \ $(S)/LexLisp.$(OBJSUFF) \ + $(S)/LexLout.$(OBJSUFF) \ $(S)/LexLua.$(OBJSUFF) \ $(S)/LexOthers.$(OBJSUFF) \ $(S)/LexPOV.$(OBJSUFF) \ diff --git a/contrib/src/stc/makefile.vc b/contrib/src/stc/makefile.vc index 4aa0e2c352..22d7e750d1 100644 --- a/contrib/src/stc/makefile.vc +++ b/contrib/src/stc/makefile.vc @@ -22,6 +22,7 @@ OBJECTS = \ $(D)\Document.obj \ $(D)\DocumentAccessor.obj \ $(D)\Editor.obj \ + $(D)\ExternalLexer.obj \ $(D)\Indicator.obj \ $(D)\KeyMap.obj \ $(D)\KeyWords.obj \ @@ -36,9 +37,11 @@ OBJECTS = \ $(D)\LexCrontab.obj \ $(D)\LexCSS.obj \ $(D)\LexEiffel.obj \ + $(D)\LexEScript.obj \ $(D)\LexFortran.obj \ $(D)\LexHTML.obj \ $(D)\LexLisp.obj \ + $(D)\LexLout.obj \ $(D)\LexLua.obj \ $(D)\LexOthers.obj \ $(D)\LexPOV.obj \ diff --git a/contrib/src/stc/makefile.wat b/contrib/src/stc/makefile.wat index 76a2985a3b..eb568c1575 100644 --- a/contrib/src/stc/makefile.wat +++ b/contrib/src/stc/makefile.wat @@ -26,6 +26,7 @@ OBJECTS = & Document.obj & DocumentAccessor.obj & Editor.obj & + ExternalLexer.obj & Indicator.obj & KeyMap.obj & KeyWords.obj & @@ -40,9 +41,11 @@ OBJECTS = & LexCrontab.obj & LexCSS.obj & LexEiffel.obj & + LexEScript.obj & LexFortran.obj & LexHTML.obj & LexLisp.obj & + LexLout.obj & LexLua.obj & LexOthers.obj & LexPOV.obj & diff --git a/contrib/src/stc/scintilla/README.txt b/contrib/src/stc/scintilla/README.txt index 4f5b08f1cb..bba521448e 100644 --- a/contrib/src/stc/scintilla/README.txt +++ b/contrib/src/stc/scintilla/README.txt @@ -3,4 +3,4 @@ scintilla/include directories from the Scintilla/SCiTE source distribution. All other code needed to implement Scintilla on top of wxWindows is located in the directory above this one. -The current version of the Scintilla code is 1.52 +The current version of the Scintilla code is 1.53 diff --git a/contrib/src/stc/scintilla/include/Platform.h b/contrib/src/stc/scintilla/include/Platform.h index 7f5985c765..4f7ba2357c 100644 --- a/contrib/src/stc/scintilla/include/Platform.h +++ b/contrib/src/stc/scintilla/include/Platform.h @@ -57,6 +57,7 @@ typedef void *SurfaceID; typedef void *WindowID; typedef void *MenuID; typedef void *TickerID; +typedef void *Function; /** * A geometric point class. @@ -434,6 +435,23 @@ public: double Duration(bool reset=false); }; +/** + * Dynamic Library (DLL/SO/...) loading + */ +class DynamicLibrary { +public: + virtual ~DynamicLibrary() {}; + + /// @return Pointer to function "name", or NULL on failure. + virtual Function FindFunction(const char *name) = 0; + + /// @return true if the library was loaded successfully. + virtual bool IsValid() = 0; + + /// @return An instance of a DynamicLibrary subclass with "modulePath" loaded. + static DynamicLibrary *Load(const char *modulePath); +}; + /** * Platform class used to retrieve system wide parameters such as double click speed * and chrome colour. Not a creatable object, more of a module with several functions. diff --git a/contrib/src/stc/scintilla/include/PropSet.h b/contrib/src/stc/scintilla/include/PropSet.h index 3f1b64f77f..1a7e2f1665 100644 --- a/contrib/src/stc/scintilla/include/PropSet.h +++ b/contrib/src/stc/scintilla/include/PropSet.h @@ -38,7 +38,7 @@ public: void SetMultiple(const char *s); SString Get(const char *key); SString GetExpanded(const char *key); - SString Expand(const char *withVars); + SString Expand(const char *withVars, int maxExpands=100); int GetInt(const char *key, int defaultValue=0); SString GetWild(const char *keybase, const char *filename); SString GetNewExpand(const char *keybase, const char *filename=""); diff --git a/contrib/src/stc/scintilla/include/SciLexer.h b/contrib/src/stc/scintilla/include/SciLexer.h index e1da492b27..edf4bd0d24 100644 --- a/contrib/src/stc/scintilla/include/SciLexer.h +++ b/contrib/src/stc/scintilla/include/SciLexer.h @@ -54,6 +54,8 @@ #define SCLEX_F77 37 #define SCLEX_CSS 38 #define SCLEX_POV 39 +#define SCLEX_LOUT 40 +#define SCLEX_ESCRIPT 41 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 @@ -88,6 +90,7 @@ #define SCE_C_WORD2 16 #define SCE_C_COMMENTDOCKEYWORD 17 #define SCE_C_COMMENTDOCKEYWORDERROR 18 +#define SCE_C_GLOBALCLASS 19 #define SCE_H_DEFAULT 0 #define SCE_H_TAG 1 #define SCE_H_TAGUNKNOWN 2 @@ -460,6 +463,29 @@ #define SCE_POV_IDENTIFIER 8 #define SCE_POV_BRACE 9 #define SCE_POV_WORD2 10 +#define SCE_LOUT_DEFAULT 0 +#define SCE_LOUT_COMMENT 1 +#define SCE_LOUT_NUMBER 2 +#define SCE_LOUT_WORD 3 +#define SCE_LOUT_WORD2 4 +#define SCE_LOUT_WORD3 5 +#define SCE_LOUT_WORD4 6 +#define SCE_LOUT_STRING 7 +#define SCE_LOUT_OPERATOR 8 +#define SCE_LOUT_IDENTIFIER 9 +#define SCE_LOUT_STRINGEOL 10 +#define SCE_ESCRIPT_DEFAULT 0 +#define SCE_ESCRIPT_COMMENT 1 +#define SCE_ESCRIPT_COMMENTLINE 2 +#define SCE_ESCRIPT_COMMENTDOC 3 +#define SCE_ESCRIPT_NUMBER 4 +#define SCE_ESCRIPT_WORD 5 +#define SCE_ESCRIPT_STRING 6 +#define SCE_ESCRIPT_OPERATOR 7 +#define SCE_ESCRIPT_IDENTIFIER 8 +#define SCE_ESCRIPT_BRACE 9 +#define SCE_ESCRIPT_WORD2 10 +#define SCE_ESCRIPT_WORD3 11 //--Autogenerated -- end of section automatically generated from Scintilla.iface #endif diff --git a/contrib/src/stc/scintilla/include/Scintilla.h b/contrib/src/stc/scintilla/include/Scintilla.h index c377d07cc2..250f793142 100644 --- a/contrib/src/stc/scintilla/include/Scintilla.h +++ b/contrib/src/stc/scintilla/include/Scintilla.h @@ -464,6 +464,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_LINEENDWRAPEXTEND 2452 #define SCI_VCHOMEWRAP 2453 #define SCI_VCHOMEWRAPEXTEND 2454 +#define SCI_LINECOPY 2455 #define SCI_MOVECARETINSIDEVIEW 2401 #define SCI_LINELENGTH 2350 #define SCI_BRACEHIGHLIGHT 2351 @@ -535,6 +536,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_PARADOWNEXTEND 2414 #define SCI_PARAUP 2415 #define SCI_PARAUPEXTEND 2416 +#define SCI_POSITIONBEFORE 2417 +#define SCI_POSITIONAFTER 2418 +#define SCI_COPYRANGE 2419 +#define SCI_COPYTEXT 2420 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 diff --git a/contrib/src/stc/scintilla/include/Scintilla.iface b/contrib/src/stc/scintilla/include/Scintilla.iface index c5dacbdf04..2ac0b66f50 100644 --- a/contrib/src/stc/scintilla/include/Scintilla.iface +++ b/contrib/src/stc/scintilla/include/Scintilla.iface @@ -1231,6 +1231,9 @@ fun void LineEndWrapExtend=2452(,) fun void VCHomeWrap=2453(,) fun void VCHomeWrapExtend=2454(,) +# Copy the line containing the caret. +fun void LineCopy=2455(,) + # Move the caret inside current view if it's not there already. fun void MoveCaretInsideView=2401(,) @@ -1441,6 +1444,20 @@ fun void ParaDownExtend=2414(,) fun void ParaUp=2415(,) fun void ParaUpExtend=2416(,) +# Given a valid document position, return the previous position taking code +# page into account. Returns 0 if passed 0. +fun position PositionBefore=2417(position pos,) + +# Given a valid document position, return the next position taking code +# page into account. Maximum value returned is the last position in the document. +fun position PositionAfter=2418(position pos,) + +# Copy a range of text to the clipboard. Positions are clipped into the document. +fun void CopyRange=2419(position start, position end) + +# Copy argument text to the clipboard. +fun void CopyText=2420(int length, string text) + # Start notifying the container of all key presses and commands. fun void StartRecord=3001(,) @@ -1466,7 +1483,6 @@ set void SetKeyWords=4005(int keywordSet, string keyWords) set void SetLexerLanguage=4006(, string language) # Load a lexer library (dll / so) -# NOT YET IMPLEMENTED fun void LoadLexerLibrary=4007(, string path) # Notifications @@ -1566,6 +1582,8 @@ val SCLEX_FORTRAN=36 val SCLEX_F77=37 val SCLEX_CSS=38 val SCLEX_POV=39 +val SCLEX_LOUT=40 +val SCLEX_ESCRIPT=41 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -1612,6 +1630,7 @@ val SCE_C_COMMENTLINEDOC=15 val SCE_C_WORD2=16 val SCE_C_COMMENTDOCKEYWORD=17 val SCE_C_COMMENTDOCKEYWORDERROR=18 +val SCE_C_GLOBALCLASS=19 # Lexical states for SCLEX_HTML, SCLEX_XML lex HTML=SCLEX_HTML SCE_H lex XML=SCLEX_XML SCE_H @@ -2047,6 +2066,34 @@ val SCE_POV_OPERATOR=7 val SCE_POV_IDENTIFIER=8 val SCE_POV_BRACE=9 val SCE_POV_WORD2=10 +# Lexical states for SCLEX_LOUT +lex LOUT=SCLEX_LOUT SCE_LOUT_ +val SCE_LOUT_DEFAULT=0 +val SCE_LOUT_COMMENT=1 +val SCE_LOUT_NUMBER=2 +val SCE_LOUT_WORD=3 +val SCE_LOUT_WORD2=4 +val SCE_LOUT_WORD3=5 +val SCE_LOUT_WORD4=6 +val SCE_LOUT_STRING=7 +val SCE_LOUT_OPERATOR=8 +val SCE_LOUT_IDENTIFIER=9 +val SCE_LOUT_STRINGEOL=10 +# Lexical states for SCLEX_ESCRIPT +lex ESCRIPT=SCLEX_ESCRIPT SCE_ESCRIPT_ +val SCE_ESCRIPT_DEFAULT=0 +val SCE_ESCRIPT_COMMENT=1 +val SCE_ESCRIPT_COMMENTLINE=2 +val SCE_ESCRIPT_COMMENTDOC=3 +val SCE_ESCRIPT_NUMBER=4 +val SCE_ESCRIPT_WORD=5 +val SCE_ESCRIPT_STRING=6 +val SCE_ESCRIPT_OPERATOR=7 +val SCE_ESCRIPT_IDENTIFIER=8 +val SCE_ESCRIPT_BRACE=9 +val SCE_ESCRIPT_WORD2=10 +val SCE_ESCRIPT_WORD3=11 + # Events evt void StyleNeeded=2000(int position) diff --git a/contrib/src/stc/scintilla/src/Document.cxx b/contrib/src/stc/scintilla/src/Document.cxx index 20900bcf97..98fc6b330c 100644 --- a/contrib/src/stc/scintilla/src/Document.cxx +++ b/contrib/src/stc/scintilla/src/Document.cxx @@ -265,7 +265,7 @@ int Document::LenChar(int pos) { return 1; } } - +#include // Normalise a position so that it is not halfway through a two byte character. // This can occur in two situations - // When lines are terminated with \r\n pairs which should be treated as one character. @@ -273,17 +273,11 @@ int Document::LenChar(int pos) { // If moving, move the position in the indicated direction. int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { //Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir); - // If out of range, just return value - should be fixed up after - if (pos < 0) - return pos; - if (pos > Length()) - return pos; - - // Position 0 and Length() can not be between any two characters - if (pos == 0) - return pos; - if (pos == Length()) - return pos; + // If out of range, just return minimum/maximum value. + if (pos <= 0) + return 0; + if (pos >= Length()) + return Length(); // assert pos > 0 && pos < Length() if (checkLineEnd && IsCrLf(pos - 1)) { @@ -309,29 +303,26 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { } else { // Anchor DBCS calculations at start of line because start of line can // not be a DBCS trail byte. - int startLine = pos; - - while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n') - startLine--; - while (startLine < pos) { + int posCheck = LineStart(LineFromPosition(pos)); + while (posCheck < pos) { char mbstr[maxBytesInDBCSCharacter+1]; int i; for(i=0;i pos) { + } else if (posCheck + mbsize > pos) { if (moveDir > 0) { - return startLine + mbsize; + return posCheck + mbsize; } else { - return startLine; + return posCheck; } } - startLine += mbsize; + posCheck += mbsize; } } } diff --git a/contrib/src/stc/scintilla/src/Editor.cxx b/contrib/src/stc/scintilla/src/Editor.cxx index 5364f9a4c4..cc53f5aac8 100644 --- a/contrib/src/stc/scintilla/src/Editor.cxx +++ b/contrib/src/stc/scintilla/src/Editor.cxx @@ -1,7 +1,6 @@ // Scintilla source code edit control /** @file Editor.cxx ** Main code for the edit control. - Last change: JS 18 Jun 103 1:07 am **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. @@ -712,7 +711,9 @@ void Editor::RedrawRect(PRectangle rc) { void Editor::Redraw() { //Platform::DebugPrintf("Redraw all\n"); - wMain.InvalidateAll(); + PRectangle rcClient = GetClientRectangle(); + wMain.InvalidateRectangle(rcClient); + //wMain.InvalidateAll(); } void Editor::RedrawSelMargin() { @@ -1577,8 +1578,15 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { number[0] = '\0'; if (firstSubLine) sprintf(number, "%d", lineDoc + 1); - if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) - sprintf(number, "%X", pdoc->GetLevel(lineDoc)); + if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { + int lev = pdoc->GetLevel(lineDoc); + sprintf(number, "%c%c %03X %03X", + (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', + (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', + lev & SC_FOLDLEVELNUMBERMASK, + lev >> 16 + ); + } PRectangle rcNumber = rcMarker; // Right justify int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, strlen(number)); @@ -2353,10 +2361,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { return; } } - // Workaround by JACS: sometimes due to a re-entry condition, - // pixmapLine becomes uninitialised, followed by a crash. - if (!pixmapLine->Initialised()) - return; PRectangle rcRightMargin = rcClient; rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth; @@ -2481,7 +2485,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { } else { int FoldLevelCurr = (pdoc->GetLevel(lineDoc) & SC_FOLDLEVELNUMBERMASK) - SC_FOLDLEVELBASE; int FoldLevelPrev = (pdoc->GetLevel(lineDoc - 1) & SC_FOLDLEVELNUMBERMASK) - SC_FOLDLEVELBASE; - int FoldLevelFlags = (pdoc->GetLevel(lineDoc) & ~SC_FOLDLEVELNUMBERMASK); + int FoldLevelFlags = (pdoc->GetLevel(lineDoc) & ~SC_FOLDLEVELNUMBERMASK) & ~(0xFFF0000); int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars); // Draw line above fold if ((FoldLevelPrev < FoldLevelCurr) @@ -3437,6 +3441,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long case SCI_DELWORDRIGHT: case SCI_DELLINELEFT: case SCI_DELLINERIGHT: + case SCI_LINECOPY: case SCI_LINECUT: case SCI_LINEDELETE: case SCI_LINETRANSPOSE: @@ -3875,18 +3880,21 @@ int Editor::KeyCommand(unsigned int iMessage) { pdoc->DeleteChars(currentPos, end - currentPos); } break; + case SCI_LINECOPY: { + int lineStart = pdoc->LineFromPosition(SelectionStart()); + int lineEnd = pdoc->LineFromPosition(SelectionEnd()); + CopyRangeToClipboard(pdoc->LineStart(lineStart), + pdoc->LineStart(lineEnd + 1)); + } + break; case SCI_LINECUT: { - int lineStart = pdoc->LineFromPosition(currentPos); - int lineEnd = pdoc->LineFromPosition(anchor); - if (lineStart > lineEnd) { - int t = lineEnd; - lineEnd = lineStart; - lineStart = t; - } + int lineStart = pdoc->LineFromPosition(SelectionStart()); + int lineEnd = pdoc->LineFromPosition(SelectionEnd()); int start = pdoc->LineStart(lineStart); int end = pdoc->LineStart(lineEnd + 1); SetSelection(start, end); Cut(); + SetLastXChosen(); } break; case SCI_LINEDELETE: { @@ -4183,10 +4191,14 @@ char *Editor::CopyRange(int start, int end) { return text; } +void Editor::CopySelectionFromRange(SelectionText *ss, int start, int end) { + ss->Set(CopyRange(start, end), end - start + 1, false); +} + void Editor::CopySelectionRange(SelectionText *ss) { - char *text = 0; - int size = 0; if (selType == selRectangle) { + char *text = 0; + int size = 0; int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); int line; @@ -4211,11 +4223,24 @@ void Editor::CopySelectionRange(SelectionText *ss) { text[size] = '\0'; } } + ss->Set(text, size + 1, true); } else { - size = SelectionEnd() - SelectionStart(); - text = CopyRange(SelectionStart(), SelectionEnd()); + CopySelectionFromRange(ss, SelectionStart(), SelectionEnd()); } - ss->Set(text, size, selType == selRectangle); +} + +void Editor::CopyRangeToClipboard(int start, int end) { + start = pdoc->ClampPositionIntoDocument(start); + end = pdoc->ClampPositionIntoDocument(end); + SelectionText selectedText; + selectedText.Set(CopyRange(start, end), end - start + 1); + CopyToClipboard(selectedText); +} + +void Editor::CopyText(int length, const char *text) { + SelectionText selectedText; + selectedText.Copy(text, length); + CopyToClipboard(selectedText); } void Editor::SetDragPosition(int newPos) { @@ -4877,10 +4902,7 @@ void Editor::SetDocPointer(Document *document) { pdoc->AddWatcher(this, 0); Redraw(); - // Removed because of reentrance problems of GTK+ 2.x - // where changing a scroll bar position causes synchronous - // painting before lexer and styling state is set up. - //SetScrollBars(); + SetScrollBars(); } // Recursively expand a fold, making lines visible except where they have an unexpanded parent @@ -5045,6 +5067,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { Copy(); break; + case SCI_COPYRANGE: + CopyRangeToClipboard(wParam, lParam); + break; + + case SCI_COPYTEXT: + CopyText(wParam, CharPtrFromSPtr(lParam)); + break; + case SCI_PASTE: Paste(); SetLastXChosen(); @@ -5204,6 +5234,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETSEARCHFLAGS: return searchFlags; + case SCI_POSITIONBEFORE: + return pdoc->MovePositionOutsideChar(wParam-1, -1, true); + + case SCI_POSITIONAFTER: + return pdoc->MovePositionOutsideChar(wParam+1, 1, true); + case SCI_LINESCROLL: ScrollTo(topLine + lParam); HorizontalScrollTo(xOffset + wParam * vs.spaceWidth); @@ -6180,6 +6216,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_DELWORDRIGHT: case SCI_DELLINELEFT: case SCI_DELLINERIGHT: + case SCI_LINECOPY: case SCI_LINECUT: case SCI_LINEDELETE: case SCI_LINETRANSPOSE: diff --git a/contrib/src/stc/scintilla/src/Editor.h b/contrib/src/stc/scintilla/src/Editor.h index 2cc7930c47..bd4669192f 100644 --- a/contrib/src/stc/scintilla/src/Editor.h +++ b/contrib/src/stc/scintilla/src/Editor.h @@ -133,6 +133,19 @@ public: len = 0; rectangular = rectangular_; } + void Copy(const char *s_, int len_, bool rectangular_=false) { + delete []s; + s = new char[len_]; + if (s) { + len = len_; + for (int i = 0; i < len_; i++) { + s[i] = s_[i]; + } + } else { + len = 0; + } + rectangular = rectangular_; + } }; /** @@ -416,10 +429,14 @@ protected: // ScintillaBase subclass needs access to much of Editor long SearchInTarget(const char *text, int length); void GoToLine(int lineNo); + virtual void CopyToClipboard(const SelectionText &selectedText) = 0; char *CopyRange(int start, int end); + void CopySelectionFromRange(SelectionText *ss, int start, int end); void CopySelectionRange(SelectionText *ss); + void CopyRangeToClipboard(int start, int end); + void CopyText(int length, const char *text); void SetDragPosition(int newPos); - void DisplayCursor(Window::Cursor c); + virtual void DisplayCursor(Window::Cursor c); virtual void StartDrag(); void DropAt(int position, const char *value, bool moving, bool rectangular); /** PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after. diff --git a/contrib/src/stc/scintilla/src/ExternalLexer.cxx b/contrib/src/stc/scintilla/src/ExternalLexer.cxx new file mode 100644 index 0000000000..88be76f249 --- /dev/null +++ b/contrib/src/stc/scintilla/src/ExternalLexer.cxx @@ -0,0 +1,256 @@ +// Scintilla source code edit control +/** @file ExternalLexer.cxx + ** Support external lexers in DLLs. + **/ +// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include "Platform.h" + +#include "SciLexer.h" +#include "PropSet.h" +#include "Accessor.h" +#include "DocumentAccessor.h" +#include "KeyWords.h" +#include "ExternalLexer.h" + +LexerManager *LexerManager::theInstance = NULL; + +//------------------------------------------ +// +// ExternalLexerModule +// +//------------------------------------------ + +char **WordListsToStrings(WordList *val[]) { + int dim = 0; + while (val[dim]) + dim++; + char **wls = new char * [dim + 1]; + for (int i = 0;i < dim;i++) { + SString words; + words = ""; + for (int n = 0; n < val[i]->len; n++) { + words += val[i]->words[n]; + if (n != val[i]->len - 1) + words += " "; + } + wls[i] = new char[words.length() + 1]; + strcpy(wls[i], words.c_str()); + } + wls[dim] = 0; + return wls; +} + +void DeleteWLStrings(char *strs[]) { + int dim = 0; + while (strs[dim]) { + delete strs[dim]; + dim++; + } + delete [] strs; +} + +void ExternalLexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const { + if (!fneLexer) + return ; + + char **kwds = WordListsToStrings(keywordlists); + char *ps = styler.GetProperties(); + + // The accessor passed in is always a DocumentAccessor so this cast and the subsequent + // access will work. Can not use the stricter dynamic_cast as that requires RTTI. + DocumentAccessor &da = static_cast(styler); + WindowID wID = da.GetWindow(); + + fneLexer(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps); + + delete ps; + DeleteWLStrings(kwds); +} + +void ExternalLexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const { + if (!fneFolder) + return ; + + char **kwds = WordListsToStrings(keywordlists); + char *ps = styler.GetProperties(); + + // The accessor passed in is always a DocumentAccessor so this cast and the subsequent + // access will work. Can not use the stricter dynamic_cast as that requires RTTI. + DocumentAccessor &da = static_cast(styler); + WindowID wID = da.GetWindow(); + + fneFolder(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps); + + delete ps; + DeleteWLStrings(kwds); +} + +void ExternalLexerModule::SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index) { + fneLexer = fLexer; + fneFolder = fFolder; + externalLanguage = index; +} + +//------------------------------------------ +// +// LexerLibrary +// +//------------------------------------------ + +LexerLibrary::LexerLibrary(const char* ModuleName) { + // Initialise some members... + first = NULL; + last = NULL; + + // Load the DLL + lib = DynamicLibrary::Load(ModuleName); + if (lib->IsValid()) { + m_sModuleName = ModuleName; + //Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects + GetLexerCountFn GetLexerCount = (GetLexerCountFn)lib->FindFunction("GetLexerCount"); + + if (GetLexerCount) { + ExternalLexerModule *lex; + LexerMinder *lm; + + // Find functions in the DLL + GetLexerNameFn GetLexerName = (GetLexerNameFn)lib->FindFunction("GetLexerName"); + ExtLexerFunction Lexer = (ExtLexerFunction)lib->FindFunction("Lex"); + ExtFoldFunction Folder = (ExtFoldFunction)lib->FindFunction("Fold"); + + // Assign a buffer for the lexer name. + char lexname[100]; + strcpy(lexname, ""); + + int nl = GetLexerCount(); + + for (int i = 0; i < nl; i++) { + GetLexerName(i, lexname, 100); + lex = new ExternalLexerModule(SCLEX_AUTOMATIC, NULL, lexname, NULL); + + // Create a LexerMinder so we don't leak the ExternalLexerModule... + lm = new LexerMinder; + lm->self = lex; + lm->next = NULL; + if (first != NULL) { + last->next = lm; + last = lm; + } else { + first = lm; + last = lm; + } + + // The external lexer needs to know how to call into its DLL to + // do its lexing and folding, we tell it here. Folder may be null. + lex->SetExternal(Lexer, Folder, i); + } + } + } + next = NULL; +} + +LexerLibrary::~LexerLibrary() { + Release(); + delete lib; +} + +void LexerLibrary::Release() { + //TODO maintain a list of lexers created, and delete them! + LexerMinder *lm; + LexerMinder *next; + lm = first; + while (NULL != lm) { + next = lm->next; + delete lm->self; + delete lm; + lm = next; + } + + first = NULL; + last = NULL; +} + +//------------------------------------------ +// +// LexerManager +// +//------------------------------------------ + +/// Return the single LexerManager instance... +LexerManager *LexerManager::GetInstance() { + if(!theInstance) + theInstance = new LexerManager; + return theInstance; +} + +/// Delete any LexerManager instance... +void LexerManager::DeleteInstance() +{ + if(theInstance) { + delete theInstance; + theInstance = NULL; + } +} + +/// protected constructor - this is a singleton... +LexerManager::LexerManager() { + first = NULL; + last = NULL; +} + +LexerManager::~LexerManager() { + Clear(); +} + +void LexerManager::Load(const char* path) +{ + LoadLexerLibrary(path); +} + +void LexerManager::LoadLexerLibrary(const char* module) +{ + LexerLibrary *lib = new LexerLibrary(module); + if (NULL != first) { + last->next = lib; + last = lib; + } else { + first = lib; + last = lib; + } +} + +void LexerManager::Clear() +{ + if (NULL != first) { + LexerLibrary *cur = first; + LexerLibrary *next = first->next; + while (cur) { + delete cur; + cur = next; + } + first = NULL; + last = NULL; + } +} + +//------------------------------------------ +// +// LexerManager +// +//------------------------------------------ + +LMMinder::~LMMinder() +{ + LexerManager::DeleteInstance(); +} + +LMMinder minder; diff --git a/contrib/src/stc/scintilla/src/ExternalLexer.h b/contrib/src/stc/scintilla/src/ExternalLexer.h new file mode 100644 index 0000000000..01d9ac7141 --- /dev/null +++ b/contrib/src/stc/scintilla/src/ExternalLexer.h @@ -0,0 +1,103 @@ +// Scintilla source code edit control +/** @file ExternalLexer.h + ** Support external lexers in DLLs. + **/ +// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef EXTERNALLEXER_H +#define EXTERNALLEXER_H + +#if PLAT_WIN +#define EXT_LEXER_DECL __stdcall +#elif PLAT_GTK +#define EXT_LEXER_DECL +#endif + +#if PLAT_WX +#ifdef __WXMSW__ +#define EXT_LEXER_DECL __stdcall +#else +#define EXT_LEXER_DECL +#endif +#endif + +// External Lexer function definitions... +typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, + char *words[], WindowID window, char *props); +typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, + char *words[], WindowID window, char *props); +typedef void* (EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); +typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); +typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); + +//class DynamicLibrary; + +/// Sub-class of LexerModule to use an external lexer. +class ExternalLexerModule : protected LexerModule { +protected: + ExtLexerFunction fneLexer; + ExtFoldFunction fneFolder; + int externalLanguage; + char name[100]; +public: + ExternalLexerModule(int language_, LexerFunction fnLexer_, + const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ + strncpy(name, languageName_, sizeof(name)); + languageName = name; + }; + virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const; + virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const; + virtual void SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index); +}; + +/// LexerMinder points to an ExternalLexerModule - so we don't leak them. +class LexerMinder { +public: + ExternalLexerModule *self; + LexerMinder *next; +}; + +/// LexerLibrary exists for every External Lexer DLL, contains LexerMinders. +class LexerLibrary { + DynamicLibrary *lib; + LexerMinder *first; + LexerMinder *last; + +public: + LexerLibrary(const char* ModuleName); + ~LexerLibrary(); + void Release(); + + LexerLibrary *next; + SString m_sModuleName; +}; + +/// LexerManager manages external lexers, contains LexerLibrarys. +class LexerManager { +public: + ~LexerManager(); + + static LexerManager *GetInstance(); + static void DeleteInstance(); + + void Load(const char* path); + void Clear(); + +private: + LexerManager(); + static LexerManager *theInstance; + + void LoadLexerLibrary(const char* module); + LexerLibrary *first; + LexerLibrary *last; +}; + +class LMMinder { +public: + ~LMMinder(); +}; + +#endif diff --git a/contrib/src/stc/scintilla/src/KeyMap.cxx b/contrib/src/stc/scintilla/src/KeyMap.cxx index 12249e5f3c..f15842af68 100644 --- a/contrib/src/stc/scintilla/src/KeyMap.cxx +++ b/contrib/src/stc/scintilla/src/KeyMap.cxx @@ -130,6 +130,7 @@ const KeyToCommand KeyMap::MapDefault[] = { //'L', SCI_CTRL, SCI_FORMFEED, {'L', SCI_CTRL, SCI_LINECUT}, {'L', SCI_CSHIFT, SCI_LINEDELETE}, + {'T', SCI_CSHIFT, SCI_LINECOPY}, {'T', SCI_CTRL, SCI_LINETRANSPOSE}, {'D', SCI_CTRL, SCI_LINEDUPLICATE}, {'U', SCI_CTRL, SCI_LOWERCASE}, diff --git a/contrib/src/stc/scintilla/src/KeyWords.cxx b/contrib/src/stc/scintilla/src/KeyWords.cxx index 73ecddf50d..8fb51bdb76 100644 --- a/contrib/src/stc/scintilla/src/KeyWords.cxx +++ b/contrib/src/stc/scintilla/src/KeyWords.cxx @@ -112,18 +112,6 @@ void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, } } -static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[], - Accessor &styler) { - // Null language means all style bytes are 0 so just mark the end - no need to fill in. - if (length > 0) { - styler.StartAt(startPos + length - 1); - styler.StartSegment(startPos + length - 1); - styler.ColourTo(startPos + length - 1, 0); - } -} - -LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null"); - // Alternative historical name for Scintilla_LinkLexers int wxForceScintillaLexers(void) { return Scintilla_LinkLexers(); @@ -154,6 +142,7 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmCss); LINK_LEXER(lmEiffel); LINK_LEXER(lmEiffelkw); + LINK_LEXER(lmESCRIPT); LINK_LEXER(lmFortran); LINK_LEXER(lmF77); LINK_LEXER(lmHTML); @@ -161,6 +150,7 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmASP); LINK_LEXER(lmPHP); LINK_LEXER(lmLISP); + LINK_LEXER(lmLout); LINK_LEXER(lmLua); LINK_LEXER(lmMatlab); LINK_LEXER(lmBatch); @@ -169,6 +159,7 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmMake); LINK_LEXER(lmErrorList); LINK_LEXER(lmLatex); + LINK_LEXER(lmNull); LINK_LEXER(lmPascal); LINK_LEXER(lmPerl); LINK_LEXER(lmPOV); diff --git a/contrib/src/stc/scintilla/src/LexCPP.cxx b/contrib/src/stc/scintilla/src/LexCPP.cxx index 661b968cd7..9c8ea416ae 100644 --- a/contrib/src/stc/scintilla/src/LexCPP.cxx +++ b/contrib/src/stc/scintilla/src/LexCPP.cxx @@ -60,6 +60,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; + WordList &keywords4 = *keywordlists[3]; bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0; @@ -111,6 +112,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo sc.ChangeState(SCE_C_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_C_WORD2); + } else if (keywords4.InList(s)) { + sc.ChangeState(SCE_C_GLOBALCLASS); } sc.SetState(SCE_C_DEFAULT); } @@ -279,237 +282,23 @@ static bool IsStreamCommentStyle(int style) { style == SCE_C_COMMENTDOCKEYWORDERROR; } -static bool matchKeyword(unsigned int start, WordList &keywords, Accessor &styler, int keywordtype) { - bool FoundKeyword = false; - - for (unsigned int i = 0; - strlen(keywords[i]) > 0 && !FoundKeyword; - i++) { - if (atoi(keywords[i]) == keywordtype) { - FoundKeyword = styler.Match(start, ((char *)keywords[i]) + 2); - } - } - return FoundKeyword; -} - -static bool IsCommentLine(int line, Accessor &styler) { - unsigned int Pos = styler.LineStart(line); - while (styler.GetLine(Pos) == line) { - int PosStyle = styler.StyleAt(Pos); - - if ( !IsStreamCommentStyle(PosStyle) - && - PosStyle != SCE_C_COMMENTLINEDOC - && - PosStyle != SCE_C_COMMENTLINE - && - !IsASpace(styler.SafeGetCharAt(Pos)) - ) - return false; - Pos++; - } - - return true; -} - -static void FoldBoxCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - - WordList &keywords4 = *keywordlists[3]; - - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool firstLine = true; - unsigned int endPos = startPos + length; - int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - int levelPrevPrev; - int levelFlags = 0; - int levelUnindent = 0; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - - if (lineCurrent == 0) { - levelPrevPrev = levelPrev; - } else { - levelPrevPrev = styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK; - } - - for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - if (foldComment && IsStreamCommentStyle(style)) { - if (!IsStreamCommentStyle(stylePrev)) { - levelCurrent++; - } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { - // Comments don't end at end of line and the next character may be unstyled. - levelCurrent--; - } - } - - if (foldComment && (style == SCE_C_COMMENTLINE)) { - if ((ch == '/') && (chNext == '/')) { - char chNext2 = styler.SafeGetCharAt(i + 2); - if (chNext2 == '{') { - levelCurrent++; - } else if (chNext2 == '}') { - levelCurrent--; - } - } - } - - if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { - if (ch == '#') { - unsigned int j = i + 1; - while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { - j++; - } - - if (styler.Match(j, "region") || styler.Match(j, "if")) { - levelCurrent++; - } else if (styler.Match(j, "end")) { - levelCurrent--; - } - } - } - - if (style == SCE_C_OPERATOR - || - style == SCE_C_COMMENT - || - style == SCE_C_COMMENTLINE) { - - if (ch == '{') { - levelCurrent++; - // Special handling if line has closing brace followed by opening brace. - if (levelCurrent == levelPrev) { - if (firstLine) - levelUnindent = 1; - else - levelUnindent = -1; - } - } else if (ch == '}') { - levelCurrent--; - } - } - - /* Check for fold header keyword at beginning of word */ - if ((style == SCE_C_WORD || style == SCE_C_COMMENT || style == SCE_C_COMMENTLINE) - && - (style != stylePrev)) { - if (matchKeyword(i, keywords4, styler, KEYWORD_BOXHEADER)) { - int line; - /* Loop backwards all empty or comment lines */ - for (line = lineCurrent - 1; - line >= 0 - && - levelCurrent == (styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK) - && - (styler.LevelAt(line) & SC_FOLDLEVELBOXFOOTERFLAG) == 0 - && - IsCommentLine(line, styler); - line--) { - /* just loop backwards */; - } - - line++; - /* Set Box header flag (if the previous line has no footer line) */ - if ((styler.LevelAt(line) & SC_FOLDLEVELBOXFOOTERFLAG) == 0) { - if (line == lineCurrent) { - /* in current line */ - levelFlags |= SC_FOLDLEVELBOXHEADERFLAG; - } else { - /* at top of all preceding comment lines */ - styler.SetLevel(line, styler.LevelAt(line) - | SC_FOLDLEVELBOXHEADERFLAG); - } - } - } - } - - if (matchKeyword(i, keywords4, styler, KEYWORD_FOLDCONTRACTED)) { - levelFlags |= SC_FOLDLEVELCONTRACTED; - } - - if (atEOL) { - int lev; - // Compute level correction for special case: '} else {' - if (levelUnindent < 0) { - levelPrev += levelUnindent; - } else { - levelCurrent += levelUnindent; - } - - lev = levelPrev; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - // Produce additional footer line (e.g. after closed if) - if (visibleChars == 0 - && - (levelPrev < levelPrevPrev)) - lev |= SC_FOLDLEVELBOXFOOTERFLAG; - // Produce footer line at line before (special handling for '} else {' - if (levelPrev < levelPrevPrev) { - styler.SetLevel(lineCurrent - 1, - styler.LevelAt(lineCurrent - 1) | SC_FOLDLEVELBOXFOOTERFLAG); - } - // Mark the fold header (the line that is always visible) - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - // Show a footer line at end of fold - if (levelCurrent < levelPrev) - lev |= SC_FOLDLEVELBOXFOOTERFLAG; - /* Show a footer line at the end of each procedure (level == SC_FOLDLEVELBASE) */ - if ((levelPrev == SC_FOLDLEVELBASE) - && - (levelPrevPrev > SC_FOLDLEVELBASE) - && - (visibleChars == 0)) { - lev |= SC_FOLDLEVELBOXFOOTERFLAG; - } - - lev |= levelFlags; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - - lineCurrent++; - levelPrevPrev = levelPrev; - levelPrev = levelCurrent; - levelUnindent = 0; - visibleChars = 0; - levelFlags = 0; - firstLine = false; - } - - if (!isspacechar(ch)) - visibleChars++; - } - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - +// Store both the current line's fold level and the next lines in the +// level store to make it easy to pick up with each increment +// and to make it possible to fiddle the current level for "} else {". static void FoldNoBoxCppDoc(unsigned int startPos, int length, int initStyle, Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; + int levelCurrent = SC_FOLDLEVELBASE; + if (lineCurrent > 0) + levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; + int levelMinCurrent = levelCurrent; + int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; @@ -522,19 +311,19 @@ static void FoldNoBoxCppDoc(unsigned int startPos, int length, int initStyle, bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev)) { - levelCurrent++; + levelNext++; } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. - levelCurrent--; + levelNext--; } } if (foldComment && (style == SCE_C_COMMENTLINE)) { if ((ch == '/') && (chNext == '/')) { char chNext2 = styler.SafeGetCharAt(i + 2); if (chNext2 == '{') { - levelCurrent++; + levelNext++; } else if (chNext2 == '}') { - levelCurrent--; + levelNext--; } } } @@ -545,58 +334,58 @@ static void FoldNoBoxCppDoc(unsigned int startPos, int length, int initStyle, j++; } if (styler.Match(j, "region") || styler.Match(j, "if")) { - levelCurrent++; + levelNext++; } else if (styler.Match(j, "end")) { - levelCurrent--; + levelNext--; } } } if (style == SCE_C_OPERATOR) { if (ch == '{') { - levelCurrent++; + // Measure the minimum before a '{' to allow + // folding on "} else {" + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } + levelNext++; } else if (ch == '}') { - levelCurrent--; + levelNext--; } } if (atEOL) { - int lev = levelPrev; + int levelUse = levelCurrent; + if (foldAtElse) { + levelUse = levelMinCurrent; + } + int lev = levelUse | levelNext << 16; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) + if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; - levelPrev = levelCurrent; + levelCurrent = levelNext; + levelMinCurrent = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); } -static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], +static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { - - int foldFlags = styler.GetPropertyInt("fold.flags") ; - bool foldBox = ((foldFlags & SC_FOLDFLAG_BOX) == SC_FOLDFLAG_BOX); - - if (foldBox) { - FoldBoxCppDoc(startPos, length, initStyle, keywordlists, styler); - } else { - FoldNoBoxCppDoc(startPos, length, initStyle, styler); - } + FoldNoBoxCppDoc(startPos, length, initStyle, styler); } static const char * const cppWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", "Documentation comment keywords", - "Fold header keywords", + "Unused", + "Global classes and typedefs", 0, }; diff --git a/contrib/src/stc/scintilla/src/LexEScript.cxx b/contrib/src/stc/scintilla/src/LexEScript.cxx new file mode 100644 index 0000000000..28e3b3b0de --- /dev/null +++ b/contrib/src/stc/scintilla/src/LexEScript.cxx @@ -0,0 +1,270 @@ +// Scintilla source code edit control +/** @file LexESCRIPT.cxx + ** Lexer for ESCRIPT + **/ +// Copyright 2003 by Patrizio Bekerle (patrizio@bekerle.com) + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + + + +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); +} + +static inline bool IsAWordStart(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_'); +} + + + +static void ColouriseESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + + // Do not leak onto next line + /*if (initStyle == SCE_ESCRIPT_STRINGEOL) + initStyle = SCE_ESCRIPT_DEFAULT;*/ + + StyleContext sc(startPos, length, initStyle, styler); + + bool caseSensitive = styler.GetPropertyInt("escript.case.sensitive", 0) != 0; + + for (; sc.More(); sc.Forward()) { + + /*if (sc.atLineStart && (sc.state == SCE_ESCRIPT_STRING)) { + // Prevent SCE_ESCRIPT_STRINGEOL from leaking back to previous line + sc.SetState(SCE_ESCRIPT_STRING); + }*/ + + // Handle line continuation generically. + if (sc.ch == '\\') { + if (sc.chNext == '\n' || sc.chNext == '\r') { + sc.Forward(); + if (sc.ch == '\r' && sc.chNext == '\n') { + sc.Forward(); + } + continue; + } + } + + // Determine if the current state should terminate. + if (sc.state == SCE_ESCRIPT_OPERATOR || sc.state == SCE_ESCRIPT_BRACE) { + sc.SetState(SCE_ESCRIPT_DEFAULT); + } else if (sc.state == SCE_ESCRIPT_NUMBER) { + if (!IsADigit(sc.ch) || sc.ch != '.') { + sc.SetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_IDENTIFIER) { + if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { + char s[100]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + +// sc.GetCurrentLowered(s, sizeof(s)); + + if (keywords.InList(s)) { + sc.ChangeState(SCE_ESCRIPT_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_ESCRIPT_WORD2); + } else if (keywords3.InList(s)) { + sc.ChangeState(SCE_ESCRIPT_WORD3); + // sc.state = SCE_ESCRIPT_IDENTIFIER; + } + sc.SetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_COMMENT) { + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_COMMENTDOC) { + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_COMMENTLINE) { + if (sc.atLineEnd) { + sc.SetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_STRING) { + if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_ESCRIPT_DEFAULT) { + if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_ESCRIPT_NUMBER); + } else if (IsAWordStart(sc.ch) || (sc.ch == '#')) { + sc.SetState(SCE_ESCRIPT_IDENTIFIER); + } else if (sc.Match('/', '*')) { + sc.SetState(SCE_ESCRIPT_COMMENT); + sc.Forward(); // Eat the * so it isn't used for the end of the comment + } else if (sc.Match('/', '/')) { + sc.SetState(SCE_ESCRIPT_COMMENTLINE); + } else if (sc.ch == '\"') { + sc.SetState(SCE_ESCRIPT_STRING); + //} else if (isoperator(static_cast(sc.ch))) { + } else if (sc.ch == '+' || sc.ch == '-' || sc.ch == '*' || sc.ch == '/' || sc.ch == '=' || sc.ch == '<' || sc.ch == '>' || sc.ch == '&' || sc.ch == '|' || sc.ch == '!' || sc.ch == '?' || sc.ch == ':') { + sc.SetState(SCE_ESCRIPT_OPERATOR); + } else if (sc.ch == '{' || sc.ch == '}') { + sc.SetState(SCE_ESCRIPT_BRACE); + } + } + + } + sc.Complete(); +} + + +static int classifyFoldPointESCRIPT(const char* s, const char* prevWord) { + int lev = 0; + if (strcmp(prevWord, "end") == 0) return lev; + if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) + return -1; + + if (strcmp(s, "for") == 0 || strcmp(s, "foreach") == 0 + || strcmp(s, "program") == 0 || strcmp(s, "function") == 0 + || strcmp(s, "while") == 0 || strcmp(s, "case") == 0 + || strcmp(s, "if") == 0 ) { + lev = 1; + } else if ( strcmp(s, "endfor") == 0 || strcmp(s, "endforeach") == 0 + || strcmp(s, "endprogram") == 0 || strcmp(s, "endfunction") == 0 + || strcmp(s, "endwhile") == 0 || strcmp(s, "endcase") == 0 + || strcmp(s, "endif") == 0 ) { + lev = -1; + } + + return lev; +} + + +static bool IsStreamCommentStyle(int style) { + return style == SCE_ESCRIPT_COMMENT || + style == SCE_ESCRIPT_COMMENTDOC || + style == SCE_ESCRIPT_COMMENTLINE; +} + +static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { + //~ bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + // Do not know how to fold the comment at the moment. + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + bool foldComment = true; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + + int lastStart = 0; + char prevWord[32] = ""; + + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + + + if (foldComment && IsStreamCommentStyle(style)) { + if (!IsStreamCommentStyle(stylePrev)) { + levelCurrent++; + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { + // Comments don't end at end of line and the next character may be unstyled. + levelCurrent--; + } + } + + if (foldComment && (style == SCE_ESCRIPT_COMMENTLINE)) { + if ((ch == '/') && (chNext == '/')) { + char chNext2 = styler.SafeGetCharAt(i + 2); + if (chNext2 == '{') { + levelCurrent++; + } else if (chNext2 == '}') { + levelCurrent--; + } + } + } + + if (stylePrev == SCE_ESCRIPT_DEFAULT && style == SCE_ESCRIPT_WORD3) + { + // Store last word start point. + lastStart = i; + } + + if (style == SCE_ESCRIPT_WORD3) { + if(iswordchar(ch) && !iswordchar(chNext)) { + char s[32]; + unsigned int j; + for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) { + s[j] = static_cast(tolower(styler[lastStart + j])); + } + s[j] = '\0'; + levelCurrent += classifyFoldPointESCRIPT(s, prevWord); + strcpy(prevWord, s); + } + } + if (atEOL) { + int lev = levelPrev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + strcpy(prevWord, ""); + } + + if (!isspacechar(ch)) + visibleChars++; + } + + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + + + +static const char * const ESCRIPTWordLists[] = { + "Primary keywords and identifiers", + "Intrinsic functions", + "Extended and user defined functions", + 0, +}; + +LexerModule lmESCRIPT(SCLEX_ESCRIPT, ColouriseESCRIPTDoc, "escript", FoldESCRIPTDoc, ESCRIPTWordLists); diff --git a/contrib/src/stc/scintilla/src/LexLout.cxx b/contrib/src/stc/scintilla/src/LexLout.cxx new file mode 100644 index 0000000000..9d1a45a028 --- /dev/null +++ b/contrib/src/stc/scintilla/src/LexLout.cxx @@ -0,0 +1,208 @@ +// Scintilla source code edit control +/** @file LexLout.cxx + ** Lexer for the Basser Lout (>= version 3) typesetting language + **/ +// Copyright 2003 by Kein-Hong Man +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80) && (isalpha(ch) || ch == '@' || ch == '_'); +} + +static inline bool IsAnOther(const int ch) { + return (ch < 0x80) && (ch == '{' || ch == '}' || + ch == '!' || ch == '$' || ch == '%' || ch == '&' || ch == '\'' || + ch == '(' || ch == ')' || ch == '*' || ch == '+' || ch == ',' || + ch == '-' || ch == '.' || ch == '/' || ch == ':' || ch == ';' || + ch == '<' || ch == '=' || ch == '>' || ch == '?' || ch == '[' || + ch == ']' || ch == '^' || ch == '`' || ch == '|' || ch == '~'); +} + +static void ColouriseLoutDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + + int visibleChars = 0; + int firstWordInLine = 0; + int leadingAtSign = 0; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + + if (sc.atLineStart && (sc.state == SCE_LOUT_STRING)) { + // Prevent SCE_LOUT_STRINGEOL from leaking back to previous line + sc.SetState(SCE_LOUT_STRING); + } + + // Determine if the current state should terminate. + if (sc.state == SCE_LOUT_COMMENT) { + if (sc.atLineEnd) { + sc.SetState(SCE_LOUT_DEFAULT); + visibleChars = 0; + } + } else if (sc.state == SCE_LOUT_NUMBER) { + if (!IsADigit(sc.ch) && sc.ch != '.') { + sc.SetState(SCE_LOUT_DEFAULT); + } + } else if (sc.state == SCE_LOUT_STRING) { + if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_LOUT_DEFAULT); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_LOUT_STRINGEOL); + sc.ForwardSetState(SCE_LOUT_DEFAULT); + visibleChars = 0; + } + } else if (sc.state == SCE_LOUT_IDENTIFIER) { + if (!IsAWordChar(sc.ch)) { + char s[100]; + sc.GetCurrent(s, sizeof(s)); + + if (leadingAtSign) { + if (keywords.InList(s)) { + sc.ChangeState(SCE_LOUT_WORD); + } else { + sc.ChangeState(SCE_LOUT_WORD4); + } + } else if (firstWordInLine && keywords3.InList(s)) { + sc.ChangeState(SCE_LOUT_WORD3); + } + sc.SetState(SCE_LOUT_DEFAULT); + } + } else if (sc.state == SCE_LOUT_OPERATOR) { + if (!IsAnOther(sc.ch)) { + char s[100]; + sc.GetCurrent(s, sizeof(s)); + + if (keywords2.InList(s)) { + sc.ChangeState(SCE_LOUT_WORD2); + } + sc.SetState(SCE_LOUT_DEFAULT); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_LOUT_DEFAULT) { + if (sc.ch == '#') { + sc.SetState(SCE_LOUT_COMMENT); + } else if (sc.ch == '\"') { + sc.SetState(SCE_LOUT_STRING); + } else if (IsADigit(sc.ch) || + (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_LOUT_NUMBER); + } else if (IsAWordChar(sc.ch)) { + firstWordInLine = (visibleChars == 0); + leadingAtSign = (sc.ch == '@'); + sc.SetState(SCE_LOUT_IDENTIFIER); + } else if (IsAnOther(sc.ch)) { + sc.SetState(SCE_LOUT_OPERATOR); + } + } + + if (sc.atLineEnd) { + // Reset states to begining of colourise so no surprises + // if different sets of lines lexed. + visibleChars = 0; + } + if (!IsASpace(sc.ch)) { + visibleChars++; + } + } + sc.Complete(); +} + +static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[], + Accessor &styler) { + + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + int styleNext = styler.StyleAt(startPos); + char s[10]; + + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + + if (style == SCE_LOUT_WORD) { + if (ch == '@') { + for (unsigned int j = 0; j < 8; j++) { + if (!IsAWordChar(styler[i + j])) { + break; + } + s[j] = styler[i + j]; + s[j + 1] = '\0'; + } + if (strcmp(s, "@Begin") == 0) { + levelCurrent++; + } else if (strcmp(s, "@End") == 0) { + levelCurrent--; + } + } + } else if (style == SCE_LOUT_OPERATOR) { + if (ch == '{') { + levelCurrent++; + } else if (ch == '}') { + levelCurrent--; + } + } + if (atEOL) { + int lev = levelPrev; + if (visibleChars == 0 && foldCompact) { + lev |= SC_FOLDLEVELWHITEFLAG; + } + if ((levelCurrent > levelPrev) && (visibleChars > 0)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + } + if (!isspacechar(ch)) + visibleChars++; + } + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const loutWordLists[] = { + "Predefined identifiers", + "Predefined delimiters", + "Predefined keywords", + 0, + }; + +LexerModule lmLout(SCLEX_LOUT, ColouriseLoutDoc, "lout", FoldLoutDoc, loutWordLists); diff --git a/contrib/src/stc/scintilla/src/LexOthers.cxx b/contrib/src/stc/scintilla/src/LexOthers.cxx index 6d537c9b6c..45e2d51544 100644 --- a/contrib/src/stc/scintilla/src/LexOthers.cxx +++ b/contrib/src/stc/scintilla/src/LexOthers.cxx @@ -626,9 +626,20 @@ static const char * const emptyWordListDesc[] = { 0 }; +static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[], + Accessor &styler) { + // Null language means all style bytes are 0 so just mark the end - no need to fill in. + if (length > 0) { + styler.StartAt(startPos + length - 1); + styler.StartSegment(startPos + length - 1); + styler.ColourTo(startPos + length - 1, 0); + } +} + LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc); LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", 0, emptyWordListDesc); LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", 0, emptyWordListDesc); LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc); LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc); LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex", 0, emptyWordListDesc); +LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null"); diff --git a/contrib/src/stc/scintilla/src/PropSet.cxx b/contrib/src/stc/scintilla/src/PropSet.cxx index 18544aef23..8455d854d2 100644 --- a/contrib/src/stc/scintilla/src/PropSet.cxx +++ b/contrib/src/stc/scintilla/src/PropSet.cxx @@ -9,7 +9,6 @@ #include #include -//#include #include #include "Platform.h" @@ -182,25 +181,26 @@ SString PropSet::GetExpanded(const char *key) { return Expand(val.c_str()); } -SString PropSet::Expand(const char *withVars) { +SString PropSet::Expand(const char *withVars, int maxExpands) { char *base = StringDup(withVars); char *cpvar = strstr(base, "$("); - int maxExpands = 1000; // Avoid infinite expansion of recursive definitions while (cpvar && (maxExpands > 0)) { char *cpendvar = strchr(cpvar, ')'); - if (cpendvar) { - int lenvar = cpendvar - cpvar - 2; // Subtract the $() - char *var = StringDup(cpvar + 2, lenvar); - SString val = GetExpanded(var); - size_t newlenbase = strlen(base) + val.length() - lenvar; - char *newbase = new char[newlenbase]; - strncpy(newbase, base, cpvar - base); - strcpy(newbase + (cpvar - base), val.c_str()); - strcpy(newbase + (cpvar - base) + val.length(), cpendvar + 1); - delete []var; - delete []base; - base = newbase; - } + if (!cpendvar) + break; + int lenvar = cpendvar - cpvar - 2; // Subtract the $() + char *var = StringDup(cpvar + 2, lenvar); + SString val = Get(var); + if (IncludesVar(val.c_str(), var)) + break; + size_t newlenbase = strlen(base) + val.length() - lenvar; + char *newbase = new char[newlenbase]; + strncpy(newbase, base, cpvar - base); + strcpy(newbase + (cpvar - base), val.c_str()); + strcpy(newbase + (cpvar - base) + val.length(), cpendvar + 1); + delete []var; + delete []base; + base = newbase; cpvar = strstr(base, "$("); maxExpands--; } diff --git a/contrib/src/stc/scintilla/src/RESearch.cxx b/contrib/src/stc/scintilla/src/RESearch.cxx index d0f9fa4752..c579312f44 100644 --- a/contrib/src/stc/scintilla/src/RESearch.cxx +++ b/contrib/src/stc/scintilla/src/RESearch.cxx @@ -30,8 +30,8 @@ * Modification history: * * $Log$ - * Revision 1.5.2.2 2003/04/19 19:56:40 RD - * Updated Scintilla to 1.52 + * Revision 1.5.2.3 2003/07/18 06:35:14 RD + * Update to Scintilla 1.53 * * Revision 1.9 2003/03/21 10:36:08 nyamatongwe * Detect patterns too long in regular expression search. diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index c437fee5a0..274bce2f81 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -475,7 +475,7 @@ void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp) buff[len] = 0; SendMsg(2049, markerNumber, (long)buff); delete [] buff; - + } // Set a margin to be either numeric or symbolic. @@ -858,7 +858,7 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) { buff[len] = 0; SendMsg(2405, type, (long)buff); delete [] buff; - + } // Clear all the registered images. @@ -1618,6 +1618,11 @@ void wxStyledTextCtrl::LineEndDisplayExtend() { SendMsg(2348, 0, 0); } +// Copy the line containing the caret. +void wxStyledTextCtrl::LineCopy() { + SendMsg(2455, 0, 0); +} + // Move the caret inside current view if it's not there already. void wxStyledTextCtrl::MoveCaretInsideView() { SendMsg(2401, 0, 0); @@ -1905,6 +1910,28 @@ void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline) { SendMsg(2412, underline, 0); } +// Given a valid document position, return the previous position taking code +// page into account. Returns 0 if passed 0. +int wxStyledTextCtrl::PositionBefore(int pos) { + return SendMsg(2417, pos, 0); +} + +// Given a valid document position, return the next position taking code +// page into account. Maximum value returned is the last position in the document. +int wxStyledTextCtrl::PositionAfter(int pos) { + return SendMsg(2418, pos, 0); +} + +// Copy a range of text to the clipboard. Positions are clipped into the document. +void wxStyledTextCtrl::CopyRange(int start, int end) { + SendMsg(2419, start, end); +} + +// Copy argument text to the clipboard. +void wxStyledTextCtrl::CopyText(int length, const wxString& text) { + SendMsg(2420, length, (long)(const char*)wx2stc(text)); +} + // Start notifying the container of all key presses and commands. void wxStyledTextCtrl::StartRecord() { SendMsg(3001, 0, 0); diff --git a/src/stc/makefile.b32 b/src/stc/makefile.b32 index ac6a1b59c3..6ce6044a8b 100644 --- a/src/stc/makefile.b32 +++ b/src/stc/makefile.b32 @@ -29,6 +29,7 @@ OBJECTS = \ Document.obj \ DocumentAccessor.obj \ Editor.obj \ + ExternalLexer.obj \ Indicator.obj \ KeyMap.obj \ KeyWords.obj \ @@ -43,9 +44,11 @@ OBJECTS = \ LexCrontab.obj \ LexCSS.obj \ LexEiffel.obj \ + LexEScript.obj \ LexFortran.obj \ LexHTML.obj \ LexLisp.obj \ + LexLout.obj \ LexLua.obj \ LexOthers.obj \ LexPOV.obj \ diff --git a/src/stc/makefile.g95 b/src/stc/makefile.g95 index 25dd4ad0cd..6f23b518da 100644 --- a/src/stc/makefile.g95 +++ b/src/stc/makefile.g95 @@ -17,6 +17,7 @@ OBJECTS = \ $(S)/Document.$(OBJSUFF) \ $(S)/DocumentAccessor.$(OBJSUFF) \ $(S)/Editor.$(OBJSUFF) \ + $(S)/ExternalLexer.$(OBJSUFF) \ $(S)/Indicator.$(OBJSUFF) \ $(S)/KeyMap.$(OBJSUFF) \ $(S)/KeyWords.$(OBJSUFF) \ @@ -31,9 +32,11 @@ OBJECTS = \ $(S)/LexCrontab.$(OBJSUFF) \ $(S)/LexCSS.$(OBJSUFF) \ $(S)/LexEiffel.$(OBJSUFF) \ + $(S)/LexEScript.$(OBJSUFF) \ $(S)/LexFortran.$(OBJSUFF) \ $(S)/LexHTML.$(OBJSUFF) \ $(S)/LexLisp.$(OBJSUFF) \ + $(S)/LexLout.$(OBJSUFF) \ $(S)/LexLua.$(OBJSUFF) \ $(S)/LexOthers.$(OBJSUFF) \ $(S)/LexPOV.$(OBJSUFF) \ diff --git a/src/stc/makefile.vc b/src/stc/makefile.vc index 4aa0e2c352..22d7e750d1 100644 --- a/src/stc/makefile.vc +++ b/src/stc/makefile.vc @@ -22,6 +22,7 @@ OBJECTS = \ $(D)\Document.obj \ $(D)\DocumentAccessor.obj \ $(D)\Editor.obj \ + $(D)\ExternalLexer.obj \ $(D)\Indicator.obj \ $(D)\KeyMap.obj \ $(D)\KeyWords.obj \ @@ -36,9 +37,11 @@ OBJECTS = \ $(D)\LexCrontab.obj \ $(D)\LexCSS.obj \ $(D)\LexEiffel.obj \ + $(D)\LexEScript.obj \ $(D)\LexFortran.obj \ $(D)\LexHTML.obj \ $(D)\LexLisp.obj \ + $(D)\LexLout.obj \ $(D)\LexLua.obj \ $(D)\LexOthers.obj \ $(D)\LexPOV.obj \ diff --git a/src/stc/makefile.wat b/src/stc/makefile.wat index 76a2985a3b..eb568c1575 100644 --- a/src/stc/makefile.wat +++ b/src/stc/makefile.wat @@ -26,6 +26,7 @@ OBJECTS = & Document.obj & DocumentAccessor.obj & Editor.obj & + ExternalLexer.obj & Indicator.obj & KeyMap.obj & KeyWords.obj & @@ -40,9 +41,11 @@ OBJECTS = & LexCrontab.obj & LexCSS.obj & LexEiffel.obj & + LexEScript.obj & LexFortran.obj & LexHTML.obj & LexLisp.obj & + LexLout.obj & LexLua.obj & LexOthers.obj & LexPOV.obj & diff --git a/wxPython/contrib/stc/gtk/stc_.cpp b/wxPython/contrib/stc/gtk/stc_.cpp index 7deb374c77..a2883b21cb 100644 --- a/wxPython/contrib/stc/gtk/stc_.cpp +++ b/wxPython/contrib/stc/gtk/stc_.cpp @@ -7933,6 +7933,34 @@ static PyObject *_wrap_wxStyledTextCtrl_LineEndDisplayExtend(PyObject *self, PyO return _resultobj; } +#define wxStyledTextCtrl_LineCopy(_swigobj) (_swigobj->LineCopy()) +static PyObject *_wrap_wxStyledTextCtrl_LineCopy(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_LineCopy",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_LineCopy. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxStyledTextCtrl_LineCopy(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + #define wxStyledTextCtrl_MoveCaretInsideView(_swigobj) (_swigobj->MoveCaretInsideView()) static PyObject *_wrap_wxStyledTextCtrl_MoveCaretInsideView(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -9605,6 +9633,134 @@ static PyObject *_wrap_wxStyledTextCtrl_SetHotspotActiveUnderline(PyObject *self return _resultobj; } +#define wxStyledTextCtrl_PositionBefore(_swigobj,_swigarg0) (_swigobj->PositionBefore(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_PositionBefore(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_PositionBefore",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_PositionBefore. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxStyledTextCtrl_PositionBefore(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_PositionAfter(_swigobj,_swigarg0) (_swigobj->PositionAfter(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_PositionAfter(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_PositionAfter",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_PositionAfter. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxStyledTextCtrl_PositionAfter(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_CopyRange(_swigobj,_swigarg0,_swigarg1) (_swigobj->CopyRange(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_CopyRange(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","start","end", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_CopyRange",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CopyRange. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxStyledTextCtrl_CopyRange(_arg0,_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CopyText(_swigobj,_swigarg0,_swigarg1) (_swigobj->CopyText(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_CopyText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxString * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","length","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_CopyText",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CopyText. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxStyledTextCtrl_CopyText(_arg0,_arg1,*_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + #define wxStyledTextCtrl_StartRecord(_swigobj) (_swigobj->StartRecord()) static PyObject *_wrap_wxStyledTextCtrl_StartRecord(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -11921,6 +12077,10 @@ static PyMethodDef stc_cMethods[] = { { "wxStyledTextCtrl_SetLexer", (PyCFunction) _wrap_wxStyledTextCtrl_SetLexer, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_StopRecord", (PyCFunction) _wrap_wxStyledTextCtrl_StopRecord, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_StartRecord", (PyCFunction) _wrap_wxStyledTextCtrl_StartRecord, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CopyText", (PyCFunction) _wrap_wxStyledTextCtrl_CopyText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CopyRange", (PyCFunction) _wrap_wxStyledTextCtrl_CopyRange, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_PositionAfter", (PyCFunction) _wrap_wxStyledTextCtrl_PositionAfter, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_PositionBefore", (PyCFunction) _wrap_wxStyledTextCtrl_PositionBefore, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_SetHotspotActiveUnderline", (PyCFunction) _wrap_wxStyledTextCtrl_SetHotspotActiveUnderline, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_SetHotspotActiveBackground", (PyCFunction) _wrap_wxStyledTextCtrl_SetHotspotActiveBackground, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_SetHotspotActiveForeground", (PyCFunction) _wrap_wxStyledTextCtrl_SetHotspotActiveForeground, METH_VARARGS | METH_KEYWORDS }, @@ -11976,6 +12136,7 @@ static PyMethodDef stc_cMethods[] = { { "wxStyledTextCtrl_BraceHighlight", (PyCFunction) _wrap_wxStyledTextCtrl_BraceHighlight, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_LineLength", (PyCFunction) _wrap_wxStyledTextCtrl_LineLength, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_MoveCaretInsideView", (PyCFunction) _wrap_wxStyledTextCtrl_MoveCaretInsideView, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_LineCopy", (PyCFunction) _wrap_wxStyledTextCtrl_LineCopy, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_LineEndDisplayExtend", (PyCFunction) _wrap_wxStyledTextCtrl_LineEndDisplayExtend, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_LineEndDisplay", (PyCFunction) _wrap_wxStyledTextCtrl_LineEndDisplay, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_HomeDisplayExtend", (PyCFunction) _wrap_wxStyledTextCtrl_HomeDisplayExtend, METH_VARARGS | METH_KEYWORDS }, @@ -12559,6 +12720,8 @@ SWIGEXPORT(void) initstc_c() { PyDict_SetItemString(d,"wxSTC_LEX_F77", PyInt_FromLong((long) 37)); PyDict_SetItemString(d,"wxSTC_LEX_CSS", PyInt_FromLong((long) 38)); PyDict_SetItemString(d,"wxSTC_LEX_POV", PyInt_FromLong((long) 39)); + PyDict_SetItemString(d,"wxSTC_LEX_LOUT", PyInt_FromLong((long) 40)); + PyDict_SetItemString(d,"wxSTC_LEX_ESCRIPT", PyInt_FromLong((long) 41)); PyDict_SetItemString(d,"wxSTC_LEX_AUTOMATIC", PyInt_FromLong((long) 1000)); PyDict_SetItemString(d,"wxSTC_P_DEFAULT", PyInt_FromLong((long) 0)); PyDict_SetItemString(d,"wxSTC_P_COMMENTLINE", PyInt_FromLong((long) 1)); @@ -12593,6 +12756,7 @@ SWIGEXPORT(void) initstc_c() { PyDict_SetItemString(d,"wxSTC_C_WORD2", PyInt_FromLong((long) 16)); PyDict_SetItemString(d,"wxSTC_C_COMMENTDOCKEYWORD", PyInt_FromLong((long) 17)); PyDict_SetItemString(d,"wxSTC_C_COMMENTDOCKEYWORDERROR", PyInt_FromLong((long) 18)); + PyDict_SetItemString(d,"wxSTC_C_GLOBALCLASS", PyInt_FromLong((long) 19)); PyDict_SetItemString(d,"wxSTC_H_DEFAULT", PyInt_FromLong((long) 0)); PyDict_SetItemString(d,"wxSTC_H_TAG", PyInt_FromLong((long) 1)); PyDict_SetItemString(d,"wxSTC_H_TAGUNKNOWN", PyInt_FromLong((long) 2)); @@ -12965,6 +13129,29 @@ SWIGEXPORT(void) initstc_c() { PyDict_SetItemString(d,"wxSTC_POV_IDENTIFIER", PyInt_FromLong((long) 8)); PyDict_SetItemString(d,"wxSTC_POV_BRACE", PyInt_FromLong((long) 9)); PyDict_SetItemString(d,"wxSTC_POV_WORD2", PyInt_FromLong((long) 10)); + PyDict_SetItemString(d,"wxSTC_LOUT_DEFAULT", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"wxSTC_LOUT_COMMENT", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"wxSTC_LOUT_NUMBER", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"wxSTC_LOUT_WORD", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"wxSTC_LOUT_WORD2", PyInt_FromLong((long) 4)); + PyDict_SetItemString(d,"wxSTC_LOUT_WORD3", PyInt_FromLong((long) 5)); + PyDict_SetItemString(d,"wxSTC_LOUT_WORD4", PyInt_FromLong((long) 6)); + PyDict_SetItemString(d,"wxSTC_LOUT_STRING", PyInt_FromLong((long) 7)); + PyDict_SetItemString(d,"wxSTC_LOUT_OPERATOR", PyInt_FromLong((long) 8)); + PyDict_SetItemString(d,"wxSTC_LOUT_IDENTIFIER", PyInt_FromLong((long) 9)); + PyDict_SetItemString(d,"wxSTC_LOUT_STRINGEOL", PyInt_FromLong((long) 10)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_DEFAULT", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_COMMENT", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_COMMENTLINE", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_COMMENTDOC", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_NUMBER", PyInt_FromLong((long) 4)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_WORD", PyInt_FromLong((long) 5)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_STRING", PyInt_FromLong((long) 6)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_OPERATOR", PyInt_FromLong((long) 7)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_IDENTIFIER", PyInt_FromLong((long) 8)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_BRACE", PyInt_FromLong((long) 9)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_WORD2", PyInt_FromLong((long) 10)); + PyDict_SetItemString(d,"wxSTC_ESCRIPT_WORD3", PyInt_FromLong((long) 11)); PyDict_SetItemString(d,"wxSTC_CMD_REDO", PyInt_FromLong((long) 2011)); PyDict_SetItemString(d,"wxSTC_CMD_SELECTALL", PyInt_FromLong((long) 2013)); PyDict_SetItemString(d,"wxSTC_CMD_UNDO", PyInt_FromLong((long) 2176)); diff --git a/wxPython/contrib/stc/gtk/stc_.py b/wxPython/contrib/stc/gtk/stc_.py index 93e7f892ef..2a0d4627c4 100644 --- a/wxPython/contrib/stc/gtk/stc_.py +++ b/wxPython/contrib/stc/gtk/stc_.py @@ -878,6 +878,9 @@ class wxStyledTextCtrlPtr(wxControlPtr): def LineEndDisplayExtend(self, *_args, **_kwargs): val = stc_c.wxStyledTextCtrl_LineEndDisplayExtend(self, *_args, **_kwargs) return val + def LineCopy(self, *_args, **_kwargs): + val = stc_c.wxStyledTextCtrl_LineCopy(self, *_args, **_kwargs) + return val def MoveCaretInsideView(self, *_args, **_kwargs): val = stc_c.wxStyledTextCtrl_MoveCaretInsideView(self, *_args, **_kwargs) return val @@ -1044,6 +1047,18 @@ class wxStyledTextCtrlPtr(wxControlPtr): def SetHotspotActiveUnderline(self, *_args, **_kwargs): val = stc_c.wxStyledTextCtrl_SetHotspotActiveUnderline(self, *_args, **_kwargs) return val + def PositionBefore(self, *_args, **_kwargs): + val = stc_c.wxStyledTextCtrl_PositionBefore(self, *_args, **_kwargs) + return val + def PositionAfter(self, *_args, **_kwargs): + val = stc_c.wxStyledTextCtrl_PositionAfter(self, *_args, **_kwargs) + return val + def CopyRange(self, *_args, **_kwargs): + val = stc_c.wxStyledTextCtrl_CopyRange(self, *_args, **_kwargs) + return val + def CopyText(self, *_args, **_kwargs): + val = stc_c.wxStyledTextCtrl_CopyText(self, *_args, **_kwargs) + return val def StartRecord(self, *_args, **_kwargs): val = stc_c.wxStyledTextCtrl_StartRecord(self, *_args, **_kwargs) return val @@ -1497,6 +1512,8 @@ wxSTC_LEX_FORTRAN = stc_c.wxSTC_LEX_FORTRAN wxSTC_LEX_F77 = stc_c.wxSTC_LEX_F77 wxSTC_LEX_CSS = stc_c.wxSTC_LEX_CSS wxSTC_LEX_POV = stc_c.wxSTC_LEX_POV +wxSTC_LEX_LOUT = stc_c.wxSTC_LEX_LOUT +wxSTC_LEX_ESCRIPT = stc_c.wxSTC_LEX_ESCRIPT wxSTC_LEX_AUTOMATIC = stc_c.wxSTC_LEX_AUTOMATIC wxSTC_P_DEFAULT = stc_c.wxSTC_P_DEFAULT wxSTC_P_COMMENTLINE = stc_c.wxSTC_P_COMMENTLINE @@ -1531,6 +1548,7 @@ wxSTC_C_COMMENTLINEDOC = stc_c.wxSTC_C_COMMENTLINEDOC wxSTC_C_WORD2 = stc_c.wxSTC_C_WORD2 wxSTC_C_COMMENTDOCKEYWORD = stc_c.wxSTC_C_COMMENTDOCKEYWORD wxSTC_C_COMMENTDOCKEYWORDERROR = stc_c.wxSTC_C_COMMENTDOCKEYWORDERROR +wxSTC_C_GLOBALCLASS = stc_c.wxSTC_C_GLOBALCLASS wxSTC_H_DEFAULT = stc_c.wxSTC_H_DEFAULT wxSTC_H_TAG = stc_c.wxSTC_H_TAG wxSTC_H_TAGUNKNOWN = stc_c.wxSTC_H_TAGUNKNOWN @@ -1903,6 +1921,29 @@ wxSTC_POV_OPERATOR = stc_c.wxSTC_POV_OPERATOR wxSTC_POV_IDENTIFIER = stc_c.wxSTC_POV_IDENTIFIER wxSTC_POV_BRACE = stc_c.wxSTC_POV_BRACE wxSTC_POV_WORD2 = stc_c.wxSTC_POV_WORD2 +wxSTC_LOUT_DEFAULT = stc_c.wxSTC_LOUT_DEFAULT +wxSTC_LOUT_COMMENT = stc_c.wxSTC_LOUT_COMMENT +wxSTC_LOUT_NUMBER = stc_c.wxSTC_LOUT_NUMBER +wxSTC_LOUT_WORD = stc_c.wxSTC_LOUT_WORD +wxSTC_LOUT_WORD2 = stc_c.wxSTC_LOUT_WORD2 +wxSTC_LOUT_WORD3 = stc_c.wxSTC_LOUT_WORD3 +wxSTC_LOUT_WORD4 = stc_c.wxSTC_LOUT_WORD4 +wxSTC_LOUT_STRING = stc_c.wxSTC_LOUT_STRING +wxSTC_LOUT_OPERATOR = stc_c.wxSTC_LOUT_OPERATOR +wxSTC_LOUT_IDENTIFIER = stc_c.wxSTC_LOUT_IDENTIFIER +wxSTC_LOUT_STRINGEOL = stc_c.wxSTC_LOUT_STRINGEOL +wxSTC_ESCRIPT_DEFAULT = stc_c.wxSTC_ESCRIPT_DEFAULT +wxSTC_ESCRIPT_COMMENT = stc_c.wxSTC_ESCRIPT_COMMENT +wxSTC_ESCRIPT_COMMENTLINE = stc_c.wxSTC_ESCRIPT_COMMENTLINE +wxSTC_ESCRIPT_COMMENTDOC = stc_c.wxSTC_ESCRIPT_COMMENTDOC +wxSTC_ESCRIPT_NUMBER = stc_c.wxSTC_ESCRIPT_NUMBER +wxSTC_ESCRIPT_WORD = stc_c.wxSTC_ESCRIPT_WORD +wxSTC_ESCRIPT_STRING = stc_c.wxSTC_ESCRIPT_STRING +wxSTC_ESCRIPT_OPERATOR = stc_c.wxSTC_ESCRIPT_OPERATOR +wxSTC_ESCRIPT_IDENTIFIER = stc_c.wxSTC_ESCRIPT_IDENTIFIER +wxSTC_ESCRIPT_BRACE = stc_c.wxSTC_ESCRIPT_BRACE +wxSTC_ESCRIPT_WORD2 = stc_c.wxSTC_ESCRIPT_WORD2 +wxSTC_ESCRIPT_WORD3 = stc_c.wxSTC_ESCRIPT_WORD3 wxSTC_CMD_REDO = stc_c.wxSTC_CMD_REDO wxSTC_CMD_SELECTALL = stc_c.wxSTC_CMD_SELECTALL wxSTC_CMD_UNDO = stc_c.wxSTC_CMD_UNDO