├── .gitignore ├── Demo.cpp ├── Demo.rc ├── ElasticTabstops.cpp ├── ElasticTabstopsEdit.cpp ├── ElasticTabstopsEdit.h ├── ElasticTabstopsForScintilla.sln ├── ElasticTabstopsForScintilla.vcxproj ├── ElasticTabstopsForScintilla.vcxproj.filters ├── LICENCE.md ├── README.md ├── buffer_contents.txt ├── resource.h └── scintilla ├── .hg_archival.txt ├── .hgeol ├── .hgignore ├── .hgtags ├── License.txt ├── README ├── 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 ├── ScintillaTest │ ├── AppController.h │ ├── AppController.mm │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ └── MainMenu.xib │ ├── Info.plist │ ├── Scintilla-Info.plist │ ├── ScintillaTest.xcodeproj │ │ └── project.pbxproj │ ├── 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 ├── 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 ├── LexRegistry.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 ├── 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 ├── EditModel.cxx ├── EditModel.h ├── EditView.cxx ├── EditView.h ├── Editor.cxx ├── Editor.h ├── ExternalLexer.cxx ├── ExternalLexer.h ├── FontQuality.h ├── Indicator.cxx ├── Indicator.h ├── KeyMap.cxx ├── KeyMap.h ├── LineMarker.cxx ├── LineMarker.h ├── MarginView.cxx ├── MarginView.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 │ ├── 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 | #OS junk files 2 | [Tt]humbs.db 3 | 4 | #Visual Studio files 5 | *.[Oo]bj 6 | *.user 7 | *.aps 8 | *.pch 9 | *.vspscc 10 | *.vssscc 11 | *_i.c 12 | *_p.c 13 | *.ncb 14 | *.suo 15 | *.tlb 16 | *.tlh 17 | *.bak 18 | *.[Cc]ache 19 | *.ilk 20 | *.log 21 | *.lib 22 | *.sbr 23 | *.sdf 24 | *.opensdf 25 | *.unsuccessfulbuild 26 | ipch/ 27 | obj/ 28 | [Bb]in 29 | [Dd]ebug*/ 30 | [Rr]elease*/ 31 | Ankh.NoLoad 32 | 33 | #Project files 34 | [Bb]uild/ 35 | 36 | #Test files 37 | *.testsettings -------------------------------------------------------------------------------- /Demo.cpp: -------------------------------------------------------------------------------- 1 | // Elastic tabstops for Scintilla demo application 2 | 3 | #define VC_EXTRALEAN 4 | #undef _WIN32_WINNT 5 | #define _WIN32_WINNT 0x0501 6 | #undef WINVER 7 | #define WINVER 0x0501 8 | #define NTDDI_VERSION 0x05010300 9 | 10 | #include 11 | 12 | #include "SciLexer.h" 13 | 14 | #include "ElasticTabstopsEdit.h" 15 | #include "resource.h" 16 | 17 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 18 | 19 | #ifdef _DEBUG 20 | #define new DEBUG_NEW 21 | #endif 22 | 23 | class DemoDialog : public CDialog 24 | { 25 | public: 26 | DemoDialog() : CDialog(IDD_TEST_DIALOG) 27 | { 28 | } 29 | 30 | protected: 31 | BOOL OnInitDialog() 32 | { 33 | CDialog::OnInitDialog(); 34 | 35 | m_edit.SubclassDlgItem(IDC_EDIT, this); 36 | m_edit.Setup(); 37 | m_edit.SendMessage(SCI_SETWRAPMODE, 1); 38 | 39 | HMODULE hModule = GetModuleHandle(NULL); 40 | HRSRC hRes = FindResource(hModule, MAKEINTRESOURCE(IDR_TEXTFILE), L"BUFFER_CONTENTS"); 41 | HGLOBAL hMem = LoadResource(hModule, hRes); 42 | DWORD size = SizeofResource(hModule, hRes); 43 | char *res_text = (char*) LockResource(hMem); 44 | char *text = (char*) malloc(size + 1); 45 | memcpy(text, res_text, size); 46 | text[size] = 0; 47 | FreeResource(hMem); 48 | m_edit.SetText(text); 49 | free(text); 50 | 51 | // set default and C++ comment styles 52 | m_edit.SendMessage(SCI_STYLESETFONT, STYLE_DEFAULT, reinterpret_cast("verdana")); 53 | m_edit.SendMessage(SCI_STYLESETSIZE, STYLE_DEFAULT, 8); 54 | m_edit.SendMessage(SCI_STYLECLEARALL, 0, 0); 55 | m_edit.SendMessage(SCI_SETLEXER, SCLEX_CPP); 56 | m_edit.SendMessage(SCI_STYLESETFONT, SCE_C_COMMENT, reinterpret_cast("georgia")); 57 | m_edit.SendMessage(SCI_STYLESETSIZE, SCE_C_COMMENT, 10); 58 | m_edit.SendMessage(SCI_STYLESETFORE, SCE_C_COMMENT, 0x008000); 59 | 60 | return TRUE; 61 | } 62 | 63 | void DemoDialog::PostNcDestroy() 64 | { 65 | m_edit.CleanUp(); 66 | CDialog::PostNcDestroy(); 67 | } 68 | 69 | ElasticTabstopsEdit m_edit; 70 | }; 71 | 72 | class DemoApp : public CWinApp 73 | { 74 | public: 75 | BOOL InitInstance() 76 | { 77 | INITCOMMONCONTROLSEX InitCtrls; 78 | InitCtrls.dwSize = sizeof(InitCtrls); 79 | InitCtrls.dwICC = ICC_WIN95_CLASSES; 80 | ::InitCommonControlsEx(&InitCtrls); 81 | 82 | CWinApp::InitInstance(); 83 | 84 | // Set up Scintilla 85 | if (Scintilla_RegisterClasses(AfxGetInstanceHandle())) 86 | { 87 | // Show the test editor dialog 88 | DemoDialog dialog; 89 | dialog.DoModal(); 90 | } 91 | return FALSE; 92 | } 93 | }; 94 | 95 | DemoApp theApp; 96 | -------------------------------------------------------------------------------- /Demo.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | #pragma code_page(1252) 21 | 22 | ///////////////////////////////////////////////////////////////////////////// 23 | // 24 | // Dialog 25 | // 26 | 27 | IDD_TEST_DIALOG DIALOGEX 0, 0, 495, 372 28 | STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME 29 | EXSTYLE WS_EX_APPWINDOW 30 | CAPTION "Elastic tabstops for Scintilla demo" 31 | FONT 8, "MS Shell Dlg", 0, 0, 0x1 32 | BEGIN 33 | DEFPUSHBUTTON "OK",IDOK,438,351,50,14 34 | CONTROL "",IDC_EDIT,"Scintilla",WS_TABSTOP,7,7,481,340 35 | END 36 | 37 | 38 | ///////////////////////////////////////////////////////////////////////////// 39 | // 40 | // DESIGNINFO 41 | // 42 | 43 | #ifdef APSTUDIO_INVOKED 44 | GUIDELINES DESIGNINFO 45 | BEGIN 46 | IDD_TEST_DIALOG, DIALOG 47 | BEGIN 48 | LEFTMARGIN, 7 49 | RIGHTMARGIN, 488 50 | TOPMARGIN, 7 51 | BOTTOMMARGIN, 365 52 | END 53 | END 54 | #endif // APSTUDIO_INVOKED 55 | 56 | #endif // English (United States) resources 57 | ///////////////////////////////////////////////////////////////////////////// 58 | 59 | 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // English (United Kingdom) resources 62 | 63 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) 64 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK 65 | #pragma code_page(1252) 66 | 67 | #ifdef APSTUDIO_INVOKED 68 | ///////////////////////////////////////////////////////////////////////////// 69 | // 70 | // TEXTINCLUDE 71 | // 72 | 73 | 1 TEXTINCLUDE 74 | BEGIN 75 | "resource.h\0" 76 | END 77 | 78 | 2 TEXTINCLUDE 79 | BEGIN 80 | "#include ""afxres.h""\r\n" 81 | "\0" 82 | END 83 | 84 | 3 TEXTINCLUDE 85 | BEGIN 86 | "#define _AFX_NO_SPLITTER_RESOURCES\r\n" 87 | "#define _AFX_NO_OLE_RESOURCES\r\n" 88 | "#define _AFX_NO_TRACKER_RESOURCES\r\n" 89 | "#define _AFX_NO_PROPERTY_RESOURCES\r\n" 90 | "\r\n" 91 | "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" 92 | "LANGUAGE 9, 1\r\n" 93 | "#pragma code_page(1252)\r\n" 94 | "#include ""afxres.rc"" // Standard components\r\n" 95 | "#endif\r\n" 96 | "\0" 97 | END 98 | 99 | #endif // APSTUDIO_INVOKED 100 | 101 | 102 | ///////////////////////////////////////////////////////////////////////////// 103 | // 104 | // BUFFER_CONTENTS 105 | // 106 | 107 | IDR_TEXTFILE BUFFER_CONTENTS "buffer_contents.txt" 108 | #endif // English (United Kingdom) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | #define _AFX_NO_SPLITTER_RESOURCES 119 | #define _AFX_NO_OLE_RESOURCES 120 | #define _AFX_NO_TRACKER_RESOURCES 121 | #define _AFX_NO_PROPERTY_RESOURCES 122 | 123 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 124 | LANGUAGE 9, 1 125 | #pragma code_page(1252) 126 | #include "afxres.rc" // Standard components 127 | #endif 128 | 129 | ///////////////////////////////////////////////////////////////////////////// 130 | #endif // not APSTUDIO_INVOKED 131 | 132 | -------------------------------------------------------------------------------- /ElasticTabstopsEdit.cpp: -------------------------------------------------------------------------------- 1 | // Scintilla derived class implementing elastic tabstops 2 | 3 | #define VC_EXTRALEAN 4 | #undef _WIN32_WINNT 5 | #define _WIN32_WINNT 0x0501 6 | #undef WINVER 7 | #define WINVER 0x0501 8 | #define NTDDI_VERSION 0x05010300 9 | 10 | #include 11 | 12 | #include "ElasticTabstopsEdit.h" 13 | 14 | // Function that calculates and sets the elastic tabstops 15 | void ElasticTabstops_OnModify(sptr_t edit, int start, int end); 16 | 17 | void exit_cleanly(); 18 | 19 | IMPLEMENT_DYNAMIC(ElasticTabstopsEdit, CWnd) 20 | 21 | BEGIN_MESSAGE_MAP(ElasticTabstopsEdit, CWnd) 22 | ON_NOTIFY_REFLECT(SCN_MODIFIED, OnModified) 23 | END_MESSAGE_MAP() 24 | 25 | void ElasticTabstopsEdit::Setup(void) 26 | { 27 | // Listen for changes to the editor's document 28 | SendMessage(SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_CHANGESTYLE); 29 | } 30 | 31 | void ElasticTabstopsEdit::SetText(const char* text) 32 | { 33 | // Set the text in the editor 34 | SendMessage(SCI_SETTEXT, 0, (LPARAM)text); 35 | } 36 | 37 | void ElasticTabstopsEdit::OnModified(NMHDR* hdr, LRESULT*) 38 | { 39 | if (hdr->code == SCN_MODIFIED) 40 | { 41 | // If text has been added or removed, update the tabstops 42 | SCNotification* notify = (SCNotification*)hdr; 43 | if (notify->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_CHANGESTYLE)) 44 | { 45 | ElasticTabstops_OnModify(SendMessage(SCI_GETDIRECTPOINTER), notify->position, notify->position + notify->length); 46 | } 47 | else if (notify->modificationType & SC_MOD_DELETETEXT) 48 | { 49 | ElasticTabstops_OnModify(SendMessage(SCI_GETDIRECTPOINTER), notify->position, notify->position); 50 | } 51 | } 52 | } 53 | 54 | void ElasticTabstopsEdit::CleanUp() 55 | { 56 | exit_cleanly(); 57 | } 58 | -------------------------------------------------------------------------------- /ElasticTabstopsEdit.h: -------------------------------------------------------------------------------- 1 | // Scintilla derived class implementing elastic tabstops 2 | 3 | #pragma once 4 | 5 | #include "Platform.h" 6 | #include "Scintilla.h" 7 | 8 | class ElasticTabstopsEdit : public CWnd 9 | { 10 | DECLARE_DYNAMIC(ElasticTabstopsEdit) 11 | 12 | public: 13 | void Setup(void); 14 | void SetText(const char* text); 15 | void CleanUp(); 16 | 17 | protected: 18 | DECLARE_MESSAGE_MAP() 19 | 20 | afx_msg void OnModified(NMHDR*, LRESULT*); 21 | }; 22 | -------------------------------------------------------------------------------- /ElasticTabstopsForScintilla.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ElasticTabstopsForScintilla", "ElasticTabstopsForScintilla.vcxproj", "{29192A45-B5CC-4A9A-A5A3-05376D5B02A1}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {29192A45-B5CC-4A9A-A5A3-05376D5B02A1}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {29192A45-B5CC-4A9A-A5A3-05376D5B02A1}.Debug|Win32.Build.0 = Debug|Win32 14 | {29192A45-B5CC-4A9A-A5A3-05376D5B02A1}.Release|Win32.ActiveCfg = Release|Win32 15 | {29192A45-B5CC-4A9A-A5A3-05376D5B02A1}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /LICENCE.md: -------------------------------------------------------------------------------- 1 | *Elastic tabstops for Scintilla has been released under the the MIT licence* 2 | 3 | Copyright (c) 2007-2014 Nick Gravgaard, David Kinder 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elastic tabstops for Scintilla 2 | 3 | This is an implementation of elastic tabstops for Scintilla. 4 | It was originally based on a port by [David Kinder](http://www.davidkinder.co.uk/) of [my old Gedit implementation](http://nickgravgaard.com/elastic-tabstops/gedit/). 5 | 6 | The work consisted of 2 main parts: 7 | * extending Scintilla's API to support explicit tabstop positions 8 | * implementing elastic tabstops using the extended API 9 | 10 | ## Extending Scintilla's API to support explicit tabstop positions 11 | 12 | In August 2014, code from this repo was added to Scintilla's main branch (see [this commit](http://sourceforge.net/p/scintilla/code/ci/3f3ae214c626d7276aee35a14d1ffa1ad848c9cd/)) and released as part of version 3.5.0. 13 | This makes it possible to set explicit tabstop positions in Scintilla (using SCI_CLEARTABSTOPS, SCI_ADDTABSTOP, and SCI_GETNEXTTABSTOP as [documented here](http://www.scintilla.org/ScintillaDoc.html#TabsAndIndentationGuides)), which is a prerequisite for implementing elastic tabstops. 14 | 15 | ## Implementing elastic tabstops using the extended API 16 | 17 | Most of the interesting code is in [ElasticTabstops.cpp](https://github.com/nickgravgaard/ElasticTabstopsForScintilla/blob/master/ElasticTabstops.cpp). 18 | Currently this is not a very efficient implementation as it rescans the entire buffer every time a change is made, rather than caching everything and only rescanning the parts that have changed. 19 | Unless performance is not an issue, those wishing to reimplement elastic tabstops should find a way to cache cell widths per line. 20 | For a discussion about possible ways to do this in Scintilla see [here](https://groups.google.com/forum/#!topic/scintilla-interest/Z-gSieCdbyM). 21 | 22 | Visit http://nickgravgaard.com/elastic-tabstops/ for more information. 23 | -------------------------------------------------------------------------------- /buffer_contents.txt: -------------------------------------------------------------------------------- 1 | /* Hopefully this program should demonstrate how elastic tabstops work. */ 2 | /* Try inserting and deleting different parts of the text and watch as the tabstops move. */ 3 | /* If you like this, please ask the writers of your text editor to implement it. */ 4 | 5 | #include 6 | 7 | struct ipc_perm 8 | { 9 | key_t key; 10 | ushort uid; /* owner euid and egid */ 11 | ushort gid; /* group id */ 12 | ushort cuid; /* creator euid and egid */ 13 | cell-missing /* for test purposes */ 14 | ushort mode; /* access modes */ 15 | ushort seq; /* sequence number */ 16 | }; 17 | 18 | int someDemoCode( int fred, 19 | int wilma) 20 | { 21 | x(); /* try making */ 22 | printf("hello!\n"); /* this comment */ 23 | doSomethingComplicated(); /* a bit longer */ 24 | for (i = start; i < end; ++i) 25 | { 26 | if (isPrime(i)) 27 | { 28 | ++numPrimes; 29 | } 30 | } 31 | return numPrimes; 32 | } 33 | 34 | ---- and now for something completely different: a table ---- 35 | 36 | Title Author Publisher Year 37 | Generation X Douglas Coupland Abacus 1995 38 | Informagic Jean-Pierre Petit John Murray Ltd 1982 39 | The Cyberiad Stanislaw Lem Harcourt Publishers Ltd 1985 40 | The Selfish Gene Richard Dawkins Oxford University Press 2006 41 | -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Demo.rc 4 | // 5 | #define IDD_TEST_DIALOG 101 6 | #define IDR_TEXTFILE 129 7 | #define IDC_EDIT 1000 8 | 9 | // Next default values for new objects 10 | // 11 | #ifdef APSTUDIO_INVOKED 12 | #ifndef APSTUDIO_READONLY_SYMBOLS 13 | #define _APS_NEXT_RESOURCE_VALUE 130 14 | #define _APS_NEXT_COMMAND_VALUE 32771 15 | #define _APS_NEXT_CONTROL_VALUE 1002 16 | #define _APS_NEXT_SYMED_VALUE 102 17 | #endif 18 | #endif 19 | -------------------------------------------------------------------------------- /scintilla/.hg_archival.txt: -------------------------------------------------------------------------------- 1 | repo: bdf8c3ef2fb01ea24578e726337888e706d10b92 2 | node: 338662f185a7a7519553f90b66fda346587e76f7 3 | branch: default 4 | latesttag: rel-3-5-0 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/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/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/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/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/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/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/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/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/cocoa/res/info_bar_bg.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/info_bar_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/cocoa/res/info_bar_bg@2x.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_busy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/cocoa/res/mac_cursor_busy.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_busy@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/cocoa/res/mac_cursor_busy@2x.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_flipped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/cocoa/res/mac_cursor_flipped.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_flipped@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/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/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/doc/Indicators.png -------------------------------------------------------------------------------- /scintilla/doc/Markers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/doc/Markers.png -------------------------------------------------------------------------------- /scintilla/doc/SciBreak.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/doc/SciBreak.jpg -------------------------------------------------------------------------------- /scintilla/doc/SciRest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/doc/SciRest.jpg -------------------------------------------------------------------------------- /scintilla/doc/SciTEIco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/doc/SciTEIco.png -------------------------------------------------------------------------------- /scintilla/doc/SciWord.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/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.5.0 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/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/doc/annotations.png -------------------------------------------------------------------------------- /scintilla/doc/styledmargin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/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++ -Wno-deprecated-register 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 EditModel.o Editor.o EditView.o ExternalLexer.o MarginView.o \ 94 | PropSetSimple.o PlatGTK.o \ 95 | KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o CharacterCategory.o ViewStyle.o \ 96 | RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \ 97 | $(MARSHALLER) $(LEXOBJS) 98 | $(AR) rc $@ $^ 99 | $(RANLIB) $@ 100 | 101 | # Automatically generate header dependencies with "make deps" 102 | include deps.mak 103 | -------------------------------------------------------------------------------- /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/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/lexers/LexCSS.cxx -------------------------------------------------------------------------------- /scintilla/lexers/LexErlang.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/lexers/LexErlang.cxx -------------------------------------------------------------------------------- /scintilla/lexers/LexMMIXAL.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/scintilla/lexers/LexMMIXAL.cxx -------------------------------------------------------------------------------- /scintilla/lexers/LexMatlab.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nick-gravgaard/ElasticTabstopsForScintilla/7328b4830d9b1dd1616175ad1a6722e722928d9f/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 4456 4457) 71 | #endif 72 | 73 | // Turn off shadow warnings for lexers as may be maintained by others 74 | #if defined(__GNUC__) 75 | #pragma GCC diagnostic ignored "-Wshadow" 76 | #endif 77 | 78 | #ifdef SCI_NAMESPACE 79 | } 80 | #endif 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /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 | int get_character(int pos); // Calls GetCharacterAndWidth(pos, NULL) 78 | 79 | private: 80 | void emit_modify_attempt(); 81 | void emit_save_point(bool atSavePoint); 82 | void emit_modified(int position, int modification_type, const QByteArray& text, int length, 83 | int linesAdded, int line, int foldLevelNow, int foldLevelPrev); 84 | void emit_style_needed(int pos); 85 | void emit_lexer_changed(); 86 | void emit_error_occurred(int status); 87 | 88 | signals: 89 | void modify_attempt(); 90 | void save_point(bool atSavePoint); 91 | void modified(int position, int modification_type, const QByteArray& text, int length, 92 | int linesAdded, int line, int foldLevelNow, int foldLevelPrev); 93 | void style_needed(int pos); 94 | void lexer_changed(); 95 | void error_occurred(int status); 96 | 97 | friend class WatcherHelper; 98 | 99 | }; 100 | 101 | #endif // SCINTILLADOCUMENT_H 102 | -------------------------------------------------------------------------------- /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.5.0 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/MarginView.cxx \ 33 | ../../src/LineMarker.cxx \ 34 | ../../src/KeyMap.cxx \ 35 | ../../src/Indicator.cxx \ 36 | ../../src/ExternalLexer.cxx \ 37 | ../../src/EditView.cxx \ 38 | ../../src/Editor.cxx \ 39 | ../../src/EditModel.cxx \ 40 | ../../src/Document.cxx \ 41 | ../../src/Decoration.cxx \ 42 | ../../src/ContractionState.cxx \ 43 | ../../src/CharClassify.cxx \ 44 | ../../src/CellBuffer.cxx \ 45 | ../../src/Catalogue.cxx \ 46 | ../../src/CaseFolder.cxx \ 47 | ../../src/CaseConvert.cxx \ 48 | ../../src/CallTip.cxx \ 49 | ../../src/AutoComplete.cxx \ 50 | ../../lexlib/WordList.cxx \ 51 | ../../lexlib/StyleContext.cxx \ 52 | ../../lexlib/PropSetSimple.cxx \ 53 | ../../lexlib/LexerSimple.cxx \ 54 | ../../lexlib/LexerNoExceptions.cxx \ 55 | ../../lexlib/LexerModule.cxx \ 56 | ../../lexlib/LexerBase.cxx \ 57 | ../../lexlib/CharacterSet.cxx \ 58 | ../../lexlib/CharacterCategory.cxx \ 59 | ../../lexlib/Accessor.cxx \ 60 | ../../lexers/*.cxx 61 | 62 | HEADERS += \ 63 | ScintillaEdit.h \ 64 | ScintillaDocument.h \ 65 | ../ScintillaEditBase/ScintillaEditBase.h \ 66 | ../ScintillaEditBase/ScintillaQt.h 67 | 68 | OTHER_FILES += 69 | 70 | INCLUDEPATH += ../ScintillaEditBase ../../include ../../src ../../lexlib 71 | 72 | DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 SCI_LEXER=1 _CRT_SECURE_NO_DEPRECATE=1 73 | 74 | DESTDIR = ../../bin 75 | DLLDESTDIR = ../../bin 76 | 77 | macx { 78 | QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/ 79 | } 80 | -------------------------------------------------------------------------------- /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/ScintillaEditBase/ScintillaEditBase.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 = ScintillaEditBase 11 | TEMPLATE = lib 12 | CONFIG += lib_bundle 13 | 14 | VERSION = 3.5.0 15 | 16 | SOURCES += \ 17 | PlatQt.cpp \ 18 | ScintillaQt.cpp \ 19 | ScintillaEditBase.cpp \ 20 | ../../src/XPM.cxx \ 21 | ../../src/ViewStyle.cxx \ 22 | ../../src/UniConversion.cxx \ 23 | ../../src/Style.cxx \ 24 | ../../src/Selection.cxx \ 25 | ../../src/ScintillaBase.cxx \ 26 | ../../src/RunStyles.cxx \ 27 | ../../src/RESearch.cxx \ 28 | ../../src/PositionCache.cxx \ 29 | ../../src/PerLine.cxx \ 30 | ../../src/MarginView.cxx \ 31 | ../../src/LineMarker.cxx \ 32 | ../../src/KeyMap.cxx \ 33 | ../../src/Indicator.cxx \ 34 | ../../src/ExternalLexer.cxx \ 35 | ../../src/EditView.cxx \ 36 | ../../src/Editor.cxx \ 37 | ../../src/EditModel.cxx \ 38 | ../../src/Document.cxx \ 39 | ../../src/Decoration.cxx \ 40 | ../../src/ContractionState.cxx \ 41 | ../../src/CharClassify.cxx \ 42 | ../../src/CellBuffer.cxx \ 43 | ../../src/Catalogue.cxx \ 44 | ../../src/CaseFolder.cxx \ 45 | ../../src/CaseConvert.cxx \ 46 | ../../src/CallTip.cxx \ 47 | ../../src/AutoComplete.cxx \ 48 | ../../lexlib/WordList.cxx \ 49 | ../../lexlib/StyleContext.cxx \ 50 | ../../lexlib/PropSetSimple.cxx \ 51 | ../../lexlib/LexerSimple.cxx \ 52 | ../../lexlib/LexerNoExceptions.cxx \ 53 | ../../lexlib/LexerModule.cxx \ 54 | ../../lexlib/LexerBase.cxx \ 55 | ../../lexlib/CharacterSet.cxx \ 56 | ../../lexlib/Accessor.cxx \ 57 | ../../lexlib/CharacterCategory.cxx \ 58 | ../../lexers/*.cxx 59 | 60 | HEADERS += \ 61 | PlatQt.h \ 62 | ScintillaQt.h \ 63 | ScintillaEditBase.h \ 64 | ../../src/XPM.h \ 65 | ../../src/ViewStyle.h \ 66 | ../../src/UniConversion.h \ 67 | ../../src/UnicodeFromUTF8.h \ 68 | ../../src/Style.h \ 69 | ../../src/SplitVector.h \ 70 | ../../src/Selection.h \ 71 | ../../src/ScintillaBase.h \ 72 | ../../src/RunStyles.h \ 73 | ../../src/RESearch.h \ 74 | ../../src/PositionCache.h \ 75 | ../../src/PerLine.h \ 76 | ../../src/Partitioning.h \ 77 | ../../src/LineMarker.h \ 78 | ../../src/KeyMap.h \ 79 | ../../src/Indicator.h \ 80 | ../../src/FontQuality.h \ 81 | ../../src/ExternalLexer.h \ 82 | ../../src/Editor.h \ 83 | ../../src/Document.h \ 84 | ../../src/Decoration.h \ 85 | ../../src/ContractionState.h \ 86 | ../../src/CharClassify.h \ 87 | ../../src/CellBuffer.h \ 88 | ../../src/Catalogue.h \ 89 | ../../src/CaseFolder.h \ 90 | ../../src/CaseConvert.h \ 91 | ../../src/CallTip.h \ 92 | ../../src/AutoComplete.h \ 93 | ../../include/Scintilla.h \ 94 | ../../include/SciLexer.h \ 95 | ../../include/Platform.h \ 96 | ../../include/ILexer.h \ 97 | ../../lexlib/WordList.h \ 98 | ../../lexlib/StyleContext.h \ 99 | ../../lexlib/SparseState.h \ 100 | ../../lexlib/PropSetSimple.h \ 101 | ../../lexlib/OptionSet.h \ 102 | ../../lexlib/LexerSimple.h \ 103 | ../../lexlib/LexerNoExceptions.h \ 104 | ../../lexlib/LexerModule.h \ 105 | ../../lexlib/LexerBase.h \ 106 | ../../lexlib/LexAccessor.h \ 107 | ../../lexlib/CharacterSet.h \ 108 | ../../lexlib/CharacterCategory.h \ 109 | ../../lexlib/Accessor.h 110 | 111 | OTHER_FILES += 112 | 113 | INCLUDEPATH += ../../include ../../src ../../lexlib 114 | 115 | DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 SCI_LEXER=1 _CRT_SECURE_NO_DEPRECATE=1 116 | 117 | DESTDIR = ../../bin 118 | 119 | macx { 120 | QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/ 121 | } 122 | -------------------------------------------------------------------------------- /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/ScintillaEditPy.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = lib 2 | QT += core gui 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | TARGET = ScintillaEditPy 6 | 7 | # Clear debug & release so that sepbuild.pri can set one or the other 8 | CONFIG -= debug release 9 | 10 | include(sepbuild.pri) 11 | 12 | VERSION = $$SCINTILLA_VERSION 13 | 14 | win32 { 15 | DebugBuild { 16 | TARGET_EXT = _d.pyd 17 | } 18 | else { 19 | TARGET_EXT = .pyd 20 | } 21 | } 22 | 23 | INCLUDEPATH += ../ScintillaEdit 24 | INCLUDEPATH += ../ScintillaEditBase 25 | INCLUDEPATH += ../../include ../../lexlib ../../src 26 | 27 | INCLUDEPATH += $$PY_INCLUDES 28 | 29 | INCLUDEPATH += $$SHIBOKEN_INCLUDES 30 | INCLUDEPATH += $$PYSIDE_INCLUDES 31 | INCLUDEPATH += $$PYSIDE_INCLUDES/QtCore 32 | INCLUDEPATH += $$PYSIDE_INCLUDES/QtGui 33 | 34 | unix:!mac { 35 | LIBS += `pkg-config pyside --libs` 36 | } 37 | unix:linux-* { 38 | # gcc on freebsd 9.2, at least, doesn't support -Wno-empty-body 39 | QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-empty-body 40 | LIBS += -ldl 41 | } 42 | 43 | macx { 44 | # Only build for x64 for now 45 | # QMAKE_CFLAGS = -arch i386 -arch x86_64 46 | # QMAKE_CXXFLAGS = -arch i386 -arch x86_64 47 | # QMAKE_LFLAGS = -arch i386 -arch x86_64 48 | LIBS += -L$$PY_LIBDIR -lpython$$PY_VERSION_SUFFIX 49 | LIBS += -L$$PYSIDE_LIB -L$$SHIBOKEN_LIB 50 | debug { 51 | LIBS += -lshiboken-python$$PY_VERSION_SUFFIX-dbg 52 | LIBS += -lpyside-python$$PY_VERSION_SUFFIX-dbg 53 | } 54 | else { 55 | LIBS += -lshiboken-python$$PY_VERSION_SUFFIX 56 | LIBS += -lpyside-python$$PY_VERSION_SUFFIX 57 | } 58 | } 59 | 60 | win32 { 61 | DebugBuild { 62 | DEFINES += DEBUG 63 | LIBS += -lQtCored4 64 | } 65 | else { 66 | LIBS += -lQtCore 67 | } 68 | LIBS += -L$$PY_PREFIX/libs # Note python lib is pulled in via a #pragma 69 | LIBS += -L$$PYSIDE_LIB -L$$SHIBOKEN_LIB 70 | # PySide uses x.y suffix on Windows even though Python uses xy 71 | DebugBuild { 72 | LIBS += -lshiboken-python$${PY_VERSION}_d 73 | LIBS += -lpyside-python$${PY_VERSION}_d 74 | } 75 | else { 76 | LIBS += -lshiboken-python$${PY_VERSION} 77 | LIBS += -lpyside-python$${PY_VERSION} 78 | } 79 | } 80 | 81 | # Wrapper sources; notifyheader commented out due to shiboken bug 82 | SOURCES += \ 83 | ScintillaEditPy/scintillaeditpy_module_wrapper.cpp \ 84 | ScintillaEditPy/sci_notifyheader_wrapper.cpp \ 85 | ScintillaEditPy/scnotification_wrapper.cpp \ 86 | ScintillaEditPy/scintillaeditbase_wrapper.cpp \ 87 | ScintillaEditPy/scintillaedit_wrapper.cpp \ 88 | ScintillaEditPy/scintilladocument_wrapper.cpp 89 | 90 | # ScintillaEdit sources 91 | 92 | SOURCES += \ 93 | ../ScintillaEdit/ScintillaEdit.cpp \ 94 | ../ScintillaEdit/ScintillaDocument.cpp \ 95 | ../ScintillaEditBase/PlatQt.cpp \ 96 | ../ScintillaEditBase/ScintillaQt.cpp \ 97 | ../ScintillaEditBase/ScintillaEditBase.cpp \ 98 | ../../src/*.cxx \ 99 | ../../lexlib/*.cxx \ 100 | ../../lexers/*.cxx 101 | 102 | # HEADERS is used to find what needs to be run through moc 103 | HEADERS += \ 104 | ../ScintillaEdit/ScintillaEdit.h \ 105 | ../ScintillaEdit/ScintillaDocument.h \ 106 | ../ScintillaEditBase/ScintillaQt.h \ 107 | ../ScintillaEditBase/ScintillaEditBase.h 108 | 109 | DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 SCI_LEXER=1 _CRT_SECURE_NO_DEPRECATE=1 110 | 111 | DESTDIR = ../../bin 112 | 113 | unix:!mac { 114 | # Rename to not have 'lib' at start 115 | QMAKE_POST_LINK += rm -rf ../../bin/ScintillaEditPy.so && ln -s libScintillaEditPy.so ../../bin/ScintillaEditPy.so 116 | } 117 | 118 | macx { 119 | # Rename to .so and not have 'lib' at start 120 | QMAKE_POST_LINK += rm -rf ../../bin/ScintillaEditPy.so && ln -s libScintillaEditPy.dylib ../../bin/ScintillaEditPy.so 121 | } 122 | -------------------------------------------------------------------------------- /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/Face.py: -------------------------------------------------------------------------------- 1 | # Face.py - module for reading and parsing Scintilla.iface file 2 | # Implemented 2000 by Neil Hodgson neilh@scintilla.org 3 | # Released to the public domain. 4 | # Requires Python 2.5 or later 5 | 6 | def sanitiseLine(line): 7 | if line[-1:] == '\n': line = line[:-1] 8 | if line.find("##") != -1: 9 | line = line[:line.find("##")] 10 | line = line.strip() 11 | return line 12 | 13 | def decodeFunction(featureVal): 14 | retType, rest = featureVal.split(" ", 1) 15 | nameIdent, params = rest.split("(") 16 | name, value = nameIdent.split("=") 17 | params, rest = params.split(")") 18 | param1, param2 = params.split(",") 19 | return retType, name, value, param1, param2 20 | 21 | def decodeEvent(featureVal): 22 | retType, rest = featureVal.split(" ", 1) 23 | nameIdent, params = rest.split("(") 24 | name, value = nameIdent.split("=") 25 | return retType, name, value 26 | 27 | def decodeParam(p): 28 | param = p.strip() 29 | type = "" 30 | name = "" 31 | value = "" 32 | if " " in param: 33 | type, nv = param.split(" ") 34 | if "=" in nv: 35 | name, value = nv.split("=") 36 | else: 37 | name = nv 38 | return type, name, value 39 | 40 | class Face: 41 | 42 | def __init__(self): 43 | self.order = [] 44 | self.features = {} 45 | self.values = {} 46 | self.events = {} 47 | 48 | def ReadFromFile(self, name): 49 | currentCategory = "" 50 | currentComment = [] 51 | currentCommentFinished = 0 52 | file = open(name) 53 | for line in file.readlines(): 54 | line = sanitiseLine(line) 55 | if line: 56 | if line[0] == "#": 57 | if line[1] == " ": 58 | if currentCommentFinished: 59 | currentComment = [] 60 | currentCommentFinished = 0 61 | currentComment.append(line[2:]) 62 | else: 63 | currentCommentFinished = 1 64 | featureType, featureVal = line.split(" ", 1) 65 | if featureType in ["fun", "get", "set"]: 66 | try: 67 | retType, name, value, param1, param2 = decodeFunction(featureVal) 68 | except ValueError: 69 | print("Failed to decode %s" % line) 70 | raise 71 | p1 = decodeParam(param1) 72 | p2 = decodeParam(param2) 73 | self.features[name] = { 74 | "FeatureType": featureType, 75 | "ReturnType": retType, 76 | "Value": value, 77 | "Param1Type": p1[0], "Param1Name": p1[1], "Param1Value": p1[2], 78 | "Param2Type": p2[0], "Param2Name": p2[1], "Param2Value": p2[2], 79 | "Category": currentCategory, "Comment": currentComment 80 | } 81 | if value in self.values: 82 | raise Exception("Duplicate value " + value + " " + name) 83 | self.values[value] = 1 84 | self.order.append(name) 85 | elif featureType == "evt": 86 | retType, name, value = decodeEvent(featureVal) 87 | self.features[name] = { 88 | "FeatureType": featureType, 89 | "ReturnType": retType, 90 | "Value": value, 91 | "Category": currentCategory, "Comment": currentComment 92 | } 93 | if value in self.events: 94 | raise Exception("Duplicate event " + value + " " + name) 95 | self.events[value] = 1 96 | self.order.append(name) 97 | elif featureType == "cat": 98 | currentCategory = featureVal 99 | elif featureType == "val": 100 | try: 101 | name, value = featureVal.split("=", 1) 102 | except ValueError: 103 | print("Failure %s" % featureVal) 104 | raise Exception() 105 | self.features[name] = { 106 | "FeatureType": featureType, 107 | "Category": currentCategory, 108 | "Value": value } 109 | self.order.append(name) 110 | elif featureType == "enu" or featureType == "lex": 111 | name, value = featureVal.split("=", 1) 112 | self.features[name] = { 113 | "FeatureType": featureType, 114 | "Category": currentCategory, 115 | "Value": value } 116 | self.order.append(name) 117 | 118 | -------------------------------------------------------------------------------- /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 "PerLine.h" 93 | #include "CallTip.h" 94 | #include "KeyMap.h" 95 | #include "Indicator.h" 96 | #include "XPM.h" 97 | #include "LineMarker.h" 98 | #include "Style.h" 99 | #include "ViewStyle.h" 100 | #include "CharClassify.h" 101 | #include "Decoration.h" 102 | #include "CaseFolder.h" 103 | #include "Document.h" 104 | #include "CaseConvert.h" 105 | #include "UniConversion.h" 106 | #include "UnicodeFromUTF8.h" 107 | #include "Selection.h" 108 | #include "PositionCache.h" 109 | #include "FontQuality.h" 110 | #include "EditModel.h" 111 | #include "MarginView.h" 112 | #include "EditView.h" 113 | #include "Editor.h" 114 | 115 | #include "AutoComplete.h" 116 | #include "ScintillaBase.h" 117 | 118 | #include "ExternalLexer.h" 119 | 120 | // Platform-specific headers 121 | 122 | // win32 123 | #include "PlatWin.h" 124 | 125 | // gtk 126 | #include "Converter.h" 127 | 128 | // cocoa 129 | #include "QuartzTextStyle.h" 130 | #include "QuartzTextStyleAttribute.h" 131 | #import "InfoBarCommunicator.h" 132 | #include "InfoBar.h" 133 | -------------------------------------------------------------------------------- /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 isVisible); 52 | bool HiddenLines() const; 53 | 54 | bool GetExpanded(int lineDoc) const; 55 | bool SetExpanded(int lineDoc, bool isExpanded); 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/EditModel.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file EditModel.cxx 3 | ** Defines the editor state that must be visible to EditorView. 4 | **/ 5 | // Copyright 1998-2014 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 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include "Platform.h" 22 | 23 | #include "ILexer.h" 24 | #include "Scintilla.h" 25 | 26 | #include "StringCopy.h" 27 | #include "SplitVector.h" 28 | #include "Partitioning.h" 29 | #include "RunStyles.h" 30 | #include "ContractionState.h" 31 | #include "CellBuffer.h" 32 | #include "KeyMap.h" 33 | #include "Indicator.h" 34 | #include "XPM.h" 35 | #include "LineMarker.h" 36 | #include "Style.h" 37 | #include "ViewStyle.h" 38 | #include "CharClassify.h" 39 | #include "Decoration.h" 40 | #include "CaseFolder.h" 41 | #include "Document.h" 42 | #include "UniConversion.h" 43 | #include "Selection.h" 44 | #include "PositionCache.h" 45 | #include "EditModel.h" 46 | 47 | #ifdef SCI_NAMESPACE 48 | using namespace Scintilla; 49 | #endif 50 | 51 | Caret::Caret() : 52 | active(false), on(false), period(500) {} 53 | 54 | EditModel::EditModel() { 55 | inOverstrike = false; 56 | xOffset = 0; 57 | trackLineWidth = false; 58 | posDrag = SelectionPosition(invalidPosition); 59 | braces[0] = invalidPosition; 60 | braces[1] = invalidPosition; 61 | bracesMatchStyle = STYLE_BRACEBAD; 62 | highlightGuideColumn = 0; 63 | primarySelection = true; 64 | foldFlags = 0; 65 | hotspot = Range(invalidPosition); 66 | wrapWidth = LineLayout::wrapWidthInfinite; 67 | pdoc = new Document(); 68 | pdoc->AddRef(); 69 | } 70 | 71 | EditModel::~EditModel() { 72 | pdoc->Release(); 73 | pdoc = 0; 74 | } 75 | -------------------------------------------------------------------------------- /scintilla/src/EditModel.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file EditModel.h 3 | ** Defines the editor state that must be visible to EditorView. 4 | **/ 5 | // Copyright 1998-2014 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef EDITMODEL_H 9 | #define EDITMODEL_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | /** 16 | */ 17 | class Caret { 18 | public: 19 | bool active; 20 | bool on; 21 | int period; 22 | 23 | Caret(); 24 | }; 25 | 26 | class EditModel { 27 | // Private so EditModel objects can not be copied 28 | EditModel(const EditModel &); 29 | EditModel &operator=(const EditModel &); 30 | 31 | public: 32 | bool inOverstrike; 33 | int xOffset; ///< Horizontal scrolled amount in pixels 34 | bool trackLineWidth; 35 | 36 | SpecialRepresentations reprs; 37 | Caret caret; 38 | SelectionPosition posDrag; 39 | Position braces[2]; 40 | int bracesMatchStyle; 41 | int highlightGuideColumn; 42 | Selection sel; 43 | bool primarySelection; 44 | 45 | int foldFlags; 46 | ContractionState cs; 47 | // Hotspot support 48 | Range hotspot; 49 | 50 | // Wrapping support 51 | int wrapWidth; 52 | 53 | Document *pdoc; 54 | 55 | EditModel(); 56 | virtual ~EditModel(); 57 | virtual int TopLineOfMain() const = 0; 58 | virtual Point GetVisibleOriginInMain() const = 0; 59 | virtual int LinesOnScreen() const = 0; 60 | virtual Range GetHotSpotRange() const = 0; 61 | }; 62 | 63 | #ifdef SCI_NAMESPACE 64 | } 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /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/MarginView.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file MarginView.h 3 | ** Defines the appearance of the editor margin. 4 | **/ 5 | // Copyright 1998-2014 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef MARGINVIEW_H 9 | #define MARGINVIEW_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour); 16 | 17 | /** 18 | * MarginView draws the margins. 19 | */ 20 | class MarginView { 21 | public: 22 | Surface *pixmapSelMargin; 23 | Surface *pixmapSelPattern; 24 | Surface *pixmapSelPatternOffset1; 25 | // Highlight current folding block 26 | HighlightDelimiter highlightDelimiter; 27 | 28 | MarginView(); 29 | 30 | void DropGraphics(bool freeObjects); 31 | void AllocateGraphics(const ViewStyle &vsDraw); 32 | void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw); 33 | void PaintMargin(Surface *surface, int topLine, PRectangle rc, PRectangle rcMargin, 34 | const EditModel &model, const ViewStyle &vs); 35 | }; 36 | 37 | #ifdef SCI_NAMESPACE 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /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 | typedef std::vector TabstopList; 116 | 117 | class LineTabstops : public PerLine { 118 | SplitVector tabstops; 119 | public: 120 | LineTabstops() { 121 | } 122 | virtual ~LineTabstops(); 123 | virtual void Init(); 124 | virtual void InsertLine(int line); 125 | virtual void RemoveLine(int line); 126 | 127 | bool ClearTabstops(int line); 128 | bool AddTabstop(int line, int x); 129 | int GetNextTabstop(int line, int x) const; 130 | }; 131 | 132 | #ifdef SCI_NAMESPACE 133 | } 134 | #endif 135 | 136 | #endif 137 | -------------------------------------------------------------------------------- /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 Clear(); 50 | void ChSet(unsigned char c); 51 | void ChSetWithCase(unsigned char c, bool caseSensitive); 52 | int GetBackslashExpression(const char *pattern, int &incr); 53 | 54 | int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap); 55 | 56 | int bol; 57 | int tagstk[MAXTAG]; /* subpat tag stack */ 58 | char nfa[MAXNFA]; /* automaton */ 59 | int sta; 60 | unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */ 61 | int failure; 62 | CharClassify *charClass; 63 | bool iswordc(unsigned char x) const { 64 | return charClass->IsWord(x); 65 | } 66 | }; 67 | 68 | #ifdef SCI_NAMESPACE 69 | } 70 | #endif 71 | 72 | #endif 73 | 74 | -------------------------------------------------------------------------------- /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 | enum { maxLenInputIME = 200 }; 42 | 43 | bool displayPopupMenu; 44 | Menu popup; 45 | AutoComplete ac; 46 | 47 | CallTip ct; 48 | 49 | int listType; ///< 0 is an autocomplete list 50 | int maxListWidth; /// Maximum width of list, in average character widths 51 | int multiAutoCMode; /// Mode for autocompleting when multiple selections are present 52 | 53 | #ifdef SCI_LEXER 54 | LexState *DocumentLexState(); 55 | void SetLexer(uptr_t wParam); 56 | void SetLexerLanguage(const char *languageName); 57 | void Colourise(int start, int end); 58 | #endif 59 | 60 | ScintillaBase(); 61 | virtual ~ScintillaBase(); 62 | virtual void Initialise() = 0; 63 | virtual void Finalise(); 64 | 65 | virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); 66 | void Command(int cmdId); 67 | virtual void CancelModes(); 68 | virtual int KeyCommand(unsigned int iMessage); 69 | 70 | void AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen); 71 | void AutoCompleteStart(int lenEntered, const char *list); 72 | void AutoCompleteCancel(); 73 | void AutoCompleteMove(int delta); 74 | int AutoCompleteGetCurrent() const; 75 | int AutoCompleteGetCurrentText(char *buffer) const; 76 | void AutoCompleteCharacterAdded(char ch); 77 | void AutoCompleteCharacterDeleted(); 78 | void AutoCompleteCompleted(); 79 | void AutoCompleteMoveToCurrentWord(); 80 | static void AutoCompleteDoubleClick(void *p); 81 | 82 | void CallTipClick(); 83 | void CallTipShow(Point pt, const char *defn); 84 | virtual void CreateCallTipWindow(PRectangle rc) = 0; 85 | 86 | virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0; 87 | void ContextMenu(Point pt); 88 | 89 | virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); 90 | virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); 91 | 92 | void NotifyStyleToNeeded(int endStyleNeeded); 93 | void NotifyLexerChanged(Document *doc, void *userData); 94 | 95 | public: 96 | // Public so scintilla_send_message can use it 97 | virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); 98 | }; 99 | 100 | #ifdef SCI_NAMESPACE 101 | } 102 | #endif 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /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: -------------------------------------------------------------------------------- 1 | $ 2 | // /++ +/ doccomments are not yet supported 3 | /* */ 4 | /** */ 5 | /// drdr 6 | /+ /+ +/ +/ 7 | //keyword test 8 | keyword1 9 | keyword2 10 | keyword4 11 | keyword5 12 | keyword6 13 | keyword7 14 | //unicode identifier test 15 | вапёasdÓΘΣαԷԸՑהכ拉麺とひシマイ단결을 16 | //strings test 17 | 's 18 | ' 19 | w's'w 20 | "multiline 21 | string"w 22 | e"zz"e 23 | r"asd\"e 24 | r"multiline 25 | string"c 26 | r`asd\`e 27 | `multiline 28 | string`d 29 | x"023 abc"e 30 | x"023 31 | abc"w 32 | //numbers test 33 | a[3..4]=3 34 | 2.stringof 35 | 2.0.stringof 36 | 2. 37 | 2.2e+2 38 | 2.2e-2 39 | .2e+2 40 | .2 41 | 2e+2 42 | 0x2e+2 43 | 0x2ep+10 44 | ,.2.stringof, 45 | 46 | end 47 | 48 | -------------------------------------------------------------------------------- /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/lexTests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Requires Python 2.7 or later 3 | 4 | import io, os, sys, unittest 5 | 6 | if sys.platform == "win32": 7 | import XiteWin as Xite 8 | else: 9 | import XiteQt as Xite 10 | 11 | keywordsHTML = [ 12 | b"b body content head href html link meta " 13 | b"name rel script strong title type xmlns", 14 | b"function", 15 | b"sub" 16 | ] 17 | 18 | class TestLexers(unittest.TestCase): 19 | 20 | def setUp(self): 21 | self.xite = Xite.xiteFrame 22 | self.ed = self.xite.ed 23 | self.ed.ClearAll() 24 | self.ed.EmptyUndoBuffer() 25 | 26 | def AsStyled(self): 27 | text = self.ed.Contents() 28 | data = io.BytesIO() 29 | prevStyle = -1 30 | for o in range(self.ed.Length): 31 | styleNow = self.ed.GetStyleAt(o) 32 | if styleNow != prevStyle: 33 | styleBuf = "{%0d}" % styleNow 34 | data.write(styleBuf.encode('utf-8')) 35 | prevStyle = styleNow 36 | data.write(text[o:o+1]) 37 | return data.getvalue() 38 | 39 | def LexExample(self, name, lexerName, keywords=None): 40 | if keywords is None: 41 | keywords = [] 42 | self.ed.SetCodePage(65001) 43 | self.ed.LexerLanguage = lexerName 44 | bits = self.ed.StyleBitsNeeded 45 | mask = 2 << bits - 1 46 | self.ed.StyleBits = bits 47 | for i in range(len(keywords)): 48 | self.ed.SetKeyWords(i, keywords[i]) 49 | 50 | nameExample = os.path.join("examples", name) 51 | namePrevious = nameExample +".styled" 52 | nameNew = nameExample +".new" 53 | with open(nameExample, "rb") as f: 54 | prog = f.read() 55 | BOM = b"\xEF\xBB\xBF" 56 | if prog.startswith(BOM): 57 | prog = prog[len(BOM):] 58 | lenDocument = len(prog) 59 | self.ed.AddText(lenDocument, prog) 60 | self.ed.Colourise(0, lenDocument) 61 | self.assertEquals(self.ed.EndStyled, lenDocument) 62 | try: 63 | with open(namePrevious, "rb") as f: 64 | prevStyled = f.read() 65 | except FileNotFoundError: 66 | prevStyled = "" 67 | progStyled = self.AsStyled() 68 | if progStyled != prevStyled: 69 | with open(nameNew, "wb") as f: 70 | f.write(progStyled) 71 | print(progStyled) 72 | print(prevStyled) 73 | self.assertEquals(progStyled, prevStyled) 74 | # The whole file doesn't parse like it did before so don't try line by line 75 | # as that is likely to fail many times. 76 | return 77 | 78 | # Try partial lexes from the start of every line which should all be identical. 79 | for line in range(self.ed.LineCount): 80 | lineStart = self.ed.PositionFromLine(line) 81 | self.ed.StartStyling(lineStart, mask) 82 | self.assertEquals(self.ed.EndStyled, lineStart) 83 | self.ed.Colourise(lineStart, lenDocument) 84 | progStyled = self.AsStyled() 85 | if progStyled != prevStyled: 86 | with open(nameNew, "wb") as f: 87 | f.write(progStyled) 88 | self.assertEquals(progStyled, prevStyled) 89 | # Give up after one failure 90 | return 91 | 92 | def testCXX(self): 93 | self.LexExample("x.cxx", b"cpp", [b"int"]) 94 | 95 | def testPython(self): 96 | self.LexExample("x.py", b"python", 97 | [b"class def else for if import in print return while"]) 98 | 99 | def testHTML(self): 100 | self.LexExample("x.html", b"hypertext", keywordsHTML) 101 | 102 | def testASP(self): 103 | self.LexExample("x.asp", b"hypertext", keywordsHTML) 104 | 105 | def testPHP(self): 106 | self.LexExample("x.php", b"hypertext", keywordsHTML) 107 | 108 | def testVB(self): 109 | self.LexExample("x.vb", b"vb", [b"as dim or string"]) 110 | 111 | def testLua(self): 112 | self.LexExample("x.lua", b"lua", [b"function end"]) 113 | 114 | def testRuby(self): 115 | self.LexExample("x.rb", b"ruby", [b"class def end"]) 116 | 117 | def testPerl(self): 118 | self.LexExample("x.pl", b"perl", [b"printf sleep use while"]) 119 | 120 | def testD(self): 121 | self.LexExample("x.d", b"d", 122 | [b"keyword1", b"keyword2", b"", b"keyword4", b"keyword5", 123 | b"keyword6", b"keyword7"]) 124 | 125 | if __name__ == '__main__': 126 | Xite.main("lexTests") 127 | -------------------------------------------------------------------------------- /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/testCharClassify.cxx: -------------------------------------------------------------------------------- 1 | // Unit Tests for Scintilla internal data structures 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include "Platform.h" 8 | 9 | #include "CharClassify.h" 10 | 11 | #include "catch.hpp" 12 | 13 | // Test CharClassify. 14 | 15 | class CharClassifyTest { 16 | // Avoid warnings, private so never called. 17 | CharClassifyTest(const CharClassifyTest &); 18 | protected: 19 | CharClassifyTest() { 20 | pcc = new CharClassify(); 21 | for (int ch = 0; ch < 256; ch++) { 22 | if (ch == '\r' || ch == '\n') 23 | charClass[ch] = CharClassify::ccNewLine; 24 | else if (ch < 0x20 || ch == ' ') 25 | charClass[ch] = CharClassify::ccSpace; 26 | else if (ch >= 0x80 || isalnum(ch) || ch == '_') 27 | charClass[ch] = CharClassify::ccWord; 28 | else 29 | charClass[ch] = CharClassify::ccPunctuation; 30 | } 31 | } 32 | 33 | ~CharClassifyTest() { 34 | delete pcc; 35 | pcc = 0; 36 | } 37 | 38 | CharClassify *pcc; 39 | CharClassify::cc charClass[256]; 40 | 41 | static const char* GetClassName(CharClassify::cc charClass) { 42 | switch(charClass) { 43 | #define CASE(c) case CharClassify::c: return #c 44 | CASE(ccSpace); 45 | CASE(ccNewLine); 46 | CASE(ccWord); 47 | CASE(ccPunctuation); 48 | #undef CASE 49 | default: 50 | return ""; 51 | } 52 | } 53 | }; 54 | 55 | TEST_CASE_METHOD(CharClassifyTest, "Defaults") { 56 | for (int i = 0; i < 256; i++) { 57 | if (charClass[i] != pcc->GetClass(i)) 58 | std::cerr 59 | << "Character " << i 60 | << " should be class " << GetClassName(charClass[i]) 61 | << ", but got " << GetClassName(pcc->GetClass(i)) << std::endl; 62 | REQUIRE(charClass[i] == pcc->GetClass(i)); 63 | } 64 | } 65 | 66 | TEST_CASE_METHOD(CharClassifyTest, "Custom") { 67 | unsigned char buf[2] = {0, 0}; 68 | for (int i = 0; i < 256; i++) { 69 | CharClassify::cc thisClass = CharClassify::cc(i % 4); 70 | buf[0] = i; 71 | pcc->SetCharClasses(buf, thisClass); 72 | charClass[i] = thisClass; 73 | } 74 | for (int i = 0; i < 256; i++) { 75 | if (charClass[i] != pcc->GetClass(i)) 76 | std::cerr 77 | << "Character " << i 78 | << " should be class " << GetClassName(charClass[i]) 79 | << ", but got " << GetClassName(pcc->GetClass(i)) << std::endl; 80 | REQUIRE(charClass[i] == pcc->GetClass(i)); 81 | } 82 | } 83 | 84 | TEST_CASE_METHOD(CharClassifyTest, "CharsOfClass") { 85 | unsigned char buf[2] = {0, 0}; 86 | for (int i = 1; i < 256; i++) { 87 | CharClassify::cc thisClass = CharClassify::cc(i % 4); 88 | buf[0] = i; 89 | pcc->SetCharClasses(buf, thisClass); 90 | charClass[i] = thisClass; 91 | } 92 | for (int classVal = 0; classVal < 4; ++classVal) { 93 | CharClassify::cc thisClass = CharClassify::cc(classVal % 4); 94 | int size = pcc->GetCharsOfClass(thisClass, NULL); 95 | unsigned char* buffer = reinterpret_cast(malloc(size + 1)); 96 | CHECK(buffer); 97 | buffer[size] = '\0'; 98 | pcc->GetCharsOfClass(thisClass, buffer); 99 | for (int i = 1; i < 256; i++) { 100 | if (charClass[i] == thisClass) { 101 | if (!memchr(reinterpret_cast(buffer), i, size)) 102 | std::cerr 103 | << "Character " << i 104 | << " should be class " << GetClassName(thisClass) 105 | << ", but was not in GetCharsOfClass;" 106 | << " it is reported to be " 107 | << GetClassName(pcc->GetClass(i)) << std::endl; 108 | REQUIRE(memchr(reinterpret_cast(buffer), i, size)); 109 | } else { 110 | if (memchr(reinterpret_cast(buffer), i, size)) 111 | std::cerr 112 | << "Character " << i 113 | << " should not be class " << GetClassName(thisClass) 114 | << ", but was in GetCharsOfClass" 115 | << " it is reported to be " 116 | << GetClassName(pcc->GetClass(i)) << std::endl; 117 | REQUIRE_FALSE(memchr(reinterpret_cast(buffer), i, size)); 118 | } 119 | } 120 | free(buffer); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /scintilla/test/unit/testContractionState.cxx: -------------------------------------------------------------------------------- 1 | // Unit Tests for Scintilla internal data structures 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include "Platform.h" 8 | 9 | #include "SplitVector.h" 10 | #include "Partitioning.h" 11 | #include "RunStyles.h" 12 | #include "ContractionState.h" 13 | 14 | #include "catch.hpp" 15 | 16 | // Test ContractionState. 17 | 18 | TEST_CASE("ContractionState") { 19 | 20 | ContractionState cs; 21 | 22 | SECTION("IsEmptyInitially") { 23 | REQUIRE(1 == cs.LinesInDoc()); 24 | REQUIRE(1 == cs.LinesDisplayed()); 25 | REQUIRE(0 == cs.DisplayFromDoc(0)); 26 | REQUIRE(0 == cs.DocFromDisplay(0)); 27 | } 28 | 29 | SECTION("OneLine") { 30 | cs.InsertLine(0); 31 | REQUIRE(2 == cs.LinesInDoc()); 32 | REQUIRE(2 == cs.LinesDisplayed()); 33 | REQUIRE(0 == cs.DisplayFromDoc(0)); 34 | REQUIRE(0 == cs.DocFromDisplay(0)); 35 | REQUIRE(1 == cs.DisplayFromDoc(1)); 36 | REQUIRE(1 == cs.DocFromDisplay(1)); 37 | } 38 | 39 | SECTION("InsertionThenDeletions") { 40 | cs.InsertLines(0,4); 41 | cs.DeleteLine(1); 42 | 43 | REQUIRE(4 == cs.LinesInDoc()); 44 | REQUIRE(4 == cs.LinesDisplayed()); 45 | for (int l=0;l<4;l++) { 46 | REQUIRE(l == cs.DisplayFromDoc(l)); 47 | REQUIRE(l == cs.DocFromDisplay(l)); 48 | } 49 | 50 | cs.DeleteLines(0,2); 51 | REQUIRE(2 == cs.LinesInDoc()); 52 | REQUIRE(2 == cs.LinesDisplayed()); 53 | for (int l=0;l<2;l++) { 54 | REQUIRE(l == cs.DisplayFromDoc(l)); 55 | REQUIRE(l == cs.DocFromDisplay(l)); 56 | } 57 | } 58 | 59 | SECTION("ShowHide") { 60 | cs.InsertLines(0,4); 61 | REQUIRE(true == cs.GetVisible(0)); 62 | REQUIRE(true == cs.GetVisible(1)); 63 | REQUIRE(true == cs.GetVisible(2)); 64 | REQUIRE(5 == cs.LinesDisplayed()); 65 | 66 | cs.SetVisible(1, 1, false); 67 | REQUIRE(true == cs.GetVisible(0)); 68 | REQUIRE(0 == cs.GetVisible(1)); 69 | REQUIRE(true == cs.GetVisible(2)); 70 | REQUIRE(4 == cs.LinesDisplayed()); 71 | REQUIRE(1 == cs.HiddenLines()); 72 | 73 | cs.SetVisible(1, 2, true); 74 | for (int l=0;l<4;l++) { 75 | REQUIRE(true == cs.GetVisible(0)); 76 | } 77 | 78 | cs.SetVisible(1, 1, false); 79 | REQUIRE(0 == cs.GetVisible(1)); 80 | cs.ShowAll(); 81 | for (int l=0;l<4;l++) { 82 | REQUIRE(true == cs.GetVisible(0)); 83 | } 84 | REQUIRE(0 == cs.HiddenLines()); 85 | } 86 | 87 | SECTION("Hidden") { 88 | cs.InsertLines(0,1); 89 | for (int l=0;l<2;l++) { 90 | REQUIRE(true == cs.GetVisible(0)); 91 | } 92 | REQUIRE(0 == cs.HiddenLines()); 93 | 94 | cs.SetVisible(1, 1, false); 95 | REQUIRE(true == cs.GetVisible(0)); 96 | REQUIRE(0 == cs.GetVisible(1)); 97 | REQUIRE(1 == cs.HiddenLines()); 98 | 99 | cs.SetVisible(1, 1, true); 100 | for (int l=0;l<2;l++) { 101 | REQUIRE(true == cs.GetVisible(0)); 102 | } 103 | REQUIRE(0 == cs.HiddenLines()); 104 | } 105 | 106 | SECTION("Contracting") { 107 | cs.InsertLines(0,4); 108 | for (int l=0;l<4;l++) { 109 | REQUIRE(true == cs.GetExpanded(l)); 110 | } 111 | 112 | cs.SetExpanded(2, false); 113 | REQUIRE(true == cs.GetExpanded(1)); 114 | REQUIRE(0 == cs.GetExpanded(2)); 115 | REQUIRE(true == cs.GetExpanded(3)); 116 | 117 | REQUIRE(2 == cs.ContractedNext(0)); 118 | REQUIRE(2 == cs.ContractedNext(1)); 119 | REQUIRE(2 == cs.ContractedNext(2)); 120 | REQUIRE(-1 == cs.ContractedNext(3)); 121 | 122 | cs.SetExpanded(2, true); 123 | REQUIRE(true == cs.GetExpanded(1)); 124 | REQUIRE(true == cs.GetExpanded(2)); 125 | REQUIRE(true == cs.GetExpanded(3)); 126 | } 127 | 128 | SECTION("ChangeHeight") { 129 | cs.InsertLines(0,4); 130 | for (int l=0;l<4;l++) { 131 | REQUIRE(1 == cs.GetHeight(l)); 132 | } 133 | 134 | cs.SetHeight(1, 2); 135 | REQUIRE(1 == cs.GetHeight(0)); 136 | REQUIRE(2 == cs.GetHeight(1)); 137 | REQUIRE(1 == cs.GetHeight(2)); 138 | } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /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 | 350 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.5.0" 8 | #define VERSION_WORDS 3, 5, 0, 0 9 | 10 | VS_VERSION_INFO VERSIONINFO 11 | FILEVERSION VERSION_WORDS 12 | PRODUCTVERSION VERSION_WORDS 13 | FILEFLAGSMASK 0x3fL 14 | FILEFLAGS 0 15 | FILEOS VOS_NT_WINDOWS32 16 | FILETYPE VFT_APP 17 | FILESUBTYPE VFT2_UNKNOWN 18 | BEGIN 19 | BLOCK "VarFileInfo" 20 | BEGIN 21 | VALUE "Translation", 0x409, 1200 22 | END 23 | BLOCK "StringFileInfo" 24 | BEGIN 25 | BLOCK "040904b0" 26 | BEGIN 27 | VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\0" 28 | VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component\0" 29 | VALUE "FileVersion", VERSION_SCINTILLA "\0" 30 | VALUE "InternalName", "Scintilla\0" 31 | VALUE "LegalCopyright", "Copyright 1998-2012 by Neil Hodgson\0" 32 | VALUE "OriginalFilename", "Scintilla.DLL\0" 33 | VALUE "ProductName", "Scintilla\0" 34 | VALUE "ProductVersion", VERSION_SCINTILLA "\0" 35 | END 36 | END 37 | END 38 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------