├── .gitignore ├── README.md ├── foo_tfsandbox-1.png ├── foo_tfsandbox.sln ├── foo_tfsandbox ├── CustomScanner.cpp ├── CustomScanner.h ├── LibraryScope.cpp ├── LibraryScope.h ├── Parser.cpp ├── Parser.cpp.old ├── Parser.frame ├── Parser.h ├── Parser.h.old ├── Scanner.frame ├── Scanner.h ├── TitleformatSandboxDialog.cpp ├── TitleformatSandboxDialog.h ├── cross.ico ├── exclamation.ico ├── foo_tfsandbox.cpp ├── foo_tfsandbox.rc ├── foo_tfsandbox.vcxproj ├── foo_tfsandbox.vcxproj.filters ├── foo_tfsandbox_version.h ├── foo_tfsandbox_version.rc ├── mainmenu_commands_impl_single.h ├── mainmenu_tfsandbox.cpp ├── resource.h ├── stdafx.cpp ├── stdafx.h ├── string_from_resources.cpp ├── string_from_resources.h ├── symbols.bmp ├── symbols.pdn ├── symbols32.bmp ├── targetver.h ├── tick.ico ├── titleformat.atg ├── titleformat_analysis.cpp ├── titleformat_analysis.h ├── titleformat_debug.cpp ├── titleformat_debug.h ├── titleformat_node_filter.h ├── titleformat_syntax.cpp ├── titleformat_syntax.h └── titleformat_visitor_impl.h ├── lexlib ├── lexlib.vcxproj └── lexlib.vcxproj.filters ├── lextitleformat ├── include │ └── ILexerTitleformat.h ├── lextitleformat.sln ├── lextitleformat.vcxproj ├── lextitleformat.vcxproj.filters └── src │ ├── LexTitleformat.def │ ├── LexerModuleTitleformat.cpp │ ├── LexerTitleformat.cpp │ ├── LexerTitleformat.h │ ├── LexerTitleformatPrivateCall.cpp │ ├── LexerTitleformatPrivateCall.h │ ├── OptionSetTiteformat.h │ └── OptionSetTitleformat.cpp └── scintilla ├── .hg_archival.txt ├── .hgeol ├── .hgignore ├── .hgtags ├── License.txt ├── README ├── bin ├── __init__.py └── empty.txt ├── cocoa ├── InfoBar.h ├── InfoBar.mm ├── InfoBarCommunicator.h ├── PlatCocoa.h ├── PlatCocoa.mm ├── QuartzTextLayout.h ├── QuartzTextStyle.h ├── QuartzTextStyleAttribute.h ├── ScintillaCocoa.h ├── ScintillaCocoa.mm ├── ScintillaFramework │ ├── English.lproj │ │ └── InfoPlist.strings │ ├── Info.plist │ ├── ScintillaFramework.xcodeproj │ │ └── project.pbxproj │ └── Scintilla_Prefix.pch ├── ScintillaTest │ ├── AppController.h │ ├── AppController.mm │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ └── MainMenu.xib │ ├── Info.plist │ ├── Scintilla-Info.plist │ ├── ScintillaTest.xcodeproj │ │ └── project.pbxproj │ ├── ScintillaTest_Prefix.pch │ ├── TestData.sql │ └── main.m ├── ScintillaView.h ├── ScintillaView.mm ├── checkbuildosx.sh └── res │ ├── info_bar_bg.png │ ├── info_bar_bg@2x.png │ ├── mac_cursor_busy.png │ ├── mac_cursor_busy@2x.png │ ├── mac_cursor_flipped.png │ └── mac_cursor_flipped@2x.png ├── cppcheck.suppress ├── delbin.bat ├── delcvs.bat ├── doc ├── Design.html ├── Icons.html ├── Indicators.png ├── Lexer.txt ├── Markers.png ├── SciBreak.jpg ├── SciCoding.html ├── SciRest.jpg ├── SciTEIco.png ├── SciWord.jpg ├── ScintillaDoc.html ├── ScintillaDownload.html ├── ScintillaHistory.html ├── ScintillaRelated.html ├── ScintillaToDo.html ├── ScintillaUsage.html ├── Steps.html ├── annotations.png ├── index.html └── styledmargin.png ├── gtk ├── Converter.h ├── PlatGTK.cxx ├── ScintillaGTK.cxx ├── deps.mak ├── makefile ├── scintilla-marshal.c ├── scintilla-marshal.h └── scintilla-marshal.list ├── include ├── ILexer.h ├── Platform.h ├── SciLexer.h ├── Scintilla.h ├── Scintilla.iface ├── ScintillaWidget.h └── atlscilexer.h ├── lexers ├── LexA68k.cxx ├── LexAPDL.cxx ├── LexASY.cxx ├── LexAU3.cxx ├── LexAVE.cxx ├── LexAVS.cxx ├── LexAbaqus.cxx ├── LexAda.cxx ├── LexAsm.cxx ├── LexAsn1.cxx ├── LexBaan.cxx ├── LexBash.cxx ├── LexBasic.cxx ├── LexBullant.cxx ├── LexCLW.cxx ├── LexCOBOL.cxx ├── LexCPP.cxx ├── LexCSS.cxx ├── LexCaml.cxx ├── LexCmake.cxx ├── LexCoffeeScript.cxx ├── LexConf.cxx ├── LexCrontab.cxx ├── LexCsound.cxx ├── LexD.cxx ├── LexDMAP.cxx ├── LexDMIS.cxx ├── LexECL.cxx ├── LexEScript.cxx ├── LexEiffel.cxx ├── LexErlang.cxx ├── LexFlagship.cxx ├── LexForth.cxx ├── LexFortran.cxx ├── LexGAP.cxx ├── LexGui4Cli.cxx ├── LexHTML.cxx ├── LexHaskell.cxx ├── LexInno.cxx ├── LexKVIrc.cxx ├── LexKix.cxx ├── LexLaTeX.cxx ├── LexLisp.cxx ├── LexLout.cxx ├── LexLua.cxx ├── LexMMIXAL.cxx ├── LexMPT.cxx ├── LexMSSQL.cxx ├── LexMagik.cxx ├── LexMarkdown.cxx ├── LexMatlab.cxx ├── LexMetapost.cxx ├── LexModula.cxx ├── LexMySQL.cxx ├── LexNimrod.cxx ├── LexNsis.cxx ├── LexOScript.cxx ├── LexOpal.cxx ├── LexOthers.cxx ├── LexPB.cxx ├── LexPLM.cxx ├── LexPO.cxx ├── LexPOV.cxx ├── LexPS.cxx ├── LexPascal.cxx ├── LexPerl.cxx ├── LexPowerPro.cxx ├── LexPowerShell.cxx ├── LexProgress.cxx ├── LexPython.cxx ├── LexR.cxx ├── LexRebol.cxx ├── LexRuby.cxx ├── LexRust.cxx ├── LexSML.cxx ├── LexSQL.cxx ├── LexSTTXT.cxx ├── LexScriptol.cxx ├── LexSmalltalk.cxx ├── LexSorcus.cxx ├── LexSpecman.cxx ├── LexSpice.cxx ├── LexTACL.cxx ├── LexTADS3.cxx ├── LexTAL.cxx ├── LexTCL.cxx ├── LexTCMD.cxx ├── LexTeX.cxx ├── LexTxt2tags.cxx ├── LexVB.cxx ├── LexVHDL.cxx ├── LexVerilog.cxx ├── LexVisualProlog.cxx └── LexYAML.cxx ├── lexlib ├── Accessor.cxx ├── Accessor.h ├── CharacterCategory.cxx ├── CharacterCategory.h ├── CharacterSet.cxx ├── CharacterSet.h ├── LexAccessor.h ├── LexerBase.cxx ├── LexerBase.h ├── LexerModule.cxx ├── LexerModule.h ├── LexerNoExceptions.cxx ├── LexerNoExceptions.h ├── LexerSimple.cxx ├── LexerSimple.h ├── OptionSet.h ├── PropSetSimple.cxx ├── PropSetSimple.h ├── SparseState.h ├── StringCopy.h ├── StyleContext.cxx ├── StyleContext.h ├── SubStyles.h ├── WordList.cxx └── WordList.h ├── qt ├── README ├── ScintillaEdit │ ├── ScintillaDocument.cpp │ ├── ScintillaDocument.h │ ├── ScintillaEdit.cpp.template │ ├── ScintillaEdit.h.template │ ├── ScintillaEdit.pro │ └── WidgetGen.py ├── ScintillaEditBase │ ├── Notes.txt │ ├── PlatQt.cpp │ ├── PlatQt.h │ ├── ScintillaEditBase.cpp │ ├── ScintillaEditBase.h │ ├── ScintillaEditBase.pro │ ├── ScintillaQt.cpp │ └── ScintillaQt.h └── ScintillaEditPy │ ├── README │ ├── ScintillaConstants.py.template │ ├── ScintillaEditPy.pro │ ├── global.h │ ├── sepbuild.py │ ├── testsepq.py │ └── typesystem_ScintillaEdit.xml.template ├── scripts ├── Face.py ├── FileGenerator.py ├── GenerateCaseConvert.py ├── GenerateCharacterCategory.py ├── HFacer.py ├── HFacerWTL.py ├── HeaderOrder.txt ├── LexGen.py └── ScintillaData.py ├── src ├── AutoComplete.cxx ├── AutoComplete.h ├── CallTip.cxx ├── CallTip.h ├── CaseConvert.cxx ├── CaseConvert.h ├── CaseFolder.cxx ├── CaseFolder.h ├── Catalogue.cxx ├── Catalogue.h ├── CellBuffer.cxx ├── CellBuffer.h ├── CharClassify.cxx ├── CharClassify.h ├── ContractionState.cxx ├── ContractionState.h ├── Decoration.cxx ├── Decoration.h ├── Document.cxx ├── Document.h ├── Editor.cxx ├── Editor.h ├── ExternalLexer.cxx ├── ExternalLexer.h ├── FontQuality.h ├── Indicator.cxx ├── Indicator.h ├── KeyMap.cxx ├── KeyMap.h ├── LineMarker.cxx ├── LineMarker.h ├── Partitioning.h ├── PerLine.cxx ├── PerLine.h ├── PositionCache.cxx ├── PositionCache.h ├── RESearch.cxx ├── RESearch.h ├── RunStyles.cxx ├── RunStyles.h ├── SciTE.properties ├── ScintillaBase.cxx ├── ScintillaBase.h ├── Selection.cxx ├── Selection.h ├── SplitVector.h ├── Style.cxx ├── Style.h ├── UniConversion.cxx ├── UniConversion.h ├── UnicodeFromUTF8.h ├── ViewStyle.cxx ├── ViewStyle.h ├── XPM.cxx └── XPM.h ├── test ├── MessageNumbers.py ├── README ├── ScintillaCallable.py ├── XiteMenu.py ├── XiteQt.py ├── XiteWin.py ├── examples │ ├── x.asp │ ├── x.asp.styled │ ├── x.cxx │ ├── x.cxx.styled │ ├── x.d.styled │ ├── x.html │ ├── x.html.styled │ ├── x.lua │ ├── x.lua.styled │ ├── x.php │ ├── x.php.styled │ ├── x.pl │ ├── x.pl.styled │ ├── x.py │ ├── x.py.styled │ ├── x.rb │ ├── x.rb.styled │ ├── x.vb │ └── x.vb.styled ├── lexTests.py ├── performanceTests.py ├── simpleTests.py ├── unit │ ├── LICENSE_1_0.txt │ ├── README │ ├── SciTE.properties │ ├── catch.hpp │ ├── makefile │ ├── test.mak │ ├── testCellBuffer.cxx │ ├── testCharClassify.cxx │ ├── testContractionState.cxx │ ├── testDecoration.cxx │ ├── testPartitioning.cxx │ ├── testRunStyles.cxx │ ├── testSparseState.cxx │ ├── testSplitVector.cxx │ └── unitTest.cxx └── xite.py ├── tgzsrc ├── version.txt ├── win32 ├── CheckD2D.cxx ├── PlatWin.cxx ├── PlatWin.h ├── SciLexer.vcxproj ├── SciTE.properties ├── ScintRes.rc ├── Scintilla.def ├── ScintillaWin.cxx ├── deps.mak ├── makefile └── scintilla.mak └── zipsrc.bat /.gitignore: -------------------------------------------------------------------------------- 1 | *.aps 2 | *.vcxproj.user 3 | *.suo 4 | *.opensdf 5 | *.sdf 6 | /ipch 7 | /Debug 8 | /Release 9 | /lexlib/Debug 10 | /lexlib/Release 11 | /lextitleformat/Debug 12 | /lextitleformat/Release 13 | /foo_tfsandbox/Debug 14 | /foo_tfsandbox/Release 15 | /scintilla/win32/Debug 16 | /scintilla/win32/Release 17 | *.pyc 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Title Formatting Sandbox 2 | ======================== 3 | 4 | Plugin for foobar2000 which provides an editor for title formatting scripts with syntax highlighting, a code structure view and preview for the selected script fragment. 5 | 6 | ![Screenshot of Title Formatting Sandbox window](foo_tfsandbox-1.png) 7 | 8 | Links 9 | ----- 10 | 11 | * [foobar2000 home page](http://www.foobar2000.org/) 12 | * [Title Formatting Sandbox](http://www.hydrogenaud.io/forums/index.php?showtopic=108601) on the foobar2000 forum 13 | * [Fugue Icons by Yusuke Kamiyamane](http://p.yusukekamiyamane.com/) 14 | * [Scintilla editor component by Neil Hodgson](http://www.scintillia.org/) 15 | -------------------------------------------------------------------------------- /foo_tfsandbox-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/foo_tfsandbox-1.png -------------------------------------------------------------------------------- /foo_tfsandbox/LibraryScope.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "LibraryScope.h" 3 | 4 | CLibraryScope::CLibraryScope() : m_hDll(NULL) 5 | { 6 | } 7 | 8 | CLibraryScope::CLibraryScope(LPCTSTR pszName) : m_hDll(NULL) 9 | { 10 | LoadLibrary(pszName); 11 | } 12 | 13 | bool CLibraryScope::LoadLibrary(LPCTSTR pszName) 14 | { 15 | ATLASSERT(m_hDll == NULL); 16 | 17 | m_hDll = ::LoadLibrary(pszName); 18 | 19 | return m_hDll != NULL; 20 | } 21 | 22 | CLibraryScope::~CLibraryScope() 23 | { 24 | if (m_hDll != NULL) 25 | { 26 | ::FreeLibrary(m_hDll); 27 | m_hDll = NULL; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /foo_tfsandbox/LibraryScope.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CLibraryScope 4 | { 5 | public: 6 | CLibraryScope(); 7 | explicit CLibraryScope(LPCTSTR pszName); 8 | ~CLibraryScope(); 9 | 10 | bool LoadLibrary(LPCTSTR pszName); 11 | 12 | bool IsLoaded() const {return m_hDll != NULL;} 13 | 14 | private: 15 | HMODULE m_hDll; 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /foo_tfsandbox/Parser.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #if !defined(COCO_PARSER_H__) 4 | #define COCO_PARSER_H__ 5 | 6 | #include "titleformat_syntax.h" 7 | 8 | 9 | #include "Scanner.h" 10 | 11 | 12 | 13 | class ErrorOutput { 14 | public: 15 | virtual void Print(int line, int col, const wchar_t *s) {} 16 | virtual void Print(const wchar_t *s) {} 17 | }; 18 | 19 | class Errors { 20 | public: 21 | int count; // number of errors detected 22 | ErrorOutput *output; 23 | 24 | Errors(ErrorOutput *output = 0); 25 | void SynErr(int line, int col, int n); 26 | void Error(int line, int col, const wchar_t *s); 27 | void Warning(int line, int col, const wchar_t *s); 28 | void Warning(const wchar_t *s); 29 | void Exception(const wchar_t *s); 30 | 31 | void Print(int line, int col, const wchar_t *s); 32 | void Print(const wchar_t *s); 33 | }; // Errors 34 | 35 | class Parser { 36 | private: 37 | enum { 38 | _EOF=0, 39 | _literal=1, 40 | _string=2, 41 | _field=3, 42 | _func=4, 43 | _selfquot=5, 44 | _badstring=11, 45 | _badfield=12, 46 | _badfunc=13, 47 | _comment=14, 48 | }; 49 | int maxT; 50 | 51 | Token *dummyToken; 52 | int errDist; 53 | int minErrDist; 54 | 55 | void SynErr(int n); 56 | void Get(); 57 | void Expect(int n); 58 | bool StartOf(int s); 59 | void ExpectWeak(int n, int follow); 60 | bool WeakSeparator(int n, int syFol, int repFol); 61 | 62 | public: 63 | Scanner *scanner; 64 | Errors *errors; 65 | 66 | Token *t; // last recognized token 67 | Token *la; // lookahead token 68 | 69 | ast::block_expression *root; 70 | 71 | /* 72 | CHARACTERS 73 | funcchar = ANY - '\r' - '\n' - '('. 74 | funcchar1 = funcchar - '$'. 75 | stringchar = ANY - '\''. 76 | fieldchar = ANY - '%'. 77 | literalchar = ANY - '\r' - '\n' - '(' - ')' - ',' - '$' - '\'' - '%' - '[' - ']'. 78 | 79 | TOKENS 80 | literal = literalchar {literalchar}. 81 | string = '\'' stringchar {stringchar} '\''. 82 | field = '%' fieldchar {fieldchar} '%'. 83 | func = '$' funcchar1 {funcchar}. 84 | selfquot = "$$" | "''" | "%%". 85 | "[" 86 | "]" 87 | "(" 88 | ")" 89 | "," 90 | 91 | COMMENTS FROM "//" TO "\n" 92 | 93 | IGNORE '\r' + '\n' 94 | */ 95 | 96 | 97 | 98 | Parser(Scanner *scanner, ErrorOutput *output = 0); 99 | ~Parser(); 100 | void SemErr(const wchar_t* msg); 101 | 102 | void Script(); 103 | void Block(ast::block_expression *&n); 104 | void Expression(ast::expression *&n); 105 | void Error(); 106 | void Comment(ast::expression *&n); 107 | void String(ast::string_constant *&n); 108 | void Field(ast::field_reference *&n); 109 | void Condition(ast::condition_expression *&n); 110 | void Call(ast::call_expression *&n); 111 | 112 | void Parse(); 113 | 114 | }; // end Parser 115 | 116 | 117 | 118 | #endif // !defined(COCO_PARSER_H__) 119 | 120 | -------------------------------------------------------------------------------- /foo_tfsandbox/Parser.h.old: -------------------------------------------------------------------------------- 1 | 2 | 3 | #if !defined(COCO_PARSER_H__) 4 | #define COCO_PARSER_H__ 5 | 6 | #include "titleformat_syntax.h" 7 | 8 | 9 | #include "Scanner.h" 10 | 11 | 12 | 13 | class ErrorOutput { 14 | public: 15 | virtual void Print(int line, int col, const wchar_t *s) {} 16 | virtual void Print(const wchar_t *s) {} 17 | }; 18 | 19 | class Errors { 20 | public: 21 | int count; // number of errors detected 22 | ErrorOutput *output; 23 | 24 | Errors(ErrorOutput *output = 0); 25 | void SynErr(int line, int col, int n); 26 | void Error(int line, int col, const wchar_t *s); 27 | void Warning(int line, int col, const wchar_t *s); 28 | void Warning(const wchar_t *s); 29 | void Exception(const wchar_t *s); 30 | 31 | void Print(int line, int col, const wchar_t *s); 32 | void Print(const wchar_t *s); 33 | }; // Errors 34 | 35 | class Parser { 36 | private: 37 | enum { 38 | _EOF=0, 39 | _literal=1, 40 | _string=2, 41 | _field=3, 42 | _func=4, 43 | _selfquot=5, 44 | _badstring=11, 45 | _badfield=12, 46 | _badfunc=13, 47 | _comment=14, 48 | }; 49 | int maxT; 50 | 51 | Token *dummyToken; 52 | int errDist; 53 | int minErrDist; 54 | 55 | void SynErr(int n); 56 | void Get(); 57 | void Expect(int n); 58 | bool StartOf(int s); 59 | void ExpectWeak(int n, int follow); 60 | bool WeakSeparator(int n, int syFol, int repFol); 61 | 62 | public: 63 | Scanner *scanner; 64 | Errors *errors; 65 | 66 | Token *t; // last recognized token 67 | Token *la; // lookahead token 68 | 69 | ast::block_expression *root; 70 | 71 | /* 72 | CHARACTERS 73 | funcchar = ANY - '\r' - '\n' - '('. 74 | funcchar1 = funcchar - '$'. 75 | stringchar = ANY - '\''. 76 | fieldchar = ANY - '%'. 77 | literalchar = ANY - '\r' - '\n' - '(' - ')' - ',' - '$' - '\'' - '%' - '[' - ']'. 78 | 79 | TOKENS 80 | literal = literalchar {literalchar}. 81 | string = '\'' stringchar {stringchar} '\''. 82 | field = '%' fieldchar {fieldchar} '%'. 83 | func = '$' funcchar1 {funcchar}. 84 | selfquot = "$$" | "''" | "%%". 85 | "[" 86 | "]" 87 | "(" 88 | ")" 89 | "," 90 | 91 | COMMENTS FROM "//" TO "\n" 92 | 93 | IGNORE '\r' + '\n' 94 | */ 95 | 96 | 97 | 98 | Parser(Scanner *scanner, ErrorOutput *output = 0); 99 | ~Parser(); 100 | void SemErr(const wchar_t* msg); 101 | 102 | void Script(); 103 | void Block(ast::block_expression *&n); 104 | void Expression(ast::expression *&n); 105 | void Error(); 106 | void Comment(ast::expression *&n); 107 | void String(ast::string_constant *&n); 108 | void Field(ast::field_reference *&n); 109 | void Condition(ast::condition_expression *&n); 110 | void Call(ast::call_expression *&n); 111 | 112 | void Parse(); 113 | 114 | }; // end Parser 115 | 116 | 117 | 118 | #endif // !defined(COCO_PARSER_H__) 119 | 120 | -------------------------------------------------------------------------------- /foo_tfsandbox/Scanner.h: -------------------------------------------------------------------------------- 1 | #include "CustomScanner.h" 2 | -------------------------------------------------------------------------------- /foo_tfsandbox/cross.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/foo_tfsandbox/cross.ico -------------------------------------------------------------------------------- /foo_tfsandbox/exclamation.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/foo_tfsandbox/exclamation.ico -------------------------------------------------------------------------------- /foo_tfsandbox/foo_tfsandbox.cpp: -------------------------------------------------------------------------------- 1 | // foo_tfsandbox.cpp : Defines the exported functions for the DLL application. 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "foo_tfsandbox_version.h" 6 | 7 | DECLARE_COMPONENT_VERSION( 8 | COMPONENT_NAME, 9 | COMPONENT_VERSION, 10 | "Title formatting editor with syntax coloring, code structure view and preview.\n" 11 | "\n" 12 | "Copyright (C) " COMPONENT_COPYRIGHT_YEAR " Holger Stenger\n" 13 | "- https://github.com/stengerh/foo_tfsandbox\n" 14 | "\n" 15 | "Scintilla source code editing component\n" 16 | "Copyright 1998-2003 by Neil Hodgson \n" 17 | "- http://www.scintilla.org/\n" 18 | "\n" 19 | "Some icons by Yusuke Kamiyamane. Licensed under a Creative Commons Attribution 3.0 License.\n" 20 | "- http://p.yusukekamiyamane.com/\n" 21 | "- http://creativecommons.org/licenses/by/3.0/\n" 22 | ); 23 | -------------------------------------------------------------------------------- /foo_tfsandbox/foo_tfsandbox_version.h: -------------------------------------------------------------------------------- 1 | #define COMPONENT_NAME "Title Formatting Sandbox" 2 | #define COMPONENT_VERSION_MAJOR 1 3 | #define COMPONENT_VERSION_MINOR 0 4 | #define COMPONENT_VERSION_PATCH 3 5 | #define COMPONENT_COPYRIGHT_YEAR "2016" 6 | 7 | #define MAKE_STRING(text) #text 8 | #define MAKE_COMPONENT_VERSION(major,minor,patch) MAKE_STRING(major) "." MAKE_STRING(minor) "." MAKE_STRING(patch) 9 | 10 | #define COMPONENT_VERSION MAKE_COMPONENT_VERSION(COMPONENT_VERSION_MAJOR,COMPONENT_VERSION_MINOR,COMPONENT_VERSION_PATCH) 11 | #define COMPONENT_VERSION_NUMERIC COMPONENT_VERSION_MAJOR, COMPONENT_VERSION_MINOR, COMPONENT_VERSION_PATCH, 0 12 | -------------------------------------------------------------------------------- /foo_tfsandbox/foo_tfsandbox_version.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/foo_tfsandbox/foo_tfsandbox_version.rc -------------------------------------------------------------------------------- /foo_tfsandbox/mainmenu_commands_impl_single.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class mainmenu_commands_impl_single : public mainmenu_commands 4 | { 5 | //! Retrieves number of implemented commands. Index parameter of other methods must be in 0....command_count-1 range. 6 | virtual t_uint32 get_command_count() {return 1;} 7 | //! Retrieves GUID of specified command. 8 | virtual GUID get_command(t_uint32 p_index) 9 | { 10 | pfc::dynamic_assert(p_index == 0, "Command index out-of-range"); 11 | return get_command(); 12 | } 13 | //! Retrieves name of item, for list of commands to assign keyboard shortcuts to etc. 14 | virtual void get_name(t_uint32 p_index,pfc::string_base & p_out) 15 | { 16 | pfc::dynamic_assert(p_index == 0, "Command index out-of-range"); 17 | get_name(p_out); 18 | } 19 | 20 | //! Retrieves item's description for statusbar etc. 21 | virtual bool get_description(t_uint32 p_index,pfc::string_base & p_out) 22 | { 23 | pfc::dynamic_assert(p_index == 0, "Command index out-of-range"); 24 | return get_description(p_out); 25 | } 26 | 27 | //! Retrieves display string and display flags to use when menu is about to be displayed. If returns false, menu item won't be displayed. You can create keyboard-shortcut-only commands by always returning false from get_display(). 28 | virtual bool get_display(t_uint32 p_index,pfc::string_base & p_text,t_uint32 & p_flags) 29 | { 30 | pfc::dynamic_assert(p_index == 0, "Command index out-of-range"); 31 | return get_display(p_text, p_flags); 32 | } 33 | //! Executes the command. p_callback parameter is reserved for future use and should be ignored / set to null pointer. 34 | virtual void execute(t_uint32 p_index,service_ptr_t p_callback) 35 | { 36 | pfc::dynamic_assert(p_index == 0, "Command index out-of-range"); 37 | execute(p_callback); 38 | } 39 | 40 | protected: 41 | virtual GUID get_command() = 0; 42 | virtual void get_name(pfc::string_base & p_out) = 0; 43 | virtual bool get_description(pfc::string_base & p_out) = 0; 44 | virtual GUID get_parent() = 0; 45 | virtual void execute(service_ptr_t p_callback) = 0; 46 | virtual bool get_display(pfc::string_base & p_text,t_uint32 & p_flags) {p_flags = 0;get_name(p_text);return true;} 47 | }; 48 | -------------------------------------------------------------------------------- /foo_tfsandbox/mainmenu_tfsandbox.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "TitleformatSandboxDialog.h" 3 | #include "string_from_resources.h" 4 | #include "mainmenu_commands_impl_single.h" 5 | 6 | class mainmenu_commands_tfsandbox : public mainmenu_commands_impl_single 7 | { 8 | public: 9 | virtual GUID get_command() 10 | { 11 | // {819CD6A9-A492-45cd-9BCA-DFE3A6CF2BD9} 12 | static const GUID guid = { 0x819cd6a9, 0xa492, 0x45cd, { 0x9b, 0xca, 0xdf, 0xe3, 0xa6, 0xcf, 0x2b, 0xd9 } }; 13 | return guid; 14 | } 15 | 16 | virtual void get_name(pfc::string_base & p_out) 17 | { 18 | p_out = string_from_resources(IDS_CMD_TFDBG_NAME); 19 | } 20 | 21 | virtual bool get_description(pfc::string_base & p_out) 22 | { 23 | p_out = string_from_resources(IDS_CMD_TFDBG_DESCRIPTION); 24 | return true; 25 | } 26 | 27 | virtual GUID get_parent() 28 | { 29 | return mainmenu_groups::view; 30 | } 31 | 32 | virtual void execute(service_ptr_t p_callback) 33 | { 34 | CTitleFormatSandboxDialog::ActivateDialog(); 35 | } 36 | }; 37 | 38 | static service_factory_single_t g_mainmenu_commands_tfsandbox_factory; 39 | -------------------------------------------------------------------------------- /foo_tfsandbox/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by foo_tfsandbox.rc 4 | // 5 | #define IDR_TFDBG 101 6 | #define IDS_CMD_TFDBG_NAME 106 7 | #define IDS_CMD_TFDBG_DESCRIPTION 107 8 | #define IDB_SYMBOLS 108 9 | #define IDB_SYMBOLS32 109 10 | #define IDI_FUGUE_CROSS 110 11 | #define IDI_FUGUE_EXCLAMATION 111 12 | #define IDI_FUGUE_TICK 112 13 | #define IDI_FUGUE_EXCLAMATION_SMALL 113 14 | #define IDC_SCRIPT 1001 15 | #define IDC_STRINGVALUE 1003 16 | #define IDC_BOOLVALUE 1004 17 | #define IDC_VALUE 1006 18 | #define IDC_TREE 1007 19 | #define ID_TEST_UPDATE 40003 20 | 21 | // Next default values for new objects 22 | // 23 | #ifdef APSTUDIO_INVOKED 24 | #ifndef APSTUDIO_READONLY_SYMBOLS 25 | #define _APS_NEXT_RESOURCE_VALUE 113 26 | #define _APS_NEXT_COMMAND_VALUE 40005 27 | #define _APS_NEXT_CONTROL_VALUE 1008 28 | #define _APS_NEXT_SYMED_VALUE 101 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /foo_tfsandbox/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // foo_tfsandbox.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | 10 | #pragma comment(linker,"\"/manifestdependency:type='win32' \ 11 | name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ 12 | processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 13 | 14 | #pragma comment(linker,"\"/manifestdependency:type='win32' \ 15 | name='SciLexer' version='3.4.4.0' \ 16 | processorArchitecture='*' language='*'\"") 17 | -------------------------------------------------------------------------------- /foo_tfsandbox/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define ISOLATION_AWARE_ENABLED 1 9 | 10 | #include "targetver.h" 11 | 12 | #include "foobar2000/SDK/foobar2000.h" 13 | #include "foobar2000/ATLHelpers/ATLHelpers.h" 14 | 15 | #include 16 | 17 | #include 18 | -------------------------------------------------------------------------------- /foo_tfsandbox/string_from_resources.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "string_from_resources.h" 3 | 4 | string_from_resources::string_from_resources(UINT nID) 5 | { 6 | load_string(nID); 7 | } 8 | 9 | bool string_from_resources::load_string(UINT nID) 10 | { 11 | return load_string(nID, core_api::get_my_instance()); 12 | } 13 | 14 | bool string_from_resources::load_string(UINT nID, HINSTANCE hInstance) 15 | { 16 | pfc::array_hybrid_t buffer; 17 | buffer.set_size(256); 18 | int length; 19 | do { 20 | length = ::LoadString(hInstance, nID, &buffer[0], buffer.get_size()); 21 | if (length == 0) return false; 22 | } while (length == buffer.get_size() - 1); 23 | m_data.convert(&buffer[0]); 24 | return true; 25 | } 26 | -------------------------------------------------------------------------------- /foo_tfsandbox/string_from_resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class string_from_resources 4 | { 5 | public: 6 | string_from_resources(UINT nID); 7 | 8 | bool load_string(UINT nID); 9 | bool load_string(UINT nID, HINSTANCE hInstance); 10 | 11 | inline operator const char *() const {return m_data;} 12 | 13 | private: 14 | pfc::stringcvt::string_utf8_from_os m_data; 15 | }; 16 | -------------------------------------------------------------------------------- /foo_tfsandbox/symbols.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/foo_tfsandbox/symbols.bmp -------------------------------------------------------------------------------- /foo_tfsandbox/symbols.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/foo_tfsandbox/symbols.pdn -------------------------------------------------------------------------------- /foo_tfsandbox/symbols32.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/foo_tfsandbox/symbols32.bmp -------------------------------------------------------------------------------- /foo_tfsandbox/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // The following macros define the minimum required platform. The minimum required platform 4 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run 5 | // your application. The macros work by enabling all features available on platform versions up to and 6 | // including the version specified. 7 | 8 | // Modify the following defines if you have to target a platform prior to the ones specified below. 9 | // Refer to MSDN for the latest info on corresponding values for different platforms. 10 | #ifndef WINVER // Specifies that the minimum required platform is Windows Vista. 11 | #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. 12 | #endif 13 | 14 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. 15 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. 16 | #endif 17 | 18 | //#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. 19 | #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 6.0. 20 | #define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. 21 | #endif 22 | -------------------------------------------------------------------------------- /foo_tfsandbox/tick.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/foo_tfsandbox/tick.ico -------------------------------------------------------------------------------- /foo_tfsandbox/titleformat.atg: -------------------------------------------------------------------------------- 1 | #include "titleformat_syntax.h" 2 | 3 | COMPILER Script 4 | 5 | ast::block_expression *root; 6 | 7 | /* 8 | CHARACTERS 9 | funcchar = ANY - '\r' - '\n' - '('. 10 | funcchar1 = funcchar - '$'. 11 | stringchar = ANY - '\''. 12 | fieldchar = ANY - '%'. 13 | literalchar = ANY - '\r' - '\n' - '(' - ')' - ',' - '$' - '\'' - '%' - '[' - ']'. 14 | 15 | TOKENS 16 | literal = literalchar {literalchar}. 17 | string = '\'' stringchar {stringchar} '\''. 18 | field = '%' fieldchar {fieldchar} '%'. 19 | func = '$' funcchar1 {funcchar}. 20 | selfquot = "$$" | "''" | "%%". 21 | "[" 22 | "]" 23 | "(" 24 | ")" 25 | "," 26 | 27 | COMMENTS FROM "//" TO "\n" 28 | 29 | IGNORE '\r' + '\n' 30 | */ 31 | 32 | TOKENS 33 | literal 34 | string 35 | field 36 | func 37 | selfquot 38 | "[" 39 | "]" 40 | "(" 41 | ")" 42 | "," 43 | badstring 44 | badfield 45 | badfunc 46 | comment 47 | 48 | PRODUCTIONS 49 | Script 50 | = Block 51 | . 52 | 53 | Block 54 | (. Token *t1 = 0; 55 | ast::expression *n1 = 0; 56 | pfc::ptr_list_t list; 57 | n = 0; .) 58 | = (. t1 = t; .) 59 | { 60 | Expression (. list.add_item(n1); .) 61 | | Error 62 | } 63 | (. n = new ast::block_expression(t1, list); .) 64 | . 65 | Expression 66 | = Comment 67 | | (. ast::string_constant *n1 = 0; .) String (. n = n1; .) 68 | | (. ast::field_reference *n2 = 0; .) Field (. n = n2; .) 69 | | (. ast::condition_expression *n1 = 0; .) Condition (. n = n1; .) 70 | | (. ast::call_expression *n1 = 0; .) Call (. n = n1; .) 71 | . 72 | 73 | Comment 74 | = comment (. n = new ast::comment(t); .) 75 | . 76 | 77 | String 78 | (. n = 0; .) 79 | = (literal | string | selfquot ) 80 | (. n = new ast::string_constant(t); .) 81 | . 82 | 83 | Field 84 | (. n = 0; .) 85 | = field (. n = new ast::field_reference(t); .) 86 | . 87 | 88 | Condition 89 | (. ast::block_expression *n1 = 0; 90 | Token *t1 = 0; 91 | n = 0; .) 92 | = "[" 93 | (. t1 = t; .) 94 | Block 95 | "]" 96 | (. n = new ast::condition_expression(t1, n1, t); .) 97 | . 98 | 99 | Call 100 | (. ast::block_expression *n1; 101 | Token *tname = 0; 102 | pfc::ptr_list_t tdelims; 103 | pfc::ptr_list_t params; 104 | n = 0; .) 105 | = 106 | func 107 | (. tname = t; .) 108 | "(" 109 | (. tdelims.add_item(t); .) 110 | Block 111 | (. params.add_item(n1); .) 112 | { 113 | "," 114 | (. tdelims.add_item(t); .) 115 | Block 116 | (. params.add_item(n1); .) 117 | } 118 | ")" 119 | (. tdelims.add_item(t); n = new ast::call_expression(tname, tdelims, params); .) 120 | . 121 | 122 | Error = badstring (. SemErr(L"invalid string syntax"); .) 123 | | badfield (. SemErr(L"invalid field syntax"); .) 124 | | badfunc (. SemErr(L"invalid function syntax"); .) 125 | . 126 | 127 | END Script. 128 | -------------------------------------------------------------------------------- /foo_tfsandbox/titleformat_analysis.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "titleformat_analysis.h" 3 | 4 | void titleformat_analysis::reset() 5 | { 6 | m_unknown_function_map.remove_all(); 7 | m_track = 0; 8 | } 9 | 10 | void titleformat_analysis::init(metadb_handle_ptr track, ast::block_expression *root) 11 | { 12 | reset(); 13 | m_track = track; 14 | } 15 | 16 | 17 | bool titleformat_analysis::is_function_unknown(pfc::string name, t_size param_count) 18 | { 19 | bool is_new = false; 20 | function_info &info = m_unknown_function_map.find_or_add_ex(function_signature(name, param_count), is_new); 21 | if (is_new) 22 | { 23 | pfc::string_formatter format; 24 | format << name.get_ptr() << "("; 25 | if (param_count > 0) 26 | { 27 | format << " "; 28 | for (t_size index = 1; index < param_count; ++index) {format << ", ";} 29 | } 30 | format << ")"; 31 | 32 | titleformat_object::ptr script; 33 | const bool script_valid = static_api_ptr_t()->compile(script, format); 34 | if (script.is_valid() && m_track.is_valid()) 35 | { 36 | // TODO use proper context for script evaluation 37 | pfc::string_formatter buffer; 38 | m_track->format_title(0, buffer, script, 0); 39 | info.unknown = strcmp(buffer, "[UNKNOWN FUNCTION]") == 0; 40 | } 41 | else 42 | { 43 | info.unknown = true; 44 | } 45 | } 46 | return info.unknown; 47 | } 48 | -------------------------------------------------------------------------------- /foo_tfsandbox/titleformat_analysis.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "titleformat_syntax.h" 4 | 5 | class titleformat_analysis 6 | { 7 | public: 8 | void reset(); 9 | void init(metadb_handle_ptr track, ast::block_expression *root); 10 | 11 | bool is_function_unknown(pfc::string function_name, t_size param_count); 12 | 13 | private: 14 | struct function_signature 15 | { 16 | pfc::string name; 17 | t_size param_count; 18 | 19 | function_signature() : param_count(0) {} 20 | function_signature(pfc::string _name, t_size _param_count) : name(_name), param_count(_param_count) {} 21 | function_signature(const function_signature &source) : name(source.name), param_count(source.param_count) {} 22 | function_signature &operator=(const function_signature &source) {name = source.name; param_count = source.param_count;} 23 | 24 | static int g_compare(const function_signature & p_item1, const function_signature & p_item2) {int rv = pfc::stricmp_ascii(p_item1.name.ptr(),p_item2.name.ptr()); if (rv == 0) rv = pfc::compare_t(p_item1.param_count, p_item2.param_count); return rv;} 25 | bool operator==(const function_signature& p_other) const {return g_compare(*this,p_other) == 0;} 26 | bool operator!=(const function_signature& p_other) const {return g_compare(*this,p_other) != 0;} 27 | bool operator<(const function_signature& p_other) const {return g_compare(*this,p_other) < 0;} 28 | bool operator>(const function_signature& p_other) const {return g_compare(*this,p_other) > 0;} 29 | bool operator<=(const function_signature& p_other) const {return g_compare(*this,p_other) <= 0;} 30 | bool operator>=(const function_signature& p_other) const {return g_compare(*this,p_other) >= 0;} 31 | }; 32 | 33 | struct function_info 34 | { 35 | bool unknown; 36 | 37 | function_info() : unknown(false) {} 38 | }; 39 | 40 | pfc::map_t m_unknown_function_map; 41 | 42 | metadb_handle_ptr m_track; 43 | }; 44 | -------------------------------------------------------------------------------- /foo_tfsandbox/titleformat_debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "titleformat_syntax.h" 4 | #include "titleformat_analysis.h" 5 | 6 | class titleformat_debugger_environment 7 | { 8 | public: 9 | struct variable_data 10 | { 11 | variable_data *m_parent; 12 | pfc::string8 m_name; 13 | pfc::string m_string_value; 14 | 15 | variable_data() : m_parent(0) {} 16 | }; 17 | 18 | struct node_data 19 | { 20 | pfc::string m_string_value; 21 | bool m_bool_value; 22 | bool m_unknown_function; 23 | variable_data *m_variables; 24 | 25 | node_data(variable_data *variables) : m_bool_value(false), m_unknown_function(false), m_variables(variables) {} 26 | }; 27 | 28 | pfc::map_t m_trace; 29 | pfc::ptr_list_t m_node_data_heap; 30 | pfc::ptr_list_t m_variable_data_heap; 31 | 32 | node_data *find_node_data(ast::node *n) const; 33 | node_data *create_node_data(ast::node *n, variable_data *variables); 34 | 35 | bool lookup_variable(const node_data *data, const char *p_name, pfc::string &p_out); 36 | variable_data *set_variable(node_data *data, const char *p_name, pfc::string p_string_value); 37 | 38 | void reset(); 39 | }; 40 | 41 | class titleformat_debugger 42 | { 43 | ast::script m_script; 44 | int m_parser_error_count; 45 | pfc::string_formatter m_parser_messages; 46 | 47 | titleformat_debugger_environment m_env; 48 | bool m_trace_valid; 49 | 50 | titleformat_analysis m_analysis; 51 | 52 | public: 53 | titleformat_debugger(); 54 | ~titleformat_debugger() {reset();} 55 | 56 | void reset(); 57 | 58 | bool parse(const char *p_format); 59 | void trace(metadb_handle_ptr p_handle); 60 | 61 | int get_parser_errors() const {return m_parser_error_count;} 62 | int get_parser_errors(pfc::string_base &out) const {out = m_parser_messages; return m_parser_error_count;} 63 | 64 | ast::block_expression *get_root() const {return m_script.get_root();} 65 | 66 | bool get_value(ast::node *n, pfc::string_base &p_string_value, bool &p_bool_value); 67 | bool test_value(ast::node *n); 68 | bool is_function_unknown(ast::call_expression *n); 69 | }; 70 | -------------------------------------------------------------------------------- /foo_tfsandbox/titleformat_node_filter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "titleformat_syntax.h" 4 | #include "titleformat_analysis.h" 5 | #include "titleformat_debug.h" 6 | 7 | namespace ast 8 | { 9 | class node_filter_impl_unknown_function : public node_filter 10 | { 11 | public: 12 | node_filter_impl_unknown_function(titleformat_debugger &p_debugger) : m_debugger(p_debugger) {} 13 | 14 | virtual bool test(block_expression *b) {return true;} 15 | virtual bool test(comment *n) {return true;} 16 | virtual bool test(string_constant *n) {return true;} 17 | virtual bool test(field_reference *n) {return true;} 18 | virtual bool test(condition_expression *n) {return true;} 19 | 20 | virtual bool test(call_expression *n) 21 | { 22 | return !m_debugger.is_function_unknown(n); 23 | } 24 | 25 | private: 26 | titleformat_debugger &m_debugger; 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /foo_tfsandbox/titleformat_visitor_impl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "titleformat_syntax.h" 6 | #include "titleformat_debug.h" 7 | 8 | class inactive_range_walker 9 | { 10 | public: 11 | std::vector inactiveRanges; 12 | 13 | inactive_range_walker(titleformat_debugger &p_dbg) : dbg(p_dbg) 14 | { 15 | walk(p_dbg.get_root()); 16 | } 17 | 18 | private: 19 | titleformat_debugger &dbg; 20 | 21 | void walk(ast::node *n) 22 | { 23 | if (dbg.test_value(n)) 24 | { 25 | t_size count = n->get_child_count(); 26 | switch (n->kind()) 27 | { 28 | case ast::node::kind_block: 29 | for (t_size index = 0; index < count; ++index) 30 | { 31 | walk(n->get_child(index)); 32 | } 33 | break; 34 | 35 | case ast::node::kind_condition: 36 | walk(n->get_child(1)); 37 | break; 38 | 39 | case ast::node::kind_call: 40 | ast::call_expression *call; 41 | call = static_cast(n); 42 | for (t_size index = 0; index < call->get_param_count(); ++index) 43 | { 44 | walk(call->get_param(index)); 45 | } 46 | break; 47 | } 48 | } 49 | else if (n->kind() != ast::node::kind_comment) 50 | { 51 | ast::position pos = n->get_position(); 52 | if (pos.start != -1) 53 | { 54 | Sci_CharacterRange range; 55 | range.cpMin = pos.start; 56 | range.cpMax = pos.end; 57 | inactiveRanges.push_back(range); 58 | } 59 | } 60 | } 61 | }; 62 | 63 | -------------------------------------------------------------------------------- /lextitleformat/include/ILexerTitleformat.h: -------------------------------------------------------------------------------- 1 | #ifndef ILEXTITLEFORMAT_H 2 | #define ILEXTITLEFORMAT_H 3 | 4 | #ifndef SCI_METHOD 5 | #ifdef _WIN32 6 | #define SCI_METHOD __stdcall 7 | #else 8 | #define SCI_METHOD 9 | #endif 10 | #endif 11 | 12 | enum SCE_TITLEFORMAT { 13 | SCE_TITLEFORMAT_DEFAULT = 0, 14 | SCE_TITLEFORMAT_COMMENT = 1, 15 | SCE_TITLEFORMAT_OPERATOR = 2, 16 | SCE_TITLEFORMAT_FIELD = 3, 17 | SCE_TITLEFORMAT_STRING = 4, 18 | SCE_TITLEFORMAT_LITERALSTRING = 5, 19 | SCE_TITLEFORMAT_SPECIALSTRING = 6, 20 | SCE_TITLEFORMAT_IDENTIFIER = 7, 21 | }; 22 | 23 | enum { 24 | SPC_TITLEFORMAT_GETINTERFACE = 1, 25 | }; 26 | 27 | enum { ltfvOriginal = 0 }; 28 | 29 | class ILexerTitleformatPrivateCall { 30 | public: 31 | virtual int SCI_METHOD Version() const = 0; 32 | virtual void SCI_METHOD Release() = 0; 33 | virtual void SCI_METHOD ClearInactiveRanges() = 0; 34 | virtual void SCI_METHOD SetInactiveRanges(int count, Sci_CharacterRange * ranges) = 0; 35 | }; 36 | 37 | #endif // ILEXTITLEFORMAT_H 38 | -------------------------------------------------------------------------------- /lextitleformat/lextitleformat.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | Quelldateien 21 | 22 | 23 | 24 | 25 | Quelldateien 26 | 27 | 28 | Quelldateien 29 | 30 | 31 | Quelldateien 32 | 33 | 34 | Quelldateien 35 | 36 | 37 | 38 | 39 | Headerdateien 40 | 41 | 42 | Headerdateien 43 | 44 | 45 | Headerdateien 46 | 47 | 48 | Headerdateien 49 | 50 | 51 | -------------------------------------------------------------------------------- /lextitleformat/src/LexTitleformat.def: -------------------------------------------------------------------------------- 1 | LIBRARY 2 | 3 | EXPORTS 4 | GetLexerCount 5 | GetLexerName 6 | GetLexerFactory 7 | -------------------------------------------------------------------------------- /lextitleformat/src/LexerModuleTitleformat.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "ILexer.h" 14 | #include "Scintilla.h" 15 | #include "SciLexer.h" 16 | 17 | #include "PropSetSimple.h" 18 | #include "WordList.h" 19 | #include "LexAccessor.h" 20 | #include "Accessor.h" 21 | #include "LexerModule.h" 22 | #include "LexerBase.h" 23 | #include "LexerModule.h" 24 | #include "OptionSet.h" 25 | 26 | #include "ILexerTitleformat.h" 27 | 28 | #include "LexerTitleformatPrivateCall.h" 29 | #include "OptionSetTiteformat.h" 30 | #include "LexerTitleformat.h" 31 | 32 | #ifdef BUILD_AS_EXTERNAL_LEXER 33 | 34 | #ifdef _WIN32 35 | #define EXT_LEXER_DECL __declspec( dllexport ) __stdcall 36 | #else 37 | #define EXT_LEXER_DECL 38 | #endif 39 | 40 | static const char *lexerName = "titleformat"; 41 | 42 | extern "C" { 43 | 44 | int EXT_LEXER_DECL GetLexerCount() { 45 | return 1; 46 | } 47 | 48 | void EXT_LEXER_DECL GetLexerName(unsigned int index, char *name, int buflength) { 49 | *name = 0; 50 | if ((index == 0) && (buflength > static_cast(strlen(lexerName)))) { 51 | strcpy(name, lexerName); 52 | } 53 | } 54 | 55 | LexerFactoryFunction EXT_LEXER_DECL GetLexerFactory(unsigned int index) { 56 | if (index == 0) 57 | return LexerTitleformat::LexerFactoryTitleformat; 58 | else 59 | return 0; 60 | } 61 | 62 | } 63 | 64 | #else 65 | 66 | LexerModule lmTitleformat(SCLEX_AUTOMATIC, LexerTitleformat::LexerFactoryTitleformat, "titleformat", OptionSetTitleformat::wordLists); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /lextitleformat/src/LexerTitleformat.h: -------------------------------------------------------------------------------- 1 | #ifndef LEXTITLEFORMAT_H 2 | #define LEXTITLEFORMAT_H 3 | 4 | #ifdef SCI_NAMESPACE 5 | using namespace Scintilla; 6 | #endif 7 | 8 | class LexerTitleformat : public LexerBase { 9 | public: 10 | static ILexer *LexerFactoryTitleformat(); 11 | 12 | LexerTitleformat(); 13 | virtual ~LexerTitleformat(); 14 | 15 | const char * SCI_METHOD PropertyNames(); 16 | int SCI_METHOD PropertyType(const char *name); 17 | const char * SCI_METHOD DescribeProperty(const char *name); 18 | int SCI_METHOD PropertySet(const char *key, const char *val); 19 | const char * SCI_METHOD DescribeWordListSets(); 20 | int SCI_METHOD WordListSet(int n, const char *wl); 21 | void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); 22 | void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); 23 | void * SCI_METHOD PrivateCall(int operation, void *pointer); 24 | 25 | private: 26 | OptionsTitleformat options; 27 | OptionSetTitleformat optionSet; 28 | LexerTitleformatPrivateCall * privateCall; 29 | }; 30 | 31 | #endif // LEXTITLEFORMAT_H 32 | -------------------------------------------------------------------------------- /lextitleformat/src/LexerTitleformatPrivateCall.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "LexerTitleformatPrivateCall.h" 10 | 11 | LexerTitleformatPrivateCall::LexerTitleformatPrivateCall() { 12 | refCount = 1; 13 | } 14 | 15 | LexerTitleformatPrivateCall::~LexerTitleformatPrivateCall() { 16 | } 17 | 18 | void LexerTitleformatPrivateCall::AddRef() { 19 | ++refCount; 20 | } 21 | 22 | void LexerTitleformatPrivateCall::Release() { 23 | int curRefCount = --refCount; 24 | if (curRefCount == 0) { 25 | delete this; 26 | } 27 | } 28 | 29 | void LexerTitleformatPrivateCall::ClearInactiveRanges() { 30 | inactiveRanges.clear(); 31 | } 32 | 33 | void LexerTitleformatPrivateCall::SetInactiveRanges(int count, Sci_CharacterRange * ranges) { 34 | inactiveRanges.resize(count); 35 | for (int index = 0; index < count; ++index) { 36 | inactiveRanges[index] = Range(ranges[index].cpMin, ranges[index].cpMax); 37 | } 38 | } 39 | 40 | int LexerTitleformatPrivateCall::GetInactiveRangeCount() const { 41 | return inactiveRanges.size(); 42 | } 43 | 44 | bool LexerTitleformatPrivateCall::InactiveRangeContainsCharacter(int index, Position pos) const { 45 | if (index < 0 || index >= inactiveRanges.size()) { 46 | return false; 47 | } else { 48 | return inactiveRanges[index].ContainsCharacter(pos); 49 | } 50 | } 51 | 52 | int LexerTitleformatPrivateCall::GetInactiveRangeLowerBound(Position pos) const { 53 | struct pred { 54 | bool operator ()(const Range & range, Position pos) { 55 | return range.end < pos; 56 | } 57 | }; 58 | 59 | auto it = std::lower_bound(inactiveRanges.begin(), inactiveRanges.end(), pos, pred()); 60 | 61 | return it - inactiveRanges.begin(); 62 | } 63 | -------------------------------------------------------------------------------- /lextitleformat/src/LexerTitleformatPrivateCall.h: -------------------------------------------------------------------------------- 1 | #ifndef LEXERTITLEFORMATPRIVATECALL_H 2 | #define LEXERTITLEFORMATPRIVATECALL_H 3 | 4 | typedef int Position; 5 | 6 | class Range { 7 | public: 8 | Position start; 9 | Position end; 10 | 11 | Range(Position pos = 0) : 12 | start(pos), end(pos) { 13 | } 14 | 15 | Range(Position start_, Position end_) : 16 | start(start_), end(end_) { 17 | } 18 | 19 | // Is the character after pos within the range? 20 | bool ContainsCharacter(Position pos) const { 21 | return (pos >= start && pos < end); 22 | } 23 | }; 24 | 25 | class LexerTitleformatPrivateCall : public ILexerTitleformatPrivateCall { 26 | public: 27 | LexerTitleformatPrivateCall(); 28 | virtual ~LexerTitleformatPrivateCall(); 29 | 30 | int SCI_METHOD Version() const { 31 | return ltfvOriginal; 32 | } 33 | 34 | void AddRef(); 35 | void SCI_METHOD Release(); 36 | 37 | void SCI_METHOD ClearInactiveRanges(); 38 | void SCI_METHOD SetInactiveRanges(int count, Sci_CharacterRange * ranges); 39 | int GetInactiveRangeCount() const; 40 | bool InactiveRangeContainsCharacter(int index, Position pos) const; 41 | int GetInactiveRangeLowerBound(Position pos) const; 42 | private: 43 | int refCount; 44 | std::vector inactiveRanges; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /lextitleformat/src/OptionSetTiteformat.h: -------------------------------------------------------------------------------- 1 | #ifndef OPTIONSETTITLEFORMAT_H 2 | #define OPTIONSETTITLEFORMAT_H 3 | 4 | #ifdef SCI_NAMESPACE 5 | using namespace Scintilla; 6 | #endif 7 | 8 | struct OptionsTitleformat { 9 | bool fold; 10 | OptionsTitleformat(); 11 | }; 12 | 13 | class OptionSetTitleformat : public OptionSet { 14 | public: 15 | static const char * wordLists[]; 16 | 17 | OptionSetTitleformat(); 18 | }; 19 | 20 | #endif // OPTIONSETTITLEFORMAT_H 21 | -------------------------------------------------------------------------------- /lextitleformat/src/OptionSetTitleformat.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "Scintilla.h" 7 | 8 | #include "OptionSet.h" 9 | 10 | #include "OptionSetTiteformat.h" 11 | 12 | OptionsTitleformat::OptionsTitleformat() { 13 | fold = false; 14 | } 15 | 16 | const char * OptionSetTitleformat::wordLists[] = { 17 | "Control flow functions", 18 | "Variable access functions", 19 | "Built-in functions", 20 | "Third-party functions", 21 | 0, 22 | }; 23 | 24 | 25 | OptionSetTitleformat::OptionSetTitleformat() { 26 | DefineProperty("fold", &OptionsTitleformat::fold, ""); 27 | 28 | DefineWordListSets(wordLists); 29 | } 30 | -------------------------------------------------------------------------------- /scintilla/.hg_archival.txt: -------------------------------------------------------------------------------- 1 | repo: bdf8c3ef2fb01ea24578e726337888e706d10b92 2 | node: ebfd763fc17c48d8538239131f9683758688b8d2 3 | branch: default 4 | latesttag: rel-3-4-4 5 | latesttagdistance: 1 6 | -------------------------------------------------------------------------------- /scintilla/.hgeol: -------------------------------------------------------------------------------- 1 | [patterns] 2 | **.cxx = native 3 | **.cpp = native 4 | **.c = native 5 | **.h = native 6 | **.m = native 7 | **.mm = native 8 | **.iface = native 9 | **.template = native 10 | **.mk = native 11 | **.py = native 12 | **.rc = native 13 | **.html = native 14 | **.bat = native 15 | **.mak = native 16 | **.def = native 17 | **.manifest = native 18 | **.properties = native 19 | **.styled = native 20 | **.asp = native 21 | **.php = native 22 | **.vb = native 23 | **.d = native 24 | **.lua = native 25 | **.rb = native 26 | **.pl = native 27 | **.txt = native 28 | **.pch = native 29 | **.hgeol = native 30 | **.dsp = native 31 | **.sln = native 32 | **.vcproj = native 33 | **.pro = native 34 | **.gen = native 35 | **makefile = native 36 | README = native 37 | **.bmp = BIN 38 | **.cur = BIN 39 | **.ico = BIN 40 | **.jpg = BIN 41 | **.png = BIN 42 | tgzsrc = LF 43 | -------------------------------------------------------------------------------- /scintilla/.hgignore: -------------------------------------------------------------------------------- 1 | syntax: glob 2 | *.o 3 | *.a 4 | *.lib 5 | *.obj 6 | *.pyc 7 | *.dll 8 | *.dylib 9 | *.framework 10 | *.pyd 11 | *.exp 12 | *.lib 13 | *.pdb 14 | *.res 15 | *.bak 16 | *.sbr 17 | *.suo 18 | *.idb 19 | *.bsc 20 | *.intermediate.manifest 21 | *.lastbuildstate 22 | *.cache 23 | *.ilk 24 | *.ncb 25 | *.tlog 26 | *.sdf 27 | gtk/*.plist 28 | win32/*.plist 29 | *.opt 30 | *.plg 31 | *.pbxbtree 32 | *.mode1v3 33 | *.pbxuser 34 | *.pbproj 35 | *.log 36 | *.xcbkptlist 37 | *.xcscheme 38 | *.xcworkspacedata 39 | *.xcuserstate 40 | *.xcsettings 41 | xcschememanagement.plist 42 | .DS_Store 43 | cocoa/build 44 | cocoa/ScintillaFramework/build 45 | cocoa/ScintillaTest/build 46 | macosx/SciTest/build 47 | *.cppcheck 48 | Makefile.Debug 49 | Makefile.Release 50 | *_resource.rc 51 | moc_* 52 | *.pro.user 53 | ScintillaEdit.cpp 54 | ScintillaEdit.h 55 | ScintillaConstants.py 56 | ScintillaEditBase.intermediate.manifest 57 | ScintillaEdit.intermediate.manifest 58 | qt/*/Makefile 59 | cov-int 60 | -------------------------------------------------------------------------------- /scintilla/License.txt: -------------------------------------------------------------------------------- 1 | License for Scintilla and SciTE 2 | 3 | Copyright 1998-2003 by Neil Hodgson 4 | 5 | All Rights Reserved 6 | 7 | Permission to use, copy, modify, and distribute this software and its 8 | documentation for any purpose and without fee is hereby granted, 9 | provided that the above copyright notice appear in all copies and that 10 | both that copyright notice and this permission notice appear in 11 | supporting documentation. 12 | 13 | NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 14 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 15 | AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY 16 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE 20 | OR PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /scintilla/README: -------------------------------------------------------------------------------- 1 | README for building of Scintilla and SciTE 2 | 3 | Scintilla can be built by itself. 4 | To build SciTE, Scintilla must first be built. 5 | 6 | 7 | *** GTK+/Linux version *** 8 | 9 | You must first have GTK+ 2.0 or later and GCC (4.1 or better) installed. 10 | GTK+ 1.x will not work. 11 | Other C++ compilers may work but may require tweaking the make file. 12 | 13 | To build Scintilla, use the makefile located in the scintilla/gtk directory 14 | cd scintilla/gtk 15 | make 16 | cd ../.. 17 | 18 | To build and install SciTE, use the makefile located in the scite/gtk directory 19 | cd scite/gtk 20 | make 21 | make install 22 | 23 | This installs SciTE into $prefix/bin. The value of $prefix is determined from 24 | the location of Gnome if it is installed. This is usually /usr if installed 25 | with Linux or /usr/local if built from source. If Gnome is not installed 26 | /usr/bin is used as the prefix. The prefix can be overridden on the command 27 | line like "make prefix=/opt" but the same value should be used for both make 28 | and make install as this location is compiled into the executable. The global 29 | properties file is installed at $prefix/share/scite/SciTEGlobal.properties. 30 | The language specific properties files are also installed into this directory. 31 | 32 | To remove SciTE 33 | make uninstall 34 | 35 | To clean the object files which may be needed to change $prefix 36 | make clean 37 | 38 | The current make file only supports static linking between SciTE and Scintilla. 39 | 40 | 41 | *** Windows version *** 42 | 43 | A C++ compiler is required. Visual Studio 2010 is the development system 44 | used for most development although TDM Mingw32 4.7.1 is also supported. 45 | 46 | To build Scintilla, make in the scintilla/win32 directory 47 | cd scintilla\win32 48 | GCC: mingw32-make 49 | VS .NET: nmake -f scintilla.mak 50 | cd ..\.. 51 | 52 | To build SciTE, use the makefiles located in the scite/win32 directory 53 | cd scite\win32 54 | GCC: mingw32-make 55 | VS .NET: nmake -f scite.mak 56 | 57 | An executable SciTE will now be in scite/bin. 58 | 59 | *** GTK+/Windows version *** 60 | 61 | Mingw32 is known to work. Other compilers will probably not work. 62 | 63 | Only Scintilla will build with GTK+ on Windows. SciTE will not work. 64 | 65 | To build Scintilla, make in the scintilla/gtk directory 66 | cd scintilla\gtk 67 | mingw32-make 68 | -------------------------------------------------------------------------------- /scintilla/bin/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /scintilla/bin/empty.txt: -------------------------------------------------------------------------------- 1 | This empty files ensures that the directory is created. -------------------------------------------------------------------------------- /scintilla/cocoa/InfoBar.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Scintilla source code edit control 4 | * InfoBar.h - Implements special info bar with zoom info, caret position etc. to be used with 5 | * ScintillaView. 6 | * 7 | * Mike Lischke 8 | * 9 | * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 10 | * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). 11 | */ 12 | 13 | #import 14 | #import "InfoBarCommunicator.h" 15 | 16 | /** 17 | * Extended text cell for vertically aligned text. 18 | */ 19 | @interface VerticallyCenteredTextFieldCell : NSTextFieldCell 20 | { 21 | BOOL mIsEditingOrSelecting; 22 | } 23 | 24 | @end 25 | 26 | @interface InfoBar : NSView 27 | { 28 | @private 29 | NSImage* mBackground; 30 | IBDisplay mDisplayMask; 31 | 32 | float mScaleFactor; 33 | NSPopUpButton* mZoomPopup; 34 | 35 | int mCurrentCaretX; 36 | int mCurrentCaretY; 37 | NSTextField* mCaretPositionLabel; 38 | NSTextField* mStatusTextLabel; 39 | 40 | id mCallback; 41 | } 42 | 43 | - (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location 44 | value: (float) value; 45 | - (void) setCallback: (id ) callback; 46 | 47 | - (void) createItems; 48 | - (void) positionSubViews; 49 | - (void) setDisplay: (IBDisplay) display; 50 | - (void) zoomItemAction: (id) sender; 51 | - (void) setScaleFactor: (float) newScaleFactor adjustPopup: (BOOL) flag; 52 | - (void) setCaretPosition: (NSPoint) position; 53 | - (void) sizeToFit; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /scintilla/cocoa/InfoBarCommunicator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * InfoBarCommunicator.h - Definitions of a communication protocol and other data types used for 3 | * the info bar implementation. 4 | * 5 | * Mike Lischke 6 | * 7 | * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 8 | * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). 9 | */ 10 | 11 | typedef NS_OPTIONS(NSUInteger, IBDisplay) { 12 | IBShowZoom = 0x01, 13 | IBShowCaretPosition = 0x02, 14 | IBShowStatusText = 0x04, 15 | IBShowAll = 0xFF 16 | }; 17 | 18 | /** 19 | * The info bar communicator protocol is used for communication between ScintillaView and its 20 | * information bar component. Using this protocol decouples any potential info target from the main 21 | * ScintillaView implementation. The protocol is used two-way. 22 | */ 23 | 24 | typedef NS_ENUM(NSInteger, NotificationType) { 25 | IBNZoomChanged, // The user selected another zoom value. 26 | IBNCaretChanged, // The caret in the editor changed. 27 | IBNStatusChanged, // The application set a new status message. 28 | }; 29 | 30 | @protocol InfoBarCommunicator 31 | - (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location 32 | value: (float) value; 33 | - (void) setCallback: (id ) callback; 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /scintilla/cocoa/QuartzTextLayout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QuartzTextLayout.h 3 | * 4 | * Original Code by Evan Jones on Wed Oct 02 2002. 5 | * Contributors: 6 | * Shane Caraveo, ActiveState 7 | * Bernd Paradies, Adobe 8 | * 9 | */ 10 | 11 | #ifndef _QUARTZ_TEXT_LAYOUT_H 12 | #define _QUARTZ_TEXT_LAYOUT_H 13 | 14 | #include 15 | 16 | #include "QuartzTextStyle.h" 17 | 18 | 19 | class QuartzTextLayout 20 | { 21 | public: 22 | /** Create a text layout for drawing on the specified context. */ 23 | explicit QuartzTextLayout( CGContextRef context ) 24 | { 25 | mString = NULL; 26 | mLine = NULL; 27 | stringLength = 0; 28 | setContext(context); 29 | } 30 | 31 | ~QuartzTextLayout() 32 | { 33 | if ( mString != NULL ) 34 | { 35 | CFRelease(mString); 36 | mString = NULL; 37 | } 38 | if ( mLine != NULL ) 39 | { 40 | CFRelease(mLine); 41 | mLine = NULL; 42 | } 43 | } 44 | 45 | inline void setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle& r ) 46 | { 47 | CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false ); 48 | if (!str) 49 | return; 50 | 51 | stringLength = CFStringGetLength(str); 52 | 53 | CFMutableDictionaryRef stringAttribs = r.getCTStyle(); 54 | 55 | if (mString != NULL) 56 | CFRelease(mString); 57 | mString = ::CFAttributedStringCreate(NULL, str, stringAttribs); 58 | 59 | if (mLine != NULL) 60 | CFRelease(mLine); 61 | mLine = ::CTLineCreateWithAttributedString(mString); 62 | 63 | CFRelease( str ); 64 | } 65 | 66 | /** Draw the text layout into the current CGContext at the specified position. 67 | * @param x The x axis position to draw the baseline in the current CGContext. 68 | * @param y The y axis position to draw the baseline in the current CGContext. */ 69 | void draw( float x, float y ) 70 | { 71 | if (mLine == NULL) 72 | return; 73 | 74 | ::CGContextSetTextMatrix(gc, CGAffineTransformMakeScale(1.0, -1.0)); 75 | 76 | // Set the text drawing position. 77 | ::CGContextSetTextPosition(gc, x, y); 78 | 79 | // And finally, draw! 80 | ::CTLineDraw(mLine, gc); 81 | } 82 | 83 | float MeasureStringWidth() 84 | { 85 | if (mLine == NULL) 86 | return 0.0f; 87 | 88 | return ::CTLineGetTypographicBounds(mLine, NULL, NULL, NULL); 89 | } 90 | 91 | CTLineRef getCTLine() { 92 | return mLine; 93 | } 94 | 95 | CFIndex getStringLength() { 96 | return stringLength; 97 | } 98 | 99 | inline void setContext (CGContextRef context) 100 | { 101 | gc = context; 102 | } 103 | 104 | private: 105 | CGContextRef gc; 106 | CFAttributedStringRef mString; 107 | CTLineRef mLine; 108 | CFIndex stringLength; 109 | }; 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /scintilla/cocoa/QuartzTextStyle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QuartzTextStyle.h 3 | * 4 | * Created by Evan Jones on Wed Oct 02 2002. 5 | * 6 | */ 7 | 8 | #ifndef _QUARTZ_TEXT_STYLE_H 9 | #define _QUARTZ_TEXT_STYLE_H 10 | 11 | #include "QuartzTextStyleAttribute.h" 12 | 13 | class QuartzTextStyle 14 | { 15 | public: 16 | QuartzTextStyle() 17 | { 18 | fontRef = NULL; 19 | styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, 20 | &kCFTypeDictionaryKeyCallBacks, 21 | &kCFTypeDictionaryValueCallBacks); 22 | 23 | characterSet = 0; 24 | } 25 | 26 | QuartzTextStyle(const QuartzTextStyle &other) 27 | { 28 | // Does not copy font colour attribute 29 | fontRef = static_cast(CFRetain(other.fontRef)); 30 | styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, 31 | &kCFTypeDictionaryKeyCallBacks, 32 | &kCFTypeDictionaryValueCallBacks); 33 | CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef); 34 | characterSet = other.characterSet; 35 | } 36 | 37 | ~QuartzTextStyle() 38 | { 39 | if (styleDict != NULL) 40 | { 41 | CFRelease(styleDict); 42 | styleDict = NULL; 43 | } 44 | 45 | if (fontRef) 46 | { 47 | CFRelease(fontRef); 48 | fontRef = NULL; 49 | } 50 | } 51 | 52 | CFMutableDictionaryRef getCTStyle() const 53 | { 54 | return styleDict; 55 | } 56 | 57 | void setCTStyleColor(CGColor *inColor) 58 | { 59 | CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, inColor); 60 | } 61 | 62 | float getAscent() const 63 | { 64 | return ::CTFontGetAscent(fontRef); 65 | } 66 | 67 | float getDescent() const 68 | { 69 | return ::CTFontGetDescent(fontRef); 70 | } 71 | 72 | float getLeading() const 73 | { 74 | return ::CTFontGetLeading(fontRef); 75 | } 76 | 77 | void setFontRef(CTFontRef inRef, int characterSet_) 78 | { 79 | fontRef = inRef; 80 | characterSet = characterSet_; 81 | 82 | if (styleDict != NULL) 83 | CFRelease(styleDict); 84 | 85 | styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, 86 | &kCFTypeDictionaryKeyCallBacks, 87 | &kCFTypeDictionaryValueCallBacks); 88 | 89 | CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef); 90 | } 91 | 92 | CTFontRef getFontRef() 93 | { 94 | return fontRef; 95 | } 96 | 97 | int getCharacterSet() 98 | { 99 | return characterSet; 100 | } 101 | 102 | private: 103 | CFMutableDictionaryRef styleDict; 104 | CTFontRef fontRef; 105 | int characterSet; 106 | }; 107 | 108 | #endif 109 | 110 | -------------------------------------------------------------------------------- /scintilla/cocoa/QuartzTextStyleAttribute.h: -------------------------------------------------------------------------------- 1 | /** 2 | * QuartzTextStyleAttribute.h 3 | * 4 | * Original Code by Evan Jones on Wed Oct 02 2002. 5 | * Contributors: 6 | * Shane Caraveo, ActiveState 7 | * Bernd Paradies, Adobe 8 | * 9 | */ 10 | 11 | 12 | #ifndef _QUARTZ_TEXT_STYLE_ATTRIBUTE_H 13 | #define _QUARTZ_TEXT_STYLE_ATTRIBUTE_H 14 | 15 | class QuartzFont 16 | { 17 | public: 18 | /** Create a font style from a name. */ 19 | QuartzFont( const char* name, size_t length, float size, int weight, bool italic ) 20 | { 21 | assert( name != NULL && length > 0 && name[length] == '\0' ); 22 | 23 | CFStringRef fontName = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingMacRoman); 24 | assert(fontName != NULL); 25 | bool bold = weight > SC_WEIGHT_NORMAL; 26 | 27 | if (bold || italic) 28 | { 29 | CTFontSymbolicTraits desiredTrait = 0; 30 | CTFontSymbolicTraits traitMask = 0; 31 | 32 | // if bold was specified, add the trait 33 | if (bold) { 34 | desiredTrait |= kCTFontBoldTrait; 35 | traitMask |= kCTFontBoldTrait; 36 | } 37 | 38 | // if italic was specified, add the trait 39 | if (italic) { 40 | desiredTrait |= kCTFontItalicTrait; 41 | traitMask |= kCTFontItalicTrait; 42 | } 43 | 44 | // create a font and then a copy of it with the sym traits 45 | CTFontRef iFont = ::CTFontCreateWithName(fontName, size, NULL); 46 | fontid = ::CTFontCreateCopyWithSymbolicTraits(iFont, size, NULL, desiredTrait, traitMask); 47 | if (fontid) 48 | { 49 | CFRelease(iFont); 50 | } 51 | else 52 | { 53 | // Traits failed so use base font 54 | fontid = iFont; 55 | } 56 | } 57 | else 58 | { 59 | // create the font, no traits 60 | fontid = ::CTFontCreateWithName(fontName, size, NULL); 61 | } 62 | 63 | if (!fontid) 64 | { 65 | // Failed to create requested font so use font always present 66 | fontid = ::CTFontCreateWithName((CFStringRef)@"Monaco", size, NULL); 67 | } 68 | 69 | CFRelease(fontName); 70 | } 71 | 72 | CTFontRef getFontID() 73 | { 74 | return fontid; 75 | } 76 | 77 | private: 78 | CTFontRef fontid; 79 | }; 80 | 81 | #endif 82 | 83 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaFramework/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/cocoa/ScintillaFramework/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaFramework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.sun.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaFramework/Scintilla_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Scintilla' target in the 'Scintilla' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/AppController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * AppController.h 3 | * SciTest 4 | * 5 | * Created by Mike Lischke on 01.04.09. 6 | * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 7 | * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). 8 | */ 9 | 10 | #import 11 | 12 | #import "Scintilla/ScintillaView.h" 13 | #import "Scintilla/InfoBar.h" 14 | 15 | @interface AppController : NSObject { 16 | IBOutlet NSBox *mEditHost; 17 | ScintillaView* mEditor; 18 | } 19 | 20 | - (void) awakeFromNib; 21 | - (void) setupEditor; 22 | - (IBAction) searchText: (id) sender; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/cocoa/ScintillaTest/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.sun.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSMainNibFile 24 | MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/Scintilla-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.sun.${PRODUCT_NAME:identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/ScintillaTest_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'ScintillaTest' target in the 'ScintillaTest' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * main.m 3 | * ScintillaTest 4 | * 5 | * Created by Mike Lischke on 02.04.09. 6 | * Copyright Sun Microsystems, Inc 2009. All rights reserved. 7 | * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). 8 | */ 9 | 10 | #import 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | return NSApplicationMain(argc, (const char **) argv); 15 | } 16 | -------------------------------------------------------------------------------- /scintilla/cocoa/checkbuildosx.sh: -------------------------------------------------------------------------------- 1 | # Script to build Scintilla for OS X with most supported build files. 2 | # Current directory should be scintilla/cocoa before running. 3 | 4 | cd ../.. 5 | 6 | # ************************************************************ 7 | # Target 1: Unit tests 8 | 9 | echo Unit tests 10 | 11 | cd scintilla/test/unit 12 | make clean 13 | make test 14 | cd ../../.. 15 | 16 | # ************************************************************ 17 | # Target 2: build framework and test app with Xcode targetting OS X 10.n with n from 9 to 5 18 | # Only SDK versions that are installed will be built 19 | # Clean both then build both -- if perform clean in ScintillaTest, also cleans ScintillaFramework 20 | # which can cause double build 21 | 22 | echo Building Cocoa-native ScintillaFramework and ScintillaTest 23 | for sdk in macosx10.9 macosx10.8 macosx10.7 macosx10.6 macosx10.5 24 | do 25 | xcodebuild -showsdks | grep $sdk 26 | if [ "$(xcodebuild -showsdks | grep $sdk)" != "" ] 27 | then 28 | echo Building with $sdk 29 | cd scintilla/cocoa/ScintillaFramework 30 | xcodebuild clean 31 | cd ../ScintillaTest 32 | xcodebuild clean 33 | cd ../ScintillaFramework 34 | xcodebuild -sdk $sdk 35 | cd ../ScintillaTest 36 | xcodebuild -sdk $sdk 37 | cd ../../.. 38 | else 39 | echo Warning $sdk not available 40 | fi 41 | done 42 | 43 | # ************************************************************ 44 | # Target 3: Qt builds 45 | # Requires Qt development libraries and qmake to be installed 46 | 47 | echo Building Qt and PySide 48 | 49 | cd scintilla/qt 50 | cd ScintillaEditBase 51 | qmake -spec macx-xcode 52 | xcodebuild clean 53 | xcodebuild 54 | cd .. 55 | 56 | cd ScintillaEdit 57 | python WidgetGen.py 58 | qmake -spec macx-xcode 59 | xcodebuild clean 60 | xcodebuild 61 | cd .. 62 | 63 | cd ScintillaEditPy 64 | python sepbuild.py 65 | cd .. 66 | cd ../.. 67 | -------------------------------------------------------------------------------- /scintilla/cocoa/res/info_bar_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/cocoa/res/info_bar_bg.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/info_bar_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/cocoa/res/info_bar_bg@2x.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_busy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/cocoa/res/mac_cursor_busy.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_busy@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/cocoa/res/mac_cursor_busy@2x.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_flipped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/cocoa/res/mac_cursor_flipped.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_flipped@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/cocoa/res/mac_cursor_flipped@2x.png -------------------------------------------------------------------------------- /scintilla/cppcheck.suppress: -------------------------------------------------------------------------------- 1 | // File to suppress cppcheck warnings for files that will not be fixed. 2 | // Does not suppress warnings where an additional occurrence of the warning may be of interest. 3 | // Does not suppress false positives from cppcheck. 4 | 5 | // Coding style is to use assignments in constructor when there are many 6 | // members to initialize or the initialization is complex or has comments. 7 | useInitializationList 8 | 9 | // Suppress most lexer warnings since the lexers are maintained by others 10 | useInitializationList:scintilla/lexers/LexAsm.cxx 11 | useInitializationList:scintilla/lexers/LexBasic.cxx 12 | noCopyConstructor:scintilla/lexers/LexBash.cxx 13 | variableScope:scintilla/lexers/LexBash.cxx 14 | variableScope:scintilla/lexers/LexCmake.cxx 15 | variableScope:scintilla/lexers/LexCSS.cxx 16 | useInitializationList:scintilla/lexers/LexD.cxx 17 | variableScope:scintilla/lexers/LexErlang.cxx 18 | variableScope:scintilla/lexers/LexGui4Cli.cxx 19 | variableScope:scintilla/lexers/LexInno.cxx 20 | variableScope:scintilla/lexers/LexLaTeX.cxx 21 | variableScope:scintilla/lexers/LexMetapost.cxx 22 | variableScope:scintilla/lexers/LexModula.cxx 23 | variableScope:scintilla/lexers/LexNimrod.cxx 24 | variableScope:scintilla/lexers/LexNsis.cxx 25 | variableScope:scintilla/lexers/LexOpal.cxx 26 | variableScope:scintilla/lexers/LexOthers.cxx 27 | variableScope:scintilla/lexers/LexPB.cxx 28 | noCopyConstructor:scintilla/lexers/LexPerl.cxx 29 | variableScope:scintilla/lexers/LexRuby.cxx 30 | uninitMemberVar:scintilla/lexers/LexRuby.cxx 31 | variableScope:scintilla/lexers/LexSpecman.cxx 32 | unreadVariable:scintilla/lexers/LexSpice.cxx 33 | invalidscanf:scintilla/lexers/LexTCMD.cxx 34 | variableScope:scintilla/lexers/LexTeX.cxx 35 | variableScope:scintilla/lexers/LexVHDL.cxx 36 | 37 | // Suppress C-style pointer casting for Qt code as won't be changing 38 | cstyleCast:scintilla/qt/ScintillaEdit/ScintillaDocument.cpp 39 | 40 | // Suppress everything in catch.hpp as won't be changing 41 | *:scintilla/test/unit/catch.hpp 42 | -------------------------------------------------------------------------------- /scintilla/delbin.bat: -------------------------------------------------------------------------------- 1 | del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog >NUL: 2 | -------------------------------------------------------------------------------- /scintilla/delcvs.bat: -------------------------------------------------------------------------------- 1 | del /S /Q .cvsignore 2 | -------------------------------------------------------------------------------- /scintilla/doc/Icons.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Scintilla icons 11 | 12 | 13 | 14 | 15 | 16 | 19 | 23 | 24 |
17 | Scintilla icon 18 | 20 | Scintilla 21 | and SciTE 22 |
25 |

26 | Icons 27 |

28 |

29 | These images may be used under the same license as Scintilla. 30 |

31 |

32 | Drawn by Iago Rubio, Philippe Lhoste, and Neil Hodgson. 33 |

34 |

35 | zip format (70K) 36 |

37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
For autocompletion listsFor margin markers
12x1216x1624x2432x32
55 | 56 | 57 | -------------------------------------------------------------------------------- /scintilla/doc/Indicators.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/doc/Indicators.png -------------------------------------------------------------------------------- /scintilla/doc/Markers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/doc/Markers.png -------------------------------------------------------------------------------- /scintilla/doc/SciBreak.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/doc/SciBreak.jpg -------------------------------------------------------------------------------- /scintilla/doc/SciRest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/doc/SciRest.jpg -------------------------------------------------------------------------------- /scintilla/doc/SciTEIco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/doc/SciTEIco.png -------------------------------------------------------------------------------- /scintilla/doc/SciWord.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/doc/SciWord.jpg -------------------------------------------------------------------------------- /scintilla/doc/ScintillaDownload.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Download Scintilla 11 | 12 | 13 | 14 | 15 | 16 | 19 | 23 | 24 |
17 | Scintilla icon 18 | 20 | Download 21 | Scintilla 22 |
25 | 26 | 27 | 34 | 35 |
28 | 29 | Windows   30 | 31 | GTK+/Linux   32 | 33 |
36 |

37 | Download. 38 |

39 |

40 | The license for using Scintilla or SciTE is similar to that of Python 41 | containing very few restrictions. 42 |

43 |

44 | Release 3.4.4 45 |

46 |

47 | Source Code 48 |

49 | The source code package contains all of the source code for Scintilla but no binary 50 | executable code and is available in 51 |
    52 |
  • zip format (1450K) commonly used on Windows
  • 53 |
  • tgz format (1300K) commonly used on Linux and compatible operating systems
  • 54 |
55 | Instructions for building on both Windows and Linux are included in the readme file. 56 |

57 | Windows Executable Code 58 |

59 | There is no download available containing only the Scintilla DLL. 60 | However, it is included in the SciTE 61 | executable full download as SciLexer.DLL. 62 |

63 | SciTE is a good demonstration of Scintilla. 64 |

65 |

66 | Previous versions can be downloaded from the history 67 | page. 68 |

69 | 70 | 71 | -------------------------------------------------------------------------------- /scintilla/doc/annotations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/doc/annotations.png -------------------------------------------------------------------------------- /scintilla/doc/styledmargin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/doc/styledmargin.png -------------------------------------------------------------------------------- /scintilla/gtk/Converter.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | // Converter.h - Encapsulation of iconv 3 | // Copyright 2004 by Neil Hodgson 4 | // The License.txt file describes the conditions under which this software may be distributed. 5 | 6 | #ifndef CONVERTER_H 7 | #define CONVERTER_H 8 | 9 | #ifdef SCI_NAMESPACE 10 | namespace Scintilla { 11 | #endif 12 | 13 | typedef GIConv ConverterHandle; 14 | const ConverterHandle iconvhBad = (ConverterHandle)(-1); 15 | // Since various versions of iconv can not agree on whether the src argument 16 | // is char ** or const char ** provide a templatised adaptor. 17 | template 18 | size_t iconv_adaptor(size_t(*f_iconv)(ConverterHandle, T, size_t *, char **, size_t *), 19 | ConverterHandle cd, char** src, size_t *srcleft, 20 | char **dst, size_t *dstleft) { 21 | return f_iconv(cd, (T)src, srcleft, dst, dstleft); 22 | } 23 | /** 24 | * Encapsulate iconv safely and avoid iconv_adaptor complexity in client code. 25 | */ 26 | class Converter { 27 | ConverterHandle iconvh; 28 | void OpenHandle(const char *fullDestination, const char *charSetSource) { 29 | iconvh = g_iconv_open(fullDestination, charSetSource); 30 | } 31 | bool Succeeded() const { 32 | return iconvh != iconvhBad; 33 | } 34 | public: 35 | Converter() { 36 | iconvh = iconvhBad; 37 | } 38 | Converter(const char *charSetDestination, const char *charSetSource, bool transliterations) { 39 | iconvh = iconvhBad; 40 | Open(charSetDestination, charSetSource, transliterations); 41 | } 42 | ~Converter() { 43 | Close(); 44 | } 45 | operator bool() const { 46 | return Succeeded(); 47 | } 48 | void Open(const char *charSetDestination, const char *charSetSource, bool transliterations=true) { 49 | Close(); 50 | if (*charSetSource) { 51 | // Try allowing approximate transliterations 52 | if (transliterations) { 53 | char fullDest[200]; 54 | g_strlcpy(fullDest, charSetDestination, sizeof(fullDest)); 55 | g_strlcat(fullDest, "//TRANSLIT", sizeof(fullDest)); 56 | OpenHandle(fullDest, charSetSource); 57 | } 58 | if (!Succeeded()) { 59 | // Transliterations failed so try basic name 60 | OpenHandle(charSetDestination, charSetSource); 61 | } 62 | } 63 | } 64 | void Close() { 65 | if (Succeeded()) { 66 | g_iconv_close(iconvh); 67 | iconvh = iconvhBad; 68 | } 69 | } 70 | size_t Convert(char** src, size_t *srcleft, char **dst, size_t *dstleft) const { 71 | if (!Succeeded()) { 72 | return (size_t)(-1); 73 | } else { 74 | return iconv_adaptor(g_iconv, iconvh, src, srcleft, dst, dstleft); 75 | } 76 | } 77 | }; 78 | 79 | #ifdef SCI_NAMESPACE 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /scintilla/gtk/makefile: -------------------------------------------------------------------------------- 1 | # Make file for Scintilla on Linux or compatible OS 2 | # Copyright 1998-2010 by Neil Hodgson 3 | # The License.txt file describes the conditions under which this software may be distributed. 4 | # This makefile assumes GCC 4.3 is used and changes will be needed to use other compilers. 5 | # GNU make does not like \r\n line endings so should be saved to CVS in binary form. 6 | # Builds for GTK+ 2 and no longer supports GTK+ 1. 7 | # Also works with ming32-make on Windows. 8 | 9 | .SUFFIXES: .cxx .c .o .h .a 10 | ifdef CLANG 11 | CXX = clang++ 12 | CC = clang 13 | # Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for 14 | # thread also need to create Position Independent Executable -> search online documentation 15 | SANITIZE = address 16 | #SANITIZE = undefined 17 | endif 18 | RANLIB = touch 19 | 20 | ifdef GTK3 21 | GTKVERSION=gtk+-3.0 22 | else 23 | GTKVERSION=gtk+-2.0 24 | endif 25 | 26 | # Environment variable windir always defined on Win32 27 | 28 | ifndef windir 29 | ifeq ($(shell uname),Darwin) 30 | RANLIB = ranlib 31 | endif 32 | endif 33 | 34 | ifdef windir 35 | DEL = del /q 36 | COMPLIB=..\bin\scintilla.a 37 | else 38 | DEL = rm -f 39 | COMPLIB=../bin/scintilla.a 40 | endif 41 | 42 | vpath %.h ../src ../include ../lexlib 43 | vpath %.cxx ../src ../lexlib ../lexers 44 | 45 | INCLUDEDIRS=-I ../include -I ../src -I ../lexlib 46 | ifdef CHECK_DEPRECATED 47 | DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DDISABLE_GDK_FONT 48 | endif 49 | CXXBASEFLAGS=-Wall -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED) 50 | 51 | ifdef NOTHREADS 52 | THREADFLAGS=-DG_THREADS_IMPL_NONE 53 | else 54 | THREADFLAGS= 55 | endif 56 | 57 | ifdef DEBUG 58 | ifdef CLANG 59 | CTFLAGS=-DDEBUG -g -fsanitize=$(SANITIZE) $(CXXBASEFLAGS) $(THREADFLAGS) 60 | else 61 | CTFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS) 62 | endif 63 | else 64 | CTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS) 65 | endif 66 | 67 | CFLAGS:=$(CTFLAGS) 68 | CXXTFLAGS:=--std=c++0x $(CTFLAGS) 69 | 70 | CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION)) 71 | MARSHALLER=scintilla-marshal.o 72 | 73 | .cxx.o: 74 | $(CXX) $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) -c $< 75 | .c.o: 76 | $(CC) $(CONFIGFLAGS) $(CFLAGS) -w -c $< 77 | 78 | LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx)))) 79 | 80 | all: $(COMPLIB) 81 | 82 | clean: 83 | $(DEL) *.o $(COMPLIB) *.plist 84 | 85 | analyze: 86 | clang --analyze $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx 87 | 88 | deps: 89 | $(CXX) -MM $(CONFIGFLAGS) $(CXXTFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak 90 | 91 | $(COMPLIB): Accessor.o CharacterSet.o LexerBase.o LexerModule.o LexerSimple.o StyleContext.o WordList.o \ 92 | CharClassify.o Decoration.o Document.o PerLine.o Catalogue.o CallTip.o CaseConvert.o CaseFolder.o \ 93 | ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSetSimple.o PlatGTK.o \ 94 | KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o CharacterCategory.o ViewStyle.o \ 95 | RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \ 96 | $(MARSHALLER) $(LEXOBJS) 97 | $(AR) rc $@ $^ 98 | $(RANLIB) $@ 99 | 100 | # Automatically generate header dependencies with "make deps" 101 | include deps.mak 102 | -------------------------------------------------------------------------------- /scintilla/gtk/scintilla-marshal.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __scintilla_marshal_MARSHAL_H__ 3 | #define __scintilla_marshal_MARSHAL_H__ 4 | 5 | #include 6 | 7 | G_BEGIN_DECLS 8 | 9 | /* NONE:INT,POINTER (scintilla-marshal.list:1) */ 10 | extern void scintilla_marshal_VOID__INT_POINTER (GClosure *closure, 11 | GValue *return_value, 12 | guint n_param_values, 13 | const GValue *param_values, 14 | gpointer invocation_hint, 15 | gpointer marshal_data); 16 | #define scintilla_marshal_NONE__INT_POINTER scintilla_marshal_VOID__INT_POINTER 17 | 18 | G_END_DECLS 19 | 20 | #endif /* __scintilla_marshal_MARSHAL_H__ */ 21 | 22 | -------------------------------------------------------------------------------- /scintilla/gtk/scintilla-marshal.list: -------------------------------------------------------------------------------- 1 | NONE:INT,POINTER 2 | -------------------------------------------------------------------------------- /scintilla/include/ScintillaWidget.h: -------------------------------------------------------------------------------- 1 | /* Scintilla source code edit control */ 2 | /** @file ScintillaWidget.h 3 | ** Definition of Scintilla widget for GTK+. 4 | ** Only needed by GTK+ code but is harmless on other platforms. 5 | **/ 6 | /* Copyright 1998-2001 by Neil Hodgson 7 | * The License.txt file describes the conditions under which this software may be distributed. */ 8 | 9 | #ifndef SCINTILLAWIDGET_H 10 | #define SCINTILLAWIDGET_H 11 | 12 | #if defined(GTK) 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #define SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, scintilla_get_type (), ScintillaObject) 19 | #define SCINTILLA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) 20 | #define IS_SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, scintilla_get_type ()) 21 | 22 | typedef struct _ScintillaObject ScintillaObject; 23 | typedef struct _ScintillaClass ScintillaClass; 24 | 25 | struct _ScintillaObject { 26 | GtkContainer cont; 27 | void *pscin; 28 | }; 29 | 30 | struct _ScintillaClass { 31 | GtkContainerClass parent_class; 32 | 33 | void (* command) (ScintillaObject *ttt); 34 | void (* notify) (ScintillaObject *ttt); 35 | }; 36 | 37 | GType scintilla_get_type (void); 38 | GtkWidget* scintilla_new (void); 39 | void scintilla_set_id (ScintillaObject *sci, uptr_t id); 40 | sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); 41 | void scintilla_release_resources(void); 42 | 43 | #define SCINTILLA_NOTIFY "sci-notify" 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /scintilla/lexers/LexCSS.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/lexers/LexCSS.cxx -------------------------------------------------------------------------------- /scintilla/lexers/LexErlang.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/lexers/LexErlang.cxx -------------------------------------------------------------------------------- /scintilla/lexers/LexMMIXAL.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/lexers/LexMMIXAL.cxx -------------------------------------------------------------------------------- /scintilla/lexers/LexMatlab.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stengerh/foo_tfsandbox/c48dcf95777a6e16a54420749641c583dcbc13fb/scintilla/lexers/LexMatlab.cxx -------------------------------------------------------------------------------- /scintilla/lexlib/Accessor.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file KeyWords.cxx 3 | ** Colourise for particular languages. 4 | **/ 5 | // Copyright 1998-2002 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "ILexer.h" 16 | #include "Scintilla.h" 17 | #include "SciLexer.h" 18 | 19 | #include "PropSetSimple.h" 20 | #include "WordList.h" 21 | #include "LexAccessor.h" 22 | #include "Accessor.h" 23 | 24 | #ifdef SCI_NAMESPACE 25 | using namespace Scintilla; 26 | #endif 27 | 28 | Accessor::Accessor(IDocument *pAccess_, PropSetSimple *pprops_) : LexAccessor(pAccess_), pprops(pprops_) { 29 | } 30 | 31 | int Accessor::GetPropertyInt(const char *key, int defaultValue) const { 32 | return pprops->GetInt(key, defaultValue); 33 | } 34 | 35 | int Accessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { 36 | int end = Length(); 37 | int spaceFlags = 0; 38 | 39 | // Determines the indentation level of the current line and also checks for consistent 40 | // indentation compared to the previous line. 41 | // Indentation is judged consistent when the indentation whitespace of each line lines 42 | // the same or the indentation of one line is a prefix of the other. 43 | 44 | int pos = LineStart(line); 45 | char ch = (*this)[pos]; 46 | int indent = 0; 47 | bool inPrevPrefix = line > 0; 48 | int posPrev = inPrevPrefix ? LineStart(line-1) : 0; 49 | while ((ch == ' ' || ch == '\t') && (pos < end)) { 50 | if (inPrevPrefix) { 51 | char chPrev = (*this)[posPrev++]; 52 | if (chPrev == ' ' || chPrev == '\t') { 53 | if (chPrev != ch) 54 | spaceFlags |= wsInconsistent; 55 | } else { 56 | inPrevPrefix = false; 57 | } 58 | } 59 | if (ch == ' ') { 60 | spaceFlags |= wsSpace; 61 | indent++; 62 | } else { // Tab 63 | spaceFlags |= wsTab; 64 | if (spaceFlags & wsSpace) 65 | spaceFlags |= wsSpaceTab; 66 | indent = (indent / 8 + 1) * 8; 67 | } 68 | ch = (*this)[++pos]; 69 | } 70 | 71 | *flags = spaceFlags; 72 | indent += SC_FOLDLEVELBASE; 73 | // if completely empty line or the start of a comment... 74 | if ((LineStart(line) == Length()) || (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || 75 | (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) 76 | return indent | SC_FOLDLEVELWHITEFLAG; 77 | else 78 | return indent; 79 | } 80 | -------------------------------------------------------------------------------- /scintilla/lexlib/Accessor.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Accessor.h 3 | ** Interfaces between Scintilla and lexers. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef ACCESSOR_H 9 | #define ACCESSOR_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | enum { wsSpace=1, wsTab=2, wsSpaceTab=4, wsInconsistent=8 }; 16 | 17 | class Accessor; 18 | class WordList; 19 | class PropSetSimple; 20 | 21 | typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len); 22 | 23 | class Accessor : public LexAccessor { 24 | public: 25 | PropSetSimple *pprops; 26 | Accessor(IDocument *pAccess_, PropSetSimple *pprops_); 27 | int GetPropertyInt(const char *, int defaultValue=0) const; 28 | int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); 29 | }; 30 | 31 | #ifdef SCI_NAMESPACE 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /scintilla/lexlib/CharacterCategory.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharacterCategory.h 3 | ** Returns the Unicode general category of a character. 4 | **/ 5 | // Copyright 2013 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CHARACTERCATEGORY_H 9 | #define CHARACTERCATEGORY_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | enum CharacterCategory { 16 | ccLu, ccLl, ccLt, ccLm, ccLo, 17 | ccMn, ccMc, ccMe, 18 | ccNd, ccNl, ccNo, 19 | ccPc, ccPd, ccPs, ccPe, ccPi, ccPf, ccPo, 20 | ccSm, ccSc, ccSk, ccSo, 21 | ccZs, ccZl, ccZp, 22 | ccCc, ccCf, ccCs, ccCo, ccCn 23 | }; 24 | 25 | CharacterCategory CategoriseCharacter(int character); 26 | 27 | #ifdef SCI_NAMESPACE 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /scintilla/lexlib/CharacterSet.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharacterSet.cxx 3 | ** Simple case functions for ASCII. 4 | ** Lexer infrastructure. 5 | **/ 6 | // Copyright 1998-2010 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "CharacterSet.h" 16 | 17 | #ifdef SCI_NAMESPACE 18 | using namespace Scintilla; 19 | #endif 20 | 21 | #ifdef SCI_NAMESPACE 22 | namespace Scintilla { 23 | #endif 24 | 25 | int CompareCaseInsensitive(const char *a, const char *b) { 26 | while (*a && *b) { 27 | if (*a != *b) { 28 | char upperA = MakeUpperCase(*a); 29 | char upperB = MakeUpperCase(*b); 30 | if (upperA != upperB) 31 | return upperA - upperB; 32 | } 33 | a++; 34 | b++; 35 | } 36 | // Either *a or *b is nul 37 | return *a - *b; 38 | } 39 | 40 | int CompareNCaseInsensitive(const char *a, const char *b, size_t len) { 41 | while (*a && *b && len) { 42 | if (*a != *b) { 43 | char upperA = MakeUpperCase(*a); 44 | char upperB = MakeUpperCase(*b); 45 | if (upperA != upperB) 46 | return upperA - upperB; 47 | } 48 | a++; 49 | b++; 50 | len--; 51 | } 52 | if (len == 0) 53 | return 0; 54 | else 55 | // Either *a or *b is nul 56 | return *a - *b; 57 | } 58 | 59 | #ifdef SCI_NAMESPACE 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerBase.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerBase.cxx 3 | ** A simple lexer with no state. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "ILexer.h" 16 | #include "Scintilla.h" 17 | #include "SciLexer.h" 18 | 19 | #include "PropSetSimple.h" 20 | #include "WordList.h" 21 | #include "LexAccessor.h" 22 | #include "Accessor.h" 23 | #include "LexerModule.h" 24 | #include "LexerBase.h" 25 | 26 | #ifdef SCI_NAMESPACE 27 | using namespace Scintilla; 28 | #endif 29 | 30 | LexerBase::LexerBase() { 31 | for (int wl = 0; wl < numWordLists; wl++) 32 | keyWordLists[wl] = new WordList; 33 | keyWordLists[numWordLists] = 0; 34 | } 35 | 36 | LexerBase::~LexerBase() { 37 | for (int wl = 0; wl < numWordLists; wl++) { 38 | delete keyWordLists[wl]; 39 | keyWordLists[wl] = 0; 40 | } 41 | keyWordLists[numWordLists] = 0; 42 | } 43 | 44 | void SCI_METHOD LexerBase::Release() { 45 | delete this; 46 | } 47 | 48 | int SCI_METHOD LexerBase::Version() const { 49 | return lvOriginal; 50 | } 51 | 52 | const char * SCI_METHOD LexerBase::PropertyNames() { 53 | return ""; 54 | } 55 | 56 | int SCI_METHOD LexerBase::PropertyType(const char *) { 57 | return SC_TYPE_BOOLEAN; 58 | } 59 | 60 | const char * SCI_METHOD LexerBase::DescribeProperty(const char *) { 61 | return ""; 62 | } 63 | 64 | int SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) { 65 | const char *valOld = props.Get(key); 66 | if (strcmp(val, valOld) != 0) { 67 | props.Set(key, val); 68 | return 0; 69 | } else { 70 | return -1; 71 | } 72 | } 73 | 74 | const char * SCI_METHOD LexerBase::DescribeWordListSets() { 75 | return ""; 76 | } 77 | 78 | int SCI_METHOD LexerBase::WordListSet(int n, const char *wl) { 79 | if (n < numWordLists) { 80 | WordList wlNew; 81 | wlNew.Set(wl); 82 | if (*keyWordLists[n] != wlNew) { 83 | keyWordLists[n]->Set(wl); 84 | return 0; 85 | } 86 | } 87 | return -1; 88 | } 89 | 90 | void * SCI_METHOD LexerBase::PrivateCall(int, void *) { 91 | return 0; 92 | } 93 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerBase.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerBase.h 3 | ** A simple lexer with no state. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LEXERBASE_H 9 | #define LEXERBASE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | // A simple lexer with no state 16 | class LexerBase : public ILexer { 17 | protected: 18 | PropSetSimple props; 19 | enum {numWordLists=KEYWORDSET_MAX+1}; 20 | WordList *keyWordLists[numWordLists+1]; 21 | public: 22 | LexerBase(); 23 | virtual ~LexerBase(); 24 | void SCI_METHOD Release(); 25 | int SCI_METHOD Version() const; 26 | const char * SCI_METHOD PropertyNames(); 27 | int SCI_METHOD PropertyType(const char *name); 28 | const char * SCI_METHOD DescribeProperty(const char *name); 29 | int SCI_METHOD PropertySet(const char *key, const char *val); 30 | const char * SCI_METHOD DescribeWordListSets(); 31 | int SCI_METHOD WordListSet(int n, const char *wl); 32 | void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0; 33 | void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0; 34 | void * SCI_METHOD PrivateCall(int operation, void *pointer); 35 | }; 36 | 37 | #ifdef SCI_NAMESPACE 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerModule.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerModule.cxx 3 | ** Colourise for particular languages. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #include "ILexer.h" 18 | #include "Scintilla.h" 19 | #include "SciLexer.h" 20 | 21 | #include "PropSetSimple.h" 22 | #include "WordList.h" 23 | #include "LexAccessor.h" 24 | #include "Accessor.h" 25 | #include "LexerModule.h" 26 | #include "LexerBase.h" 27 | #include "LexerSimple.h" 28 | 29 | #ifdef SCI_NAMESPACE 30 | using namespace Scintilla; 31 | #endif 32 | 33 | LexerModule::LexerModule(int language_, 34 | LexerFunction fnLexer_, 35 | const char *languageName_, 36 | LexerFunction fnFolder_, 37 | const char *const wordListDescriptions_[]) : 38 | language(language_), 39 | fnLexer(fnLexer_), 40 | fnFolder(fnFolder_), 41 | fnFactory(0), 42 | wordListDescriptions(wordListDescriptions_), 43 | languageName(languageName_) { 44 | } 45 | 46 | LexerModule::LexerModule(int language_, 47 | LexerFactoryFunction fnFactory_, 48 | const char *languageName_, 49 | const char * const wordListDescriptions_[]) : 50 | language(language_), 51 | fnLexer(0), 52 | fnFolder(0), 53 | fnFactory(fnFactory_), 54 | wordListDescriptions(wordListDescriptions_), 55 | languageName(languageName_) { 56 | } 57 | 58 | int LexerModule::GetNumWordLists() const { 59 | if (wordListDescriptions == NULL) { 60 | return -1; 61 | } else { 62 | int numWordLists = 0; 63 | 64 | while (wordListDescriptions[numWordLists]) { 65 | ++numWordLists; 66 | } 67 | 68 | return numWordLists; 69 | } 70 | } 71 | 72 | const char *LexerModule::GetWordListDescription(int index) const { 73 | assert(index < GetNumWordLists()); 74 | if (!wordListDescriptions || (index >= GetNumWordLists())) { 75 | return ""; 76 | } else { 77 | return wordListDescriptions[index]; 78 | } 79 | } 80 | 81 | ILexer *LexerModule::Create() const { 82 | if (fnFactory) 83 | return fnFactory(); 84 | else 85 | return new LexerSimple(this); 86 | } 87 | 88 | void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle, 89 | WordList *keywordlists[], Accessor &styler) const { 90 | if (fnLexer) 91 | fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler); 92 | } 93 | 94 | void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, 95 | WordList *keywordlists[], Accessor &styler) const { 96 | if (fnFolder) { 97 | int lineCurrent = styler.GetLine(startPos); 98 | // Move back one line in case deletion wrecked current line fold state 99 | if (lineCurrent > 0) { 100 | lineCurrent--; 101 | int newStartPos = styler.LineStart(lineCurrent); 102 | lengthDoc += startPos - newStartPos; 103 | startPos = newStartPos; 104 | initStyle = 0; 105 | if (startPos > 0) { 106 | initStyle = styler.StyleAt(startPos - 1); 107 | } 108 | } 109 | fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerModule.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerModule.h 3 | ** Colourise for particular languages. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LEXERMODULE_H 9 | #define LEXERMODULE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class Accessor; 16 | class WordList; 17 | 18 | typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, 19 | WordList *keywordlists[], Accessor &styler); 20 | typedef ILexer *(*LexerFactoryFunction)(); 21 | 22 | /** 23 | * A LexerModule is responsible for lexing and folding a particular language. 24 | * The class maintains a list of LexerModules which can be searched to find a 25 | * module appropriate to a particular language. 26 | */ 27 | class LexerModule { 28 | protected: 29 | int language; 30 | LexerFunction fnLexer; 31 | LexerFunction fnFolder; 32 | LexerFactoryFunction fnFactory; 33 | const char * const * wordListDescriptions; 34 | 35 | public: 36 | const char *languageName; 37 | LexerModule(int language_, 38 | LexerFunction fnLexer_, 39 | const char *languageName_=0, 40 | LexerFunction fnFolder_=0, 41 | const char * const wordListDescriptions_[] = NULL); 42 | LexerModule(int language_, 43 | LexerFactoryFunction fnFactory_, 44 | const char *languageName_, 45 | const char * const wordListDescriptions_[] = NULL); 46 | virtual ~LexerModule() { 47 | } 48 | int GetLanguage() const { return language; } 49 | 50 | // -1 is returned if no WordList information is available 51 | int GetNumWordLists() const; 52 | const char *GetWordListDescription(int index) const; 53 | 54 | ILexer *Create() const; 55 | 56 | virtual void Lex(unsigned int startPos, int length, int initStyle, 57 | WordList *keywordlists[], Accessor &styler) const; 58 | virtual void Fold(unsigned int startPos, int length, int initStyle, 59 | WordList *keywordlists[], Accessor &styler) const; 60 | 61 | friend class Catalogue; 62 | }; 63 | 64 | inline int Maximum(int a, int b) { 65 | return (a > b) ? a : b; 66 | } 67 | 68 | // Shut up annoying Visual C++ warnings: 69 | #ifdef _MSC_VER 70 | #pragma warning(disable: 4244 4309) 71 | #endif 72 | 73 | #ifdef SCI_NAMESPACE 74 | } 75 | #endif 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerNoExceptions.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerNoExceptions.cxx 3 | ** A simple lexer with no state which does not throw exceptions so can be used in an external lexer. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "ILexer.h" 16 | #include "Scintilla.h" 17 | #include "SciLexer.h" 18 | 19 | #include "PropSetSimple.h" 20 | #include "WordList.h" 21 | #include "LexAccessor.h" 22 | #include "Accessor.h" 23 | #include "LexerModule.h" 24 | #include "LexerBase.h" 25 | #include "LexerNoExceptions.h" 26 | 27 | #ifdef SCI_NAMESPACE 28 | using namespace Scintilla; 29 | #endif 30 | 31 | int SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) { 32 | try { 33 | return LexerBase::PropertySet(key, val); 34 | } catch (...) { 35 | // Should not throw into caller as may be compiled with different compiler or options 36 | } 37 | return -1; 38 | } 39 | 40 | int SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) { 41 | try { 42 | return LexerBase::WordListSet(n, wl); 43 | } catch (...) { 44 | // Should not throw into caller as may be compiled with different compiler or options 45 | } 46 | return -1; 47 | } 48 | 49 | void SCI_METHOD LexerNoExceptions::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { 50 | try { 51 | Accessor astyler(pAccess, &props); 52 | Lexer(startPos, length, initStyle, pAccess, astyler); 53 | astyler.Flush(); 54 | } catch (...) { 55 | // Should not throw into caller as may be compiled with different compiler or options 56 | pAccess->SetErrorStatus(SC_STATUS_FAILURE); 57 | } 58 | } 59 | void SCI_METHOD LexerNoExceptions::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { 60 | try { 61 | Accessor astyler(pAccess, &props); 62 | Folder(startPos, length, initStyle, pAccess, astyler); 63 | astyler.Flush(); 64 | } catch (...) { 65 | // Should not throw into caller as may be compiled with different compiler or options 66 | pAccess->SetErrorStatus(SC_STATUS_FAILURE); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerNoExceptions.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerNoExceptions.h 3 | ** A simple lexer with no state. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LEXERNOEXCEPTIONS_H 9 | #define LEXERNOEXCEPTIONS_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | // A simple lexer with no state 16 | class LexerNoExceptions : public LexerBase { 17 | public: 18 | // TODO Also need to prevent exceptions in constructor and destructor 19 | int SCI_METHOD PropertySet(const char *key, const char *val); 20 | int SCI_METHOD WordListSet(int n, const char *wl); 21 | void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); 22 | void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *); 23 | 24 | virtual void Lexer(unsigned int startPos, int length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; 25 | virtual void Folder(unsigned int startPos, int length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; 26 | }; 27 | 28 | #ifdef SCI_NAMESPACE 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerSimple.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerSimple.cxx 3 | ** A simple lexer with no state. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #include "ILexer.h" 18 | #include "Scintilla.h" 19 | #include "SciLexer.h" 20 | 21 | #include "PropSetSimple.h" 22 | #include "WordList.h" 23 | #include "LexAccessor.h" 24 | #include "Accessor.h" 25 | #include "LexerModule.h" 26 | #include "LexerBase.h" 27 | #include "LexerSimple.h" 28 | 29 | #ifdef SCI_NAMESPACE 30 | using namespace Scintilla; 31 | #endif 32 | 33 | LexerSimple::LexerSimple(const LexerModule *module_) : module(module_) { 34 | for (int wl = 0; wl < module->GetNumWordLists(); wl++) { 35 | if (!wordLists.empty()) 36 | wordLists += "\n"; 37 | wordLists += module->GetWordListDescription(wl); 38 | } 39 | } 40 | 41 | const char * SCI_METHOD LexerSimple::DescribeWordListSets() { 42 | return wordLists.c_str(); 43 | } 44 | 45 | void SCI_METHOD LexerSimple::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) { 46 | Accessor astyler(pAccess, &props); 47 | module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler); 48 | astyler.Flush(); 49 | } 50 | 51 | void SCI_METHOD LexerSimple::Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) { 52 | if (props.GetInt("fold")) { 53 | Accessor astyler(pAccess, &props); 54 | module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler); 55 | astyler.Flush(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerSimple.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerSimple.h 3 | ** A simple lexer with no state. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LEXERSIMPLE_H 9 | #define LEXERSIMPLE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | // A simple lexer with no state 16 | class LexerSimple : public LexerBase { 17 | const LexerModule *module; 18 | std::string wordLists; 19 | public: 20 | explicit LexerSimple(const LexerModule *module_); 21 | const char * SCI_METHOD DescribeWordListSets(); 22 | void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); 23 | void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); 24 | }; 25 | 26 | #ifdef SCI_NAMESPACE 27 | } 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /scintilla/lexlib/PropSetSimple.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file PropSetSimple.h 3 | ** A basic string to string map. 4 | **/ 5 | // Copyright 1998-2009 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef PROPSETSIMPLE_H 9 | #define PROPSETSIMPLE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class PropSetSimple { 16 | void *impl; 17 | void Set(const char *keyVal); 18 | public: 19 | PropSetSimple(); 20 | virtual ~PropSetSimple(); 21 | void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1); 22 | void SetMultiple(const char *); 23 | const char *Get(const char *key) const; 24 | int GetExpanded(const char *key, char *result) const; 25 | int GetInt(const char *key, int defaultValue=0) const; 26 | }; 27 | 28 | #ifdef SCI_NAMESPACE 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /scintilla/lexlib/SparseState.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file SparseState.h 3 | ** Hold lexer state that may change rarely. 4 | ** This is often per-line state such as whether a particular type of section has been entered. 5 | ** A state continues until it is changed. 6 | **/ 7 | // Copyright 2011 by Neil Hodgson 8 | // The License.txt file describes the conditions under which this software may be distributed. 9 | 10 | #ifndef SPARSESTATE_H 11 | #define SPARSESTATE_H 12 | 13 | #ifdef SCI_NAMESPACE 14 | namespace Scintilla { 15 | #endif 16 | 17 | template 18 | class SparseState { 19 | struct State { 20 | int position; 21 | T value; 22 | State(int position_, T value_) : position(position_), value(value_) { 23 | } 24 | inline bool operator<(const State &other) const { 25 | return position < other.position; 26 | } 27 | inline bool operator==(const State &other) const { 28 | return (position == other.position) && (value == other.value); 29 | } 30 | }; 31 | int positionFirst; 32 | typedef std::vector stateVector; 33 | stateVector states; 34 | 35 | typename stateVector::iterator Find(int position) { 36 | State searchValue(position, T()); 37 | return std::lower_bound(states.begin(), states.end(), searchValue); 38 | } 39 | 40 | public: 41 | explicit SparseState(int positionFirst_=-1) { 42 | positionFirst = positionFirst_; 43 | } 44 | void Set(int position, T value) { 45 | Delete(position); 46 | if (states.empty() || (value != states[states.size()-1].value)) { 47 | states.push_back(State(position, value)); 48 | } 49 | } 50 | T ValueAt(int position) { 51 | if (states.empty()) 52 | return T(); 53 | if (position < states[0].position) 54 | return T(); 55 | typename stateVector::iterator low = Find(position); 56 | if (low == states.end()) { 57 | return states[states.size()-1].value; 58 | } else { 59 | if (low->position > position) { 60 | --low; 61 | } 62 | return low->value; 63 | } 64 | } 65 | bool Delete(int position) { 66 | typename stateVector::iterator low = Find(position); 67 | if (low != states.end()) { 68 | states.erase(low, states.end()); 69 | return true; 70 | } 71 | return false; 72 | } 73 | size_t size() const { 74 | return states.size(); 75 | } 76 | 77 | // Returns true if Merge caused a significant change 78 | bool Merge(const SparseState &other, int ignoreAfter) { 79 | // Changes caused beyond ignoreAfter are not significant 80 | Delete(ignoreAfter+1); 81 | 82 | bool different = true; 83 | bool changed = false; 84 | typename stateVector::iterator low = Find(other.positionFirst); 85 | if (static_cast(states.end() - low) == other.states.size()) { 86 | // Same number in other as after positionFirst in this 87 | different = !std::equal(low, states.end(), other.states.begin()); 88 | } 89 | if (different) { 90 | if (low != states.end()) { 91 | states.erase(low, states.end()); 92 | changed = true; 93 | } 94 | typename stateVector::const_iterator startOther = other.states.begin(); 95 | if (!states.empty() && !other.states.empty() && states.back().value == startOther->value) 96 | ++startOther; 97 | if (startOther != other.states.end()) { 98 | states.insert(states.end(), startOther, other.states.end()); 99 | changed = true; 100 | } 101 | } 102 | return changed; 103 | } 104 | }; 105 | 106 | #ifdef SCI_NAMESPACE 107 | } 108 | #endif 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /scintilla/lexlib/StringCopy.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file StringCopy.h 3 | ** Safe string copy function which always NUL terminates. 4 | ** ELEMENTS macro for determining array sizes. 5 | **/ 6 | // Copyright 2013 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef STRINGCOPY_H 10 | #define STRINGCOPY_H 11 | 12 | #ifdef SCI_NAMESPACE 13 | namespace Scintilla { 14 | #endif 15 | 16 | // Safer version of string copy functions like strcpy, wcsncpy, etc. 17 | // Instantiate over fixed length strings of both char and wchar_t. 18 | // May truncate if source doesn't fit into dest with room for NUL. 19 | 20 | template 21 | void StringCopy(T (&dest)[count], const T* source) { 22 | for (size_t i=0; i 6 | // This file is in the public domain. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "ILexer.h" 15 | 16 | #include "LexAccessor.h" 17 | #include "Accessor.h" 18 | #include "StyleContext.h" 19 | 20 | #ifdef SCI_NAMESPACE 21 | using namespace Scintilla; 22 | #endif 23 | 24 | static void getRange(unsigned int start, 25 | unsigned int end, 26 | LexAccessor &styler, 27 | char *s, 28 | unsigned int len) { 29 | unsigned int i = 0; 30 | while ((i < end - start + 1) && (i < len-1)) { 31 | s[i] = styler[start + i]; 32 | i++; 33 | } 34 | s[i] = '\0'; 35 | } 36 | 37 | void StyleContext::GetCurrent(char *s, unsigned int len) { 38 | getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); 39 | } 40 | 41 | static void getRangeLowered(unsigned int start, 42 | unsigned int end, 43 | LexAccessor &styler, 44 | char *s, 45 | unsigned int len) { 46 | unsigned int i = 0; 47 | while ((i < end - start + 1) && (i < len-1)) { 48 | s[i] = static_cast(tolower(styler[start + i])); 49 | i++; 50 | } 51 | s[i] = '\0'; 52 | } 53 | 54 | void StyleContext::GetCurrentLowered(char *s, unsigned int len) { 55 | getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); 56 | } 57 | -------------------------------------------------------------------------------- /scintilla/lexlib/WordList.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file WordList.h 3 | ** Hold a list of words. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef WORDLIST_H 9 | #define WORDLIST_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | */ 17 | class WordList { 18 | // Each word contains at least one character - a empty word acts as sentinel at the end. 19 | char **words; 20 | char *list; 21 | int len; 22 | bool onlyLineEnds; ///< Delimited by any white space or only line ends 23 | int starts[256]; 24 | public: 25 | explicit WordList(bool onlyLineEnds_ = false); 26 | ~WordList(); 27 | operator bool() const; 28 | bool operator!=(const WordList &other) const; 29 | int Length() const; 30 | void Clear(); 31 | void Set(const char *s); 32 | bool InList(const char *s) const; 33 | bool InListAbbreviated(const char *s, const char marker) const; 34 | const char *WordAt(int n) const; 35 | }; 36 | 37 | #ifdef SCI_NAMESPACE 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /scintilla/qt/README: -------------------------------------------------------------------------------- 1 | README for building of Scintilla on Qt 2 | 3 | There are three different Scintilla libraries that can be produced: 4 | 5 | ScintillaEditBase 6 | A basic widget callable from C++ which is small and can be used just as is 7 | or with higher level functionality added. 8 | 9 | ScintillaEdit 10 | A more complete C++ widget with a method for every Scintilla API and a 11 | secondary API allowing direct access to document objects. 12 | 13 | ScintillaEditPy 14 | A Python callable version of ScintillaEdit using the PySide bindings. 15 | 16 | Building a library 17 | 18 | ScintillaEditBase can be built without performing any generation steps. 19 | The ScintillaEditBase/ScintillaEditBase.pro project can be loaded into 20 | Qt Creator and the "Build All" command performed. 21 | Alternatively, run "qmake" to build make files and then use the platform 22 | make to build. Most commonly, use "make" on Unix and "nmake" 23 | on Windows. 24 | 25 | ScintillaEdit requires a generation command be run first. From the 26 | ScintillaEdit directory: 27 | 28 | python WidgetGen.py 29 | 30 | After the generation command has run, the ScintillaEdit.h and 31 | ScintillaEdit.cpp files will have been populated with the Scintilla API 32 | methods. 33 | To build, use Qt Creator or qmake and make as for ScintillaEditBase. 34 | 35 | ScintillaEditPy is more complex and instructions are found in 36 | ScintillaEditPy/README. 37 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEdit/ScintillaDocument.h: -------------------------------------------------------------------------------- 1 | // ScintillaDocument.h 2 | // Wrapper for Scintilla document object so it can be manipulated independently. 3 | // Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware 4 | 5 | #ifndef SCINTILLADOCUMENT_H 6 | #define SCINTILLADOCUMENT_H 7 | 8 | #include 9 | 10 | class WatcherHelper; 11 | 12 | #ifndef EXPORT_IMPORT_API 13 | #ifdef WIN32 14 | #ifdef MAKING_LIBRARY 15 | #define EXPORT_IMPORT_API __declspec(dllexport) 16 | #else 17 | // Defining dllimport upsets moc 18 | #define EXPORT_IMPORT_API __declspec(dllimport) 19 | //#define EXPORT_IMPORT_API 20 | #endif 21 | #else 22 | #define EXPORT_IMPORT_API 23 | #endif 24 | #endif 25 | 26 | class EXPORT_IMPORT_API ScintillaDocument : public QObject 27 | { 28 | Q_OBJECT 29 | 30 | void *pdoc; 31 | WatcherHelper *docWatcher; 32 | 33 | public: 34 | explicit ScintillaDocument(QObject *parent = 0, void *pdoc_=0); 35 | virtual ~ScintillaDocument(); 36 | void *pointer(); 37 | 38 | int line_from_position(int pos); 39 | bool is_cr_lf(int pos); 40 | bool delete_chars(int pos, int len); 41 | int undo(); 42 | int redo(); 43 | bool can_undo(); 44 | bool can_redo(); 45 | void delete_undo_history(); 46 | bool set_undo_collection(bool collect_undo); 47 | bool is_collecting_undo(); 48 | void begin_undo_action(); 49 | void end_undo_action(); 50 | void set_save_point(); 51 | bool is_save_point(); 52 | void set_read_only(bool read_only); 53 | bool is_read_only(); 54 | void insert_string(int position, QByteArray &str); 55 | QByteArray get_char_range(int position, int length); 56 | char style_at(int position); 57 | int line_start(int lineno); 58 | int line_end(int lineno); 59 | int line_end_position(int pos); 60 | int length(); 61 | int lines_total(); 62 | void start_styling(int position, char flags); 63 | bool set_style_for(int length, char style); 64 | int get_end_styled(); 65 | void ensure_styled_to(int position); 66 | void set_current_indicator(int indic); 67 | void decoration_fill_range(int position, int value, int fillLength); 68 | int decorations_value_at(int indic, int position); 69 | int decorations_start(int indic, int position); 70 | int decorations_end(int indic, int position); 71 | int get_code_page(); 72 | void set_code_page(int code_page); 73 | int get_eol_mode(); 74 | void set_eol_mode(int eol_mode); 75 | int move_position_outside_char(int pos, int move_dir, bool check_line_end); 76 | 77 | private: 78 | void emit_modify_attempt(); 79 | void emit_save_point(bool atSavePoint); 80 | void emit_modified(int position, int modification_type, const QByteArray& text, int length, 81 | int linesAdded, int line, int foldLevelNow, int foldLevelPrev); 82 | void emit_style_needed(int pos); 83 | void emit_lexer_changed(); 84 | void emit_error_occurred(int status); 85 | 86 | signals: 87 | void modify_attempt(); 88 | void save_point(bool atSavePoint); 89 | void modified(int position, int modification_type, const QByteArray& text, int length, 90 | int linesAdded, int line, int foldLevelNow, int foldLevelPrev); 91 | void style_needed(int pos); 92 | void lexer_changed(); 93 | void error_occurred(int status); 94 | 95 | friend class WatcherHelper; 96 | 97 | }; 98 | 99 | #endif // SCINTILLADOCUMENT_H 100 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEdit/ScintillaEdit.cpp.template: -------------------------------------------------------------------------------- 1 | // ScintillaEdit.cpp 2 | // Extended version of ScintillaEditBase with a method for each API 3 | // Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware 4 | 5 | #include "ScintillaEdit.h" 6 | 7 | ScintillaEdit::ScintillaEdit(QWidget *parent) : ScintillaEditBase(parent) { 8 | } 9 | 10 | ScintillaEdit::~ScintillaEdit() { 11 | } 12 | 13 | QByteArray ScintillaEdit::TextReturner(int message, uptr_t wParam) const { 14 | int length = send(message, wParam, 0); 15 | QByteArray ba(length, '\0'); 16 | send(message, wParam, (sptr_t)ba.data()); 17 | // Remove extra NULs 18 | if (ba.size() > 0 && ba.at(ba.size()-1) == 0) 19 | ba.chop(1); 20 | return ba; 21 | } 22 | 23 | QPairScintillaEdit::find_text(int flags, const char *text, int cpMin, int cpMax) { 24 | struct TextToFind ft = {{0, 0}, 0, {0, 0}}; 25 | ft.chrg.cpMin = cpMin; 26 | ft.chrg.cpMax = cpMax; 27 | ft.chrgText.cpMin = cpMin; 28 | ft.chrgText.cpMax = cpMax; 29 | ft.lpstrText = const_cast(text); 30 | 31 | int start = send(SCI_FINDTEXT, flags, (uptr_t) (&ft)); 32 | 33 | return QPair(start, ft.chrgText.cpMax); 34 | } 35 | 36 | QByteArray ScintillaEdit::get_text_range(int start, int end) { 37 | if (start > end) 38 | start = end; 39 | 40 | int length = end-start; 41 | QByteArray ba(length+1, '\0'); 42 | struct TextRange tr = {{start, end}, ba.data()}; 43 | 44 | send(SCI_GETTEXTRANGE, 0, (sptr_t)&tr); 45 | ba.chop(1); // Remove extra NUL 46 | 47 | return ba; 48 | } 49 | 50 | ScintillaDocument *ScintillaEdit::get_doc() { 51 | return new ScintillaDocument(0, (void *)send(SCI_GETDOCPOINTER, 0, 0)); 52 | } 53 | 54 | void ScintillaEdit::set_doc(ScintillaDocument *pdoc_) { 55 | send(SCI_SETDOCPOINTER, 0, (sptr_t)(pdoc_->pointer())); 56 | } 57 | 58 | long ScintillaEdit::format_range(bool draw, QPaintDevice* target, QPaintDevice* measure, 59 | const QRect& print_rect, const QRect& page_rect, 60 | long range_start, long range_end) 61 | { 62 | Sci_RangeToFormat to_format; 63 | 64 | to_format.hdc = target; 65 | to_format.hdcTarget = measure; 66 | 67 | to_format.rc.left = print_rect.left(); 68 | to_format.rc.top = print_rect.top(); 69 | to_format.rc.right = print_rect.right(); 70 | to_format.rc.bottom = print_rect.bottom(); 71 | 72 | to_format.rcPage.left = page_rect.left(); 73 | to_format.rcPage.top = page_rect.top(); 74 | to_format.rcPage.right = page_rect.right(); 75 | to_format.rcPage.bottom = page_rect.bottom(); 76 | 77 | to_format.chrg.cpMin = range_start; 78 | to_format.chrg.cpMax = range_end; 79 | 80 | return send(SCI_FORMATRANGE, draw, reinterpret_cast(&to_format)); 81 | } 82 | 83 | /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ 84 | /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ 85 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEdit/ScintillaEdit.h.template: -------------------------------------------------------------------------------- 1 | // ScintillaEdit.h 2 | // Extended version of ScintillaEditBase with a method for each API 3 | // Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware 4 | 5 | #ifndef SCINTILLAEDIT_H 6 | #define SCINTILLAEDIT_H 7 | 8 | #include 9 | 10 | #include "ScintillaEditBase.h" 11 | #include "ScintillaDocument.h" 12 | 13 | #ifdef SCI_NAMESPACE 14 | namespace Scintilla { 15 | #endif 16 | 17 | #ifndef EXPORT_IMPORT_API 18 | #ifdef WIN32 19 | #ifdef MAKING_LIBRARY 20 | #define EXPORT_IMPORT_API __declspec(dllexport) 21 | #else 22 | // Defining dllimport upsets moc 23 | #define EXPORT_IMPORT_API __declspec(dllimport) 24 | //#define EXPORT_IMPORT_API 25 | #endif 26 | #else 27 | #define EXPORT_IMPORT_API 28 | #endif 29 | #endif 30 | 31 | class EXPORT_IMPORT_API ScintillaEdit : public ScintillaEditBase { 32 | Q_OBJECT 33 | 34 | public: 35 | ScintillaEdit(QWidget *parent = 0); 36 | virtual ~ScintillaEdit(); 37 | 38 | QByteArray TextReturner(int message, uptr_t wParam) const; 39 | 40 | QPairfind_text(int flags, const char *text, int cpMin, int cpMax); 41 | QByteArray get_text_range(int start, int end); 42 | ScintillaDocument *get_doc(); 43 | void set_doc(ScintillaDocument *pdoc_); 44 | 45 | // Same as previous two methods but with Qt style names 46 | QPairfindText(int flags, const char *text, int cpMin, int cpMax) { 47 | return find_text(flags, text, cpMin, cpMax); 48 | } 49 | 50 | QByteArray textRange(int start, int end) { 51 | return get_text_range(start, end); 52 | } 53 | 54 | // Exposing the FORMATRANGE api with both underscore & qt style names 55 | long format_range(bool draw, QPaintDevice* target, QPaintDevice* measure, 56 | const QRect& print_rect, const QRect& page_rect, 57 | long range_start, long range_end); 58 | long formatRange(bool draw, QPaintDevice* target, QPaintDevice* measure, 59 | const QRect& print_rect, const QRect& page_rect, 60 | long range_start, long range_end) { 61 | return format_range(draw, target, measure, print_rect, page_rect, 62 | range_start, range_end); 63 | } 64 | 65 | /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ 66 | /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ 67 | 68 | }; 69 | 70 | #ifdef SCI_NAMESPACE 71 | } 72 | #endif 73 | 74 | #endif /* SCINTILLAEDIT_H */ 75 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEdit/ScintillaEdit.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2011-05-05T12:41:23 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 9 | 10 | TARGET = ScintillaEdit 11 | TEMPLATE = lib 12 | CONFIG += lib_bundle 13 | 14 | VERSION = 3.4.4 15 | 16 | SOURCES += \ 17 | ScintillaEdit.cpp \ 18 | ScintillaDocument.cpp \ 19 | ../ScintillaEditBase/PlatQt.cpp \ 20 | ../ScintillaEditBase/ScintillaQt.cpp \ 21 | ../ScintillaEditBase/ScintillaEditBase.cpp \ 22 | ../../src/XPM.cxx \ 23 | ../../src/ViewStyle.cxx \ 24 | ../../src/UniConversion.cxx \ 25 | ../../src/Style.cxx \ 26 | ../../src/Selection.cxx \ 27 | ../../src/ScintillaBase.cxx \ 28 | ../../src/RunStyles.cxx \ 29 | ../../src/RESearch.cxx \ 30 | ../../src/PositionCache.cxx \ 31 | ../../src/PerLine.cxx \ 32 | ../../src/LineMarker.cxx \ 33 | ../../src/KeyMap.cxx \ 34 | ../../src/Indicator.cxx \ 35 | ../../src/ExternalLexer.cxx \ 36 | ../../src/Editor.cxx \ 37 | ../../src/Document.cxx \ 38 | ../../src/Decoration.cxx \ 39 | ../../src/ContractionState.cxx \ 40 | ../../src/CharClassify.cxx \ 41 | ../../src/CellBuffer.cxx \ 42 | ../../src/Catalogue.cxx \ 43 | ../../src/CaseFolder.cxx \ 44 | ../../src/CaseConvert.cxx \ 45 | ../../src/CallTip.cxx \ 46 | ../../src/AutoComplete.cxx \ 47 | ../../lexlib/WordList.cxx \ 48 | ../../lexlib/StyleContext.cxx \ 49 | ../../lexlib/PropSetSimple.cxx \ 50 | ../../lexlib/LexerSimple.cxx \ 51 | ../../lexlib/LexerNoExceptions.cxx \ 52 | ../../lexlib/LexerModule.cxx \ 53 | ../../lexlib/LexerBase.cxx \ 54 | ../../lexlib/CharacterSet.cxx \ 55 | ../../lexlib/CharacterCategory.cxx \ 56 | ../../lexlib/Accessor.cxx \ 57 | ../../lexers/*.cxx 58 | 59 | HEADERS += \ 60 | ScintillaEdit.h \ 61 | ScintillaDocument.h \ 62 | ../ScintillaEditBase/ScintillaEditBase.h \ 63 | ../ScintillaEditBase/ScintillaQt.h 64 | 65 | OTHER_FILES += 66 | 67 | INCLUDEPATH += ../ScintillaEditBase ../../include ../../src ../../lexlib 68 | 69 | DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 SCI_LEXER=1 _CRT_SECURE_NO_DEPRECATE=1 70 | 71 | DESTDIR = ../../bin 72 | DLLDESTDIR = ../../bin 73 | 74 | macx { 75 | QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/ 76 | } 77 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEditBase/Notes.txt: -------------------------------------------------------------------------------- 1 | 2 | Issues with Scintilla for Qt 3 | 4 | Qt reports character descenders are 1 pixel shorter than they really are. 5 | There is a tweak in the code to add a pixel in. This may have to be reviewed for Qt 5. 6 | There's a comment in the Qt code for Windows: 7 | // ### we subtract 1 to even out the historical +1 in QFontMetrics's 8 | // ### height=asc+desc+1 equation. Fix in Qt5. 9 | 10 | The clocks used aren't great. QTime is a time since midnight clock so wraps around and 11 | is only accurate to, at best, milliseconds. 12 | 13 | On OS X drawing text into a pixmap moves it around 1 pixel to the right compared to drawing 14 | it directly onto a window. Buffered drawing turned off by default to avoid this. 15 | Reported as QTBUG-19483. 16 | 17 | Only one QPainter can be active on any widget at a time. Scintilla only draws into one 18 | widget but reenters for measurement. 19 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEditPy/ScintillaConstants.py.template: -------------------------------------------------------------------------------- 1 | # ScintillaConstants.py 2 | # Define all the symbolic constants from Scintilla.iface so Python code can use them 3 | # Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware 4 | 5 | # ++Autogenerated -- start of section automatically generated from Scintilla.iface */ 6 | # --Autogenerated -- end of section automatically generated from Scintilla.iface */ 7 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEditPy/global.h: -------------------------------------------------------------------------------- 1 | #include "pyside_global.h" 2 | 3 | #include "ScintillaEditBase.h" 4 | #include "ScintillaEdit.h" 5 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEditPy/typesystem_ScintillaEdit.xml.template: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | int margin = PyInt_AsLong(%PYARG_1); 21 | if (margin == -1 && PyErr_Occurred()) 22 | return NULL; 23 | unsigned long mask = PyInt_AsUnsignedLongMask(%PYARG_2); 24 | if (margin == -1 && PyErr_Occurred()) 25 | return NULL; 26 | 27 | %CPPSELF->set_margin_mask_n(margin, static_cast<int>(mask)); 28 | Py_RETURN_NONE; 29 | 30 | 31 | 32 | 33 | int margin = PyInt_AsLong(%PYARG_1); 34 | if (margin == -1 && PyErr_Occurred()) 35 | return NULL; 36 | unsigned int mask = (unsigned int)%CPPSELF->get_margin_mask_n(margin); 37 | %PYARG_0 = PyInt_FromSize_t(mask); 38 | 39 | 40 | 41 | 42 | int margin = PyInt_AsLong(%PYARG_1); 43 | if (margin == -1 && PyErr_Occurred()) 44 | return NULL; 45 | unsigned long mask = PyInt_AsUnsignedLongMask(%PYARG_2); 46 | if (margin == -1 && PyErr_Occurred()) 47 | return NULL; 48 | 49 | %CPPSELF->setMarginMaskN(margin, static_cast<int>(mask)); 50 | Py_RETURN_NONE; 51 | 52 | 53 | 54 | 55 | int margin = PyInt_AsLong(%PYARG_1); 56 | if (margin == -1 && PyErr_Occurred()) 57 | return NULL; 58 | unsigned int mask = (unsigned int)%CPPSELF->marginMaskN(margin); 59 | %PYARG_0 = PyInt_FromSize_t(mask); 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /scintilla/scripts/GenerateCharacterCategory.py: -------------------------------------------------------------------------------- 1 | # Script to generate CharacterCategory.cxx from Python's Unicode data 2 | # Should be run rarely when a Python with a new version of Unicode data is available. 3 | # Requires Python 3.3 or later 4 | # Should not be run with old versions of Python. 5 | 6 | import codecs, os, platform, sys, unicodedata 7 | 8 | from FileGenerator import Regenerate 9 | 10 | def findCategories(filename): 11 | with codecs.open(filename, "r", "UTF-8") as infile: 12 | lines = [x.strip() for x in infile.readlines() if "\tcc" in x] 13 | values = "".join(lines).replace(" ","").split(",") 14 | print(values) 15 | return [v[2:] for v in values] 16 | 17 | def updateCharacterCategory(filename): 18 | values = ["// Created with Python %s, Unicode %s" % ( 19 | platform.python_version(), unicodedata.unidata_version)] 20 | category = unicodedata.category(chr(0)) 21 | startRange = 0 22 | for ch in range(sys.maxunicode): 23 | uch = chr(ch) 24 | if unicodedata.category(uch) != category: 25 | value = startRange * 32 + categories.index(category) 26 | values.append("%d," % value) 27 | category = unicodedata.category(uch) 28 | startRange = ch 29 | value = startRange * 32 + categories.index(category) 30 | values.append("%d," % value) 31 | 32 | Regenerate(filename, "//", values) 33 | 34 | categories = findCategories("../lexlib/CharacterCategory.h") 35 | 36 | updateCharacterCategory("../lexlib/CharacterCategory.cxx") 37 | -------------------------------------------------------------------------------- /scintilla/scripts/HFacer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface 3 | # definition file. 4 | # Implemented 2000 by Neil Hodgson neilh@scintilla.org 5 | # Requires Python 2.5 or later 6 | 7 | import sys 8 | import os 9 | import Face 10 | 11 | from FileGenerator import UpdateFile, Generate, Regenerate, UpdateLineInFile, lineEnd 12 | 13 | def printLexHFile(f): 14 | out = [] 15 | for name in f.order: 16 | v = f.features[name] 17 | if v["FeatureType"] in ["val"]: 18 | if "SCE_" in name or "SCLEX_" in name: 19 | out.append("#define " + name + " " + v["Value"]) 20 | return out 21 | 22 | def printHFile(f): 23 | out = [] 24 | previousCategory = "" 25 | anyProvisional = False 26 | for name in f.order: 27 | v = f.features[name] 28 | if v["Category"] != "Deprecated": 29 | if v["Category"] == "Provisional" and previousCategory != "Provisional": 30 | out.append("#ifndef SCI_DISABLE_PROVISIONAL") 31 | anyProvisional = True 32 | previousCategory = v["Category"] 33 | if v["FeatureType"] in ["fun", "get", "set"]: 34 | featureDefineName = "SCI_" + name.upper() 35 | out.append("#define " + featureDefineName + " " + v["Value"]) 36 | elif v["FeatureType"] in ["evt"]: 37 | featureDefineName = "SCN_" + name.upper() 38 | out.append("#define " + featureDefineName + " " + v["Value"]) 39 | elif v["FeatureType"] in ["val"]: 40 | if not ("SCE_" in name or "SCLEX_" in name): 41 | out.append("#define " + name + " " + v["Value"]) 42 | if anyProvisional: 43 | out.append("#endif") 44 | return out 45 | 46 | def RegenerateAll(root, showMaxID): 47 | f = Face.Face() 48 | f.ReadFromFile(root + "include/Scintilla.iface") 49 | Regenerate(root + "include/Scintilla.h", "/* ", printHFile(f)) 50 | Regenerate(root + "include/SciLexer.h", "/* ", printLexHFile(f)) 51 | if showMaxID: 52 | valueSet = set(int(x) for x in f.values if int(x) < 3000) 53 | maximumID = max(valueSet) 54 | print("Maximum ID is %d" % maximumID) 55 | #~ valuesUnused = sorted(x for x in range(2001,maximumID) if x not in valueSet) 56 | #~ print("\nUnused values") 57 | #~ for v in valuesUnused: 58 | #~ print(v) 59 | 60 | if __name__ == "__main__": 61 | RegenerateAll("../", True) 62 | -------------------------------------------------------------------------------- /scintilla/scripts/HeaderOrder.txt: -------------------------------------------------------------------------------- 1 | // Define the standard order in which to include header files 2 | // All platform headers should be included before Scintilla headers 3 | // and each of these groups are then divided into directory groups. 4 | 5 | // C standard library 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | // C++ wrappers of C standard library 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | // C++ standard library 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | // GTK+ headers 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | // Windows headers 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | // Cocoa headers 52 | #include 53 | 54 | // Scintilla headers 55 | 56 | // Non-platform-specific headers 57 | 58 | // include 59 | #include "Platform.h" 60 | 61 | #include "ILexer.h" 62 | #include "Scintilla.h" 63 | #include "ScintillaWidget.h" 64 | 65 | #include "SciLexer.h" 66 | 67 | // lexlib 68 | #include "StringCopy.h" 69 | #include "PropSetSimple.h" 70 | #include "WordList.h" 71 | #include "LexAccessor.h" 72 | #include "Accessor.h" 73 | #include "StyleContext.h" 74 | #include "CharacterSet.h" 75 | #include "CharacterCategory.h" 76 | #include "LexerModule.h" 77 | #include "OptionSet.h" 78 | #include "SparseState.h" 79 | #include "SubStyles.h" 80 | #include "LexerBase.h" 81 | #include "LexerSimple.h" 82 | #include "LexerNoExceptions.h" 83 | 84 | // src 85 | #include "Catalogue.h" 86 | 87 | #include "SplitVector.h" 88 | #include "Partitioning.h" 89 | #include "RunStyles.h" 90 | #include "ContractionState.h" 91 | #include "CellBuffer.h" 92 | #include "CallTip.h" 93 | #include "KeyMap.h" 94 | #include "Indicator.h" 95 | #include "XPM.h" 96 | #include "LineMarker.h" 97 | #include "Style.h" 98 | #include "ViewStyle.h" 99 | #include "CharClassify.h" 100 | #include "Decoration.h" 101 | #include "CaseFolder.h" 102 | #include "Document.h" 103 | #include "CaseConvert.h" 104 | #include "UniConversion.h" 105 | #include "UnicodeFromUTF8.h" 106 | #include "Selection.h" 107 | #include "PositionCache.h" 108 | #include "FontQuality.h" 109 | #include "Editor.h" 110 | 111 | #include "AutoComplete.h" 112 | #include "ScintillaBase.h" 113 | 114 | #include "ExternalLexer.h" 115 | 116 | // Platform-specific headers 117 | 118 | // win32 119 | #include "PlatWin.h" 120 | 121 | // gtk 122 | #include "Converter.h" 123 | 124 | // cocoa 125 | #include "QuartzTextStyle.h" 126 | #include "QuartzTextStyleAttribute.h" 127 | #import "InfoBarCommunicator.h" 128 | #include "InfoBar.h" 129 | -------------------------------------------------------------------------------- /scintilla/scripts/LexGen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # LexGen.py - implemented 2002 by Neil Hodgson neilh@scintilla.org 3 | # Released to the public domain. 4 | 5 | # Regenerate the Scintilla source files that list all the lexers. 6 | # Should be run whenever a new lexer is added or removed. 7 | # Requires Python 2.5 or later 8 | # Files are regenerated in place with templates stored in comments. 9 | # The format of generation comments is documented in FileGenerator.py. 10 | 11 | from FileGenerator import Regenerate, UpdateLineInFile, ReplaceREInFile 12 | import ScintillaData 13 | import HFacer 14 | 15 | def UpdateVersionNumbers(sci, root): 16 | UpdateLineInFile(root + "win32/ScintRes.rc", "#define VERSION_SCINTILLA", 17 | "#define VERSION_SCINTILLA \"" + sci.versionDotted + "\"") 18 | UpdateLineInFile(root + "win32/ScintRes.rc", "#define VERSION_WORDS", 19 | "#define VERSION_WORDS " + sci.versionCommad) 20 | UpdateLineInFile(root + "qt/ScintillaEditBase/ScintillaEditBase.pro", 21 | "VERSION =", 22 | "VERSION = " + sci.versionDotted) 23 | UpdateLineInFile(root + "qt/ScintillaEdit/ScintillaEdit.pro", 24 | "VERSION =", 25 | "VERSION = " + sci.versionDotted) 26 | UpdateLineInFile(root + "doc/ScintillaDownload.html", " Release", 27 | " Release " + sci.versionDotted) 28 | ReplaceREInFile(root + "doc/ScintillaDownload.html", 29 | r"/scintilla/([a-zA-Z]+)\d\d\d", 30 | r"/scintilla/\g<1>" + sci.version) 31 | UpdateLineInFile(root + "doc/index.html", 32 | ' Release version', 33 | ' Release version ' +\ 34 | sci.versionDotted + '
') 35 | UpdateLineInFile(root + "doc/index.html", 36 | ' Site last modified', 37 | ' Site last modified ' + sci.mdyModified + '
') 38 | UpdateLineInFile(root + "doc/ScintillaHistory.html", 39 | ' Released ', 40 | ' Released ' + sci.dmyModified + '.') 41 | 42 | def RegenerateAll(root): 43 | 44 | sci = ScintillaData.ScintillaData(root) 45 | 46 | Regenerate(root + "src/Catalogue.cxx", "//", sci.lexerModules) 47 | Regenerate(root + "win32/scintilla.mak", "#", sci.lexFiles) 48 | 49 | UpdateVersionNumbers(sci, root) 50 | 51 | HFacer.RegenerateAll(root, False) 52 | 53 | if __name__=="__main__": 54 | RegenerateAll("../") 55 | -------------------------------------------------------------------------------- /scintilla/src/AutoComplete.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file AutoComplete.h 3 | ** Defines the auto completion list box. 4 | **/ 5 | // Copyright 1998-2003 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef AUTOCOMPLETE_H 9 | #define AUTOCOMPLETE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | */ 17 | class AutoComplete { 18 | bool active; 19 | std::string stopChars; 20 | std::string fillUpChars; 21 | char separator; 22 | char typesep; // Type seperator 23 | enum { maxItemLen=1000 }; 24 | std::vector sortMatrix; 25 | 26 | public: 27 | 28 | bool ignoreCase; 29 | bool chooseSingle; 30 | ListBox *lb; 31 | int posStart; 32 | int startLen; 33 | /// Should autocompletion be canceled if editor's currentPos <= startPos? 34 | bool cancelAtStartPos; 35 | bool autoHide; 36 | bool dropRestOfWord; 37 | unsigned int ignoreCaseBehaviour; 38 | int widthLBDefault; 39 | int heightLBDefault; 40 | /** SC_ORDER_PRESORTED: Assume the list is presorted; selection will fail if it is not alphabetical
41 | * SC_ORDER_PERFORMSORT: Sort the list alphabetically; start up performance cost for sorting
42 | * SC_ORDER_CUSTOM: Handle non-alphabetical entries; start up performance cost for generating a sorted lookup table 43 | */ 44 | int autoSort; 45 | 46 | AutoComplete(); 47 | ~AutoComplete(); 48 | 49 | /// Is the auto completion list displayed? 50 | bool Active() const; 51 | 52 | /// Display the auto completion list positioned to be near a character position 53 | void Start(Window &parent, int ctrlID, int position, Point location, 54 | int startLen_, int lineHeight, bool unicodeMode, int technology); 55 | 56 | /// The stop chars are characters which, when typed, cause the auto completion list to disappear 57 | void SetStopChars(const char *stopChars_); 58 | bool IsStopChar(char ch); 59 | 60 | /// The fillup chars are characters which, when typed, fill up the selected word 61 | void SetFillUpChars(const char *fillUpChars_); 62 | bool IsFillUpChar(char ch); 63 | 64 | /// The separator character is used when interpreting the list in SetList 65 | void SetSeparator(char separator_); 66 | char GetSeparator() const; 67 | 68 | /// The typesep character is used for separating the word from the type 69 | void SetTypesep(char separator_); 70 | char GetTypesep() const; 71 | 72 | /// The list string contains a sequence of words separated by the separator character 73 | void SetList(const char *list); 74 | 75 | /// Return the position of the currently selected list item 76 | int GetSelection() const; 77 | 78 | /// Return the value of an item in the list 79 | std::string GetValue(int item) const; 80 | 81 | void Show(bool show); 82 | void Cancel(); 83 | 84 | /// Move the current list element by delta, scrolling appropriately 85 | void Move(int delta); 86 | 87 | /// Select a list element that starts with word as the current element 88 | void Select(const char *word); 89 | }; 90 | 91 | #ifdef SCI_NAMESPACE 92 | } 93 | #endif 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /scintilla/src/CallTip.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CallTip.h 3 | ** Interface to the call tip control. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CALLTIP_H 9 | #define CALLTIP_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | */ 17 | class CallTip { 18 | int startHighlight; // character offset to start and... 19 | int endHighlight; // ...end of highlighted text 20 | std::string val; 21 | Font font; 22 | PRectangle rectUp; // rectangle of last up angle in the tip 23 | PRectangle rectDown; // rectangle of last down arrow in the tip 24 | int lineHeight; // vertical line spacing 25 | int offsetMain; // The alignment point of the call tip 26 | int tabSize; // Tab size in pixels, <=0 no TAB expand 27 | bool useStyleCallTip; // if true, STYLE_CALLTIP should be used 28 | bool above; // if true, display calltip above text 29 | 30 | // Private so CallTip objects can not be copied 31 | CallTip(const CallTip &); 32 | CallTip &operator=(const CallTip &); 33 | void DrawChunk(Surface *surface, int &x, const char *s, 34 | int posStart, int posEnd, int ytext, PRectangle rcClient, 35 | bool highlight, bool draw); 36 | int PaintContents(Surface *surfaceWindow, bool draw); 37 | bool IsTabCharacter(char c) const; 38 | int NextTabPos(int x) const; 39 | 40 | public: 41 | Window wCallTip; 42 | Window wDraw; 43 | bool inCallTipMode; 44 | int posStartCallTip; 45 | ColourDesired colourBG; 46 | ColourDesired colourUnSel; 47 | ColourDesired colourSel; 48 | ColourDesired colourShade; 49 | ColourDesired colourLight; 50 | int codePage; 51 | int clickPlace; 52 | 53 | int insetX; // text inset in x from calltip border 54 | int widthArrow; 55 | int borderHeight; 56 | int verticalOffset; // pixel offset up or down of the calltip with respect to the line 57 | 58 | CallTip(); 59 | ~CallTip(); 60 | 61 | void PaintCT(Surface *surfaceWindow); 62 | 63 | void MouseClick(Point pt); 64 | 65 | /// Setup the calltip and return a rectangle of the area required. 66 | PRectangle CallTipStart(int pos, Point pt, int textHeight, const char *defn, 67 | const char *faceName, int size, int codePage_, 68 | int characterSet, int technology, Window &wParent); 69 | 70 | void CallTipCancel(); 71 | 72 | /// Set a range of characters to be displayed in a highlight style. 73 | /// Commonly used to highlight the current parameter. 74 | void SetHighlight(int start, int end); 75 | 76 | /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand. 77 | void SetTabSize(int tabSz); 78 | 79 | /// Set calltip position. 80 | void SetPosition(bool aboveText); 81 | 82 | /// Used to determine which STYLE_xxxx to use for call tip information 83 | bool UseStyleCallTip() const { return useStyleCallTip;} 84 | 85 | // Modify foreground and background colours 86 | void SetForeBack(const ColourDesired &fore, const ColourDesired &back); 87 | }; 88 | 89 | #ifdef SCI_NAMESPACE 90 | } 91 | #endif 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /scintilla/src/CaseConvert.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | // Encoding: UTF-8 3 | /** @file CaseConvert.h 4 | ** Performs Unicode case conversions. 5 | ** Does not handle locale-sensitive case conversion. 6 | **/ 7 | // Copyright 2013 by Neil Hodgson 8 | // The License.txt file describes the conditions under which this software may be distributed. 9 | 10 | #ifndef CASECONVERT_H 11 | #define CASECONVERT_H 12 | 13 | #ifdef SCI_NAMESPACE 14 | namespace Scintilla { 15 | #endif 16 | 17 | enum CaseConversion { 18 | CaseConversionFold, 19 | CaseConversionUpper, 20 | CaseConversionLower 21 | }; 22 | 23 | class ICaseConverter { 24 | public: 25 | virtual size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed) = 0; 26 | }; 27 | 28 | ICaseConverter *ConverterFor(enum CaseConversion conversion); 29 | 30 | // Returns a UTF-8 string. Empty when no conversion 31 | const char *CaseConvert(int character, enum CaseConversion conversion); 32 | 33 | // When performing CaseConvertString, the converted value may be up to 3 times longer than the input. 34 | // Ligatures are often decomposed into multiple characters and long cases include: 35 | // ΐ "\xce\x90" folds to ΐ "\xce\xb9\xcc\x88\xcc\x81" 36 | const int maxExpansionCaseConversion=3; 37 | 38 | // Converts a mixed case string using a particular conversion. 39 | // Result may be a different length to input and the length is the return value. 40 | // If there is not enough space then 0 is returned. 41 | size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, enum CaseConversion conversion); 42 | 43 | #ifdef SCI_NAMESPACE 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /scintilla/src/CaseFolder.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CaseFolder.cxx 3 | ** Classes for case folding. 4 | **/ 5 | // Copyright 1998-2013 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | 11 | #include "CaseFolder.h" 12 | #include "CaseConvert.h" 13 | #include "UniConversion.h" 14 | 15 | #ifdef SCI_NAMESPACE 16 | using namespace Scintilla; 17 | #endif 18 | 19 | CaseFolder::~CaseFolder() { 20 | } 21 | 22 | CaseFolderTable::CaseFolderTable() { 23 | for (size_t iChar=0; iChar(iChar); 25 | } 26 | } 27 | 28 | CaseFolderTable::~CaseFolderTable() { 29 | } 30 | 31 | size_t CaseFolderTable::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { 32 | if (lenMixed > sizeFolded) { 33 | return 0; 34 | } else { 35 | for (size_t i=0; i(mixed[i])]; 37 | } 38 | return lenMixed; 39 | } 40 | } 41 | 42 | void CaseFolderTable::SetTranslation(char ch, char chTranslation) { 43 | mapping[static_cast(ch)] = chTranslation; 44 | } 45 | 46 | void CaseFolderTable::StandardASCII() { 47 | for (size_t iChar=0; iChar= 'A' && iChar <= 'Z') { 49 | mapping[iChar] = static_cast(iChar - 'A' + 'a'); 50 | } else { 51 | mapping[iChar] = static_cast(iChar); 52 | } 53 | } 54 | } 55 | 56 | CaseFolderUnicode::CaseFolderUnicode() { 57 | StandardASCII(); 58 | converter = ConverterFor(CaseConversionFold); 59 | } 60 | 61 | size_t CaseFolderUnicode::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { 62 | if ((lenMixed == 1) && (sizeFolded > 0)) { 63 | folded[0] = mapping[static_cast(mixed[0])]; 64 | return 1; 65 | } else { 66 | return converter->CaseConvertString(folded, sizeFolded, mixed, lenMixed); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /scintilla/src/CaseFolder.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CaseFolder.h 3 | ** Classes for case folding. 4 | **/ 5 | // Copyright 1998-2013 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CASEFOLDER_H 9 | #define CASEFOLDER_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class CaseFolder { 16 | public: 17 | virtual ~CaseFolder(); 18 | virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) = 0; 19 | }; 20 | 21 | class CaseFolderTable : public CaseFolder { 22 | protected: 23 | char mapping[256]; 24 | public: 25 | CaseFolderTable(); 26 | virtual ~CaseFolderTable(); 27 | virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed); 28 | void SetTranslation(char ch, char chTranslation); 29 | void StandardASCII(); 30 | }; 31 | 32 | class ICaseConverter; 33 | 34 | class CaseFolderUnicode : public CaseFolderTable { 35 | ICaseConverter *converter; 36 | public: 37 | CaseFolderUnicode(); 38 | virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed); 39 | }; 40 | 41 | #ifdef SCI_NAMESPACE 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /scintilla/src/Catalogue.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Catalogue.h 3 | ** Lexer infrastructure. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CATALOGUE_H 9 | #define CATALOGUE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class Catalogue { 16 | public: 17 | static const LexerModule *Find(int language); 18 | static const LexerModule *Find(const char *languageName); 19 | static void AddLexerModule(LexerModule *plm); 20 | }; 21 | 22 | #ifdef SCI_NAMESPACE 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /scintilla/src/CharClassify.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharClassify.cxx 3 | ** Character classifications used by Document and RESearch. 4 | **/ 5 | // Copyright 2006 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | 11 | #include "CharClassify.h" 12 | 13 | #ifdef SCI_NAMESPACE 14 | using namespace Scintilla; 15 | #endif 16 | 17 | CharClassify::CharClassify() { 18 | SetDefaultCharClasses(true); 19 | } 20 | 21 | void CharClassify::SetDefaultCharClasses(bool includeWordClass) { 22 | // Initialize all char classes to default values 23 | for (int ch = 0; ch < 256; ch++) { 24 | if (ch == '\r' || ch == '\n') 25 | charClass[ch] = ccNewLine; 26 | else if (ch < 0x20 || ch == ' ') 27 | charClass[ch] = ccSpace; 28 | else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_')) 29 | charClass[ch] = ccWord; 30 | else 31 | charClass[ch] = ccPunctuation; 32 | } 33 | } 34 | 35 | void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) { 36 | // Apply the newCharClass to the specifed chars 37 | if (chars) { 38 | while (*chars) { 39 | charClass[*chars] = static_cast(newCharClass); 40 | chars++; 41 | } 42 | } 43 | } 44 | 45 | int CharClassify::GetCharsOfClass(cc characterClass, unsigned char *buffer) { 46 | // Get characters belonging to the given char class; return the number 47 | // of characters (if the buffer is NULL, don't write to it). 48 | int count = 0; 49 | for (int ch = maxChar - 1; ch >= 0; --ch) { 50 | if (charClass[ch] == characterClass) { 51 | ++count; 52 | if (buffer) { 53 | *buffer = static_cast(ch); 54 | buffer++; 55 | } 56 | } 57 | } 58 | return count; 59 | } 60 | -------------------------------------------------------------------------------- /scintilla/src/CharClassify.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharClassify.h 3 | ** Character classifications used by Document and RESearch. 4 | **/ 5 | // Copyright 2006-2009 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CHARCLASSIFY_H 9 | #define CHARCLASSIFY_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class CharClassify { 16 | public: 17 | CharClassify(); 18 | 19 | enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation }; 20 | void SetDefaultCharClasses(bool includeWordClass); 21 | void SetCharClasses(const unsigned char *chars, cc newCharClass); 22 | int GetCharsOfClass(cc charClass, unsigned char *buffer); 23 | cc GetClass(unsigned char ch) const { return static_cast(charClass[ch]);} 24 | bool IsWord(unsigned char ch) const { return static_cast(charClass[ch]) == ccWord;} 25 | 26 | private: 27 | enum { maxChar=256 }; 28 | unsigned char charClass[maxChar]; // not type cc to save space 29 | }; 30 | 31 | #ifdef SCI_NAMESPACE 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /scintilla/src/ContractionState.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ContractionState.h 3 | ** Manages visibility of lines for folding and wrapping. 4 | **/ 5 | // Copyright 1998-2007 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CONTRACTIONSTATE_H 9 | #define CONTRACTIONSTATE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | */ 17 | class ContractionState { 18 | // These contain 1 element for every document line. 19 | RunStyles *visible; 20 | RunStyles *expanded; 21 | RunStyles *heights; 22 | Partitioning *displayLines; 23 | int linesInDocument; 24 | 25 | void EnsureData(); 26 | 27 | bool OneToOne() const { 28 | // True when each document line is exactly one display line so need for 29 | // complex data structures. 30 | return visible == 0; 31 | } 32 | 33 | public: 34 | ContractionState(); 35 | virtual ~ContractionState(); 36 | 37 | void Clear(); 38 | 39 | int LinesInDoc() const; 40 | int LinesDisplayed() const; 41 | int DisplayFromDoc(int lineDoc) const; 42 | int DisplayLastFromDoc(int lineDoc) const; 43 | int DocFromDisplay(int lineDisplay) const; 44 | 45 | void InsertLine(int lineDoc); 46 | void InsertLines(int lineDoc, int lineCount); 47 | void DeleteLine(int lineDoc); 48 | void DeleteLines(int lineDoc, int lineCount); 49 | 50 | bool GetVisible(int lineDoc) const; 51 | bool SetVisible(int lineDocStart, int lineDocEnd, bool visible); 52 | bool HiddenLines() const; 53 | 54 | bool GetExpanded(int lineDoc) const; 55 | bool SetExpanded(int lineDoc, bool expanded); 56 | int ContractedNext(int lineDocStart) const; 57 | 58 | int GetHeight(int lineDoc) const; 59 | bool SetHeight(int lineDoc, int height); 60 | 61 | void ShowAll(); 62 | void Check() const; 63 | }; 64 | 65 | #ifdef SCI_NAMESPACE 66 | } 67 | #endif 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /scintilla/src/Decoration.h: -------------------------------------------------------------------------------- 1 | /** @file Decoration.h 2 | ** Visual elements added over text. 3 | **/ 4 | // Copyright 1998-2007 by Neil Hodgson 5 | // The License.txt file describes the conditions under which this software may be distributed. 6 | 7 | #ifndef DECORATION_H 8 | #define DECORATION_H 9 | 10 | #ifdef SCI_NAMESPACE 11 | namespace Scintilla { 12 | #endif 13 | 14 | class Decoration { 15 | public: 16 | Decoration *next; 17 | RunStyles rs; 18 | int indicator; 19 | 20 | explicit Decoration(int indicator_); 21 | ~Decoration(); 22 | 23 | bool Empty() const; 24 | }; 25 | 26 | class DecorationList { 27 | int currentIndicator; 28 | int currentValue; 29 | Decoration *current; 30 | int lengthDocument; 31 | Decoration *DecorationFromIndicator(int indicator); 32 | Decoration *Create(int indicator, int length); 33 | void Delete(int indicator); 34 | void DeleteAnyEmpty(); 35 | public: 36 | Decoration *root; 37 | bool clickNotified; 38 | 39 | DecorationList(); 40 | ~DecorationList(); 41 | 42 | void SetCurrentIndicator(int indicator); 43 | int GetCurrentIndicator() const { return currentIndicator; } 44 | 45 | void SetCurrentValue(int value); 46 | int GetCurrentValue() const { return currentValue; } 47 | 48 | // Returns true if some values may have changed 49 | bool FillRange(int &position, int value, int &fillLength); 50 | 51 | void InsertSpace(int position, int insertLength); 52 | void DeleteRange(int position, int deleteLength); 53 | 54 | int AllOnFor(int position) const; 55 | int ValueAt(int indicator, int position); 56 | int Start(int indicator, int position); 57 | int End(int indicator, int position); 58 | }; 59 | 60 | #ifdef SCI_NAMESPACE 61 | } 62 | #endif 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /scintilla/src/ExternalLexer.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ExternalLexer.h 3 | ** Support external lexers in DLLs. 4 | **/ 5 | // Copyright 2001 Simon Steele , portions copyright Neil Hodgson. 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef EXTERNALLEXER_H 9 | #define EXTERNALLEXER_H 10 | 11 | #if PLAT_WIN 12 | #define EXT_LEXER_DECL __stdcall 13 | #else 14 | #define EXT_LEXER_DECL 15 | #endif 16 | 17 | #ifdef SCI_NAMESPACE 18 | namespace Scintilla { 19 | #endif 20 | 21 | typedef void*(EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); 22 | typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); 23 | typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); 24 | typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index); 25 | 26 | /// Sub-class of LexerModule to use an external lexer. 27 | class ExternalLexerModule : public LexerModule { 28 | protected: 29 | GetLexerFactoryFunction fneFactory; 30 | std::string name; 31 | public: 32 | ExternalLexerModule(int language_, LexerFunction fnLexer_, 33 | const char *languageName_=0, LexerFunction fnFolder_=0) : 34 | LexerModule(language_, fnLexer_, 0, fnFolder_), 35 | fneFactory(0), name(languageName_){ 36 | languageName = name.c_str(); 37 | } 38 | virtual void SetExternal(GetLexerFactoryFunction fFactory, int index); 39 | }; 40 | 41 | /// LexerMinder points to an ExternalLexerModule - so we don't leak them. 42 | class LexerMinder { 43 | public: 44 | ExternalLexerModule *self; 45 | LexerMinder *next; 46 | }; 47 | 48 | /// LexerLibrary exists for every External Lexer DLL, contains LexerMinders. 49 | class LexerLibrary { 50 | DynamicLibrary *lib; 51 | LexerMinder *first; 52 | LexerMinder *last; 53 | 54 | public: 55 | explicit LexerLibrary(const char *ModuleName); 56 | ~LexerLibrary(); 57 | void Release(); 58 | 59 | LexerLibrary *next; 60 | std::string m_sModuleName; 61 | }; 62 | 63 | /// LexerManager manages external lexers, contains LexerLibrarys. 64 | class LexerManager { 65 | public: 66 | ~LexerManager(); 67 | 68 | static LexerManager *GetInstance(); 69 | static void DeleteInstance(); 70 | 71 | void Load(const char *path); 72 | void Clear(); 73 | 74 | private: 75 | LexerManager(); 76 | static LexerManager *theInstance; 77 | 78 | void LoadLexerLibrary(const char *module); 79 | LexerLibrary *first; 80 | LexerLibrary *last; 81 | }; 82 | 83 | class LMMinder { 84 | public: 85 | ~LMMinder(); 86 | }; 87 | 88 | #ifdef SCI_NAMESPACE 89 | } 90 | #endif 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /scintilla/src/FontQuality.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file FontQuality.h 3 | ** Definitions to control font anti-aliasing. 4 | ** Redefine constants from Scintilla.h to avoid including Scintilla.h in PlatWin.cxx. 5 | **/ 6 | // Copyright 1998-2009 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef FONTQUALITY_H 10 | #define FONTQUALITY_H 11 | 12 | #ifdef SCI_NAMESPACE 13 | namespace Scintilla { 14 | #endif 15 | 16 | // These definitions match Scintilla.h 17 | #define SC_EFF_QUALITY_MASK 0xF 18 | #define SC_EFF_QUALITY_DEFAULT 0 19 | #define SC_EFF_QUALITY_NON_ANTIALIASED 1 20 | #define SC_EFF_QUALITY_ANTIALIASED 2 21 | #define SC_EFF_QUALITY_LCD_OPTIMIZED 3 22 | 23 | // These definitions must match SC_TECHNOLOGY_* in Scintilla.h 24 | #define SCWIN_TECH_GDI 0 25 | #define SCWIN_TECH_DIRECTWRITE 1 26 | 27 | #ifdef SCI_NAMESPACE 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /scintilla/src/Indicator.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Indicator.h 3 | ** Defines the style of indicators which are text decorations such as underlining. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef INDICATOR_H 9 | #define INDICATOR_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | */ 17 | class Indicator { 18 | public: 19 | int style; 20 | bool under; 21 | ColourDesired fore; 22 | int fillAlpha; 23 | int outlineAlpha; 24 | Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30), outlineAlpha(50) { 25 | } 26 | void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) const; 27 | }; 28 | 29 | #ifdef SCI_NAMESPACE 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /scintilla/src/KeyMap.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file KeyMap.h 3 | ** Defines a mapping between keystrokes and commands. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef KEYMAP_H 9 | #define KEYMAP_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | #define SCI_NORM 0 16 | #define SCI_SHIFT SCMOD_SHIFT 17 | #define SCI_CTRL SCMOD_CTRL 18 | #define SCI_ALT SCMOD_ALT 19 | #define SCI_META SCMOD_META 20 | #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) 21 | #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) 22 | 23 | /** 24 | */ 25 | class KeyModifiers { 26 | public: 27 | int key; 28 | int modifiers; 29 | KeyModifiers(int key_, int modifiers_) : key(key_), modifiers(modifiers_) { 30 | } 31 | bool operator<(const KeyModifiers &other) const { 32 | if (key == other.key) 33 | return modifiers < other.modifiers; 34 | else 35 | return key < other.key; 36 | } 37 | }; 38 | 39 | /** 40 | */ 41 | class KeyToCommand { 42 | public: 43 | int key; 44 | int modifiers; 45 | unsigned int msg; 46 | }; 47 | 48 | /** 49 | */ 50 | class KeyMap { 51 | std::map kmap; 52 | static const KeyToCommand MapDefault[]; 53 | 54 | public: 55 | KeyMap(); 56 | ~KeyMap(); 57 | void Clear(); 58 | void AssignCmdKey(int key, int modifiers, unsigned int msg); 59 | unsigned int Find(int key, int modifiers) const; // 0 returned on failure 60 | }; 61 | 62 | #ifdef SCI_NAMESPACE 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /scintilla/src/LineMarker.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LineMarker.h 3 | ** Defines the look of a line marker in the margin . 4 | **/ 5 | // Copyright 1998-2011 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LINEMARKER_H 9 | #define LINEMARKER_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | */ 17 | class LineMarker { 18 | public: 19 | enum typeOfFold { undefined, head, body, tail, headWithTail }; 20 | 21 | int markType; 22 | ColourDesired fore; 23 | ColourDesired back; 24 | ColourDesired backSelected; 25 | int alpha; 26 | XPM *pxpm; 27 | RGBAImage *image; 28 | LineMarker() { 29 | markType = SC_MARK_CIRCLE; 30 | fore = ColourDesired(0,0,0); 31 | back = ColourDesired(0xff,0xff,0xff); 32 | backSelected = ColourDesired(0xff,0x00,0x00); 33 | alpha = SC_ALPHA_NOALPHA; 34 | pxpm = NULL; 35 | image = NULL; 36 | } 37 | LineMarker(const LineMarker &) { 38 | // Defined to avoid pxpm being blindly copied, not as a complete copy constructor 39 | markType = SC_MARK_CIRCLE; 40 | fore = ColourDesired(0,0,0); 41 | back = ColourDesired(0xff,0xff,0xff); 42 | backSelected = ColourDesired(0xff,0x00,0x00); 43 | alpha = SC_ALPHA_NOALPHA; 44 | pxpm = NULL; 45 | image = NULL; 46 | } 47 | ~LineMarker() { 48 | delete pxpm; 49 | delete image; 50 | } 51 | LineMarker &operator=(const LineMarker &other) { 52 | // Defined to avoid pxpm being blindly copied, not as a complete assignment operator 53 | if (this != &other) { 54 | markType = SC_MARK_CIRCLE; 55 | fore = ColourDesired(0,0,0); 56 | back = ColourDesired(0xff,0xff,0xff); 57 | backSelected = ColourDesired(0xff,0x00,0x00); 58 | alpha = SC_ALPHA_NOALPHA; 59 | delete pxpm; 60 | pxpm = NULL; 61 | delete image; 62 | image = NULL; 63 | } 64 | return *this; 65 | } 66 | void SetXPM(const char *textForm); 67 | void SetXPM(const char *const *linesForm); 68 | void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); 69 | void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const; 70 | }; 71 | 72 | #ifdef SCI_NAMESPACE 73 | } 74 | #endif 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /scintilla/src/PerLine.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file PerLine.h 3 | ** Manages data associated with each line of the document 4 | **/ 5 | // Copyright 1998-2009 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef PERLINE_H 9 | #define PERLINE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | * This holds the marker identifier and the marker type to display. 17 | * MarkerHandleNumbers are members of lists. 18 | */ 19 | struct MarkerHandleNumber { 20 | int handle; 21 | int number; 22 | MarkerHandleNumber *next; 23 | }; 24 | 25 | /** 26 | * A marker handle set contains any number of MarkerHandleNumbers. 27 | */ 28 | class MarkerHandleSet { 29 | MarkerHandleNumber *root; 30 | 31 | public: 32 | MarkerHandleSet(); 33 | ~MarkerHandleSet(); 34 | int Length() const; 35 | int MarkValue() const; ///< Bit set of marker numbers. 36 | bool Contains(int handle) const; 37 | bool InsertHandle(int handle, int markerNum); 38 | void RemoveHandle(int handle); 39 | bool RemoveNumber(int markerNum, bool all); 40 | void CombineWith(MarkerHandleSet *other); 41 | }; 42 | 43 | class LineMarkers : public PerLine { 44 | SplitVector markers; 45 | /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big. 46 | int handleCurrent; 47 | public: 48 | LineMarkers() : handleCurrent(0) { 49 | } 50 | virtual ~LineMarkers(); 51 | virtual void Init(); 52 | virtual void InsertLine(int line); 53 | virtual void RemoveLine(int line); 54 | 55 | int MarkValue(int line); 56 | int MarkerNext(int lineStart, int mask) const; 57 | int AddMark(int line, int marker, int lines); 58 | void MergeMarkers(int pos); 59 | bool DeleteMark(int line, int markerNum, bool all); 60 | void DeleteMarkFromHandle(int markerHandle); 61 | int LineFromHandle(int markerHandle); 62 | }; 63 | 64 | class LineLevels : public PerLine { 65 | SplitVector levels; 66 | public: 67 | virtual ~LineLevels(); 68 | virtual void Init(); 69 | virtual void InsertLine(int line); 70 | virtual void RemoveLine(int line); 71 | 72 | void ExpandLevels(int sizeNew=-1); 73 | void ClearLevels(); 74 | int SetLevel(int line, int level, int lines); 75 | int GetLevel(int line) const; 76 | }; 77 | 78 | class LineState : public PerLine { 79 | SplitVector lineStates; 80 | public: 81 | LineState() { 82 | } 83 | virtual ~LineState(); 84 | virtual void Init(); 85 | virtual void InsertLine(int line); 86 | virtual void RemoveLine(int line); 87 | 88 | int SetLineState(int line, int state); 89 | int GetLineState(int line); 90 | int GetMaxLineState() const; 91 | }; 92 | 93 | class LineAnnotation : public PerLine { 94 | SplitVector annotations; 95 | public: 96 | LineAnnotation() { 97 | } 98 | virtual ~LineAnnotation(); 99 | virtual void Init(); 100 | virtual void InsertLine(int line); 101 | virtual void RemoveLine(int line); 102 | 103 | bool MultipleStyles(int line) const; 104 | int Style(int line) const; 105 | const char *Text(int line) const; 106 | const unsigned char *Styles(int line) const; 107 | void SetText(int line, const char *text); 108 | void ClearAll(); 109 | void SetStyle(int line, int style); 110 | void SetStyles(int line, const unsigned char *styles); 111 | int Length(int line) const; 112 | int Lines(int line) const; 113 | }; 114 | 115 | #ifdef SCI_NAMESPACE 116 | } 117 | #endif 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /scintilla/src/RESearch.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file RESearch.h 3 | ** Interface to the regular expression search library. 4 | **/ 5 | // Written by Neil Hodgson 6 | // Based on the work of Ozan S. Yigit. 7 | // This file is in the public domain. 8 | 9 | #ifndef RESEARCH_H 10 | #define RESEARCH_H 11 | 12 | #ifdef SCI_NAMESPACE 13 | namespace Scintilla { 14 | #endif 15 | 16 | /* 17 | * The following defines are not meant to be changeable. 18 | * They are for readability only. 19 | */ 20 | #define MAXCHR 256 21 | #define CHRBIT 8 22 | #define BITBLK MAXCHR/CHRBIT 23 | 24 | class CharacterIndexer { 25 | public: 26 | virtual char CharAt(int index)=0; 27 | virtual ~CharacterIndexer() { 28 | } 29 | }; 30 | 31 | class RESearch { 32 | 33 | public: 34 | explicit RESearch(CharClassify *charClassTable); 35 | ~RESearch(); 36 | void GrabMatches(CharacterIndexer &ci); 37 | const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix); 38 | int Execute(CharacterIndexer &ci, int lp, int endp); 39 | 40 | enum { MAXTAG=10 }; 41 | enum { MAXNFA=2048 }; 42 | enum { NOTFOUND=-1 }; 43 | 44 | int bopat[MAXTAG]; 45 | int eopat[MAXTAG]; 46 | std::string pat[MAXTAG]; 47 | 48 | private: 49 | void Init(); 50 | void Clear(); 51 | void ChSet(unsigned char c); 52 | void ChSetWithCase(unsigned char c, bool caseSensitive); 53 | int GetBackslashExpression(const char *pattern, int &incr); 54 | 55 | int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap); 56 | 57 | int bol; 58 | int tagstk[MAXTAG]; /* subpat tag stack */ 59 | char nfa[MAXNFA]; /* automaton */ 60 | int sta; 61 | unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */ 62 | int failure; 63 | CharClassify *charClass; 64 | bool iswordc(unsigned char x) const { 65 | return charClass->IsWord(x); 66 | } 67 | }; 68 | 69 | #ifdef SCI_NAMESPACE 70 | } 71 | #endif 72 | 73 | #endif 74 | 75 | -------------------------------------------------------------------------------- /scintilla/src/RunStyles.h: -------------------------------------------------------------------------------- 1 | /** @file RunStyles.h 2 | ** Data structure used to store sparse styles. 3 | **/ 4 | // Copyright 1998-2007 by Neil Hodgson 5 | // The License.txt file describes the conditions under which this software may be distributed. 6 | 7 | /// Styling buffer using one element for each run rather than using 8 | /// a filled buffer. 9 | 10 | #ifndef RUNSTYLES_H 11 | #define RUNSTYLES_H 12 | 13 | #ifdef SCI_NAMESPACE 14 | namespace Scintilla { 15 | #endif 16 | 17 | class RunStyles { 18 | private: 19 | Partitioning *starts; 20 | SplitVector *styles; 21 | int RunFromPosition(int position) const; 22 | int SplitRun(int position); 23 | void RemoveRun(int run); 24 | void RemoveRunIfEmpty(int run); 25 | void RemoveRunIfSameAsPrevious(int run); 26 | // Private so RunStyles objects can not be copied 27 | RunStyles(const RunStyles &); 28 | public: 29 | RunStyles(); 30 | ~RunStyles(); 31 | int Length() const; 32 | int ValueAt(int position) const; 33 | int FindNextChange(int position, int end) const; 34 | int StartRun(int position) const; 35 | int EndRun(int position) const; 36 | // Returns true if some values may have changed 37 | bool FillRange(int &position, int value, int &fillLength); 38 | void SetValueAt(int position, int value); 39 | void InsertSpace(int position, int insertLength); 40 | void DeleteAll(); 41 | void DeleteRange(int position, int deleteLength); 42 | int Runs() const; 43 | bool AllSame() const; 44 | bool AllSameAs(int value) const; 45 | int Find(int value, int start) const; 46 | 47 | void Check() const; 48 | }; 49 | 50 | #ifdef SCI_NAMESPACE 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /scintilla/src/SciTE.properties: -------------------------------------------------------------------------------- 1 | # SciTE.properties is the per directory local options file and can be used to override 2 | # settings made in SciTEGlobal.properties 3 | command.build.directory.*.cxx=..\win32 4 | command.build.directory.*.h=..\win32 5 | command.build.*.cxx=nmake -f scintilla.mak QUIET=1 6 | command.build.*.h=nmake -f scintilla.mak QUIET=1 7 | -------------------------------------------------------------------------------- /scintilla/src/ScintillaBase.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ScintillaBase.h 3 | ** Defines an enhanced subclass of Editor with calltips, autocomplete and context menu. 4 | **/ 5 | // Copyright 1998-2002 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef SCINTILLABASE_H 9 | #define SCINTILLABASE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | #ifdef SCI_LEXER 16 | class LexState; 17 | #endif 18 | 19 | /** 20 | */ 21 | class ScintillaBase : public Editor { 22 | // Private so ScintillaBase objects can not be copied 23 | ScintillaBase(const ScintillaBase &); 24 | ScintillaBase &operator=(const ScintillaBase &); 25 | 26 | protected: 27 | /** Enumeration of commands and child windows. */ 28 | enum { 29 | idCallTip=1, 30 | idAutoComplete=2, 31 | 32 | idcmdUndo=10, 33 | idcmdRedo=11, 34 | idcmdCut=12, 35 | idcmdCopy=13, 36 | idcmdPaste=14, 37 | idcmdDelete=15, 38 | idcmdSelectAll=16 39 | }; 40 | 41 | bool displayPopupMenu; 42 | Menu popup; 43 | AutoComplete ac; 44 | 45 | CallTip ct; 46 | 47 | int listType; ///< 0 is an autocomplete list 48 | int maxListWidth; /// Maximum width of list, in average character widths 49 | int multiAutoCMode; /// Mode for autocompleting when multiple selections are present 50 | 51 | #ifdef SCI_LEXER 52 | LexState *DocumentLexState(); 53 | void SetLexer(uptr_t wParam); 54 | void SetLexerLanguage(const char *languageName); 55 | void Colourise(int start, int end); 56 | #endif 57 | 58 | ScintillaBase(); 59 | virtual ~ScintillaBase(); 60 | virtual void Initialise() = 0; 61 | virtual void Finalise(); 62 | 63 | virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); 64 | void Command(int cmdId); 65 | virtual void CancelModes(); 66 | virtual int KeyCommand(unsigned int iMessage); 67 | 68 | void AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen); 69 | void AutoCompleteStart(int lenEntered, const char *list); 70 | void AutoCompleteCancel(); 71 | void AutoCompleteMove(int delta); 72 | int AutoCompleteGetCurrent() const; 73 | int AutoCompleteGetCurrentText(char *buffer) const; 74 | void AutoCompleteCharacterAdded(char ch); 75 | void AutoCompleteCharacterDeleted(); 76 | void AutoCompleteCompleted(); 77 | void AutoCompleteMoveToCurrentWord(); 78 | static void AutoCompleteDoubleClick(void *p); 79 | 80 | void CallTipClick(); 81 | void CallTipShow(Point pt, const char *defn); 82 | virtual void CreateCallTipWindow(PRectangle rc) = 0; 83 | 84 | virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0; 85 | void ContextMenu(Point pt); 86 | 87 | virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); 88 | virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); 89 | 90 | void NotifyStyleToNeeded(int endStyleNeeded); 91 | void NotifyLexerChanged(Document *doc, void *userData); 92 | 93 | public: 94 | // Public so scintilla_send_message can use it 95 | virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); 96 | }; 97 | 98 | #ifdef SCI_NAMESPACE 99 | } 100 | #endif 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /scintilla/src/Style.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Style.h 3 | ** Defines the font and colour style for a class of text. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef STYLE_H 9 | #define STYLE_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | struct FontSpecification { 16 | const char *fontName; 17 | int weight; 18 | bool italic; 19 | int size; 20 | int characterSet; 21 | int extraFontFlag; 22 | FontSpecification() : 23 | fontName(0), 24 | weight(SC_WEIGHT_NORMAL), 25 | italic(false), 26 | size(10 * SC_FONT_SIZE_MULTIPLIER), 27 | characterSet(0), 28 | extraFontFlag(0) { 29 | } 30 | bool operator==(const FontSpecification &other) const; 31 | bool operator<(const FontSpecification &other) const; 32 | }; 33 | 34 | // Just like Font but only has a copy of the FontID so should not delete it 35 | class FontAlias : public Font { 36 | // Private so FontAlias objects can not be assigned except for intiialization 37 | FontAlias &operator=(const FontAlias &); 38 | public: 39 | FontAlias(); 40 | FontAlias(const FontAlias &); 41 | virtual ~FontAlias(); 42 | void MakeAlias(Font &fontOrigin); 43 | void ClearFont(); 44 | }; 45 | 46 | struct FontMeasurements { 47 | unsigned int ascent; 48 | unsigned int descent; 49 | XYPOSITION aveCharWidth; 50 | XYPOSITION spaceWidth; 51 | int sizeZoomed; 52 | FontMeasurements(); 53 | void Clear(); 54 | }; 55 | 56 | /** 57 | */ 58 | class Style : public FontSpecification, public FontMeasurements { 59 | public: 60 | ColourDesired fore; 61 | ColourDesired back; 62 | bool eolFilled; 63 | bool underline; 64 | enum ecaseForced {caseMixed, caseUpper, caseLower}; 65 | ecaseForced caseForce; 66 | bool visible; 67 | bool changeable; 68 | bool hotspot; 69 | 70 | FontAlias font; 71 | 72 | Style(); 73 | Style(const Style &source); 74 | ~Style(); 75 | Style &operator=(const Style &source); 76 | void Clear(ColourDesired fore_, ColourDesired back_, 77 | int size_, 78 | const char *fontName_, int characterSet_, 79 | int weight_, bool italic_, bool eolFilled_, 80 | bool underline_, ecaseForced caseForce_, 81 | bool visible_, bool changeable_, bool hotspot_); 82 | void ClearTo(const Style &source); 83 | void Copy(Font &font_, const FontMeasurements &fm_); 84 | bool IsProtected() const { return !(changeable && visible);} 85 | }; 86 | 87 | #ifdef SCI_NAMESPACE 88 | } 89 | #endif 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /scintilla/src/UniConversion.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file UniConversion.h 3 | ** Functions to handle UTF-8 and UTF-16 strings. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef UNICONVERSION_H 9 | #define UNICONVERSION_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | const int UTF8MaxBytes = 4; 16 | 17 | unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); 18 | void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len); 19 | unsigned int UTF8CharLength(unsigned char ch); 20 | unsigned int UTF16Length(const char *s, unsigned int len); 21 | unsigned int UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen); 22 | 23 | extern int UTF8BytesOfLead[256]; 24 | void UTF8BytesOfLeadInitialise(); 25 | 26 | inline bool UTF8IsTrailByte(int ch) { 27 | return (ch >= 0x80) && (ch < 0xc0); 28 | } 29 | 30 | inline bool UTF8IsAscii(int ch) { 31 | return ch < 0x80; 32 | } 33 | 34 | enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 }; 35 | int UTF8Classify(const unsigned char *us, int len); 36 | 37 | // Similar to UTF8Classify but returns a length of 1 for invalid bytes 38 | // instead of setting the invalid flag 39 | int UTF8DrawBytes(const unsigned char *us, int len); 40 | 41 | // Line separator is U+2028 \xe2\x80\xa8 42 | // Paragraph separator is U+2029 \xe2\x80\xa9 43 | const int UTF8SeparatorLength = 3; 44 | inline bool UTF8IsSeparator(const unsigned char *us) { 45 | return (us[0] == 0xe2) && (us[1] == 0x80) && ((us[2] == 0xa8) || (us[2] == 0xa9)); 46 | } 47 | 48 | // NEL is U+0085 \xc2\x85 49 | const int UTF8NELLength = 2; 50 | inline bool UTF8IsNEL(const unsigned char *us) { 51 | return (us[0] == 0xc2) && (us[1] == 0x85); 52 | } 53 | 54 | #ifdef SCI_NAMESPACE 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /scintilla/src/UnicodeFromUTF8.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file UnicodeFromUTF8.h 3 | ** Lexer infrastructure. 4 | **/ 5 | // Copyright 2013 by Neil Hodgson 6 | // This file is in the public domain. 7 | 8 | #ifndef UNICODEFROMUTF8_H 9 | #define UNICODEFROMUTF8_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | inline int UnicodeFromUTF8(const unsigned char *us) { 16 | if (us[0] < 0xC2) { 17 | return us[0]; 18 | } else if (us[0] < 0xE0) { 19 | return ((us[0] & 0x1F) << 6) + (us[1] & 0x3F); 20 | } else if (us[0] < 0xF0) { 21 | return ((us[0] & 0xF) << 12) + ((us[1] & 0x3F) << 6) + (us[2] & 0x3F); 22 | } else if (us[0] < 0xF5) { 23 | return ((us[0] & 0x7) << 18) + ((us[1] & 0x3F) << 12) + ((us[2] & 0x3F) << 6) + (us[3] & 0x3F); 24 | } 25 | return us[0]; 26 | } 27 | 28 | #ifdef SCI_NAMESPACE 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /scintilla/src/XPM.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file XPM.h 3 | ** Define a classes to hold image data in the X Pixmap (XPM) and RGBA formats. 4 | **/ 5 | // Copyright 1998-2003 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef XPM_H 9 | #define XPM_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | * Hold a pixmap in XPM format. 17 | */ 18 | class XPM { 19 | int height; 20 | int width; 21 | int nColours; 22 | std::vector pixels; 23 | ColourDesired colourCodeTable[256]; 24 | char codeTransparent; 25 | ColourDesired ColourFromCode(int ch) const; 26 | void FillRun(Surface *surface, int code, int startX, int y, int x); 27 | public: 28 | explicit XPM(const char *textForm); 29 | explicit XPM(const char *const *linesForm); 30 | ~XPM(); 31 | void Init(const char *textForm); 32 | void Init(const char *const *linesForm); 33 | /// Decompose image into runs and use FillRectangle for each run 34 | void Draw(Surface *surface, PRectangle &rc); 35 | int GetHeight() const { return height; } 36 | int GetWidth() const { return width; } 37 | void PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const; 38 | private: 39 | static std::vectorLinesFormFromTextForm(const char *textForm); 40 | }; 41 | 42 | /** 43 | * A translucent image stored as a sequence of RGBA bytes. 44 | */ 45 | class RGBAImage { 46 | // Private so RGBAImage objects can not be copied 47 | RGBAImage(const RGBAImage &); 48 | RGBAImage &operator=(const RGBAImage &); 49 | int height; 50 | int width; 51 | float scale; 52 | std::vector pixelBytes; 53 | public: 54 | RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_); 55 | explicit RGBAImage(const XPM &xpm); 56 | virtual ~RGBAImage(); 57 | int GetHeight() const { return height; } 58 | int GetWidth() const { return width; } 59 | float GetScale() const { return scale; } 60 | float GetScaledHeight() const { return height / scale; } 61 | float GetScaledWidth() const { return width / scale; } 62 | int CountBytes() const; 63 | const unsigned char *Pixels() const; 64 | void SetPixel(int x, int y, ColourDesired colour, int alpha=0xff); 65 | }; 66 | 67 | /** 68 | * A collection of RGBAImage pixmaps indexed by integer id. 69 | */ 70 | class RGBAImageSet { 71 | typedef std::map ImageMap; 72 | ImageMap images; 73 | mutable int height; ///< Memorize largest height of the set. 74 | mutable int width; ///< Memorize largest width of the set. 75 | public: 76 | RGBAImageSet(); 77 | ~RGBAImageSet(); 78 | /// Remove all images. 79 | void Clear(); 80 | /// Add an image. 81 | void Add(int ident, RGBAImage *image); 82 | /// Get image by id. 83 | RGBAImage *Get(int ident); 84 | /// Give the largest height of the set. 85 | int GetHeight() const; 86 | /// Give the largest width of the set. 87 | int GetWidth() const; 88 | }; 89 | 90 | #ifdef SCI_NAMESPACE 91 | } 92 | #endif 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /scintilla/test/MessageNumbers.py: -------------------------------------------------------------------------------- 1 | # List many windows message numbers 2 | 3 | msgs = { 4 | "WM_ACTIVATE":6, 5 | "WM_ACTIVATEAPP":28, 6 | "WM_CAPTURECHANGED":533, 7 | "WM_CHAR":258, 8 | "WM_CLOSE":16, 9 | "WM_CREATE":1, 10 | "WM_COMMAND":273, 11 | "WM_DESTROY":2, 12 | "WM_ENTERSIZEMOVE":561, 13 | "WM_ERASEBKGND":20, 14 | "WM_EXITSIZEMOVE":562, 15 | "WM_GETMINMAXINFO":36, 16 | "WM_GETTEXT":13, 17 | "WM_IME_SETCONTEXT":0x0281, 18 | "WM_IME_NOTIFY":0x0282, 19 | "WM_KEYDOWN":256, 20 | "WM_KEYUP":257, 21 | "WM_KILLFOCUS":8, 22 | "WM_LBUTTONDOWN":513, 23 | "WM_LBUTTONUP":514, 24 | "WM_MBUTTONDOWN":519, 25 | "WM_MBUTTONUP":520, 26 | "WM_MBUTTONDBLCLK":521, 27 | "WM_MOUSEACTIVATE":33, 28 | "WM_MOUSEMOVE":512, 29 | "WM_MOVE":3, 30 | "WM_MOVING":534, 31 | "WM_NCACTIVATE":134, 32 | "WM_NCCALCSIZE":131, 33 | "WM_NCCREATE":129, 34 | "WM_NCDESTROY":130, 35 | "WM_NCHITTEST":132, 36 | "WM_NCLBUTTONDBLCLK":163, 37 | "WM_NCLBUTTONDOWN":161, 38 | "WM_NCLBUTTONUP":162, 39 | "WM_NCMOUSEMOVE":160, 40 | "WM_NCPAINT":133, 41 | "WM_PAINT":15, 42 | "WM_PARENTNOTIFY":528, 43 | "WM_SETCURSOR":32, 44 | "WM_SETFOCUS":7, 45 | "WM_SETFONT":48, 46 | "WM_SETTEXT":12, 47 | "WM_SHOWWINDOW":24, 48 | "WM_SIZE":5, 49 | "WM_SIZING":532, 50 | "WM_SYNCPAINT":136, 51 | "WM_SYSCOMMAND":274, 52 | "WM_SYSKEYDOWN":260, 53 | "WM_TIMER":275, 54 | "WM_USER":1024, 55 | "WM_USER+1":1025, 56 | "WM_WINDOWPOSCHANGED":71, 57 | "WM_WINDOWPOSCHANGING":70, 58 | } 59 | 60 | sgsm={} 61 | for k,v in msgs.items(): 62 | sgsm[v] = k 63 | 64 | -------------------------------------------------------------------------------- /scintilla/test/README: -------------------------------------------------------------------------------- 1 | The test directory contains some unit and performance tests for Scintilla. 2 | 3 | The tests can only be run on Windows or Linux/Qt using Python 2.7 or 3.x. 4 | Python 2.7+ is required because the bytes string type and literals are available. 5 | Scintilla must be built before running any tests. 6 | 7 | A test application for Windows only is in xite.py and this can be run to experiment: 8 | pythonw xite.py 9 | 10 | To run the basic tests: 11 | python simpleTests.py 12 | 13 | There are some lexing tests with simple input files in several languages in the examples 14 | subdirectory and their expected lexed states in *.styled where the start of each style 15 | is marked with {styleNumber}, for example: 16 | {15}<%@{16}language=javas{15}%>{0} 17 | 18 | To run the lexing tests: 19 | python lexTests.py 20 | 21 | To check for performance regressions: 22 | python performanceTests.py 23 | While each test run will be different and the timer has only limited granularity, some results 24 | from a 2 GHz Athlon with a DEBUG build are: 25 | 0.187 testAddLine 26 | . 0.203 testAddLineMiddle 27 | . 0.171 testHuge 28 | . 0.203 testHugeInserts 29 | . 0.312 testHugeReplace 30 | . 31 | -------------------------------------------------------------------------------- /scintilla/test/XiteMenu.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from __future__ import unicode_literals 4 | 5 | """ Define the menu structure used by the Pentacle applications """ 6 | 7 | MenuStructure = [ 8 | ["&File", [ 9 | ["&New", "N"], 10 | ["&Open...", "O"], 11 | ["&Save", "S"], 12 | ["Save &As...", "S"], 13 | ["Test", ""], 14 | ["Exercised", ""], 15 | ["Uncalled", ""], 16 | ["-", ""], 17 | ["&Exit", ""]]], 18 | [ "&Edit", [ 19 | ["&Undo", "Z"], 20 | ["&Redo", "Y"], 21 | ["-", ""], 22 | ["Cu&t", "X"], 23 | ["&Copy", "C"], 24 | ["&Paste", "V"], 25 | ["&Delete", "Del"], 26 | ["Select &All", "A"], 27 | ]], 28 | ] 29 | -------------------------------------------------------------------------------- /scintilla/test/XiteQt.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Requires Python 2.7 or later 3 | 4 | import ctypes, os, sys, unittest 5 | 6 | from PySide.QtCore import * 7 | from PySide.QtGui import * 8 | 9 | import ScintillaCallable 10 | 11 | sys.path.append("..") 12 | from bin import ScintillaEditPy 13 | 14 | scintillaDirectory = ".." 15 | scintillaIncludeDirectory = os.path.join(scintillaDirectory, "include") 16 | scintillaScriptsDirectory = os.path.join(scintillaDirectory, "scripts") 17 | sys.path.append(scintillaScriptsDirectory) 18 | import Face 19 | 20 | class Form(QDialog): 21 | 22 | def __init__(self, parent=None): 23 | super(Form, self).__init__(parent) 24 | self.resize(460,300) 25 | # Create widget 26 | self.edit = ScintillaEditPy.ScintillaEdit(self) 27 | 28 | class XiteWin(): 29 | def __init__(self, test=""): 30 | self.face = Face.Face() 31 | self.face.ReadFromFile(os.path.join(scintillaIncludeDirectory, "Scintilla.iface")) 32 | 33 | self.test = test 34 | 35 | self.form = Form() 36 | 37 | scifn = self.form.edit.send(int(self.face.features["GetDirectFunction"]["Value"]), 0, 0) 38 | sciptr = ctypes.c_char_p(self.form.edit.send( 39 | int(self.face.features["GetDirectPointer"]["Value"]), 0,0)) 40 | 41 | self.ed = ScintillaCallable.ScintillaCallable(self.face, scifn, sciptr) 42 | self.form.show() 43 | 44 | def DoStuff(self): 45 | print(self.test) 46 | self.CmdTest() 47 | 48 | def DoEvents(self): 49 | QApplication.processEvents() 50 | 51 | def CmdTest(self): 52 | runner = unittest.TextTestRunner() 53 | tests = unittest.defaultTestLoader.loadTestsFromName(self.test) 54 | results = runner.run(tests) 55 | print(results) 56 | sys.exit(0) 57 | 58 | xiteFrame = None 59 | 60 | def main(test): 61 | global xiteFrame 62 | app = QApplication(sys.argv) 63 | xiteFrame = XiteWin(test) 64 | xiteFrame.DoStuff() 65 | sys.exit(app.exec_()) 66 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.asp: -------------------------------------------------------------------------------- 1 | <%@language=javas%> 2 | <% 3 | #include 4 | function x() { 5 | } 6 | %> 7 | <%@language=vbscript%> 8 | <% 9 | sub x 'comment 10 | %> 11 | 12 | 13 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.asp.styled: -------------------------------------------------------------------------------- 1 | {15}<%@{16}language=javas{15}%>{0} 2 | {15}<%{56} 3 | #{61}include{56} 4 | {62}function{56} {61}x{65}(){56} {65}{{56} 5 | {65}}{56} 6 | {15}%>{0} 7 | {15}<%@{16}language=vbscript{15}%>{0} 8 | {15}<%{81} 9 | {84}sub{81} {86}x{81} {82}'comment {81} 10 | {15}%>{0} 11 | {1}{0} 12 | {1}{0} 13 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.cxx: -------------------------------------------------------------------------------- 1 | // A demonstration program 2 | #include 3 | #if 0 /* */ 4 | #define DUMMY() \ 5 | if (1); 6 | #endif 7 | 8 | #define M\ 9 | 10 | \ 11 | 12 | int main() { 13 | double x[] = {3.14159,6.02e23,1.6e-19,1.0+1}; 14 | int y[] = {75,0113,0x4b}; 15 | printf("hello world %d %g\n", y[0], x[0]); 16 | } 17 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.cxx.styled: -------------------------------------------------------------------------------- 1 | {2}// A demonstration program 2 | {9}#include 3 | #if 0 {23}/* */{9} 4 | {73}#define DUMMY() \ 5 | if (1); 6 | {9}#endif 7 | {0} 8 | {9}#define M\ 9 | 10 | {0}\ 11 | 12 | {5}int{0} {11}main{10}(){0} {10}{{0} 13 | {11}double{0} {11}x{10}[]{0} {10}={0} {10}{{4}3.14159{10},{4}6.02e23{10},{4}1.6e-19{10},{4}1.0{10}+{4}1{10}};{0} 14 | {5}int{0} {11}y{10}[]{0} {10}={0} {10}{{4}75{10},{4}0113{10},{4}0x4b{10}};{0} 15 | {11}printf{10}({6}"hello world %d %g\n"{10},{0} {11}y{10}[{4}0{10}],{0} {11}x{10}[{4}0{10}]);{0} 16 | {10}}{0} 17 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.d.styled: -------------------------------------------------------------------------------- 1 | {14}${0} 2 | {2}// /++ +/ doccomments are not yet supported 3 | {1}/* */{0} 4 | {3}/** */{0} 5 | {15}/// drdr 6 | {4}/+ /+ +/ +/{0} 7 | {2}//keyword test 8 | {6}keyword1{0} 9 | {7}keyword2{0} 10 | {9}keyword4{0} 11 | {20}keyword5{0} 12 | {21}keyword6{0} 13 | {22}keyword7{0} 14 | {2}//unicode identifier test 15 | {14}вапёasdÓΘΣαԷԸՑהכ拉麺とひシマイ단결을{0} 16 | {2}//strings test 17 | {11}'s 18 | ' 19 | {14}w{12}'s'{14}w{0} 20 | {10}"multiline 21 | string"w{0} 22 | {14}e{10}"zz"{14}e{0} 23 | {19}r"asd\"{14}e{0} 24 | {19}r"multiline 25 | string"c{0} 26 | {14}r{18}`asd\`{14}e{0} 27 | {18}`multiline 28 | string`d{0} 29 | {19}x"023 abc"{14}e{0} 30 | {19}x"023 31 | abc"w{0} 32 | {2}//numbers test 33 | {14}a{13}[{5}3{13}..{5}4{13}]={5}3{0} 34 | {5}2.stringof{0} 35 | {5}2.0{13}.{14}stringof{0} 36 | {5}2.{0} 37 | {5}2.2e+2{0} 38 | {5}2.2e-2{0} 39 | {5}.2e+2{0} 40 | {5}.2{0} 41 | {5}2e+2{0} 42 | {5}0x2e{13}+{5}2{0} 43 | {5}0x2ep+10{0} 44 | {13},{5}.2{13}.{14}stringof{13},{0} 45 | 46 | {14}end{0} 47 | 48 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | SinkWorld - Portability 10 | SinkWorld - Portability 11 | 12 | 13 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.html.styled: -------------------------------------------------------------------------------- 1 | {1}{0} 2 | {1}{40} 3 | {46}var{41} {46}b{41} {50}={41} {52}/abc/i{46}.test{50}({49}'abc'{50});{41} 4 | {49}'x\ 5 |
'{41} 6 | {1}{0} 7 | {1}{0} 8 | {1}{0} 9 | {1}{0}SinkWorld - Portability{1}{0} 10 | {2}{0}SinkWorld - Portability{2}{0} 11 | {1}{0} 12 | {1}{0} 13 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.lua: -------------------------------------------------------------------------------- 1 | --[[ coding:UTF-8 2 | comment ]] 3 | function first() 4 | ::開:: 5 | -- Comment 6 | func(SCI_ANNOTATIONSETTEXT, 'a', 0, "LINE1") 7 | end 8 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.lua.styled: -------------------------------------------------------------------------------- 1 | {1}--[[ coding:UTF-8 2 | comment ]]{0} 3 | {5}function{0} {11}first{10}(){0} 4 | {20}::開::{0} 5 | {2}-- Comment 6 | {0} {11}func{10}({11}SCI_ANNOTATIONSETTEXT{10},{0} {7}'a'{10},{0} {4}0{10},{0} {6}"LINE1"{10}){0} 7 | {5}end{0} 8 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.php: -------------------------------------------------------------------------------- 1 | 2 | \n"; 4 | /* ?> */ 5 | ?> 6 | forif 7 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.php.styled: -------------------------------------------------------------------------------- 1 | {1}{0} {9}{0} 2 | {18}\n"{127};{118} 4 | {124}/* ?> */{118} 5 | {18}?>{0} 6 | {1}{0}for{1}{0}if{1}{0} 7 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.pl: -------------------------------------------------------------------------------- 1 | use strict; 2 | while ( $r ) { 3 | printf ( "Example text \n" ); 4 | sleep 1; 5 | } -------------------------------------------------------------------------------- /scintilla/test/examples/x.pl.styled: -------------------------------------------------------------------------------- 1 | {5}use{0} {11}strict{10};{0} 2 | {5}while{0} {10}({0} {12}$r{0} {10}){0} {10}{{0} 3 | {5}printf{0} {10}({0} {6}"Example text \n"{0} {10});{0} 4 | {5}sleep{0} {4}1{10};{0} 5 | {10}} -------------------------------------------------------------------------------- /scintilla/test/examples/x.py: -------------------------------------------------------------------------------- 1 | # Convert all punctuation characters except '_', '*', and '.' into spaces. 2 | def depunctuate(s): 3 | '''A docstring''' 4 | """Docstring 2""" 5 | d = "" 6 | for ch in s: 7 | if ch in 'abcde': 8 | d = d + ch 9 | else: 10 | d = d + " " 11 | return d 12 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.py.styled: -------------------------------------------------------------------------------- 1 | {1}# Convert all punctuation characters except '_', '*', and '.' into spaces.{0} 2 | {5}def{0} {9}depunctuate{10}({11}s{10}):{0} 3 | {6}'''A docstring'''{0} 4 | {7}"""Docstring 2"""{0} 5 | {11}d{0} {10}={0} {3}""{0} 6 | {5}for{0} {11}ch{0} {5}in{0} {11}s{10}:{0} 7 | {5}if{0} {11}ch{0} {5}in{0} {4}'abcde'{10}:{0} 8 | {11}d{0} {10}={0} {11}d{0} {10}+{0} {11}ch{0} 9 | {5}else{10}:{0} 10 | {11}d{0} {10}={0} {11}d{0} {10}+{0} {3}" "{0} 11 | {5}return{0} {11}d{0} 12 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.rb: -------------------------------------------------------------------------------- 1 | class Demo 2 | def test # A test 3 | i = 1 4 | puts "Example" 5 | end 6 | end -------------------------------------------------------------------------------- /scintilla/test/examples/x.rb.styled: -------------------------------------------------------------------------------- 1 | {5}class{0} {8}Demo{0} 2 | {5}def{0} {9}test{0} {2}# A test{0} 3 | {11}i{0} {10}={0} {4}1{0} 4 | {11}puts{0} {6}"Example"{0} 5 | {5}end{0} 6 | {5}end -------------------------------------------------------------------------------- /scintilla/test/examples/x.vb: -------------------------------------------------------------------------------- 1 | ' String" 2 | Dim a As String = "hello, world" 3 | Dim b As String = "hello world" 4 | Dim c As String = "Joe said ""Hello"" to me" 5 | Dim d As String = "\\\\server\\share\\file.txt" 6 | ' Character 7 | ""C "c"C "cc"C 8 | ' Date 9 | d = #5/31/1993# or # 01/01/0001 12:00:00AM # 10 | -------------------------------------------------------------------------------- /scintilla/test/examples/x.vb.styled: -------------------------------------------------------------------------------- 1 | {1}' String" 2 | {3}Dim{0} {7}a{0} {3}As{0} {3}String{0} {6}={0} {4}"hello, world"{0} 3 | {3}Dim{0} {7}b{0} {3}As{0} {3}String{0} {6}={0} {4}"hello world"{0} 4 | {3}Dim{0} {7}c{0} {3}As{0} {3}String{0} {6}={0} {4}"Joe said ""Hello"" to me"{0} 5 | {3}Dim{0} {7}d{0} {3}As{0} {3}String{0} {6}={0} {4}"\\\\server\\share\\file.txt"{0} 6 | {1}' Character 7 | {4}""C{0} {4}"c"C{0} {4}"cc"C{0} 8 | {1}' Date 9 | {7}d{0} {6}={0} {8}#5/31/1993#{0} {3}or{0} {8}# 01/01/0001 12:00:00AM #{0} 10 | -------------------------------------------------------------------------------- /scintilla/test/unit/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /scintilla/test/unit/README: -------------------------------------------------------------------------------- 1 | The test/unit directory contains unit tests for Scintilla data structures. 2 | 3 | The tests can be run on Windows, OS X, or Linux using g++ and GNU make. 4 | The Catch test framework is used. 5 | https://github.com/philsquared/Catch 6 | The file catch.hpp is under the Boost Software License which is contained in LICENSE_1_0.txt 7 | 8 | To run the tests on OS X or Linux: 9 | make test 10 | 11 | To run the tests on Windows: 12 | mingw32-make test 13 | 14 | Visual C++ (2010+) and nmake can also be used on Windows: 15 | nmake -f test.mak test 16 | -------------------------------------------------------------------------------- /scintilla/test/unit/SciTE.properties: -------------------------------------------------------------------------------- 1 | command.go.*.cxx=./unitTest 2 | if PLAT_WIN 3 | make.command=mingw32-make 4 | command.go.*.cxx=unitTest 5 | command.go.needs.$(file.patterns.cplusplus)=$(make.command) 6 | -------------------------------------------------------------------------------- /scintilla/test/unit/makefile: -------------------------------------------------------------------------------- 1 | # Build all the unit tests using GNU make and either g++ or clang 2 | # Should be run using mingw32-make on Windows, not nmake 3 | # On Windows g++ is used, on OS X clang, and on Linux G++ is used by default 4 | # but clang can be used by defining CLANG when invoking make 5 | # clang works only with libc++, not libstdc++ 6 | # Tested with clang 3.3 and g++ 4.8 7 | 8 | ifndef windir 9 | ifeq ($(shell uname),Darwin) 10 | # On OS X always use clang as g++ is old version 11 | CLANG = 1 12 | USELIBCPP = 1 13 | endif 14 | endif 15 | 16 | CXXFLAGS += --std=c++11 17 | 18 | ifdef CLANG 19 | CXX = clang++ 20 | ifdef USELIBCPP 21 | # OS X, use libc++ but don't have sanitizers 22 | CXXFLAGS += --stdlib=libc++ 23 | LINKFLAGS = -lc++ 24 | else 25 | # Linux, have sanitizers 26 | SANITIZE = -fsanitize=address,undefined 27 | CXXFLAGS += $(SANITIZE) 28 | endif 29 | else 30 | CXX = g++ 31 | endif 32 | 33 | ifdef windir 34 | DEL = del /q 35 | EXE = unitTest.exe 36 | else 37 | DEL = rm -f 38 | EXE = unitTest 39 | endif 40 | 41 | INCLUDEDIRS = -I ../../include -I ../../src -I../../lexlib 42 | 43 | CPPFLAGS += $(INCLUDEDIRS) 44 | CXXFLAGS += -Wall -Wextra 45 | 46 | # Files in this directory containing tests 47 | TESTSRC=test*.cxx 48 | # Files being tested from scintilla/src directory 49 | TESTEDSRC=\ 50 | ../../src/CellBuffer.cxx \ 51 | ../../src/CharClassify.cxx \ 52 | ../../src/ContractionState.cxx \ 53 | ../../src/Decoration.cxx \ 54 | ../../src/RunStyles.cxx 55 | 56 | TESTS=$(EXE) 57 | 58 | all: $(TESTS) 59 | 60 | test: $(TESTS) 61 | ./$(EXE) 62 | 63 | clean: 64 | $(DEL) $(TESTS) *.o *.obj *.exe 65 | 66 | $(EXE): $(TESTSRC) $(TESTEDSRC) unitTest.cxx 67 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LINKFLAGS) $^ -o $@ 68 | -------------------------------------------------------------------------------- /scintilla/test/unit/test.mak: -------------------------------------------------------------------------------- 1 | # Build all the unit tests with Microsoft Visual C++ using nmake 2 | # Tested with Visual C++ 2010 and 2013 3 | 4 | DEL = del /q 5 | EXE = unitTest.exe 6 | 7 | INCLUDEDIRS = /I../../include /I../../src /I../../lexlib 8 | 9 | CXXFLAGS = /EHsc /wd 4805 $(INCLUDEDIRS) 10 | 11 | # Files in this directory containing tests 12 | TESTSRC=test*.cxx 13 | # Files being tested from scintilla/src directory 14 | TESTEDSRC=\ 15 | ../../src/CellBuffer.cxx \ 16 | ../../src/CharClassify.cxx \ 17 | ../../src/ContractionState.cxx \ 18 | ../../src/Decoration.cxx \ 19 | ../../src/RunStyles.cxx 20 | 21 | TESTS=$(EXE) 22 | 23 | all: $(TESTS) 24 | 25 | test: $(TESTS) 26 | $(EXE) 27 | 28 | clean: 29 | $(DEL) $(TESTS) *.o *.obj *.exe 30 | 31 | $(EXE): $(TESTSRC) $(TESTEDSRC) $(@B).obj 32 | $(CXX) $(CXXFLAGS) /Fe$@ $** 33 | -------------------------------------------------------------------------------- /scintilla/test/unit/testDecoration.cxx: -------------------------------------------------------------------------------- 1 | // Unit Tests for Scintilla internal data structures 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "Platform.h" 9 | 10 | #include "SplitVector.h" 11 | #include "Partitioning.h" 12 | #include "RunStyles.h" 13 | #include "Decoration.h" 14 | 15 | #include "catch.hpp" 16 | 17 | const int indicator=4; 18 | 19 | // Test Decoration. 20 | 21 | TEST_CASE("Decoration") { 22 | 23 | Decoration deco(indicator); 24 | 25 | SECTION("HasCorrectIndicator") { 26 | REQUIRE(indicator == deco.indicator); 27 | } 28 | 29 | SECTION("IsEmptyInitially") { 30 | REQUIRE(0 == deco.rs.Length()); 31 | REQUIRE(1 == deco.rs.Runs()); 32 | REQUIRE(deco.Empty()); 33 | } 34 | 35 | SECTION("SimpleSpace") { 36 | deco.rs.InsertSpace(0, 1); 37 | REQUIRE(deco.Empty()); 38 | } 39 | 40 | SECTION("SimpleRun") { 41 | deco.rs.InsertSpace(0, 1); 42 | deco.rs.SetValueAt(0, 2); 43 | REQUIRE(!deco.Empty()); 44 | } 45 | } 46 | 47 | // Test DecorationList. 48 | 49 | TEST_CASE("DecorationList") { 50 | 51 | DecorationList decol; 52 | 53 | SECTION("HasCorrectIndicator") { 54 | decol.SetCurrentIndicator(indicator); 55 | REQUIRE(indicator == decol.GetCurrentIndicator()); 56 | } 57 | 58 | SECTION("HasCorrectCurrentValue") { 59 | const int value = 55; 60 | decol.SetCurrentValue(value); 61 | REQUIRE(value == decol.GetCurrentValue()); 62 | } 63 | 64 | SECTION("ExpandSetValues") { 65 | decol.SetCurrentIndicator(indicator); 66 | decol.InsertSpace(0, 9); 67 | const int value = 59; 68 | int position = 4; 69 | int fillLength = 3; 70 | bool changed = decol.FillRange(position, value, fillLength); 71 | REQUIRE(changed); 72 | REQUIRE(position == 4); 73 | REQUIRE(fillLength == 3); 74 | REQUIRE(fillLength == 3); 75 | REQUIRE(decol.ValueAt(indicator, 5) == value); 76 | REQUIRE(decol.AllOnFor(5) == (1 << indicator)); 77 | REQUIRE(decol.Start(indicator, 5) == 4); 78 | REQUIRE(decol.End(indicator, 5) == 7); 79 | const int indicatorB=6; 80 | decol.SetCurrentIndicator(indicatorB); 81 | changed = decol.FillRange(position, value, fillLength); 82 | REQUIRE(changed); 83 | REQUIRE(decol.AllOnFor(5) == ((1 << indicator) | (1 << indicatorB))); 84 | decol.DeleteRange(5, 1); 85 | REQUIRE(decol.Start(indicatorB, 5) == 4); 86 | REQUIRE(decol.End(indicatorB, 5) == 6); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /scintilla/test/unit/unitTest.cxx: -------------------------------------------------------------------------------- 1 | // Unit Tests for Scintilla internal data structures 2 | 3 | /* 4 | Currently tested: 5 | SplitVector 6 | Partitioning 7 | RunStyles 8 | ContractionState 9 | CharClassify 10 | Decoration 11 | DecorationList 12 | CellBuffer 13 | 14 | To do: 15 | PerLine * 16 | Range 17 | StyledText 18 | CaseFolder ... 19 | Document 20 | RESearch 21 | Selection 22 | UniConversion 23 | Style 24 | 25 | lexlib: 26 | Accessor 27 | LexAccessor 28 | CharacterSet 29 | OptionSet 30 | PropSetSimple 31 | StyleContext 32 | WordList 33 | */ 34 | 35 | #include 36 | #include 37 | 38 | #include "Platform.h" 39 | 40 | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file 41 | #include "catch.hpp" 42 | 43 | // Needed for PLATFORM_ASSERT in code being tested 44 | 45 | void Platform::Assert(const char *c, const char *file, int line) { 46 | fprintf(stderr, "Assertion [%s] failed at %s %d\n", c, file, line); 47 | abort(); 48 | } 49 | 50 | void Platform::DebugPrintf(const char *format, ...) { 51 | char buffer[2000]; 52 | va_list pArguments; 53 | va_start(pArguments, format); 54 | vsprintf(buffer, format, pArguments); 55 | va_end(pArguments); 56 | fprintf(stderr, "%s", buffer); 57 | } 58 | -------------------------------------------------------------------------------- /scintilla/test/xite.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import XiteWin 4 | 5 | if __name__ == "__main__": 6 | XiteWin.main("") 7 | -------------------------------------------------------------------------------- /scintilla/tgzsrc: -------------------------------------------------------------------------------- 1 | cd .. 2 | rm -f scintilla.tgz 3 | tar --create --exclude \*.o --exclude \*.obj --exclude \*.dll --exclude \*.exe --exclude \*.a scintilla/* \ 4 | | gzip -c >scintilla.tgz 5 | -------------------------------------------------------------------------------- /scintilla/version.txt: -------------------------------------------------------------------------------- 1 | 344 2 | -------------------------------------------------------------------------------- /scintilla/win32/CheckD2D.cxx: -------------------------------------------------------------------------------- 1 | // This file is compiled to check whether Direct2D and DirectWrite headers are available. 2 | #include 3 | #include 4 | -------------------------------------------------------------------------------- /scintilla/win32/PlatWin.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file PlatWin.h 3 | ** Implementation of platform facilities on Windows. 4 | **/ 5 | // Copyright 1998-2011 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef PLATWIN_H 9 | #define PLATWIN_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | extern bool IsNT(); 16 | extern void Platform_Initialise(void *hInstance); 17 | extern void Platform_Finalise(bool fromDllMain); 18 | 19 | #if defined(USE_D2D) 20 | extern bool LoadD2D(); 21 | extern ID2D1Factory *pD2DFactory; 22 | extern IDWriteFactory *pIDWriteFactory; 23 | #endif 24 | 25 | #ifdef SCI_NAMESPACE 26 | } 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /scintilla/win32/SciTE.properties: -------------------------------------------------------------------------------- 1 | command.build.SConstruct=scons.bat . 2 | command.name.1.SConstruct=scons clean 3 | command.1.SConstruct=scons.bat --clean . 4 | 5 | command.build.*.mak=nmake -f $(FileNameExt) DEBUG=1 QUIET=1 6 | command.name.1.*.mak=nmake clean 7 | command.1.*.mak=nmake -f $(FileNameExt) clean 8 | command.name.2.*.mak=Borland Make 9 | command.2.*.mak=make -f $(FileNameExt) 10 | command.subsystem.2.*.mak=0 11 | command.name.3.*.mak=make clean 12 | command.3.*.mak=make -f $(FileNameExt) clean 13 | command.name.4.*.mak=make debug 14 | command.4.*.mak=make DEBUG=1 -f $(FileNameExt) 15 | command.name.5.*.mak=nmake debug 16 | command.5.*.mak=nmake DEBUG=1 -f $(FileNameExt) 17 | # SciTE.properties is the per directory local options file and can be used to override 18 | # settings made in SciTEGlobal.properties 19 | command.build.*.cxx=nmake -f scintilla.mak DEBUG=1 QUIET=1 20 | command.build.*.h=nmake -f scintilla.mak DEBUG=1 QUIET=1 21 | command.build.*.rc=nmake -f scintilla.mak DEBUG=1 QUIET=1 22 | -------------------------------------------------------------------------------- /scintilla/win32/ScintRes.rc: -------------------------------------------------------------------------------- 1 | // Resource file for Scintilla 2 | // Copyright 1998-2010 by Neil Hodgson 3 | // The License.txt file describes the conditions under which this software may be distributed. 4 | 5 | #include 6 | 7 | #define VERSION_SCINTILLA "3.4.4" 8 | #define VERSION_WORDS 3, 4, 4, 0 9 | 10 | #ifndef RT_MANIFEST 11 | #define RT_MANIFEST 24 12 | #endif 13 | 14 | #ifndef ISOLATIONAWARE_MANIFEST_RESOURCE_ID 15 | #define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2 16 | #endif 17 | 18 | VS_VERSION_INFO VERSIONINFO 19 | FILEVERSION VERSION_WORDS 20 | PRODUCTVERSION VERSION_WORDS 21 | FILEFLAGSMASK 0x3fL 22 | FILEFLAGS 0 23 | FILEOS VOS_NT_WINDOWS32 24 | FILETYPE VFT_APP 25 | FILESUBTYPE VFT2_UNKNOWN 26 | BEGIN 27 | BLOCK "VarFileInfo" 28 | BEGIN 29 | VALUE "Translation", 0x409, 1200 30 | END 31 | BLOCK "StringFileInfo" 32 | BEGIN 33 | BLOCK "040904b0" 34 | BEGIN 35 | VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\0" 36 | VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component\0" 37 | VALUE "FileVersion", VERSION_SCINTILLA "\0" 38 | VALUE "InternalName", "Scintilla\0" 39 | VALUE "LegalCopyright", "Copyright 1998-2012 by Neil Hodgson\0" 40 | VALUE "OriginalFilename", "Scintilla.DLL\0" 41 | VALUE "ProductName", "Scintilla\0" 42 | VALUE "ProductVersion", VERSION_SCINTILLA "\0" 43 | END 44 | END 45 | END 46 | 47 | ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST 48 | BEGIN 49 | "" 50 | "" 51 | "" 52 | "" 53 | "Scintilla" 54 | "CallTip" 55 | "" 56 | "" 57 | END 58 | -------------------------------------------------------------------------------- /scintilla/win32/Scintilla.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | Scintilla_DirectFunction -------------------------------------------------------------------------------- /scintilla/zipsrc.bat: -------------------------------------------------------------------------------- 1 | cd .. 2 | del/q scintilla.zip 3 | zip scintilla.zip scintilla\*.* scintilla\*\*.* scintilla\*\*\*.* scintilla\*\*\*\*.* scintilla\*\*\*\*\*.* -x *.o -x *.obj -x *.dll -x *.lib -x *.res -x *.exp 4 | cd scintilla 5 | --------------------------------------------------------------------------------