From e1cac7c2315f02c670b02375e6f74470b396205a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 20 May 2000 03:24:11 +0000 Subject: [PATCH] New code from Scintilla and supporting code in STC. Styles can now have underlines, new indicator types, zoom-in and zoom-out methods. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/stc/stc.h | 12 +- contrib/src/stc/PlatWX.cpp | 5 +- contrib/src/stc/scintilla/include/Platform.h | 2 +- contrib/src/stc/scintilla/include/SciLexer.h | 8 + contrib/src/stc/scintilla/include/Scintilla.h | 16 +- contrib/src/stc/scintilla/include/WinDefs.h | 48 +---- contrib/src/stc/scintilla/src/CallTip.cxx | 3 +- contrib/src/stc/scintilla/src/Editor.cxx | 68 +++---- contrib/src/stc/scintilla/src/Indicator.cxx | 16 ++ contrib/src/stc/scintilla/src/KeyMap.cxx | 1 + contrib/src/stc/scintilla/src/LexCPP.cxx | 10 +- contrib/src/stc/scintilla/src/LexOthers.cxx | 105 +++++++++++ contrib/src/stc/scintilla/src/LexPerl.cxx | 8 +- contrib/src/stc/scintilla/src/LexPython.cxx | 4 + .../src/stc/scintilla/src/ScintillaBase.cxx | 1 + contrib/src/stc/scintilla/src/Style.cxx | 29 +-- contrib/src/stc/scintilla/src/Style.h | 6 +- contrib/src/stc/scintilla/src/ViewStyle.cxx | 9 +- contrib/src/stc/stc.cpp | 40 ++++- include/wx/stc/stc.h | 12 +- src/stc/PlatWX.cpp | 5 +- src/stc/scintilla/include/Platform.h | 2 +- src/stc/scintilla/include/SciLexer.h | 8 + src/stc/scintilla/include/Scintilla.h | 16 +- src/stc/scintilla/include/WinDefs.h | 48 +---- src/stc/scintilla/src/CallTip.cxx | 3 +- src/stc/scintilla/src/Editor.cxx | 68 +++---- src/stc/scintilla/src/Indicator.cxx | 16 ++ src/stc/scintilla/src/KeyMap.cxx | 1 + src/stc/scintilla/src/LexCPP.cxx | 10 +- src/stc/scintilla/src/LexOthers.cxx | 105 +++++++++++ src/stc/scintilla/src/LexPerl.cxx | 8 +- src/stc/scintilla/src/LexPython.cxx | 4 + src/stc/scintilla/src/ScintillaBase.cxx | 1 + src/stc/scintilla/src/Style.cxx | 29 +-- src/stc/scintilla/src/Style.h | 6 +- src/stc/scintilla/src/ViewStyle.cxx | 9 +- src/stc/stc.cpp | 40 ++++- wxPython/contrib/stc/stc_.cpp | 166 +++++++++++++++++- wxPython/contrib/stc/stc_.py | 17 ++ 40 files changed, 743 insertions(+), 222 deletions(-) diff --git a/contrib/include/wx/stc/stc.h b/contrib/include/wx/stc/stc.h index f2a514524e..890b2f03bd 100644 --- a/contrib/include/wx/stc/stc.h +++ b/contrib/include/wx/stc/stc.h @@ -75,6 +75,8 @@ 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; @@ -323,12 +325,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 @@ -458,6 +461,13 @@ public: void SetFoldFlags(int flags); + // Zooming + void ZoomIn(); + void ZoomOut(); + void SetZoom(int zoom); + int GetZoom(); + + // Long Lines int GetEdgeColumn(); void SetEdgeColumn(int column); diff --git a/contrib/src/stc/PlatWX.cpp b/contrib/src/stc/PlatWX.cpp index 02287e97ca..5045e6d506 100644 --- a/contrib/src/stc/PlatWX.cpp +++ b/contrib/src/stc/PlatWX.cpp @@ -106,14 +106,15 @@ Font::Font() { Font::~Font() { } -void Font::Create(const char *faceName, int size, bool bold, bool italic) { +void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) { Release(); id = new wxFont(size, wxDEFAULT, italic ? wxITALIC : wxNORMAL, bold ? wxBOLD : wxNORMAL, false, - faceName); + faceName, + wxFONTENCODING_DEFAULT); } diff --git a/contrib/src/stc/scintilla/include/Platform.h b/contrib/src/stc/scintilla/include/Platform.h index 24c6b88543..5a87c64feb 100644 --- a/contrib/src/stc/scintilla/include/Platform.h +++ b/contrib/src/stc/scintilla/include/Platform.h @@ -210,7 +210,7 @@ public: Font(); ~Font(); - void Create(const char *faceName, int size, bool bold=false, bool italic=false); + void Create(const char *faceName, int characterSet, int size, bool bold, bool italic); void Release(); FontID GetID() { return id; } diff --git a/contrib/src/stc/scintilla/include/SciLexer.h b/contrib/src/stc/scintilla/include/SciLexer.h index b99526e4f6..d869758f61 100644 --- a/contrib/src/stc/scintilla/include/SciLexer.h +++ b/contrib/src/stc/scintilla/include/SciLexer.h @@ -22,6 +22,7 @@ #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 @@ -170,4 +171,11 @@ #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 diff --git a/contrib/src/stc/scintilla/include/Scintilla.h b/contrib/src/stc/scintilla/include/Scintilla.h index d4092814f7..8e52ba59e2 100644 --- a/contrib/src/stc/scintilla/include/Scintilla.h +++ b/contrib/src/stc/scintilla/include/Scintilla.h @@ -89,7 +89,6 @@ extern "C" { #define SCI_GETVIEWWS SCI_START + 20 #define SCI_SETVIEWWS SCI_START + 21 -#define SCI_CHANGEPOSITION SCI_START + 22 #define SCI_GOTOLINE SCI_START + 24 #define SCI_GOTOPOS SCI_START + 25 #define SCI_SETANCHOR SCI_START + 26 @@ -161,6 +160,10 @@ extern "C" { #define STYLE_CONTROLCHAR 36 #define STYLE_MAX 127 +#define SC_CHARSET_ANSI 0 +#define SC_CHARSET_DEFAULT 1 +#define SC_CHARSET_RUSSIAN 204 + #define SCI_STYLECLEARALL SCI_START + 50 #define SCI_STYLESETFORE SCI_START + 51 #define SCI_STYLESETBACK SCI_START + 52 @@ -170,6 +173,8 @@ extern "C" { #define SCI_STYLESETFONT SCI_START + 56 #define SCI_STYLESETEOLFILLED SCI_START + 57 #define SCI_STYLERESETDEFAULT SCI_START + 58 +#define SCI_STYLESETUNDERLINE SCI_START + 59 +#define SCI_STYLESETCHARACTERSET SCI_START + 66 #define SCI_SETSELFORE SCI_START + 67 #define SCI_SETSELBACK SCI_START + 68 @@ -193,6 +198,8 @@ extern "C" { #define INDIC_PLAIN 0 #define INDIC_SQUIGGLE 1 #define INDIC_TT 2 +#define INDIC_DIAGONAL 3 +#define INDIC_STRIKE 4 #define INDIC0_MASK 32 #define INDIC1_MASK 64 @@ -339,6 +346,11 @@ extern "C" { #define SCI_LINESONSCREEN SCI_START + 370 #define SCI_USEPOPUP SCI_START + 371 #define SCI_SELECTIONISRECTANGLE SCI_START + 372 +#define SCI_SETZOOM SCI_START + 373 +#define SCI_GETZOOM SCI_START + 374 + +#define SCI_ADDREFDOC SCI_START + 375 +#define SCI_RELEASEDOC SCI_START + 376 // GTK+ Specific #define SCI_GRABFOCUS SCI_START + 400 @@ -425,6 +437,8 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance); #ifdef INCLUDE_DEPRECATED_FEATURES +#define SCI_CHANGEPOSITION SCI_START + 22 + // Default style settings. These are deprecated and will be removed in a future version. #define SCI_SETFORE SCI_START + 60 #define SCI_SETBACK SCI_START + 61 diff --git a/contrib/src/stc/scintilla/include/WinDefs.h b/contrib/src/stc/scintilla/include/WinDefs.h index 0b125e7313..d1c25a595a 100644 --- a/contrib/src/stc/scintilla/include/WinDefs.h +++ b/contrib/src/stc/scintilla/include/WinDefs.h @@ -20,79 +20,34 @@ #define EM_CANPASTE (1074) #define EM_CANUNDO (198) #define EM_CHARFROMPOS (215) -#define EM_DISPLAYBAND (1075) #define EM_EMPTYUNDOBUFFER (205) #define EM_EXGETSEL (1076) -#define EM_EXLIMITTEXT (1077) #define EM_EXLINEFROMCHAR (1078) #define EM_EXSETSEL (1079) #define EM_FINDTEXT (1080) #define EM_FINDTEXTEX (1103) -#define EM_FINDWORDBREAK (1100) -#define EM_FMTLINES (200) #define EM_FORMATRANGE (1081) -#define EM_GETCHARFORMAT (1082) -#define EM_GETEVENTMASK (1083) #define EM_GETFIRSTVISIBLELINE (206) -#define EM_GETHANDLE (189) -#define EM_GETLIMITTEXT (213) #define EM_GETLINE (196) #define EM_GETLINECOUNT (186) #define EM_GETMARGINS (212) #define EM_GETMODIFY (184) -#define EM_GETIMECOLOR (1129) -#define EM_GETIMEOPTIONS (1131) -#define EM_GETOPTIONS (1102) -#define EM_GETOLEINTERFACE (1084) -#define EM_GETPARAFORMAT (1085) -#define EM_GETPASSWORDCHAR (210) -#define EM_GETPUNCTUATION (1125) #define EM_GETRECT (178) #define EM_GETSEL (176) #define EM_GETSELTEXT (1086) #define EM_GETTEXTRANGE (1099) -#define EM_GETTHUMB (190) -#define EM_GETWORDBREAKPROC (209) -#define EM_GETWORDBREAKPROCEX (1104) -#define EM_GETWORDWRAPMODE (1127) #define EM_HIDESELECTION (1087) -#define EM_LIMITTEXT (197) #define EM_LINEFROMCHAR (201) #define EM_LINEINDEX (187) #define EM_LINELENGTH (193) #define EM_LINESCROLL (182) -#define EM_PASTESPECIAL (1088) #define EM_POSFROMCHAR (214) #define EM_REPLACESEL (194) -#define EM_REQUESTRESIZE (1089) -#define EM_SCROLL (181) #define EM_SCROLLCARET (183) #define EM_SELECTIONTYPE (1090) -#define EM_SETBKGNDCOLOR (1091) -#define EM_SETCHARFORMAT (1092) -#define EM_SETEVENTMASK (1093) -#define EM_SETHANDLE (188) -#define EM_SETIMECOLOR (1128) -#define EM_SETIMEOPTIONS (1130) -#define EM_SETLIMITTEXT (197) #define EM_SETMARGINS (211) -#define EM_SETMODIFY (185) -#define EM_SETOLECALLBACK (1094) -#define EM_SETOPTIONS (1101) -#define EM_SETPARAFORMAT (1095) -#define EM_SETPASSWORDCHAR (204) -#define EM_SETPUNCTUATION (1124) #define EM_SETREADONLY (207) -#define EM_SETRECT (179) -#define EM_SETRECTNP (180) #define EM_SETSEL (177) -#define EM_SETTABSTOPS (203) -#define EM_SETTARGETDEVICE (1096) -#define EM_SETWORDBREAKPROC (208) -#define EM_SETWORDBREAKPROCEX (1105) -#define EM_SETWORDWRAPMODE (1126) -#define EM_STREAMIN (1097) -#define EM_STREAMOUT (1098) #define EM_UNDO (199) #define WM_NULL (0) @@ -132,6 +87,7 @@ #define VK_RETURN GDK_Return #define VK_ADD GDK_KP_Add #define VK_SUBTRACT GDK_KP_Subtract +#define VK_DIVIDE GDK_KP_Divide #endif #if PLAT_WX @@ -151,6 +107,8 @@ #define VK_RETURN WXK_RETURN #define VK_ADD WXK_ADD #define VK_SUBTRACT WXK_SUBTRACT +//TODO: +#define VK_DIVIDE WXK_DIVIDE // Are these needed any more #define LPSTR char * diff --git a/contrib/src/stc/scintilla/src/CallTip.cxx b/contrib/src/stc/scintilla/src/CallTip.cxx index ad6740208b..d22a963645 100644 --- a/contrib/src/stc/scintilla/src/CallTip.cxx +++ b/contrib/src/stc/scintilla/src/CallTip.cxx @@ -8,6 +8,7 @@ #include "Platform.h" +#include "Scintilla.h" #include "CallTip.h" CallTip::CallTip() { @@ -117,7 +118,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, Surface surfaceMeasure; surfaceMeasure.Init(); int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72; - font.Create(faceName, deviceHeight); + font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false); if (val) delete []val; val = new char[strlen(defn) + 1]; diff --git a/contrib/src/stc/scintilla/src/Editor.cxx b/contrib/src/stc/scintilla/src/Editor.cxx index bccddf160b..ad8bab8c5f 100644 --- a/contrib/src/stc/scintilla/src/Editor.cxx +++ b/contrib/src/stc/scintilla/src/Editor.cxx @@ -889,6 +889,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int xStart, } } } + if (vsDraw.styles[styleMain].underline) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + surface->FillRectangle(rcUL, textFore); + } } startseg = i + 1; } @@ -1348,8 +1354,7 @@ void Editor::ClearSelection() { int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); int startPos = SelectionStart(); - int line; - for (line=lineStart; line <= lineEnd; line++) { + for (int line=lineEnd; line >= lineStart; line--) { startPos = SelectionStart(line); unsigned int chars = SelectionEnd(line) - startPos; if (0 != chars) { @@ -1782,7 +1787,7 @@ void Editor::ChangeCaseOfSelection(bool makeUpperCase) { if (selType == selRectangle) { int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); - for (int line=lineStart; line <= lineEnd; line++) { + for (int line=lineEnd; line >= lineStart; line--) { pdoc->ChangeCase( Range(SelectionStart(line), SelectionEnd(line)), makeUpperCase); @@ -2908,19 +2913,20 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { // EM_GETPUNCTUATION // EM_SETPUNCTUATION // EM_GETTHUMB + // EM_SETTARGETDEVICE // Not supported but should be: // EM_GETEVENTMASK // EM_SETEVENTMASK // For printing: // EM_DISPLAYBAND - // EM_SETTARGETDEVICE case EM_CANUNDO: return pdoc->CanUndo() ? TRUE : FALSE; case EM_UNDO: Undo(); + SetLastXChosen(); break; case EM_EMPTYUNDOBUFFER: @@ -2956,12 +2962,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case EM_GETMODIFY: return !pdoc->IsSavePoint(); - case EM_SETMODIFY: - // Not really supported now that there is the save point stuff - //pdoc->isModified = wParam; - //return pdoc->isModified; - return false; - case EM_GETRECT: if (lParam == 0) return 0; @@ -3025,22 +3025,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { return iChar; } - case EM_GETWORDBREAKPROC: - return 0; - - case EM_SETWORDBREAKPROC: - break; - - case EM_LIMITTEXT: - // wParam holds the number of characters control should be limited to - break; - - case EM_GETLIMITTEXT: - return 0xffffffff; - - case EM_GETOLEINTERFACE: - return 0; - case EM_LINEFROMCHAR: if (static_cast(wParam) < 0) wParam = SelectionStart(); @@ -3110,9 +3094,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { pdoc->SetReadOnly(wParam); return TRUE; - case EM_SETRECT: - break; - case EM_CANPASTE: return 1; @@ -3605,12 +3586,23 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { InvalidateStyleRedraw(); } break; + case SCI_STYLESETUNDERLINE: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].underline = lParam; + InvalidateStyleRedraw(); + } + break; + case SCI_STYLESETCHARACTERSET: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].characterSet = lParam; + InvalidateStyleRedraw(); + } + break; case SCI_STYLERESETDEFAULT: vs.ResetDefaultStyle(); InvalidateStyleRedraw(); break; - case SCI_SETSTYLEBITS: pdoc->SetStylingBits(wParam); break; @@ -3858,6 +3850,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { Redraw(); break; + case SCI_SETZOOM: + vs.zoomLevel = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETZOOM: + return vs.zoomLevel; + case SCI_GETEDGECOLUMN: return theEdge; @@ -3889,6 +3889,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { SetDocPointer(reinterpret_cast(lParam)); return 0; + case SCI_ADDREFDOC: + (reinterpret_cast(lParam))->AddRef(); + break; + + case SCI_RELEASEDOC: + (reinterpret_cast(lParam))->Release(); + break; + case SCI_SETMODEVENTMASK: modEventMask = wParam; return 0; diff --git a/contrib/src/stc/scintilla/src/Indicator.cxx b/contrib/src/stc/scintilla/src/Indicator.cxx index fb6ad09157..05bdf66b53 100644 --- a/contrib/src/stc/scintilla/src/Indicator.cxx +++ b/contrib/src/stc/scintilla/src/Indicator.cxx @@ -37,6 +37,22 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) { surface->MoveTo(x-3, ymid); surface->LineTo(x-3, ymid+2); } + } else if (style == INDIC_DIAGONAL) { + int x = rc.left; + while (x < rc.right) { + surface->MoveTo(x, rc.top+2); + int endX = x+3; + int endY = rc.top - 1; + if (endX > rc.right) { + endY += endX - rc.right; + endX = rc.right; + } + surface->LineTo(endX, endY); + x += 4; + } + } else if (style == INDIC_STRIKE) { + surface->MoveTo(rc.left, rc.top - 4); + surface->LineTo(rc.right, rc.top - 4); } else { // Either INDIC_PLAIN or unknown surface->MoveTo(rc.left, ymid); surface->LineTo(rc.right, ymid); diff --git a/contrib/src/stc/scintilla/src/KeyMap.cxx b/contrib/src/stc/scintilla/src/KeyMap.cxx index 0dd4ec0880..3a6a31f974 100644 --- a/contrib/src/stc/scintilla/src/KeyMap.cxx +++ b/contrib/src/stc/scintilla/src/KeyMap.cxx @@ -107,6 +107,7 @@ KeyToCommand KeyMap::MapDefault[] = { {VK_RETURN, SCI_NORM, SCI_NEWLINE}, {VK_ADD, SCI_CTRL, SCI_ZOOMIN}, {VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT}, + {VK_DIVIDE, SCI_CTRL, SCI_SETZOOM}, //'L', SCI_CTRL, SCI_FORMFEED, {'L', SCI_CTRL, SCI_LINECUT}, {'L', SCI_CSHIFT, SCI_LINEDELETE}, diff --git a/contrib/src/stc/scintilla/src/LexCPP.cxx b/contrib/src/stc/scintilla/src/LexCPP.cxx index ea62091df6..4f042bd61d 100644 --- a/contrib/src/stc/scintilla/src/LexCPP.cxx +++ b/contrib/src/stc/scintilla/src/LexCPP.cxx @@ -179,10 +179,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo state = SCE_C_DEFAULT; } } else if (state == SCE_C_STRING) { - if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { - styler.ColourTo(i-1, SCE_C_STRINGEOL); - state = SCE_C_STRINGEOL; - } else if (ch == '\\') { + if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; ch = chNext; @@ -194,7 +191,10 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo i++; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); - } + } else if (chNext == '\r' || chNext == '\n') { + styler.ColourTo(i-1, SCE_C_STRINGEOL); + state = SCE_C_STRINGEOL; + } } else if (state == SCE_C_CHARACTER) { if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { styler.ColourTo(i-1, SCE_C_STRINGEOL); diff --git a/contrib/src/stc/scintilla/src/LexOthers.cxx b/contrib/src/stc/scintilla/src/LexOthers.cxx index 30589d6f3b..90f41e3bf3 100644 --- a/contrib/src/stc/scintilla/src/LexOthers.cxx +++ b/contrib/src/stc/scintilla/src/LexOthers.cxx @@ -193,7 +193,112 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi ColouriseErrorListLine(lineBuffer, linePos, startPos + length, styler); } +static int isSpecial(char s) { + + return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') || + (s == '\"') || (s == '`') || (s == '^') || (s == '~'); +} + +static int isTag(int start, Accessor &styler) { + + char s[6]; + unsigned int i = 0, e=1; + while (i < 5 && e) { + s[i] = styler[start + i]; + i++; + e = styler[start + i] != '{'; + } + s[i] = '\0'; + return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0); +} + +static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { + + styler.StartAt(startPos); + + int state = initStyle; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + int lengthDoc = startPos + length; + + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + i++; + continue; + } + switch(state) { + case SCE_L_DEFAULT : + switch(ch) { + case '\\' : + styler.ColourTo(i - 1, state); + if (isSpecial(styler[i + 1])) { + styler.ColourTo(i + 1, SCE_L_COMMAND); + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + else { + if (isTag(i+1, styler)) + state = SCE_L_TAG; + else + state = SCE_L_COMMAND; + } + break; + case '$' : + styler.ColourTo(i - 1, state); + state = SCE_L_MATH; + if (chNext == '$') { + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case '%' : + styler.ColourTo(i - 1, state); + state = SCE_L_COMMENT; + break; + } + break; + case SCE_L_COMMAND : + if (chNext == '[' || chNext == '{' || chNext == '}' || + chNext == ' ' || chNext == '\r' || chNext == '\n') { + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case SCE_L_TAG : + if (ch == '}') { + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + } + break; + case SCE_L_MATH : + if (ch == '$') { + if (chNext == '$') { + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + } + break; + case SCE_L_COMMENT : + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_L_DEFAULT; + } + } + } + styler.ColourTo(lengthDoc, state); +} + LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc); LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc); LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc); LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc); +LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc); diff --git a/contrib/src/stc/scintilla/src/LexPerl.cxx b/contrib/src/stc/scintilla/src/LexPerl.cxx index 2ed36e1928..3c9972e2d6 100644 --- a/contrib/src/stc/scintilla/src/LexPerl.cxx +++ b/contrib/src/stc/scintilla/src/LexPerl.cxx @@ -292,11 +292,13 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, } else { quotes++; } - - if (quotes > 1 && isMatch(styler, lengthDoc, i, sooked)) { + if (quotes > 1 && isMatch(styler, lengthDoc, i, sooked) && (chPrev == '\n' || chPrev == '\r') ) { styler.ColourTo(i + sookedpos - 1, SCE_PL_HERE); - state = SCE_PL_DEFAULT; i += sookedpos; + chNext = styler.SafeGetCharAt(i); + if (chNext == '\n' || chNext == '\r') { + state = SCE_PL_DEFAULT; + } chNext = ' '; } } else if (state == SCE_PL_STRING) { diff --git a/contrib/src/stc/scintilla/src/LexPython.cxx b/contrib/src/stc/scintilla/src/LexPython.cxx index f309036a73..df8b7085bf 100644 --- a/contrib/src/stc/scintilla/src/LexPython.cxx +++ b/contrib/src/stc/scintilla/src/LexPython.cxx @@ -52,6 +52,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, if (lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); + if (startPos == 0) + initStyle = SCE_P_DEFAULT; + else + initStyle = styler.StyleAt(startPos-1); } } diff --git a/contrib/src/stc/scintilla/src/ScintillaBase.cxx b/contrib/src/stc/scintilla/src/ScintillaBase.cxx index 972e4fbff0..87b84f7064 100644 --- a/contrib/src/stc/scintilla/src/ScintillaBase.cxx +++ b/contrib/src/stc/scintilla/src/ScintillaBase.cxx @@ -390,6 +390,7 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_COLOURISE: Colourise(wParam, lParam); + Redraw(); break; case SCI_SETPROPERTY: diff --git a/contrib/src/stc/scintilla/src/Style.cxx b/contrib/src/stc/scintilla/src/Style.cxx index 36d4b98502..7aa44c0eb9 100644 --- a/contrib/src/stc/scintilla/src/Style.cxx +++ b/contrib/src/stc/scintilla/src/Style.cxx @@ -7,25 +7,28 @@ #include "Platform.h" +#include "Scintilla.h" #include "Style.h" Style::Style() { aliasOfDefaultFont = true; Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), - Platform::DefaultFontSize(), 0, - false, false, false); + Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT, + false, false, false, false); } Style::Style(const Style &source) { Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), - 0, 0, - false, false, false); + 0, 0, 0, + false, false, false, false); fore.desired = source.fore.desired; back.desired = source.back.desired; + characterSet = source.characterSet; bold = source.bold; italic = source.italic; size = source.size; eolFilled = source.eolFilled; + underline = source.underline; } Style::~Style() { @@ -40,26 +43,31 @@ Style &Style::operator=(const Style &source) { if (this == &source) return *this; Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), - 0, 0, - false, false, false); + 0, 0, SC_CHARSET_DEFAULT, + false, false, false, false); fore.desired = source.fore.desired; back.desired = source.back.desired; + characterSet = source.characterSet; bold = source.bold; italic = source.italic; size = source.size; eolFilled = source.eolFilled; + underline = source.underline; return *this; } -void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_, - bool bold_, bool italic_, bool eolFilled_) { +void Style::Clear(Colour fore_, Colour back_, int size_, + const char *fontName_, int characterSet_, + bool bold_, bool italic_, bool eolFilled_, bool underline_) { fore.desired = fore_; back.desired = back_; + characterSet = characterSet_; bold = bold_; italic = italic_; size = size_; fontName = fontName_; eolFilled = eolFilled_; + underline = underline_; if (aliasOfDefaultFont) font.SetID(0); else @@ -70,7 +78,8 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_, bool Style::EquivalentFontTo(const Style *other) const { if (bold != other->bold || italic != other->italic || - size != other->size) + size != other->size || + characterSet != other->characterSet) return false; if (fontName == other->fontName) return true; @@ -96,7 +105,7 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) { if (aliasOfDefaultFont) { font.SetID(defaultStyle->font.GetID()); } else if (fontName) { - font.Create(fontName, deviceHeight, bold, italic); + font.Create(fontName, characterSet, deviceHeight, bold, italic); } else { font.SetID(0); } diff --git a/contrib/src/stc/scintilla/src/Style.h b/contrib/src/stc/scintilla/src/Style.h index 95e006135b..dc643d08d2 100644 --- a/contrib/src/stc/scintilla/src/Style.h +++ b/contrib/src/stc/scintilla/src/Style.h @@ -15,7 +15,9 @@ public: bool italic; int size; const char *fontName; + int characterSet; bool eolFilled; + bool underline; Font font; unsigned int lineHeight; @@ -31,8 +33,8 @@ public: Style &operator=(const Style &source); void Clear(Colour fore_, Colour back_, int size_, - const char *fontName_, - bool bold_, bool italic_, bool eolFilled_); + const char *fontName_, int characterSet_, + bool bold_, bool italic_, bool eolFilled_, bool underline_); bool EquivalentFontTo(const Style *other) const; void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0); }; diff --git a/contrib/src/stc/scintilla/src/ViewStyle.cxx b/contrib/src/stc/scintilla/src/ViewStyle.cxx index 2188fd03f7..580ecc71ff 100644 --- a/contrib/src/stc/scintilla/src/ViewStyle.cxx +++ b/contrib/src/stc/scintilla/src/ViewStyle.cxx @@ -201,8 +201,9 @@ void ViewStyle::Refresh(Surface &surface) { void ViewStyle::ResetDefaultStyle() { styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), - Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), - false, false, false); + Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), + SC_CHARSET_DEFAULT, + false, false, false, false); } void ViewStyle::ClearStyles() { @@ -214,9 +215,11 @@ void ViewStyle::ClearStyles() { styles[STYLE_DEFAULT].back.desired, styles[STYLE_DEFAULT].size, styles[STYLE_DEFAULT].fontName, + styles[STYLE_DEFAULT].characterSet, styles[STYLE_DEFAULT].bold, styles[STYLE_DEFAULT].italic, - styles[STYLE_DEFAULT].eolFilled); + styles[STYLE_DEFAULT].eolFilled, + styles[STYLE_DEFAULT].underline); } } styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index 3ec0fb0b52..2ef9c3079b 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -727,6 +727,7 @@ void wxStyledTextCtrl::StyleResetDefault() { // face:[facename] sets the font face name to use // size:[num] sets the font size in points // eol turns on eol filling +// underline turns on underlining // void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { @@ -744,6 +745,9 @@ void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { else if (option == "italic") StyleSetItalic(styleNum, true); + else if (option == "underline") + StyleSetUnderline(styleNum, true); + else if (option == "eol") StyleSetEOLFilled(styleNum, true); @@ -780,18 +784,21 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) { wxString faceName = font.GetFaceName(); bool bold = font.GetWeight() == wxBOLD; bool italic = font.GetStyle() != wxNORMAL; + bool under = font.GetUnderlined(); - StyleSetFontAttr(styleNum, size, faceName, bold, italic); + StyleSetFontAttr(styleNum, size, faceName, bold, italic, under); } void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size, const wxString& faceName, - bool bold, bool italic) { + bool bold, bool italic, + bool underline) { StyleSetSize(styleNum, size); StyleSetFaceName(styleNum, faceName); StyleSetBold(styleNum, bold); StyleSetItalic(styleNum, italic); + StyleSetUnderline(styleNum, underline); } @@ -820,6 +827,11 @@ void wxStyledTextCtrl::StyleSetEOLFilled(int styleNum, bool fillEOL) { } +void wxStyledTextCtrl::StyleSetUnderline(int styleNum, bool underline) { + SendMsg(SCI_STYLESETUNDERLINE, styleNum, underline); +} + + //---------------------------------------------------------------------- // Margins in the edit area @@ -910,7 +922,7 @@ void wxStyledTextCtrl::SetSelectionBackground(const wxColour& colour) { void wxStyledTextCtrl::SetCaretForeground(const wxColour& colour) { - SendMsg(SCI_SETCARETFORE, 0, wxColourAsLong(colour)); + SendMsg(SCI_SETCARETFORE, wxColourAsLong(colour)); } @@ -1305,6 +1317,28 @@ void wxStyledTextCtrl::SetFoldFlags(int flags) { } +//---------------------------------------------------------------------- +// Zooming + +void wxStyledTextCtrl::ZoomIn() { + SendMsg(SCI_ZOOMIN); +} + + +void wxStyledTextCtrl::ZoomOut() { + SendMsg(SCI_ZOOMOUT); +} + + +void wxStyledTextCtrl::SetZoom(int zoom) { + SendMsg(SCI_SETZOOM, zoom); +} + + +int wxStyledTextCtrl::GetZoom() { + return SendMsg(SCI_GETZOOM); +} + //---------------------------------------------------------------------- // Long Lines diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index f2a514524e..890b2f03bd 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -75,6 +75,8 @@ 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; @@ -323,12 +325,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 @@ -458,6 +461,13 @@ public: void SetFoldFlags(int flags); + // Zooming + void ZoomIn(); + void ZoomOut(); + void SetZoom(int zoom); + int GetZoom(); + + // Long Lines int GetEdgeColumn(); void SetEdgeColumn(int column); diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 02287e97ca..5045e6d506 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -106,14 +106,15 @@ Font::Font() { Font::~Font() { } -void Font::Create(const char *faceName, int size, bool bold, bool italic) { +void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) { Release(); id = new wxFont(size, wxDEFAULT, italic ? wxITALIC : wxNORMAL, bold ? wxBOLD : wxNORMAL, false, - faceName); + faceName, + wxFONTENCODING_DEFAULT); } diff --git a/src/stc/scintilla/include/Platform.h b/src/stc/scintilla/include/Platform.h index 24c6b88543..5a87c64feb 100644 --- a/src/stc/scintilla/include/Platform.h +++ b/src/stc/scintilla/include/Platform.h @@ -210,7 +210,7 @@ public: Font(); ~Font(); - void Create(const char *faceName, int size, bool bold=false, bool italic=false); + void Create(const char *faceName, int characterSet, int size, bool bold, bool italic); void Release(); FontID GetID() { return id; } diff --git a/src/stc/scintilla/include/SciLexer.h b/src/stc/scintilla/include/SciLexer.h index b99526e4f6..d869758f61 100644 --- a/src/stc/scintilla/include/SciLexer.h +++ b/src/stc/scintilla/include/SciLexer.h @@ -22,6 +22,7 @@ #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 @@ -170,4 +171,11 @@ #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 diff --git a/src/stc/scintilla/include/Scintilla.h b/src/stc/scintilla/include/Scintilla.h index d4092814f7..8e52ba59e2 100644 --- a/src/stc/scintilla/include/Scintilla.h +++ b/src/stc/scintilla/include/Scintilla.h @@ -89,7 +89,6 @@ extern "C" { #define SCI_GETVIEWWS SCI_START + 20 #define SCI_SETVIEWWS SCI_START + 21 -#define SCI_CHANGEPOSITION SCI_START + 22 #define SCI_GOTOLINE SCI_START + 24 #define SCI_GOTOPOS SCI_START + 25 #define SCI_SETANCHOR SCI_START + 26 @@ -161,6 +160,10 @@ extern "C" { #define STYLE_CONTROLCHAR 36 #define STYLE_MAX 127 +#define SC_CHARSET_ANSI 0 +#define SC_CHARSET_DEFAULT 1 +#define SC_CHARSET_RUSSIAN 204 + #define SCI_STYLECLEARALL SCI_START + 50 #define SCI_STYLESETFORE SCI_START + 51 #define SCI_STYLESETBACK SCI_START + 52 @@ -170,6 +173,8 @@ extern "C" { #define SCI_STYLESETFONT SCI_START + 56 #define SCI_STYLESETEOLFILLED SCI_START + 57 #define SCI_STYLERESETDEFAULT SCI_START + 58 +#define SCI_STYLESETUNDERLINE SCI_START + 59 +#define SCI_STYLESETCHARACTERSET SCI_START + 66 #define SCI_SETSELFORE SCI_START + 67 #define SCI_SETSELBACK SCI_START + 68 @@ -193,6 +198,8 @@ extern "C" { #define INDIC_PLAIN 0 #define INDIC_SQUIGGLE 1 #define INDIC_TT 2 +#define INDIC_DIAGONAL 3 +#define INDIC_STRIKE 4 #define INDIC0_MASK 32 #define INDIC1_MASK 64 @@ -339,6 +346,11 @@ extern "C" { #define SCI_LINESONSCREEN SCI_START + 370 #define SCI_USEPOPUP SCI_START + 371 #define SCI_SELECTIONISRECTANGLE SCI_START + 372 +#define SCI_SETZOOM SCI_START + 373 +#define SCI_GETZOOM SCI_START + 374 + +#define SCI_ADDREFDOC SCI_START + 375 +#define SCI_RELEASEDOC SCI_START + 376 // GTK+ Specific #define SCI_GRABFOCUS SCI_START + 400 @@ -425,6 +437,8 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance); #ifdef INCLUDE_DEPRECATED_FEATURES +#define SCI_CHANGEPOSITION SCI_START + 22 + // Default style settings. These are deprecated and will be removed in a future version. #define SCI_SETFORE SCI_START + 60 #define SCI_SETBACK SCI_START + 61 diff --git a/src/stc/scintilla/include/WinDefs.h b/src/stc/scintilla/include/WinDefs.h index 0b125e7313..d1c25a595a 100644 --- a/src/stc/scintilla/include/WinDefs.h +++ b/src/stc/scintilla/include/WinDefs.h @@ -20,79 +20,34 @@ #define EM_CANPASTE (1074) #define EM_CANUNDO (198) #define EM_CHARFROMPOS (215) -#define EM_DISPLAYBAND (1075) #define EM_EMPTYUNDOBUFFER (205) #define EM_EXGETSEL (1076) -#define EM_EXLIMITTEXT (1077) #define EM_EXLINEFROMCHAR (1078) #define EM_EXSETSEL (1079) #define EM_FINDTEXT (1080) #define EM_FINDTEXTEX (1103) -#define EM_FINDWORDBREAK (1100) -#define EM_FMTLINES (200) #define EM_FORMATRANGE (1081) -#define EM_GETCHARFORMAT (1082) -#define EM_GETEVENTMASK (1083) #define EM_GETFIRSTVISIBLELINE (206) -#define EM_GETHANDLE (189) -#define EM_GETLIMITTEXT (213) #define EM_GETLINE (196) #define EM_GETLINECOUNT (186) #define EM_GETMARGINS (212) #define EM_GETMODIFY (184) -#define EM_GETIMECOLOR (1129) -#define EM_GETIMEOPTIONS (1131) -#define EM_GETOPTIONS (1102) -#define EM_GETOLEINTERFACE (1084) -#define EM_GETPARAFORMAT (1085) -#define EM_GETPASSWORDCHAR (210) -#define EM_GETPUNCTUATION (1125) #define EM_GETRECT (178) #define EM_GETSEL (176) #define EM_GETSELTEXT (1086) #define EM_GETTEXTRANGE (1099) -#define EM_GETTHUMB (190) -#define EM_GETWORDBREAKPROC (209) -#define EM_GETWORDBREAKPROCEX (1104) -#define EM_GETWORDWRAPMODE (1127) #define EM_HIDESELECTION (1087) -#define EM_LIMITTEXT (197) #define EM_LINEFROMCHAR (201) #define EM_LINEINDEX (187) #define EM_LINELENGTH (193) #define EM_LINESCROLL (182) -#define EM_PASTESPECIAL (1088) #define EM_POSFROMCHAR (214) #define EM_REPLACESEL (194) -#define EM_REQUESTRESIZE (1089) -#define EM_SCROLL (181) #define EM_SCROLLCARET (183) #define EM_SELECTIONTYPE (1090) -#define EM_SETBKGNDCOLOR (1091) -#define EM_SETCHARFORMAT (1092) -#define EM_SETEVENTMASK (1093) -#define EM_SETHANDLE (188) -#define EM_SETIMECOLOR (1128) -#define EM_SETIMEOPTIONS (1130) -#define EM_SETLIMITTEXT (197) #define EM_SETMARGINS (211) -#define EM_SETMODIFY (185) -#define EM_SETOLECALLBACK (1094) -#define EM_SETOPTIONS (1101) -#define EM_SETPARAFORMAT (1095) -#define EM_SETPASSWORDCHAR (204) -#define EM_SETPUNCTUATION (1124) #define EM_SETREADONLY (207) -#define EM_SETRECT (179) -#define EM_SETRECTNP (180) #define EM_SETSEL (177) -#define EM_SETTABSTOPS (203) -#define EM_SETTARGETDEVICE (1096) -#define EM_SETWORDBREAKPROC (208) -#define EM_SETWORDBREAKPROCEX (1105) -#define EM_SETWORDWRAPMODE (1126) -#define EM_STREAMIN (1097) -#define EM_STREAMOUT (1098) #define EM_UNDO (199) #define WM_NULL (0) @@ -132,6 +87,7 @@ #define VK_RETURN GDK_Return #define VK_ADD GDK_KP_Add #define VK_SUBTRACT GDK_KP_Subtract +#define VK_DIVIDE GDK_KP_Divide #endif #if PLAT_WX @@ -151,6 +107,8 @@ #define VK_RETURN WXK_RETURN #define VK_ADD WXK_ADD #define VK_SUBTRACT WXK_SUBTRACT +//TODO: +#define VK_DIVIDE WXK_DIVIDE // Are these needed any more #define LPSTR char * diff --git a/src/stc/scintilla/src/CallTip.cxx b/src/stc/scintilla/src/CallTip.cxx index ad6740208b..d22a963645 100644 --- a/src/stc/scintilla/src/CallTip.cxx +++ b/src/stc/scintilla/src/CallTip.cxx @@ -8,6 +8,7 @@ #include "Platform.h" +#include "Scintilla.h" #include "CallTip.h" CallTip::CallTip() { @@ -117,7 +118,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, Surface surfaceMeasure; surfaceMeasure.Init(); int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72; - font.Create(faceName, deviceHeight); + font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false); if (val) delete []val; val = new char[strlen(defn) + 1]; diff --git a/src/stc/scintilla/src/Editor.cxx b/src/stc/scintilla/src/Editor.cxx index bccddf160b..ad8bab8c5f 100644 --- a/src/stc/scintilla/src/Editor.cxx +++ b/src/stc/scintilla/src/Editor.cxx @@ -889,6 +889,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int xStart, } } } + if (vsDraw.styles[styleMain].underline) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + surface->FillRectangle(rcUL, textFore); + } } startseg = i + 1; } @@ -1348,8 +1354,7 @@ void Editor::ClearSelection() { int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); int startPos = SelectionStart(); - int line; - for (line=lineStart; line <= lineEnd; line++) { + for (int line=lineEnd; line >= lineStart; line--) { startPos = SelectionStart(line); unsigned int chars = SelectionEnd(line) - startPos; if (0 != chars) { @@ -1782,7 +1787,7 @@ void Editor::ChangeCaseOfSelection(bool makeUpperCase) { if (selType == selRectangle) { int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); - for (int line=lineStart; line <= lineEnd; line++) { + for (int line=lineEnd; line >= lineStart; line--) { pdoc->ChangeCase( Range(SelectionStart(line), SelectionEnd(line)), makeUpperCase); @@ -2908,19 +2913,20 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { // EM_GETPUNCTUATION // EM_SETPUNCTUATION // EM_GETTHUMB + // EM_SETTARGETDEVICE // Not supported but should be: // EM_GETEVENTMASK // EM_SETEVENTMASK // For printing: // EM_DISPLAYBAND - // EM_SETTARGETDEVICE case EM_CANUNDO: return pdoc->CanUndo() ? TRUE : FALSE; case EM_UNDO: Undo(); + SetLastXChosen(); break; case EM_EMPTYUNDOBUFFER: @@ -2956,12 +2962,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case EM_GETMODIFY: return !pdoc->IsSavePoint(); - case EM_SETMODIFY: - // Not really supported now that there is the save point stuff - //pdoc->isModified = wParam; - //return pdoc->isModified; - return false; - case EM_GETRECT: if (lParam == 0) return 0; @@ -3025,22 +3025,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { return iChar; } - case EM_GETWORDBREAKPROC: - return 0; - - case EM_SETWORDBREAKPROC: - break; - - case EM_LIMITTEXT: - // wParam holds the number of characters control should be limited to - break; - - case EM_GETLIMITTEXT: - return 0xffffffff; - - case EM_GETOLEINTERFACE: - return 0; - case EM_LINEFROMCHAR: if (static_cast(wParam) < 0) wParam = SelectionStart(); @@ -3110,9 +3094,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { pdoc->SetReadOnly(wParam); return TRUE; - case EM_SETRECT: - break; - case EM_CANPASTE: return 1; @@ -3605,12 +3586,23 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { InvalidateStyleRedraw(); } break; + case SCI_STYLESETUNDERLINE: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].underline = lParam; + InvalidateStyleRedraw(); + } + break; + case SCI_STYLESETCHARACTERSET: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].characterSet = lParam; + InvalidateStyleRedraw(); + } + break; case SCI_STYLERESETDEFAULT: vs.ResetDefaultStyle(); InvalidateStyleRedraw(); break; - case SCI_SETSTYLEBITS: pdoc->SetStylingBits(wParam); break; @@ -3858,6 +3850,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { Redraw(); break; + case SCI_SETZOOM: + vs.zoomLevel = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETZOOM: + return vs.zoomLevel; + case SCI_GETEDGECOLUMN: return theEdge; @@ -3889,6 +3889,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { SetDocPointer(reinterpret_cast(lParam)); return 0; + case SCI_ADDREFDOC: + (reinterpret_cast(lParam))->AddRef(); + break; + + case SCI_RELEASEDOC: + (reinterpret_cast(lParam))->Release(); + break; + case SCI_SETMODEVENTMASK: modEventMask = wParam; return 0; diff --git a/src/stc/scintilla/src/Indicator.cxx b/src/stc/scintilla/src/Indicator.cxx index fb6ad09157..05bdf66b53 100644 --- a/src/stc/scintilla/src/Indicator.cxx +++ b/src/stc/scintilla/src/Indicator.cxx @@ -37,6 +37,22 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) { surface->MoveTo(x-3, ymid); surface->LineTo(x-3, ymid+2); } + } else if (style == INDIC_DIAGONAL) { + int x = rc.left; + while (x < rc.right) { + surface->MoveTo(x, rc.top+2); + int endX = x+3; + int endY = rc.top - 1; + if (endX > rc.right) { + endY += endX - rc.right; + endX = rc.right; + } + surface->LineTo(endX, endY); + x += 4; + } + } else if (style == INDIC_STRIKE) { + surface->MoveTo(rc.left, rc.top - 4); + surface->LineTo(rc.right, rc.top - 4); } else { // Either INDIC_PLAIN or unknown surface->MoveTo(rc.left, ymid); surface->LineTo(rc.right, ymid); diff --git a/src/stc/scintilla/src/KeyMap.cxx b/src/stc/scintilla/src/KeyMap.cxx index 0dd4ec0880..3a6a31f974 100644 --- a/src/stc/scintilla/src/KeyMap.cxx +++ b/src/stc/scintilla/src/KeyMap.cxx @@ -107,6 +107,7 @@ KeyToCommand KeyMap::MapDefault[] = { {VK_RETURN, SCI_NORM, SCI_NEWLINE}, {VK_ADD, SCI_CTRL, SCI_ZOOMIN}, {VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT}, + {VK_DIVIDE, SCI_CTRL, SCI_SETZOOM}, //'L', SCI_CTRL, SCI_FORMFEED, {'L', SCI_CTRL, SCI_LINECUT}, {'L', SCI_CSHIFT, SCI_LINEDELETE}, diff --git a/src/stc/scintilla/src/LexCPP.cxx b/src/stc/scintilla/src/LexCPP.cxx index ea62091df6..4f042bd61d 100644 --- a/src/stc/scintilla/src/LexCPP.cxx +++ b/src/stc/scintilla/src/LexCPP.cxx @@ -179,10 +179,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo state = SCE_C_DEFAULT; } } else if (state == SCE_C_STRING) { - if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { - styler.ColourTo(i-1, SCE_C_STRINGEOL); - state = SCE_C_STRINGEOL; - } else if (ch == '\\') { + if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; ch = chNext; @@ -194,7 +191,10 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo i++; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); - } + } else if (chNext == '\r' || chNext == '\n') { + styler.ColourTo(i-1, SCE_C_STRINGEOL); + state = SCE_C_STRINGEOL; + } } else if (state == SCE_C_CHARACTER) { if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { styler.ColourTo(i-1, SCE_C_STRINGEOL); diff --git a/src/stc/scintilla/src/LexOthers.cxx b/src/stc/scintilla/src/LexOthers.cxx index 30589d6f3b..90f41e3bf3 100644 --- a/src/stc/scintilla/src/LexOthers.cxx +++ b/src/stc/scintilla/src/LexOthers.cxx @@ -193,7 +193,112 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi ColouriseErrorListLine(lineBuffer, linePos, startPos + length, styler); } +static int isSpecial(char s) { + + return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') || + (s == '\"') || (s == '`') || (s == '^') || (s == '~'); +} + +static int isTag(int start, Accessor &styler) { + + char s[6]; + unsigned int i = 0, e=1; + while (i < 5 && e) { + s[i] = styler[start + i]; + i++; + e = styler[start + i] != '{'; + } + s[i] = '\0'; + return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0); +} + +static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { + + styler.StartAt(startPos); + + int state = initStyle; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + int lengthDoc = startPos + length; + + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + i++; + continue; + } + switch(state) { + case SCE_L_DEFAULT : + switch(ch) { + case '\\' : + styler.ColourTo(i - 1, state); + if (isSpecial(styler[i + 1])) { + styler.ColourTo(i + 1, SCE_L_COMMAND); + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + else { + if (isTag(i+1, styler)) + state = SCE_L_TAG; + else + state = SCE_L_COMMAND; + } + break; + case '$' : + styler.ColourTo(i - 1, state); + state = SCE_L_MATH; + if (chNext == '$') { + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case '%' : + styler.ColourTo(i - 1, state); + state = SCE_L_COMMENT; + break; + } + break; + case SCE_L_COMMAND : + if (chNext == '[' || chNext == '{' || chNext == '}' || + chNext == ' ' || chNext == '\r' || chNext == '\n') { + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case SCE_L_TAG : + if (ch == '}') { + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + } + break; + case SCE_L_MATH : + if (ch == '$') { + if (chNext == '$') { + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + } + break; + case SCE_L_COMMENT : + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_L_DEFAULT; + } + } + } + styler.ColourTo(lengthDoc, state); +} + LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc); LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc); LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc); LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc); +LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc); diff --git a/src/stc/scintilla/src/LexPerl.cxx b/src/stc/scintilla/src/LexPerl.cxx index 2ed36e1928..3c9972e2d6 100644 --- a/src/stc/scintilla/src/LexPerl.cxx +++ b/src/stc/scintilla/src/LexPerl.cxx @@ -292,11 +292,13 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, } else { quotes++; } - - if (quotes > 1 && isMatch(styler, lengthDoc, i, sooked)) { + if (quotes > 1 && isMatch(styler, lengthDoc, i, sooked) && (chPrev == '\n' || chPrev == '\r') ) { styler.ColourTo(i + sookedpos - 1, SCE_PL_HERE); - state = SCE_PL_DEFAULT; i += sookedpos; + chNext = styler.SafeGetCharAt(i); + if (chNext == '\n' || chNext == '\r') { + state = SCE_PL_DEFAULT; + } chNext = ' '; } } else if (state == SCE_PL_STRING) { diff --git a/src/stc/scintilla/src/LexPython.cxx b/src/stc/scintilla/src/LexPython.cxx index f309036a73..df8b7085bf 100644 --- a/src/stc/scintilla/src/LexPython.cxx +++ b/src/stc/scintilla/src/LexPython.cxx @@ -52,6 +52,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, if (lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); + if (startPos == 0) + initStyle = SCE_P_DEFAULT; + else + initStyle = styler.StyleAt(startPos-1); } } diff --git a/src/stc/scintilla/src/ScintillaBase.cxx b/src/stc/scintilla/src/ScintillaBase.cxx index 972e4fbff0..87b84f7064 100644 --- a/src/stc/scintilla/src/ScintillaBase.cxx +++ b/src/stc/scintilla/src/ScintillaBase.cxx @@ -390,6 +390,7 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_COLOURISE: Colourise(wParam, lParam); + Redraw(); break; case SCI_SETPROPERTY: diff --git a/src/stc/scintilla/src/Style.cxx b/src/stc/scintilla/src/Style.cxx index 36d4b98502..7aa44c0eb9 100644 --- a/src/stc/scintilla/src/Style.cxx +++ b/src/stc/scintilla/src/Style.cxx @@ -7,25 +7,28 @@ #include "Platform.h" +#include "Scintilla.h" #include "Style.h" Style::Style() { aliasOfDefaultFont = true; Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), - Platform::DefaultFontSize(), 0, - false, false, false); + Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT, + false, false, false, false); } Style::Style(const Style &source) { Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), - 0, 0, - false, false, false); + 0, 0, 0, + false, false, false, false); fore.desired = source.fore.desired; back.desired = source.back.desired; + characterSet = source.characterSet; bold = source.bold; italic = source.italic; size = source.size; eolFilled = source.eolFilled; + underline = source.underline; } Style::~Style() { @@ -40,26 +43,31 @@ Style &Style::operator=(const Style &source) { if (this == &source) return *this; Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), - 0, 0, - false, false, false); + 0, 0, SC_CHARSET_DEFAULT, + false, false, false, false); fore.desired = source.fore.desired; back.desired = source.back.desired; + characterSet = source.characterSet; bold = source.bold; italic = source.italic; size = source.size; eolFilled = source.eolFilled; + underline = source.underline; return *this; } -void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_, - bool bold_, bool italic_, bool eolFilled_) { +void Style::Clear(Colour fore_, Colour back_, int size_, + const char *fontName_, int characterSet_, + bool bold_, bool italic_, bool eolFilled_, bool underline_) { fore.desired = fore_; back.desired = back_; + characterSet = characterSet_; bold = bold_; italic = italic_; size = size_; fontName = fontName_; eolFilled = eolFilled_; + underline = underline_; if (aliasOfDefaultFont) font.SetID(0); else @@ -70,7 +78,8 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_, bool Style::EquivalentFontTo(const Style *other) const { if (bold != other->bold || italic != other->italic || - size != other->size) + size != other->size || + characterSet != other->characterSet) return false; if (fontName == other->fontName) return true; @@ -96,7 +105,7 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) { if (aliasOfDefaultFont) { font.SetID(defaultStyle->font.GetID()); } else if (fontName) { - font.Create(fontName, deviceHeight, bold, italic); + font.Create(fontName, characterSet, deviceHeight, bold, italic); } else { font.SetID(0); } diff --git a/src/stc/scintilla/src/Style.h b/src/stc/scintilla/src/Style.h index 95e006135b..dc643d08d2 100644 --- a/src/stc/scintilla/src/Style.h +++ b/src/stc/scintilla/src/Style.h @@ -15,7 +15,9 @@ public: bool italic; int size; const char *fontName; + int characterSet; bool eolFilled; + bool underline; Font font; unsigned int lineHeight; @@ -31,8 +33,8 @@ public: Style &operator=(const Style &source); void Clear(Colour fore_, Colour back_, int size_, - const char *fontName_, - bool bold_, bool italic_, bool eolFilled_); + const char *fontName_, int characterSet_, + bool bold_, bool italic_, bool eolFilled_, bool underline_); bool EquivalentFontTo(const Style *other) const; void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0); }; diff --git a/src/stc/scintilla/src/ViewStyle.cxx b/src/stc/scintilla/src/ViewStyle.cxx index 2188fd03f7..580ecc71ff 100644 --- a/src/stc/scintilla/src/ViewStyle.cxx +++ b/src/stc/scintilla/src/ViewStyle.cxx @@ -201,8 +201,9 @@ void ViewStyle::Refresh(Surface &surface) { void ViewStyle::ResetDefaultStyle() { styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), - Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), - false, false, false); + Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), + SC_CHARSET_DEFAULT, + false, false, false, false); } void ViewStyle::ClearStyles() { @@ -214,9 +215,11 @@ void ViewStyle::ClearStyles() { styles[STYLE_DEFAULT].back.desired, styles[STYLE_DEFAULT].size, styles[STYLE_DEFAULT].fontName, + styles[STYLE_DEFAULT].characterSet, styles[STYLE_DEFAULT].bold, styles[STYLE_DEFAULT].italic, - styles[STYLE_DEFAULT].eolFilled); + styles[STYLE_DEFAULT].eolFilled, + styles[STYLE_DEFAULT].underline); } } styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 3ec0fb0b52..2ef9c3079b 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -727,6 +727,7 @@ void wxStyledTextCtrl::StyleResetDefault() { // face:[facename] sets the font face name to use // size:[num] sets the font size in points // eol turns on eol filling +// underline turns on underlining // void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { @@ -744,6 +745,9 @@ void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { else if (option == "italic") StyleSetItalic(styleNum, true); + else if (option == "underline") + StyleSetUnderline(styleNum, true); + else if (option == "eol") StyleSetEOLFilled(styleNum, true); @@ -780,18 +784,21 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) { wxString faceName = font.GetFaceName(); bool bold = font.GetWeight() == wxBOLD; bool italic = font.GetStyle() != wxNORMAL; + bool under = font.GetUnderlined(); - StyleSetFontAttr(styleNum, size, faceName, bold, italic); + StyleSetFontAttr(styleNum, size, faceName, bold, italic, under); } void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size, const wxString& faceName, - bool bold, bool italic) { + bool bold, bool italic, + bool underline) { StyleSetSize(styleNum, size); StyleSetFaceName(styleNum, faceName); StyleSetBold(styleNum, bold); StyleSetItalic(styleNum, italic); + StyleSetUnderline(styleNum, underline); } @@ -820,6 +827,11 @@ void wxStyledTextCtrl::StyleSetEOLFilled(int styleNum, bool fillEOL) { } +void wxStyledTextCtrl::StyleSetUnderline(int styleNum, bool underline) { + SendMsg(SCI_STYLESETUNDERLINE, styleNum, underline); +} + + //---------------------------------------------------------------------- // Margins in the edit area @@ -910,7 +922,7 @@ void wxStyledTextCtrl::SetSelectionBackground(const wxColour& colour) { void wxStyledTextCtrl::SetCaretForeground(const wxColour& colour) { - SendMsg(SCI_SETCARETFORE, 0, wxColourAsLong(colour)); + SendMsg(SCI_SETCARETFORE, wxColourAsLong(colour)); } @@ -1305,6 +1317,28 @@ void wxStyledTextCtrl::SetFoldFlags(int flags) { } +//---------------------------------------------------------------------- +// Zooming + +void wxStyledTextCtrl::ZoomIn() { + SendMsg(SCI_ZOOMIN); +} + + +void wxStyledTextCtrl::ZoomOut() { + SendMsg(SCI_ZOOMOUT); +} + + +void wxStyledTextCtrl::SetZoom(int zoom) { + SendMsg(SCI_SETZOOM, zoom); +} + + +int wxStyledTextCtrl::GetZoom() { + return SendMsg(SCI_GETZOOM); +} + //---------------------------------------------------------------------- // Long Lines diff --git a/wxPython/contrib/stc/stc_.cpp b/wxPython/contrib/stc/stc_.cpp index af87992710..b4f03361e4 100644 --- a/wxPython/contrib/stc/stc_.cpp +++ b/wxPython/contrib/stc/stc_.cpp @@ -2950,23 +2950,25 @@ static PyObject *_wrap_wxStyledTextCtrl_StyleSetFont(PyObject *self, PyObject *a return _resultobj; } -#define wxStyledTextCtrl_StyleSetFontAttr(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4) (_swigobj->StyleSetFontAttr(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4)) +#define wxStyledTextCtrl_StyleSetFontAttr(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->StyleSetFontAttr(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) static PyObject *_wrap_wxStyledTextCtrl_StyleSetFontAttr(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxStyledTextCtrl * _arg0; int _arg1; int _arg2; wxString * _arg3; - bool _arg4; - bool _arg5; + bool _arg4 = (bool ) FALSE; + bool _arg5 = (bool ) FALSE; + bool _arg6 = (bool ) FALSE; PyObject * _argo0 = 0; PyObject * _obj3 = 0; - int tempbool4; - int tempbool5; - char *_kwnames[] = { "self","styleNum","size","faceName","bold","italic", NULL }; + int tempbool4 = (int) FALSE; + int tempbool5 = (int) FALSE; + int tempbool6 = (int) FALSE; + char *_kwnames[] = { "self","styleNum","size","faceName","bold","italic","underline", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiOii:wxStyledTextCtrl_StyleSetFontAttr",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&tempbool4,&tempbool5)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiO|iii:wxStyledTextCtrl_StyleSetFontAttr",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&tempbool4,&tempbool5,&tempbool6)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2984,9 +2986,10 @@ static PyObject *_wrap_wxStyledTextCtrl_StyleSetFontAttr(PyObject *self, PyObjec } _arg4 = (bool ) tempbool4; _arg5 = (bool ) tempbool5; + _arg6 = (bool ) tempbool6; { wxPy_BEGIN_ALLOW_THREADS; - wxStyledTextCtrl_StyleSetFontAttr(_arg0,_arg1,_arg2,*_arg3,_arg4,_arg5); + wxStyledTextCtrl_StyleSetFontAttr(_arg0,_arg1,_arg2,*_arg3,_arg4,_arg5,_arg6); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -3161,6 +3164,37 @@ static PyObject *_wrap_wxStyledTextCtrl_StyleSetEOLFilled(PyObject *self, PyObje return _resultobj; } +#define wxStyledTextCtrl_StyleSetUnderline(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetUnderline(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetUnderline(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + bool _arg2; + PyObject * _argo0 = 0; + int tempbool2; + char *_kwnames[] = { "self","styleNum","underline", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_StyleSetUnderline",_kwnames,&_argo0,&_arg1,&tempbool2)) + 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_StyleSetUnderline. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetUnderline(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + #define wxStyledTextCtrl_GetLeftMargin(_swigobj) (_swigobj->GetLeftMargin()) static PyObject *_wrap_wxStyledTextCtrl_GetLeftMargin(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -5576,6 +5610,115 @@ static PyObject *_wrap_wxStyledTextCtrl_SetFoldFlags(PyObject *self, PyObject *a return _resultobj; } +#define wxStyledTextCtrl_ZoomIn(_swigobj) (_swigobj->ZoomIn()) +static PyObject *_wrap_wxStyledTextCtrl_ZoomIn(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_ZoomIn",_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_ZoomIn. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ZoomIn(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_ZoomOut(_swigobj) (_swigobj->ZoomOut()) +static PyObject *_wrap_wxStyledTextCtrl_ZoomOut(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_ZoomOut",_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_ZoomOut. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ZoomOut(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetZoom(_swigobj,_swigarg0) (_swigobj->SetZoom(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetZoom(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","zoom", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetZoom",_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_SetZoom. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetZoom(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetZoom(_swigobj) (_swigobj->GetZoom()) +static PyObject *_wrap_wxStyledTextCtrl_GetZoom(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetZoom",_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_GetZoom. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetZoom(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxStyledTextCtrl_GetEdgeColumn(_swigobj) (_swigobj->GetEdgeColumn()) static PyObject *_wrap_wxStyledTextCtrl_GetEdgeColumn(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -6936,6 +7079,10 @@ static PyMethodDef stc_cMethods[] = { { "wxStyledTextCtrl_GetEdgeMode", (PyCFunction) _wrap_wxStyledTextCtrl_GetEdgeMode, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_SetEdgeColumn", (PyCFunction) _wrap_wxStyledTextCtrl_SetEdgeColumn, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_GetEdgeColumn", (PyCFunction) _wrap_wxStyledTextCtrl_GetEdgeColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetZoom", (PyCFunction) _wrap_wxStyledTextCtrl_GetZoom, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetZoom", (PyCFunction) _wrap_wxStyledTextCtrl_SetZoom, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ZoomOut", (PyCFunction) _wrap_wxStyledTextCtrl_ZoomOut, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ZoomIn", (PyCFunction) _wrap_wxStyledTextCtrl_ZoomIn, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_SetFoldFlags", (PyCFunction) _wrap_wxStyledTextCtrl_SetFoldFlags, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_EnsureVisible", (PyCFunction) _wrap_wxStyledTextCtrl_EnsureVisible, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_ToggleFold", (PyCFunction) _wrap_wxStyledTextCtrl_ToggleFold, METH_VARARGS | METH_KEYWORDS }, @@ -7015,6 +7162,7 @@ static PyMethodDef stc_cMethods[] = { { "wxStyledTextCtrl_SetMargins", (PyCFunction) _wrap_wxStyledTextCtrl_SetMargins, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_GetRightMargin", (PyCFunction) _wrap_wxStyledTextCtrl_GetRightMargin, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_GetLeftMargin", (PyCFunction) _wrap_wxStyledTextCtrl_GetLeftMargin, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetUnderline", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetUnderline, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_StyleSetEOLFilled", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetEOLFilled, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_StyleSetSize", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetSize, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_StyleSetFaceName", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetFaceName, METH_VARARGS | METH_KEYWORDS }, @@ -7624,6 +7772,8 @@ SWIGEXPORT(void) initstc_c() { PyDict_SetItemString(d,"wxSTC_INDIC_PLAIN", PyInt_FromLong((long) 0)); PyDict_SetItemString(d,"wxSTC_INDIC_SQUIGGLE", PyInt_FromLong((long) 1)); PyDict_SetItemString(d,"wxSTC_INDIC_TT", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"wxSTC_INDIC_DIAGONAL", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"wxSTC_INDIC_STRIKE", PyInt_FromLong((long) 4)); PyDict_SetItemString(d,"wxSTC_INDIC0_MASK", PyInt_FromLong((long) 32)); PyDict_SetItemString(d,"wxSTC_INDIC1_MASK", PyInt_FromLong((long) 64)); PyDict_SetItemString(d,"wxSTC_INDIC2_MASK", PyInt_FromLong((long) 128)); diff --git a/wxPython/contrib/stc/stc_.py b/wxPython/contrib/stc/stc_.py index e905e33cbb..c99224881d 100644 --- a/wxPython/contrib/stc/stc_.py +++ b/wxPython/contrib/stc/stc_.py @@ -373,6 +373,9 @@ class wxStyledTextCtrlPtr(wxControlPtr): def StyleSetEOLFilled(self, *_args, **_kwargs): val = apply(stc_c.wxStyledTextCtrl_StyleSetEOLFilled,(self,) + _args, _kwargs) return val + def StyleSetUnderline(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetUnderline,(self,) + _args, _kwargs) + return val def GetLeftMargin(self, *_args, **_kwargs): val = apply(stc_c.wxStyledTextCtrl_GetLeftMargin,(self,) + _args, _kwargs) return val @@ -610,6 +613,18 @@ class wxStyledTextCtrlPtr(wxControlPtr): def SetFoldFlags(self, *_args, **_kwargs): val = apply(stc_c.wxStyledTextCtrl_SetFoldFlags,(self,) + _args, _kwargs) return val + def ZoomIn(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ZoomIn,(self,) + _args, _kwargs) + return val + def ZoomOut(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ZoomOut,(self,) + _args, _kwargs) + return val + def SetZoom(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetZoom,(self,) + _args, _kwargs) + return val + def GetZoom(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetZoom,(self,) + _args, _kwargs) + return val def GetEdgeColumn(self, *_args, **_kwargs): val = apply(stc_c.wxStyledTextCtrl_GetEdgeColumn,(self,) + _args, _kwargs) return val @@ -808,6 +823,8 @@ wxSTC_INDIC_MAX = stc_c.wxSTC_INDIC_MAX wxSTC_INDIC_PLAIN = stc_c.wxSTC_INDIC_PLAIN wxSTC_INDIC_SQUIGGLE = stc_c.wxSTC_INDIC_SQUIGGLE wxSTC_INDIC_TT = stc_c.wxSTC_INDIC_TT +wxSTC_INDIC_DIAGONAL = stc_c.wxSTC_INDIC_DIAGONAL +wxSTC_INDIC_STRIKE = stc_c.wxSTC_INDIC_STRIKE wxSTC_INDIC0_MASK = stc_c.wxSTC_INDIC0_MASK wxSTC_INDIC1_MASK = stc_c.wxSTC_INDIC1_MASK wxSTC_INDIC2_MASK = stc_c.wxSTC_INDIC2_MASK