├── .gitattributes ├── scintilla ├── version.txt ├── doc │ ├── Markers.png │ ├── SciRest.jpg │ ├── SciWord.jpg │ ├── Indicators.png │ ├── SciBreak.jpg │ ├── SciTEIco.png │ ├── annotations.png │ ├── styledmargin.png │ ├── Icons.html │ ├── Privacy.html │ ├── ScintillaDownload.html │ └── ScintillaToDo.html ├── lexers │ ├── LexCSS.cxx │ ├── LexErlang.cxx │ ├── LexMMIXAL.cxx │ ├── LexMatlab.cxx │ ├── LexNull.cxx │ ├── LexIndent.cxx │ ├── LexKix.cxx │ └── LexMake.cxx ├── win32 │ ├── CheckD2D.cxx │ ├── HanjaDic.h │ ├── PlatWin.h │ └── HanjaDic.cxx ├── src │ ├── Catalogue.h │ ├── UnicodeFromUTF8.h │ ├── Position.h │ ├── UniqueString.h │ ├── FontQuality.h │ ├── CharClassify.h │ ├── CaseFolder.h │ ├── KeyMap.h │ ├── EditModel.h │ ├── RunStyles.h │ ├── MarginView.h │ ├── CaseConvert.h │ ├── CharClassify.cxx │ ├── Indicator.h │ ├── CaseFolder.cxx │ ├── EditModel.cxx │ ├── RESearch.h │ ├── Decoration.h │ ├── ExternalLexer.h │ ├── UniConversion.h │ ├── ContractionState.h │ ├── Style.h │ ├── LineMarker.h │ ├── XPM.h │ ├── AutoComplete.h │ ├── CallTip.h │ ├── ScintillaBase.h │ ├── ExternalLexer.cxx │ ├── Style.cxx │ └── PerLine.h ├── include │ ├── Sci_Position.h │ ├── ScintillaWidget.h │ └── ILexer.h ├── License.txt ├── lexlib │ ├── PropSetSimple.h │ ├── LexerSimple.h │ ├── Accessor.h │ ├── StringCopy.h │ ├── CharacterCategory.h │ ├── WordList.h │ ├── LexerNoExceptions.h │ ├── LexerBase.h │ ├── CharacterSet.cxx │ ├── LexerSimple.cxx │ ├── StyleContext.cxx │ ├── LexerBase.cxx │ ├── LexerNoExceptions.cxx │ ├── Accessor.cxx │ ├── LexerModule.h │ ├── LexerModule.cxx │ ├── SparseState.h │ ├── OptionSet.h │ ├── SubStyles.h │ └── PropSetSimple.cxx ├── scripts │ ├── GenerateCharacterCategory.py │ ├── HFacer.py │ ├── HeaderCheck.py │ ├── Face.py │ ├── HeaderOrder.txt │ └── GenerateCaseConvert.py └── cppcheck.suppress ├── License.txt ├── Notepad2.ini ├── res ├── Copy.cur ├── Next.bmp ├── Open.bmp ├── Pick.bmp ├── Prev.bmp ├── Run.ico ├── Styles.ico ├── Toolbar.bmp ├── Encoding.bmp ├── Notepad2.ico ├── Toolbar1.bmp ├── Toolbar2.bmp └── Notepad2.exe.manifest.conf ├── src ├── Notepad2.rc ├── Dialogs.h ├── Notepad2.ver ├── Version.h ├── Styles.h ├── Notepad2.vcxproj.filters └── Notepad2.h ├── distrib ├── Setup.ico ├── Notepad2.ini ├── license.txt ├── notepad2_setup.iss ├── WizardSmallImageFile.bmp └── todo.txt ├── appveyor.yml ├── .gitignore ├── update_rev.bat ├── lexlink.js ├── Readme-mod.txt ├── Readme.md ├── Readme.txt └── version.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh eol=lf 2 | -------------------------------------------------------------------------------- /scintilla/version.txt: -------------------------------------------------------------------------------- 1 | 375 2 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/License.txt -------------------------------------------------------------------------------- /Notepad2.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/Notepad2.ini -------------------------------------------------------------------------------- /res/Copy.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Copy.cur -------------------------------------------------------------------------------- /res/Next.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Next.bmp -------------------------------------------------------------------------------- /res/Open.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Open.bmp -------------------------------------------------------------------------------- /res/Pick.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Pick.bmp -------------------------------------------------------------------------------- /res/Prev.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Prev.bmp -------------------------------------------------------------------------------- /res/Run.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Run.ico -------------------------------------------------------------------------------- /res/Styles.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Styles.ico -------------------------------------------------------------------------------- /res/Toolbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Toolbar.bmp -------------------------------------------------------------------------------- /src/Notepad2.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/src/Notepad2.rc -------------------------------------------------------------------------------- /distrib/Setup.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/distrib/Setup.ico -------------------------------------------------------------------------------- /res/Encoding.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Encoding.bmp -------------------------------------------------------------------------------- /res/Notepad2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Notepad2.ico -------------------------------------------------------------------------------- /res/Toolbar1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Toolbar1.bmp -------------------------------------------------------------------------------- /res/Toolbar2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/res/Toolbar2.bmp -------------------------------------------------------------------------------- /distrib/Notepad2.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/distrib/Notepad2.ini -------------------------------------------------------------------------------- /distrib/license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/distrib/license.txt -------------------------------------------------------------------------------- /scintilla/doc/Markers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/doc/Markers.png -------------------------------------------------------------------------------- /scintilla/doc/SciRest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/doc/SciRest.jpg -------------------------------------------------------------------------------- /scintilla/doc/SciWord.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/doc/SciWord.jpg -------------------------------------------------------------------------------- /distrib/notepad2_setup.iss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/distrib/notepad2_setup.iss -------------------------------------------------------------------------------- /scintilla/doc/Indicators.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/doc/Indicators.png -------------------------------------------------------------------------------- /scintilla/doc/SciBreak.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/doc/SciBreak.jpg -------------------------------------------------------------------------------- /scintilla/doc/SciTEIco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/doc/SciTEIco.png -------------------------------------------------------------------------------- /scintilla/lexers/LexCSS.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/lexers/LexCSS.cxx -------------------------------------------------------------------------------- /scintilla/doc/annotations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/doc/annotations.png -------------------------------------------------------------------------------- /scintilla/doc/styledmargin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/doc/styledmargin.png -------------------------------------------------------------------------------- /scintilla/lexers/LexErlang.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/lexers/LexErlang.cxx -------------------------------------------------------------------------------- /scintilla/lexers/LexMMIXAL.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/lexers/LexMMIXAL.cxx -------------------------------------------------------------------------------- /scintilla/lexers/LexMatlab.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/scintilla/lexers/LexMatlab.cxx -------------------------------------------------------------------------------- /distrib/WizardSmallImageFile.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XhmikosR/notepad2-mod/HEAD/distrib/WizardSmallImageFile.bmp -------------------------------------------------------------------------------- /distrib/todo.txt: -------------------------------------------------------------------------------- 1 | 1) Use RegQueryStringValue to get the uninstall command for the other versions. 2 | I need to trim down the command in order to use it. -------------------------------------------------------------------------------- /scintilla/win32/CheckD2D.cxx: -------------------------------------------------------------------------------- 1 | // This file is compiled to check whether Direct2D and DirectWrite headers are available. 2 | #include 3 | #include 4 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | image: Visual Studio 2017 2 | 3 | version: "{build}" 4 | 5 | #clone_depth: 10 6 | 7 | build_script: 8 | - CALL "build\build_vs2017.bat" Build All Release 9 | 10 | test: off 11 | 12 | deploy: off 13 | 14 | matrix: 15 | fast_finish: true 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.aps 2 | *.opensdf 3 | *.pyc 4 | *.sdf 5 | *.suo 6 | *.user 7 | /bin 8 | /build.user.bat 9 | /build/*.db 10 | /build/.vs 11 | /build/cov-int 12 | /build/Notepad2-mod.lzma 13 | /build/Notepad2-mod.tar 14 | /build/Notepad2-mod.tgz 15 | /build/packages 16 | /build/temp_zip* 17 | /distrib/Notepad2-mod.*.exe 18 | /res/Notepad2.exe.manifest 19 | /signinfo.txt 20 | /src/VersionRev.h 21 | -------------------------------------------------------------------------------- /scintilla/win32/HanjaDic.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file HanjaDic.h 3 | ** Korean Hanja Dictionary 4 | ** Convert between Korean Hanja and Hangul by COM interface. 5 | **/ 6 | // Copyright 2015 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef HANJADIC_H 10 | #define HANJADIC_H 11 | 12 | #ifdef SCI_NAMESPACE 13 | namespace Scintilla { 14 | #endif 15 | 16 | namespace HanjaDict { 17 | 18 | int GetHangulOfHanja(wchar_t *inout); 19 | 20 | } 21 | 22 | #ifdef SCI_NAMESPACE 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /update_rev.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | 4 | PUSHD %~dp0 5 | 6 | IF EXIST "build.user.bat" (CALL "build.user.bat") 7 | 8 | SET PATH=%MSYS%\bin;%PATH% 9 | 10 | FOR %%G IN (bash.exe) DO (SET FOUND=%%~$PATH:G) 11 | IF NOT DEFINED FOUND GOTO MissingVar 12 | 13 | bash.exe ./version.sh 14 | 15 | 16 | :END 17 | POPD 18 | ENDLOCAL 19 | EXIT /B 20 | 21 | 22 | :MissingVar 23 | COLOR 0C 24 | TITLE ERROR 25 | ECHO MSYS (bash.exe) wasn't found. Create a file build.user.bat and set the variable there. 26 | ECHO. 27 | ECHO SET "MSYS=H:\progs\MSYS" 28 | ECHO. & ECHO. 29 | ECHO Press any key to exit... 30 | PAUSE >NUL 31 | ENDLOCAL 32 | EXIT /B 33 | -------------------------------------------------------------------------------- /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/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 void Platform_Initialise(void *hInstance); 16 | extern void Platform_Finalise(bool fromDllMain); 17 | 18 | #if defined(USE_D2D) 19 | extern bool LoadD2D(); 20 | extern ID2D1Factory *pD2DFactory; 21 | extern IDWriteFactory *pIDWriteFactory; 22 | #endif 23 | 24 | #ifdef SCI_NAMESPACE 25 | } 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /scintilla/include/Sci_Position.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Sci_Position.h 3 | ** Define the Sci_Position type used in Scintilla's external interfaces. 4 | ** These need to be available to clients written in C so are not in a C++ namespace. 5 | **/ 6 | // Copyright 2015 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef SCI_POSITION_H 10 | #define SCI_POSITION_H 11 | 12 | // Basic signed type used throughout interface 13 | typedef int Sci_Position; 14 | 15 | // Unsigned variant used for ILexer::Lex and ILexer::Fold 16 | typedef unsigned int Sci_PositionU; 17 | 18 | // For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE 19 | typedef long Sci_PositionCR; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /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/Position.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Position.h 3 | ** Defines global type name Position in the Sci internal namespace. 4 | **/ 5 | // Copyright 2015 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef POSITION_H 9 | #define POSITION_H 10 | 11 | /** 12 | * A Position is a position within a document between two characters or at the beginning or end. 13 | * Sometimes used as a character index where it identifies the character after the position. 14 | */ 15 | 16 | namespace Sci { 17 | 18 | typedef int Position; 19 | typedef int Line; 20 | 21 | // A later version (4.x) of this file may: 22 | //#if defined(SCI_LARGE_FILE_SUPPORT) 23 | //typedef std::ptrdiff_t Position; 24 | // or may allow runtime choice between different position sizes. 25 | 26 | const Position invalidPosition = -1; 27 | 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /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/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/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(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); 23 | void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); 24 | }; 25 | 26 | #ifdef SCI_NAMESPACE 27 | } 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /scintilla/src/UniqueString.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file UniqueString.h 3 | ** Define UniqueString, a unique_ptr based string type for storage in containers 4 | ** and an allocator for UniqueString. 5 | **/ 6 | // Copyright 2017 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef UNIQUESTRING_H 10 | #define UNIQUESTRING_H 11 | 12 | #ifdef SCI_NAMESPACE 13 | namespace Scintilla { 14 | #endif 15 | 16 | using UniqueString = std::unique_ptr; 17 | 18 | /// Equivalent to strdup but produces a std::unique_ptr allocation to go 19 | /// into collections. 20 | inline UniqueString UniqueStringCopy(const char *text) { 21 | if (!text) { 22 | return UniqueString(); 23 | } 24 | const size_t len = strlen(text); 25 | char *sNew = new char[len + 1]; 26 | std::copy(text, text + len + 1, sNew); 27 | return UniqueString(sNew); 28 | } 29 | 30 | #ifdef SCI_NAMESPACE 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /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/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, Sci_Position pos, Sci_Position 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(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); 29 | }; 30 | 31 | #ifdef SCI_NAMESPACE 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /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 | // 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 | // Common definitions of allowable characters in identifiers from UAX #31. 28 | bool IsIdStart(int character); 29 | bool IsIdContinue(int character); 30 | bool IsXidStart(int character); 31 | bool IsXidContinue(int character); 32 | 33 | #ifdef SCI_NAMESPACE 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /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 characterClass, unsigned char *buffer) const; 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/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 | bool InListAbridged(const char *s, const char marker) const; 35 | const char *WordAt(int n) const; 36 | }; 37 | 38 | #ifdef SCI_NAMESPACE 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /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 | size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; 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 | size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; 39 | }; 40 | 41 | #ifdef SCI_NAMESPACE 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /scintilla/lexers/LexNull.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexNull.cxx 3 | ** Lexer for no language. Used for plain text and unrecognized files. 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 | #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 "WordList.h" 20 | #include "LexAccessor.h" 21 | #include "Accessor.h" 22 | #include "StyleContext.h" 23 | #include "CharacterSet.h" 24 | #include "LexerModule.h" 25 | 26 | #ifdef SCI_NAMESPACE 27 | using namespace Scintilla; 28 | #endif 29 | 30 | static void ColouriseNullDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], 31 | Accessor &styler) { 32 | // Null language means all style bytes are 0 so just mark the end - no need to fill in. 33 | if (length > 0) { 34 | styler.StartAt(startPos + length - 1); 35 | styler.StartSegment(startPos + length - 1); 36 | styler.ColourTo(startPos + length - 1, 0); 37 | } 38 | } 39 | 40 | LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null"); 41 | -------------------------------------------------------------------------------- /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 | Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); 20 | Sci_Position SCI_METHOD WordListSet(int n, const char *wl); 21 | void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); 22 | void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *); 23 | 24 | virtual void Lexer(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; 25 | virtual void Folder(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; 26 | }; 27 | 28 | #ifdef SCI_NAMESPACE 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /lexlink.js: -------------------------------------------------------------------------------- 1 | /* 2 | Comment lexer modules from "scintilla\src\Catalogue.cxx" not used by Notepad2 3 | (c) Florian Balmer 2011 4 | */ 5 | 6 | var lex = new Array( 7 | "lmAHK", 8 | "lmAsm", 9 | "lmAU3", 10 | "lmAVS", 11 | "lmBash", 12 | "lmBatch", 13 | "lmCmake", 14 | "lmCoffeeScript", 15 | "lmConf", 16 | "lmCPP", 17 | "lmCss", 18 | "lmDiff", 19 | "lmHTML", 20 | "lmInno", 21 | "lmLatex", 22 | "lmLua", 23 | "lmMake", 24 | "lmMarkdown", 25 | "lmNsis", 26 | "lmNull", 27 | "lmPascal", 28 | "lmPerl", 29 | "lmPowerShell", 30 | "lmProps", 31 | "lmPython", 32 | "lmRuby", 33 | "lmSQL", 34 | "lmTCL", 35 | "lmVB", 36 | "lmVBScript", 37 | "lmXML", 38 | "lmYAML", 39 | "lmVHDL" 40 | ); 41 | 42 | var fso = new ActiveXObject("Scripting.FileSystemObject"); 43 | var fh = fso.OpenTextFile("scintilla\\src\\Catalogue.cxx",1,0); 44 | if (!fh.AtEndOfStream) { 45 | var str = fh.ReadAll(); 46 | str = str.replace( 47 | /^(\s*)\/\/(LINK_LEXER)/gim, 48 | "$1$2"); 49 | var re = new RegExp("^(\\s*)(LINK_LEXER\\((?!"+lex.join("|")+")\\w+\\);)","gim"); 50 | str = str.replace(re,"$1//$2"); 51 | fh.Close(); 52 | var fh = fso.OpenTextFile("scintilla\\src\\Catalogue.cxx",2,0); 53 | fh.Write(str); 54 | } 55 | -------------------------------------------------------------------------------- /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 | Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); 30 | const char * SCI_METHOD DescribeWordListSets(); 31 | Sci_Position SCI_METHOD WordListSet(int n, const char *wl); 32 | void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; 33 | void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position 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/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/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 | 12 | #include "CharacterSet.h" 13 | 14 | #ifdef SCI_NAMESPACE 15 | using namespace Scintilla; 16 | #endif 17 | 18 | #ifdef SCI_NAMESPACE 19 | namespace Scintilla { 20 | #endif 21 | 22 | int CompareCaseInsensitive(const char *a, const char *b) { 23 | while (*a && *b) { 24 | if (*a != *b) { 25 | const char upperA = static_cast(MakeUpperCase(*a)); 26 | const char upperB = static_cast(MakeUpperCase(*b)); 27 | if (upperA != upperB) 28 | return upperA - upperB; 29 | } 30 | a++; 31 | b++; 32 | } 33 | // Either *a or *b is nul 34 | return *a - *b; 35 | } 36 | 37 | int CompareNCaseInsensitive(const char *a, const char *b, size_t len) { 38 | while (*a && *b && len) { 39 | if (*a != *b) { 40 | const char upperA = static_cast(MakeUpperCase(*a)); 41 | const char upperB = static_cast(MakeUpperCase(*b)); 42 | if (upperA != upperB) 43 | return upperA - upperB; 44 | } 45 | a++; 46 | b++; 47 | len--; 48 | } 49 | if (len == 0) 50 | return 0; 51 | else 52 | // Either *a or *b is nul 53 | return *a - *b; 54 | } 55 | 56 | #ifdef SCI_NAMESPACE 57 | } 58 | #endif 59 | -------------------------------------------------------------------------------- /Readme-mod.txt: -------------------------------------------------------------------------------- 1 | This version of Notepad2 has been modified from Florian Balmer's original 2 | version using patches by Kai Liu and others. 3 | 4 | Notable changes: 5 | * Code folding 6 | * Support for bookmarks 7 | * Option to mark all occurrences of a word 8 | * Word auto-completion 9 | * Syntax highlighting support for AutoHotkey, AutoIt3, AviSynth, Bash, 10 | CMake, CoffeeScript, Inno Setup, LaTeX, Lua, Markdown, NSIS, Ruby, Tcl, YAML and VHDL scripts 11 | * Improved support for NFO ANSI art 12 | * Support for replacing Windows Notepad using a clean, unintrusive registry-based method 13 | * Other various minor changes and tweaks 14 | 15 | Supported Operating Systems: 16 | * XP (SP3, SP2 might or might not work), Vista, 7, 8, 8.1 and 10 both 32-bit and 64-bit 17 | 18 | Contributors: 19 | * Kai Liu 20 | * RL Vision 21 | * Aleksandar Lekov 22 | * Bruno Barbieri 23 | * Everyone else on GitHub: https://github.com/XhmikosR/notepad2-mod/graphs/contributors 24 | 25 | More information: 26 | * Source code and binaries: https://github.com/XhmikosR/notepad2-mod 27 | * Official Notepad2 website: http://www.flos-freeware.ch/notepad2.html 28 | * Code folding usage guide: https://github.com/XhmikosR/notepad2-mod/wiki/Code-Folding-Usage 29 | * Kai Liu's website: http://code.kliu.org/misc/notepad2/ 30 | * Bookmark Edition website: http://www.rlvision.com/notepad2/about.asp 31 | 32 | Changed keyboard shortcuts compared to Notepad2: 33 | Ctrl+Alt+F2 Expand selection to next match. 34 | Ctrl+Alt+Shift+F2 Expand selection to previous match. 35 | Ctrl+Shift+Enter New line with toggled auto indent option. 36 | -------------------------------------------------------------------------------- /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_SUPER SCMOD_SUPER 21 | #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) 22 | #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) 23 | 24 | /** 25 | */ 26 | class KeyModifiers { 27 | public: 28 | int key; 29 | int modifiers; 30 | KeyModifiers(int key_, int modifiers_) : key(key_), modifiers(modifiers_) { 31 | } 32 | bool operator<(const KeyModifiers &other) const { 33 | if (key == other.key) 34 | return modifiers < other.modifiers; 35 | else 36 | return key < other.key; 37 | } 38 | }; 39 | 40 | /** 41 | */ 42 | class KeyToCommand { 43 | public: 44 | int key; 45 | int modifiers; 46 | unsigned int msg; 47 | }; 48 | 49 | /** 50 | */ 51 | class KeyMap { 52 | std::map kmap; 53 | static const KeyToCommand MapDefault[]; 54 | 55 | public: 56 | KeyMap(); 57 | ~KeyMap(); 58 | void Clear(); 59 | void AssignCmdKey(int key, int modifiers, unsigned int msg); 60 | unsigned int Find(int key, int modifiers) const; // 0 returned on failure 61 | }; 62 | 63 | #ifdef SCI_NAMESPACE 64 | } 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /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 | 11 | #include 12 | 13 | #include "ILexer.h" 14 | #include "Scintilla.h" 15 | #include "SciLexer.h" 16 | 17 | #include "PropSetSimple.h" 18 | #include "WordList.h" 19 | #include "LexAccessor.h" 20 | #include "Accessor.h" 21 | #include "LexerModule.h" 22 | #include "LexerBase.h" 23 | #include "LexerSimple.h" 24 | 25 | #ifdef SCI_NAMESPACE 26 | using namespace Scintilla; 27 | #endif 28 | 29 | LexerSimple::LexerSimple(const LexerModule *module_) : module(module_) { 30 | for (int wl = 0; wl < module->GetNumWordLists(); wl++) { 31 | if (!wordLists.empty()) 32 | wordLists += "\n"; 33 | wordLists += module->GetWordListDescription(wl); 34 | } 35 | } 36 | 37 | const char * SCI_METHOD LexerSimple::DescribeWordListSets() { 38 | return wordLists.c_str(); 39 | } 40 | 41 | void SCI_METHOD LexerSimple::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { 42 | Accessor astyler(pAccess, &props); 43 | module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler); 44 | astyler.Flush(); 45 | } 46 | 47 | void SCI_METHOD LexerSimple::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { 48 | if (props.GetInt("fold")) { 49 | Accessor astyler(pAccess, &props); 50 | module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler); 51 | astyler.Flush(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /res/Notepad2.exe.manifest.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | Notepad2-mod 10 | 11 | 12 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | true 41 | 42 | 43 | -------------------------------------------------------------------------------- /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 | public: 28 | bool inOverstrike; 29 | int xOffset; ///< Horizontal scrolled amount in pixels 30 | bool trackLineWidth; 31 | 32 | SpecialRepresentations reprs; 33 | Caret caret; 34 | SelectionPosition posDrag; 35 | Sci::Position braces[2]; 36 | int bracesMatchStyle; 37 | int highlightGuideColumn; 38 | Selection sel; 39 | bool primarySelection; 40 | 41 | enum IMEInteraction { imeWindowed, imeInline } imeInteraction; 42 | 43 | int foldFlags; 44 | int foldDisplayTextStyle; 45 | ContractionState cs; 46 | // Hotspot support 47 | Range hotspot; 48 | Sci::Position hoverIndicatorPos; 49 | 50 | // Wrapping support 51 | int wrapWidth; 52 | 53 | Document *pdoc; 54 | 55 | EditModel(); 56 | // Deleted so EditModel objects can not be copied. 57 | explicit EditModel(const EditModel &) = delete; 58 | EditModel &operator=(const EditModel &) = delete; 59 | virtual ~EditModel(); 60 | virtual Sci::Line TopLineOfMain() const = 0; 61 | virtual Point GetVisibleOriginInMain() const = 0; 62 | virtual Sci::Line LinesOnScreen() const = 0; 63 | virtual Range GetHotSpotRange() const = 0; 64 | }; 65 | 66 | #ifdef SCI_NAMESPACE 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/Dialogs.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * 4 | * Notepad2 5 | * 6 | * Dialogs.h 7 | * Definitions for Notepad2 dialog boxes 8 | * 9 | * See Readme.txt for more information about this source code. 10 | * Please send me your comments to this work. 11 | * 12 | * See License.txt for details about distribution and modification. 13 | * 14 | * (c) Florian Balmer 1996-2011 15 | * florian.balmer@gmail.com 16 | * http://www.flos-freeware.ch 17 | * 18 | * 19 | ******************************************************************************/ 20 | 21 | 22 | #define MBINFO 0 23 | #define MBWARN 1 24 | #define MBYESNO 2 25 | #define MBYESNOWARN 3 26 | #define MBYESNOCANCEL 4 27 | #define MBOKCANCEL 8 28 | 29 | int MsgBox(int,UINT,...); 30 | void DisplayCmdLineHelp(HWND hwnd); 31 | BOOL GetDirectory(HWND,int,LPWSTR,LPCWSTR,BOOL); 32 | INT_PTR CALLBACK AboutDlgProc(HWND,UINT,WPARAM,LPARAM); 33 | void RunDlg(HWND,LPCWSTR); 34 | BOOL OpenWithDlg(HWND,LPCWSTR); 35 | BOOL FavoritesDlg(HWND,LPWSTR); 36 | BOOL AddToFavDlg(HWND,LPCWSTR,LPCWSTR); 37 | BOOL FileMRUDlg(HWND,LPWSTR); 38 | BOOL ChangeNotifyDlg(HWND); 39 | BOOL ColumnWrapDlg(HWND,UINT,int *); 40 | BOOL WordWrapSettingsDlg(HWND,UINT,int *); 41 | BOOL LongLineSettingsDlg(HWND,UINT,int *); 42 | BOOL TabSettingsDlg(HWND,UINT,int *); 43 | BOOL SelectDefEncodingDlg(HWND,int *); 44 | BOOL SelectEncodingDlg(HWND,int *); 45 | BOOL RecodeDlg(HWND,int *); 46 | BOOL SelectDefLineEndingDlg(HWND,int *); 47 | INT_PTR InfoBox(int,LPCWSTR,int,...); 48 | 49 | 50 | // End of Dialogs.h 51 | -------------------------------------------------------------------------------- /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 | std::unique_ptr starts; 20 | std::unique_ptr> 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 | public: 27 | RunStyles(); 28 | // Deleted so RunStyles objects can not be copied. 29 | RunStyles(const RunStyles &) = delete; 30 | void operator=(const RunStyles &) = delete; 31 | ~RunStyles(); 32 | int Length() const; 33 | int ValueAt(int position) const; 34 | int FindNextChange(int position, int end) const; 35 | int StartRun(int position) const; 36 | int EndRun(int position) const; 37 | // Returns true if some values may have changed 38 | bool FillRange(int &position, int value, int &fillLength); 39 | void SetValueAt(int position, int value); 40 | void InsertSpace(int position, int insertLength); 41 | void DeleteAll(); 42 | void DeleteRange(int position, int deleteLength); 43 | int Runs() const; 44 | bool AllSame() const; 45 | bool AllSameAs(int value) const; 46 | int Find(int value, int start) const; 47 | 48 | void Check() const; 49 | }; 50 | 51 | #ifdef SCI_NAMESPACE 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /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 | typedef void (*DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour); 18 | 19 | /** 20 | * MarginView draws the margins. 21 | */ 22 | class MarginView { 23 | public: 24 | std::unique_ptr pixmapSelMargin; 25 | std::unique_ptr pixmapSelPattern; 26 | std::unique_ptr pixmapSelPatternOffset1; 27 | // Highlight current folding block 28 | HighlightDelimiter highlightDelimiter; 29 | 30 | int wrapMarkerPaddingRight; // right-most pixel padding of wrap markers 31 | /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native 32 | * DrawWrapMarker function for drawing wrap markers. Allow those platforms to 33 | * override it instead of creating a new method in the Surface class that 34 | * existing platforms must implement as empty. */ 35 | DrawWrapMarkerFn customDrawWrapMarker; 36 | 37 | MarginView(); 38 | 39 | void DropGraphics(bool freeObjects); 40 | void AllocateGraphics(const ViewStyle &vsDraw); 41 | void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw); 42 | void PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcMargin, 43 | const EditModel &model, const ViewStyle &vs); 44 | }; 45 | 46 | #ifdef SCI_NAMESPACE 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /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 | // Converts a mixed case string using a particular conversion. 44 | std::string CaseConvertString(const std::string &s, enum CaseConversion conversion); 45 | 46 | #ifdef SCI_NAMESPACE 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /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 12 | 13 | #include "CharClassify.h" 14 | 15 | #ifdef SCI_NAMESPACE 16 | using namespace Scintilla; 17 | #endif 18 | 19 | CharClassify::CharClassify() { 20 | SetDefaultCharClasses(true); 21 | } 22 | 23 | void CharClassify::SetDefaultCharClasses(bool includeWordClass) { 24 | // Initialize all char classes to default values 25 | for (int ch = 0; ch < 256; ch++) { 26 | if (ch == '\r' || ch == '\n') 27 | charClass[ch] = ccNewLine; 28 | else if (ch < 0x20 || ch == ' ') 29 | charClass[ch] = ccSpace; 30 | else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_')) 31 | charClass[ch] = ccWord; 32 | else 33 | charClass[ch] = ccPunctuation; 34 | } 35 | } 36 | 37 | void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) { 38 | // Apply the newCharClass to the specifed chars 39 | if (chars) { 40 | while (*chars) { 41 | charClass[*chars] = static_cast(newCharClass); 42 | chars++; 43 | } 44 | } 45 | } 46 | 47 | int CharClassify::GetCharsOfClass(cc characterClass, unsigned char *buffer) const { 48 | // Get characters belonging to the given char class; return the number 49 | // of characters (if the buffer is NULL, don't write to it). 50 | int count = 0; 51 | for (int ch = maxChar - 1; ch >= 0; --ch) { 52 | if (charClass[ch] == characterClass) { 53 | ++count; 54 | if (buffer) { 55 | *buffer = static_cast(ch); 56 | buffer++; 57 | } 58 | } 59 | } 60 | return count; 61 | } 62 | -------------------------------------------------------------------------------- /src/Notepad2.ver: -------------------------------------------------------------------------------- 1 | /******************************************************************* mode:rc ** 2 | * 3 | * 4 | * Notepad2 5 | * 6 | * Notepad2.ver 7 | * Notepad2 version information 8 | * 9 | * See Readme.txt for more information about this source code. 10 | * Please send me your comments to this work. 11 | * 12 | * See License.txt for details about distribution and modification. 13 | * 14 | * (c) Florian Balmer 1996-2011 15 | * florian.balmer@gmail.com 16 | * http://www.flos-freeware.ch 17 | * 18 | * 19 | ******************************************************************************/ 20 | 21 | 22 | #include "version.h" 23 | 24 | #ifdef _WIN32 25 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 26 | #pragma code_page(1252) 27 | #endif //_WIN32 28 | 29 | VS_VERSION_INFO VERSIONINFO 30 | FILEVERSION VERSION_FILEVERSION_NUM 31 | PRODUCTVERSION VERSION_FILEVERSION_NUM 32 | FILEFLAGSMASK 0x3fL 33 | #ifdef _DEBUG 34 | FILEFLAGS VS_FF_PATCHED | VS_FF_DEBUG 35 | #else 36 | FILEFLAGS VS_FF_PATCHED 37 | #endif 38 | FILEOS 0x4L 39 | FILETYPE 0x1L 40 | FILESUBTYPE 0x0L 41 | BEGIN 42 | BLOCK "StringFileInfo" 43 | BEGIN 44 | BLOCK "040904b0" 45 | BEGIN 46 | VALUE "Comments", MY_APPNAME 47 | VALUE "FileDescription", MY_APPNAME 48 | VALUE "InternalName", MY_APPNAME 49 | VALUE "ProductName", MY_APPNAME 50 | VALUE "CompanyName", VERSION_COMPANYNAME 51 | VALUE "FileVersion", VERSION_FILEVERSION 52 | VALUE "ProductVersion", VERSION_FILEVERSION 53 | VALUE "LegalCopyright", VERSION_LEGALCOPYRIGHT_LONG 54 | VALUE "OriginalFilename", "Notepad2.exe" 55 | END 56 | END 57 | BLOCK "VarFileInfo" 58 | BEGIN 59 | VALUE "Translation", 0x409, 1200 60 | END 61 | END 62 | -------------------------------------------------------------------------------- /scintilla/doc/Icons.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Scintilla icons 12 | 13 | 14 | 15 | 16 | 17 | 20 | 24 | 25 |
18 | Scintilla icon 19 | 21 | Scintilla 22 | and SciTE 23 |
26 |

27 | Icons 28 |

29 |

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

32 |

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

35 |

36 | zip format (70K) 37 |

38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
For autocompletion listsFor margin markers
12x1216x1624x2432x32
56 | 57 | 58 | -------------------------------------------------------------------------------- /scintilla/lexlib/StyleContext.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file StyleContext.cxx 3 | ** Lexer infrastructure. 4 | **/ 5 | // Copyright 1998-2004 by Neil Hodgson 6 | // This file is in the public domain. 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "ILexer.h" 13 | 14 | #include "LexAccessor.h" 15 | #include "Accessor.h" 16 | #include "StyleContext.h" 17 | #include "CharacterSet.h" 18 | 19 | #ifdef SCI_NAMESPACE 20 | using namespace Scintilla; 21 | #endif 22 | 23 | bool StyleContext::MatchIgnoreCase(const char *s) { 24 | if (MakeLowerCase(ch) != static_cast(*s)) 25 | return false; 26 | s++; 27 | if (MakeLowerCase(chNext) != static_cast(*s)) 28 | return false; 29 | s++; 30 | for (int n = 2; *s; n++) { 31 | if (static_cast(*s) != 32 | MakeLowerCase(static_cast(styler.SafeGetCharAt(currentPos + n, 0)))) 33 | return false; 34 | s++; 35 | } 36 | return true; 37 | } 38 | 39 | static void getRange(Sci_PositionU start, 40 | Sci_PositionU end, 41 | LexAccessor &styler, 42 | char *s, 43 | Sci_PositionU len) { 44 | Sci_PositionU i = 0; 45 | while ((i < end - start + 1) && (i < len-1)) { 46 | s[i] = styler[start + i]; 47 | i++; 48 | } 49 | s[i] = '\0'; 50 | } 51 | 52 | void StyleContext::GetCurrent(char *s, Sci_PositionU len) { 53 | getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); 54 | } 55 | 56 | static void getRangeLowered(Sci_PositionU start, 57 | Sci_PositionU end, 58 | LexAccessor &styler, 59 | char *s, 60 | Sci_PositionU len) { 61 | Sci_PositionU i = 0; 62 | while ((i < end - start + 1) && (i < len-1)) { 63 | s[i] = static_cast(tolower(styler[start + i])); 64 | i++; 65 | } 66 | s[i] = '\0'; 67 | } 68 | 69 | void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) { 70 | getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); 71 | } 72 | -------------------------------------------------------------------------------- /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 | struct StyleAndColour { 16 | int style; 17 | ColourDesired fore; 18 | StyleAndColour() : style(INDIC_PLAIN), fore(0, 0, 0) { 19 | } 20 | StyleAndColour(int style_, ColourDesired fore_ = ColourDesired(0, 0, 0)) : style(style_), fore(fore_) { 21 | } 22 | bool operator==(const StyleAndColour &other) const { 23 | return (style == other.style) && (fore == other.fore); 24 | } 25 | }; 26 | 27 | /** 28 | */ 29 | class Indicator { 30 | public: 31 | enum DrawState { drawNormal, drawHover }; 32 | StyleAndColour sacNormal; 33 | StyleAndColour sacHover; 34 | bool under; 35 | int fillAlpha; 36 | int outlineAlpha; 37 | int attributes; 38 | Indicator() : under(false), fillAlpha(30), outlineAlpha(50), attributes(0) { 39 | } 40 | Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) : 41 | sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(0) { 42 | } 43 | void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const; 44 | bool IsDynamic() const { 45 | return !(sacNormal == sacHover); 46 | } 47 | bool OverridesTextFore() const { 48 | return sacNormal.style == INDIC_TEXTFORE || sacHover.style == INDIC_TEXTFORE; 49 | } 50 | int Flags() const { 51 | return attributes; 52 | } 53 | void SetFlags(int attributes_); 54 | }; 55 | 56 | #ifdef SCI_NAMESPACE 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /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 | #include 11 | 12 | #include "CaseFolder.h" 13 | #include "CaseConvert.h" 14 | #include "UniConversion.h" 15 | 16 | #ifdef SCI_NAMESPACE 17 | using namespace Scintilla; 18 | #endif 19 | 20 | CaseFolder::~CaseFolder() { 21 | } 22 | 23 | CaseFolderTable::CaseFolderTable() { 24 | for (size_t iChar=0; iChar(iChar); 26 | } 27 | } 28 | 29 | CaseFolderTable::~CaseFolderTable() { 30 | } 31 | 32 | size_t CaseFolderTable::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { 33 | if (lenMixed > sizeFolded) { 34 | return 0; 35 | } else { 36 | for (size_t i=0; i(mixed[i])]; 38 | } 39 | return lenMixed; 40 | } 41 | } 42 | 43 | void CaseFolderTable::SetTranslation(char ch, char chTranslation) { 44 | mapping[static_cast(ch)] = chTranslation; 45 | } 46 | 47 | void CaseFolderTable::StandardASCII() { 48 | for (size_t iChar=0; iChar= 'A' && iChar <= 'Z') { 50 | mapping[iChar] = static_cast(iChar - 'A' + 'a'); 51 | } else { 52 | mapping[iChar] = static_cast(iChar); 53 | } 54 | } 55 | } 56 | 57 | CaseFolderUnicode::CaseFolderUnicode() { 58 | StandardASCII(); 59 | converter = ConverterFor(CaseConversionFold); 60 | } 61 | 62 | size_t CaseFolderUnicode::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { 63 | if ((lenMixed == 1) && (sizeFolded > 0)) { 64 | folded[0] = mapping[static_cast(mixed[0])]; 65 | return 1; 66 | } else { 67 | return converter->CaseConvertString(folded, sizeFolded, mixed, lenMixed); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /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 | 14 | #include 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 "Position.h" 28 | #include "UniqueString.h" 29 | #include "SplitVector.h" 30 | #include "Partitioning.h" 31 | #include "RunStyles.h" 32 | #include "ContractionState.h" 33 | #include "CellBuffer.h" 34 | #include "KeyMap.h" 35 | #include "Indicator.h" 36 | #include "XPM.h" 37 | #include "LineMarker.h" 38 | #include "Style.h" 39 | #include "ViewStyle.h" 40 | #include "CharClassify.h" 41 | #include "Decoration.h" 42 | #include "CaseFolder.h" 43 | #include "Document.h" 44 | #include "UniConversion.h" 45 | #include "Selection.h" 46 | #include "PositionCache.h" 47 | #include "EditModel.h" 48 | 49 | #ifdef SCI_NAMESPACE 50 | using namespace Scintilla; 51 | #endif 52 | 53 | Caret::Caret() : 54 | active(false), on(false), period(500) {} 55 | 56 | EditModel::EditModel() { 57 | inOverstrike = false; 58 | xOffset = 0; 59 | trackLineWidth = false; 60 | posDrag = SelectionPosition(Sci::invalidPosition); 61 | braces[0] = Sci::invalidPosition; 62 | braces[1] = Sci::invalidPosition; 63 | bracesMatchStyle = STYLE_BRACEBAD; 64 | highlightGuideColumn = 0; 65 | primarySelection = true; 66 | imeInteraction = imeWindowed; 67 | foldFlags = 0; 68 | foldDisplayTextStyle = SC_FOLDDISPLAYTEXT_HIDDEN; 69 | hotspot = Range(Sci::invalidPosition); 70 | hoverIndicatorPos = Sci::invalidPosition; 71 | wrapWidth = LineLayout::wrapWidthInfinite; 72 | pdoc = new Document(); 73 | pdoc->AddRef(); 74 | } 75 | 76 | EditModel::~EditModel() { 77 | pdoc->Release(); 78 | pdoc = 0; 79 | } 80 | -------------------------------------------------------------------------------- /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(Sci::Position index)=0; 27 | virtual ~CharacterIndexer() { 28 | } 29 | }; 30 | 31 | class RESearch { 32 | 33 | public: 34 | explicit RESearch(CharClassify *charClassTable); 35 | // No dynamic allocation so default copy constructor and assignment operator are OK. 36 | ~RESearch(); 37 | void Clear(); 38 | void GrabMatches(CharacterIndexer &ci); 39 | const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix); 40 | int Execute(CharacterIndexer &ci, Sci::Position lp, Sci::Position endp); 41 | 42 | enum { MAXTAG=10 }; 43 | enum { MAXNFA=4096 }; 44 | enum { NOTFOUND=-1 }; 45 | 46 | Sci::Position bopat[MAXTAG]; 47 | Sci::Position eopat[MAXTAG]; 48 | std::string pat[MAXTAG]; 49 | 50 | private: 51 | void ChSet(unsigned char c); 52 | void ChSetWithCase(unsigned char c, bool caseSensitive); 53 | int GetBackslashExpression(const char *pattern, int &incr); 54 | 55 | Sci::Position PMatch(CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap); 56 | 57 | Sci::Position bol; 58 | Sci::Position tagstk[MAXTAG]; /* subpat tag stack */ 59 | char nfa[MAXNFA]; /* automaton */ 60 | int sta; 61 | unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */ 62 | int failure; 63 | CharClassify *charClass; 64 | bool iswordc(unsigned char x) const { 65 | return charClass->IsWord(x); 66 | } 67 | }; 68 | 69 | #ifdef SCI_NAMESPACE 70 | } 71 | #endif 72 | 73 | #endif 74 | 75 | -------------------------------------------------------------------------------- /scintilla/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 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Notepad2-mod 2 | 3 | > *A modified version (fork) of Notepad2 based on Kai Liu's and other people's patches.* 4 | 5 | [![Build status](https://img.shields.io/appveyor/ci/XhmikosR/notepad2-mod/master.svg)](https://ci.appveyor.com/project/XhmikosR/notepad2-mod/branch/master) 6 | [![Coverity Scan Build Status](https://img.shields.io/coverity/scan/1113.svg)](https://scan.coverity.com/projects/1113) 7 | 8 | ## Changes compared to the official Notepad2: 9 | 10 | * Code folding 11 | * Support for bookmarks 12 | * Option to mark all occurrences of a word 13 | * Word auto-completion 14 | * Syntax highlighting support for AutoHotkey, AutoIt3, AviSynth, Bash, CMake, CoffeeScript, 15 | Inno Setup, LaTeX, Lua, Markdown, NSIS, Ruby, Tcl, YAML and VHDL scripts 16 | * Improved support for NFO ANSI art 17 | * Support for replacing Windows Notepad using a clean, unintrusive registry-based method 18 | * Other various minor changes and tweaks 19 | 20 | ## Supported Operating Systems: 21 | 22 | * XP (SP3, SP2 might or might not work), Vista, 7, 8, 8.1 and 10 both 32-bit and 64-bit 23 | 24 | ## [Screenshots](https://xhmikosr.github.io/notepad2-mod/screenshots) 25 | 26 | ## Notes: 27 | 28 | * If you find any bugs or have any suggestions for the implemented lexers (and **not** only) 29 | feel free to **provide patches/pull requests**. Without patches or pull requests chances are 30 | that nothing will be fixed/implemented. 31 | * I'm not interested in any **localization** of Notepad2. 32 | 33 | ## Contributors: 34 | 35 | * [Kai Liu](http://code.kliu.org/misc/notepad2/) 36 | * [RL Vision](http://www.rlvision.com/notepad2/about.asp) 37 | * Aleksandar Lekov 38 | * Bruno Barbieri 39 | * Everyone else on [GitHub](https://github.com/XhmikosR/notepad2-mod/graphs/contributors) 40 | 41 | ## More information: 42 | 43 | * [Official Notepad2 website](http://www.flos-freeware.ch/notepad2.html) 44 | * [Code folding usage guide](https://github.com/XhmikosR/notepad2-mod/wiki/Code-Folding-Usage) 45 | 46 | ## Changed keyboard shortcuts compared to Notepad2: 47 | 48 | * Ctrl+Alt+F2 Expand selection to next match. 49 | * Ctrl+Alt+Shift+F2 Expand selection to previous match. 50 | * Ctrl+Shift+Enter New line with toggled auto indent option. 51 | 52 | You can use MSVC 2017 to build Notepad2-mod. 53 | -------------------------------------------------------------------------------- /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 | 12 | #include "ILexer.h" 13 | #include "Scintilla.h" 14 | #include "SciLexer.h" 15 | 16 | #include "PropSetSimple.h" 17 | #include "WordList.h" 18 | #include "LexAccessor.h" 19 | #include "Accessor.h" 20 | #include "LexerModule.h" 21 | #include "LexerBase.h" 22 | 23 | #ifdef SCI_NAMESPACE 24 | using namespace Scintilla; 25 | #endif 26 | 27 | LexerBase::LexerBase() { 28 | for (int wl = 0; wl < numWordLists; wl++) 29 | keyWordLists[wl] = new WordList; 30 | keyWordLists[numWordLists] = 0; 31 | } 32 | 33 | LexerBase::~LexerBase() { 34 | for (int wl = 0; wl < numWordLists; wl++) { 35 | delete keyWordLists[wl]; 36 | keyWordLists[wl] = 0; 37 | } 38 | keyWordLists[numWordLists] = 0; 39 | } 40 | 41 | void SCI_METHOD LexerBase::Release() { 42 | delete this; 43 | } 44 | 45 | int SCI_METHOD LexerBase::Version() const { 46 | return lvOriginal; 47 | } 48 | 49 | const char * SCI_METHOD LexerBase::PropertyNames() { 50 | return ""; 51 | } 52 | 53 | int SCI_METHOD LexerBase::PropertyType(const char *) { 54 | return SC_TYPE_BOOLEAN; 55 | } 56 | 57 | const char * SCI_METHOD LexerBase::DescribeProperty(const char *) { 58 | return ""; 59 | } 60 | 61 | Sci_Position SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) { 62 | const char *valOld = props.Get(key); 63 | if (strcmp(val, valOld) != 0) { 64 | props.Set(key, val); 65 | return 0; 66 | } else { 67 | return -1; 68 | } 69 | } 70 | 71 | const char * SCI_METHOD LexerBase::DescribeWordListSets() { 72 | return ""; 73 | } 74 | 75 | Sci_Position SCI_METHOD LexerBase::WordListSet(int n, const char *wl) { 76 | if (n < numWordLists) { 77 | WordList wlNew; 78 | wlNew.Set(wl); 79 | if (*keyWordLists[n] != wlNew) { 80 | keyWordLists[n]->Set(wl); 81 | return 0; 82 | } 83 | } 84 | return -1; 85 | } 86 | 87 | void * SCI_METHOD LexerBase::PrivateCall(int, void *) { 88 | return 0; 89 | } 90 | -------------------------------------------------------------------------------- /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 | 11 | #include "ILexer.h" 12 | #include "Scintilla.h" 13 | #include "SciLexer.h" 14 | 15 | #include "PropSetSimple.h" 16 | #include "WordList.h" 17 | #include "LexAccessor.h" 18 | #include "Accessor.h" 19 | #include "LexerModule.h" 20 | #include "LexerBase.h" 21 | #include "LexerNoExceptions.h" 22 | 23 | #ifdef SCI_NAMESPACE 24 | using namespace Scintilla; 25 | #endif 26 | 27 | Sci_Position SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) { 28 | try { 29 | return LexerBase::PropertySet(key, val); 30 | } catch (...) { 31 | // Should not throw into caller as may be compiled with different compiler or options 32 | } 33 | return -1; 34 | } 35 | 36 | Sci_Position SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) { 37 | try { 38 | return LexerBase::WordListSet(n, wl); 39 | } catch (...) { 40 | // Should not throw into caller as may be compiled with different compiler or options 41 | } 42 | return -1; 43 | } 44 | 45 | void SCI_METHOD LexerNoExceptions::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { 46 | try { 47 | Accessor astyler(pAccess, &props); 48 | Lexer(startPos, lengthDoc, initStyle, pAccess, astyler); 49 | astyler.Flush(); 50 | } catch (...) { 51 | // Should not throw into caller as may be compiled with different compiler or options 52 | pAccess->SetErrorStatus(SC_STATUS_FAILURE); 53 | } 54 | } 55 | void SCI_METHOD LexerNoExceptions::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { 56 | try { 57 | Accessor astyler(pAccess, &props); 58 | Folder(startPos, lengthDoc, initStyle, pAccess, astyler); 59 | astyler.Flush(); 60 | } catch (...) { 61 | // Should not throw into caller as may be compiled with different compiler or options 62 | pAccess->SetErrorStatus(SC_STATUS_FAILURE); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /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 | int indicator; 16 | public: 17 | RunStyles rs; 18 | 19 | explicit Decoration(int indicator_); 20 | ~Decoration(); 21 | 22 | bool Empty() const; 23 | int Indicator() const { 24 | return indicator; 25 | } 26 | }; 27 | 28 | class DecorationList { 29 | int currentIndicator; 30 | int currentValue; 31 | Decoration *current; // Cached so FillRange doesn't have to search for each call. 32 | int lengthDocument; 33 | // Ordered by indicator 34 | std::vector> decorationList; 35 | std::vector decorationView; // Read-only view of decorationList 36 | bool clickNotified; 37 | 38 | Decoration *DecorationFromIndicator(int indicator); 39 | Decoration *Create(int indicator, int length); 40 | void Delete(int indicator); 41 | void DeleteAnyEmpty(); 42 | void SetView(); 43 | public: 44 | 45 | DecorationList(); 46 | ~DecorationList(); 47 | 48 | const std::vector &View() const { return decorationView; } 49 | 50 | void SetCurrentIndicator(int indicator); 51 | int GetCurrentIndicator() const { return currentIndicator; } 52 | 53 | void SetCurrentValue(int value); 54 | int GetCurrentValue() const { return currentValue; } 55 | 56 | // Returns true if some values may have changed 57 | bool FillRange(int &position, int value, int &fillLength); 58 | 59 | void InsertSpace(int position, int insertLength); 60 | void DeleteRange(int position, int deleteLength); 61 | 62 | void DeleteLexerDecorations(); 63 | 64 | int AllOnFor(int position) const; 65 | int ValueAt(int indicator, int position); 66 | int Start(int indicator, int position); 67 | int End(int indicator, int position); 68 | 69 | bool ClickNotified() const { 70 | return clickNotified; 71 | } 72 | void SetClickNotified(bool notified) { 73 | clickNotified = notified; 74 | } 75 | }; 76 | 77 | #ifdef SCI_NAMESPACE 78 | } 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /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 | /// LexerLibrary exists for every External Lexer DLL, contains ExternalLexerModules. 42 | class LexerLibrary { 43 | std::unique_ptr lib; 44 | std::vector> modules; 45 | public: 46 | explicit LexerLibrary(const char *moduleName_); 47 | ~LexerLibrary(); 48 | 49 | std::string moduleName; 50 | }; 51 | 52 | /// LexerManager manages external lexers, contains LexerLibrarys. 53 | class LexerManager { 54 | public: 55 | ~LexerManager(); 56 | 57 | static LexerManager *GetInstance(); 58 | static void DeleteInstance(); 59 | 60 | void Load(const char *path); 61 | void Clear(); 62 | 63 | private: 64 | LexerManager(); 65 | static std::unique_ptr theInstance; 66 | std::vector> libraries; 67 | }; 68 | 69 | class LMMinder { 70 | public: 71 | ~LMMinder(); 72 | }; 73 | 74 | #ifdef SCI_NAMESPACE 75 | } 76 | #endif 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /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 | 4 | // Coding style is to use assignments in constructor when there are many 5 | // members to initialize or the initialization is complex or has comments. 6 | useInitializationList 7 | 8 | // Some non-explicit constructors are used for conversions or are private to lexers 9 | noExplicitConstructor 10 | 11 | // ScintillaDocument is providing an API and there are no consumers of the API inside Scintilla 12 | unusedFunction:scintilla/qt/ScintillaEdit/ScintillaDocument.cpp 13 | 14 | // The performance cost of by-value passing is often small and using a reference decreases 15 | // code legibility. 16 | passedByValue 17 | 18 | // Suppress most lexer warnings since the lexers are maintained by others 19 | redundantCondition:scintilla/lexers/LexA68k.cxx 20 | useInitializationList:scintilla/lexers/LexAsm.cxx 21 | useInitializationList:scintilla/lexers/LexBasic.cxx 22 | uninitMemberVar:scintilla/lexers/LexBash.cxx 23 | variableScope:scintilla/lexers/LexBash.cxx 24 | variableScope:scintilla/lexers/LexBatch.cxx 25 | variableScope:scintilla/lexers/LexCmake.cxx 26 | variableScope:scintilla/lexers/LexCSS.cxx 27 | useInitializationList:scintilla/lexers/LexD.cxx 28 | variableScope:scintilla/lexers/LexErlang.cxx 29 | variableScope:scintilla/lexers/LexGui4Cli.cxx 30 | variableScope:scintilla/lexers/LexInno.cxx 31 | variableScope:scintilla/lexers/LexLaTeX.cxx 32 | variableScope:scintilla/lexers/LexMetapost.cxx 33 | variableScope:scintilla/lexers/LexModula.cxx 34 | variableScope:scintilla/lexers/LexNimrod.cxx 35 | variableScope:scintilla/lexers/LexNsis.cxx 36 | variableScope:scintilla/lexers/LexOpal.cxx 37 | variableScope:scintilla/lexers/LexPB.cxx 38 | variableScope:scintilla/lexers/LexProgress.cxx 39 | variableScope:scintilla/lexers/LexRuby.cxx 40 | uninitMemberVar:scintilla/lexers/LexRuby.cxx 41 | variableScope:scintilla/lexers/LexSpecman.cxx 42 | clarifyCalculation:scintilla/lexers/LexTADS3.cxx 43 | invalidscanf:scintilla/lexers/LexTCMD.cxx 44 | variableScope:scintilla/lexers/LexTeX.cxx 45 | variableScope:scintilla/lexers/LexVHDL.cxx 46 | 47 | // Suppress everything in catch.hpp as won't be changing 48 | *:scintilla/test/unit/catch.hpp 49 | // Spurious errors due to choice of variadic or two argument TEST_CASE macro 50 | preprocessorErrorDirective:scintilla/test/unit/*.cxx 51 | syntaxError:scintilla/test/unit/UnitTester.cxx 52 | syntaxError:scintilla/test/unit/unitTest.cxx 53 | -------------------------------------------------------------------------------- /scintilla/lexlib/Accessor.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Accessor.cxx 3 | ** Interfaces between Scintilla and lexers. 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 | 11 | #include "ILexer.h" 12 | #include "Scintilla.h" 13 | #include "SciLexer.h" 14 | 15 | #include "PropSetSimple.h" 16 | #include "WordList.h" 17 | #include "LexAccessor.h" 18 | #include "Accessor.h" 19 | 20 | #ifdef SCI_NAMESPACE 21 | using namespace Scintilla; 22 | #endif 23 | 24 | Accessor::Accessor(IDocument *pAccess_, PropSetSimple *pprops_) : LexAccessor(pAccess_), pprops(pprops_) { 25 | } 26 | 27 | int Accessor::GetPropertyInt(const char *key, int defaultValue) const { 28 | return pprops->GetInt(key, defaultValue); 29 | } 30 | 31 | int Accessor::IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { 32 | const Sci_Position end = Length(); 33 | int spaceFlags = 0; 34 | 35 | // Determines the indentation level of the current line and also checks for consistent 36 | // indentation compared to the previous line. 37 | // Indentation is judged consistent when the indentation whitespace of each line lines 38 | // the same or the indentation of one line is a prefix of the other. 39 | 40 | Sci_Position pos = LineStart(line); 41 | char ch = (*this)[pos]; 42 | int indent = 0; 43 | bool inPrevPrefix = line > 0; 44 | Sci_Position posPrev = inPrevPrefix ? LineStart(line-1) : 0; 45 | while ((ch == ' ' || ch == '\t') && (pos < end)) { 46 | if (inPrevPrefix) { 47 | const char chPrev = (*this)[posPrev++]; 48 | if (chPrev == ' ' || chPrev == '\t') { 49 | if (chPrev != ch) 50 | spaceFlags |= wsInconsistent; 51 | } else { 52 | inPrevPrefix = false; 53 | } 54 | } 55 | if (ch == ' ') { 56 | spaceFlags |= wsSpace; 57 | indent++; 58 | } else { // Tab 59 | spaceFlags |= wsTab; 60 | if (spaceFlags & wsSpace) 61 | spaceFlags |= wsSpaceTab; 62 | indent = (indent / 8 + 1) * 8; 63 | } 64 | ch = (*this)[++pos]; 65 | } 66 | 67 | *flags = spaceFlags; 68 | indent += SC_FOLDLEVELBASE; 69 | // if completely empty line or the start of a comment... 70 | if ((LineStart(line) == Length()) || (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || 71 | (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) 72 | return indent | SC_FOLDLEVELWHITEFLAG; 73 | else 74 | return indent; 75 | } 76 | -------------------------------------------------------------------------------- /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 | const int unicodeReplacementChar = 0xFFFD; 18 | 19 | size_t UTF8Length(const wchar_t *uptr, size_t tlen); 20 | void UTF8FromUTF16(const wchar_t *uptr, size_t tlen, char *putf, size_t len); 21 | unsigned int UTF8CharLength(unsigned char ch); 22 | size_t UTF16Length(const char *s, size_t len); 23 | size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen); 24 | size_t UTF32FromUTF8(const char *s, size_t len, unsigned int *tbuf, size_t tlen); 25 | unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf); 26 | std::string FixInvalidUTF8(const std::string &text); 27 | 28 | extern int UTF8BytesOfLead[256]; 29 | void UTF8BytesOfLeadInitialise(); 30 | 31 | inline bool UTF8IsTrailByte(int ch) { 32 | return (ch >= 0x80) && (ch < 0xc0); 33 | } 34 | 35 | inline bool UTF8IsAscii(int ch) { 36 | return ch < 0x80; 37 | } 38 | 39 | enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 }; 40 | int UTF8Classify(const unsigned char *us, int len); 41 | 42 | // Similar to UTF8Classify but returns a length of 1 for invalid bytes 43 | // instead of setting the invalid flag 44 | int UTF8DrawBytes(const unsigned char *us, int len); 45 | 46 | // Line separator is U+2028 \xe2\x80\xa8 47 | // Paragraph separator is U+2029 \xe2\x80\xa9 48 | const int UTF8SeparatorLength = 3; 49 | inline bool UTF8IsSeparator(const unsigned char *us) { 50 | return (us[0] == 0xe2) && (us[1] == 0x80) && ((us[2] == 0xa8) || (us[2] == 0xa9)); 51 | } 52 | 53 | // NEL is U+0085 \xc2\x85 54 | const int UTF8NELLength = 2; 55 | inline bool UTF8IsNEL(const unsigned char *us) { 56 | return (us[0] == 0xc2) && (us[1] == 0x85); 57 | } 58 | 59 | enum { SURROGATE_LEAD_FIRST = 0xD800 }; 60 | enum { SURROGATE_LEAD_LAST = 0xDBFF }; 61 | enum { SURROGATE_TRAIL_FIRST = 0xDC00 }; 62 | enum { SURROGATE_TRAIL_LAST = 0xDFFF }; 63 | enum { SUPPLEMENTAL_PLANE_FIRST = 0x10000 }; 64 | 65 | inline unsigned int UTF16CharLength(wchar_t uch) { 66 | return ((uch >= SURROGATE_LEAD_FIRST) && (uch <= SURROGATE_LEAD_LAST)) ? 2 : 1; 67 | } 68 | 69 | #ifdef SCI_NAMESPACE 70 | } 71 | #endif 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /scintilla/doc/Privacy.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Privacy Policy 11 | 12 | 13 | 14 | 15 | 16 | 19 | 23 | 24 |
17 | Scintilla icon 18 | 20 | Scintilla 21 | and SciTE 22 |
25 |

26 | Privacy Policy for scintilla.org 27 |

28 |

29 | Information Collected 30 |

31 |

32 | Logs are collected to allow analysis of which pages are viewed. 33 | The advertisements collect viewing information through Google Analytics which is 34 | used by Google and advertisers. 35 | No personally identifiable information is collected by scintilla.org. 36 |

37 |

38 | External Links 39 |

40 |

41 | Other web sites are linked to from this site. 42 | These web sites have their own privacy policies which may differ significantly to those of scintilla.org. 43 |

44 |

45 | Cookies 46 |

47 |

48 | A cookie is a text file placed on the hard drive of a computer by some web pages which is used to remember 49 | when a particular user returns to that site. 50 | The advertisements shown on the main pages may use cookies. 51 |

52 |

53 | Contact 54 |

55 |

56 | This web site is the responsibility of Neil Hodgson. 57 | Most queries about the site contents should go to one of the mailing lists mentioned on the main pages. 58 | Queries about the privacy policy may be sent to neilh @ scintilla.org. 59 |

60 |

61 | Changes to this Policy 62 |

63 |

64 | This policy may change. If it does then this page will be updated and the date at the bottom will change. 65 |

66 |

67 | This policy was last updated 2 June 2015. 68 |

69 | 70 | 71 | -------------------------------------------------------------------------------- /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)(Sci_PositionU startPos, Sci_Position 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(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, 57 | WordList *keywordlists[], Accessor &styler) const; 58 | virtual void Fold(Sci_PositionU startPos, Sci_Position lengthDoc, 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 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/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 | template 16 | class SparseVector; 17 | 18 | /** 19 | */ 20 | class ContractionState { 21 | // These contain 1 element for every document line. 22 | std::unique_ptr visible; 23 | std::unique_ptr expanded; 24 | std::unique_ptr heights; 25 | std::unique_ptr> foldDisplayTexts; 26 | std::unique_ptr displayLines; 27 | Sci::Line linesInDocument; 28 | 29 | void EnsureData(); 30 | 31 | bool OneToOne() const { 32 | // True when each document line is exactly one display line so need for 33 | // complex data structures. 34 | return visible == nullptr; 35 | } 36 | 37 | public: 38 | ContractionState(); 39 | // Deleted so ContractionState objects can not be copied. 40 | ContractionState(const ContractionState &) = delete; 41 | void operator=(const ContractionState &) = delete; 42 | virtual ~ContractionState(); 43 | 44 | void Clear(); 45 | 46 | Sci::Line LinesInDoc() const; 47 | Sci::Line LinesDisplayed() const; 48 | Sci::Line DisplayFromDoc(Sci::Line lineDoc) const; 49 | Sci::Line DisplayLastFromDoc(Sci::Line lineDoc) const; 50 | Sci::Line DocFromDisplay(Sci::Line lineDisplay) const; 51 | 52 | void InsertLine(Sci::Line lineDoc); 53 | void InsertLines(Sci::Line lineDoc, Sci::Line lineCount); 54 | void DeleteLine(Sci::Line lineDoc); 55 | void DeleteLines(Sci::Line lineDoc, Sci::Line lineCount); 56 | 57 | bool GetVisible(Sci::Line lineDoc) const; 58 | bool SetVisible(Sci::Line lineDocStart, Sci::Line lineDocEnd, bool isVisible); 59 | bool HiddenLines() const; 60 | 61 | const char *GetFoldDisplayText(Sci::Line lineDoc) const; 62 | bool SetFoldDisplayText(Sci::Line lineDoc, const char *text); 63 | 64 | bool GetExpanded(Sci::Line lineDoc) const; 65 | bool SetExpanded(Sci::Line lineDoc, bool isExpanded); 66 | bool GetFoldDisplayTextShown(Sci::Line lineDoc) const; 67 | Sci::Line ContractedNext(Sci::Line lineDocStart) const; 68 | 69 | int GetHeight(Sci::Line lineDoc) const; 70 | bool SetHeight(Sci::Line lineDoc, int height); 71 | 72 | void ShowAll(); 73 | void Check() const; 74 | }; 75 | 76 | #ifdef SCI_NAMESPACE 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /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 | public: 37 | FontAlias(); 38 | // FontAlias objects can not be assigned except for initialization 39 | FontAlias &operator=(const FontAlias &) = delete; 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 capitalHeight; // Top of capital letter to baseline: ascent - internal leading 50 | XYPOSITION aveCharWidth; 51 | XYPOSITION spaceWidth; 52 | int sizeZoomed; 53 | FontMeasurements(); 54 | void Clear(); 55 | }; 56 | 57 | /** 58 | */ 59 | class Style : public FontSpecification, public FontMeasurements { 60 | public: 61 | ColourDesired fore; 62 | ColourDesired back; 63 | bool eolFilled; 64 | bool underline; 65 | enum ecaseForced {caseMixed, caseUpper, caseLower, caseCamel}; 66 | ecaseForced caseForce; 67 | bool visible; 68 | bool changeable; 69 | bool hotspot; 70 | 71 | FontAlias font; 72 | 73 | Style(); 74 | Style(const Style &source); 75 | ~Style(); 76 | Style &operator=(const Style &source); 77 | void Clear(ColourDesired fore_, ColourDesired back_, 78 | int size_, 79 | const char *fontName_, int characterSet_, 80 | int weight_, bool italic_, bool eolFilled_, 81 | bool underline_, ecaseForced caseForce_, 82 | bool visible_, bool changeable_, bool hotspot_); 83 | void ClearTo(const Style &source); 84 | void Copy(Font &font_, const FontMeasurements &fm_); 85 | bool IsProtected() const { return !(changeable && visible);} 86 | }; 87 | 88 | #ifdef SCI_NAMESPACE 89 | } 90 | #endif 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /scintilla/lexers/LexIndent.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexIndent.cxx 3 | ** Lexer for no language. Used for indentation-based folding of files. 4 | **/ 5 | // The License.txt file describes the conditions under which this software may be distributed. 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "ILexer.h" 15 | #include "Scintilla.h" 16 | #include "SciLexer.h" 17 | 18 | #include "WordList.h" 19 | #include "LexAccessor.h" 20 | #include "Accessor.h" 21 | #include "StyleContext.h" 22 | #include "CharacterSet.h" 23 | #include "LexerModule.h" 24 | 25 | #ifdef SCI_NAMESPACE 26 | using namespace Scintilla; 27 | #endif 28 | 29 | static void ColouriseIndentDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], 30 | Accessor &styler) { 31 | // Indent language means all style bytes are 0 so just mark the end - no need to fill in. 32 | if (length > 0) { 33 | styler.StartAt(startPos + length - 1); 34 | styler.StartSegment(startPos + length - 1); 35 | styler.ColourTo(startPos + length - 1, 0); 36 | } 37 | } 38 | 39 | static void FoldIndentDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { 40 | int visibleCharsCurrent, visibleCharsNext; 41 | int levelCurrent, levelNext; 42 | Sci_PositionU i, lineEnd; 43 | Sci_PositionU lengthDoc = startPos + length; 44 | Sci_Position lineCurrent = styler.GetLine(startPos); 45 | 46 | i = styler.LineStart(lineCurrent ); 47 | lineEnd = styler.LineStart(lineCurrent+1)-1; 48 | if(lineEnd>=lengthDoc) lineEnd = lengthDoc-1; 49 | while(styler[lineEnd]=='\n' || styler[lineEnd]=='\r') lineEnd--; 50 | for(visibleCharsCurrent=0, levelCurrent=SC_FOLDLEVELBASE; !visibleCharsCurrent && i<=lineEnd; i++){ 51 | if(isspacechar(styler[i])) levelCurrent++; 52 | else visibleCharsCurrent=1; 53 | } 54 | 55 | for(; i=lengthDoc) lineEnd = lengthDoc-1; 59 | while(styler[lineEnd]=='\n' || styler[lineEnd]=='\r') lineEnd--; 60 | for(visibleCharsNext=0, levelNext=SC_FOLDLEVELBASE; !visibleCharsNext && i<=lineEnd; i++){ 61 | if(isspacechar(styler[i])) levelNext++; 62 | else visibleCharsNext=1; 63 | } 64 | int lev = levelCurrent; 65 | if(!visibleCharsCurrent) lev |= SC_FOLDLEVELWHITEFLAG; 66 | else if(levelNext > levelCurrent) lev |= SC_FOLDLEVELHEADERFLAG; 67 | styler.SetLevel(lineCurrent, lev); 68 | levelCurrent = levelNext; 69 | visibleCharsCurrent = visibleCharsNext; 70 | } 71 | } 72 | 73 | LexerModule lmIndent(SCLEX_INDENT, ColouriseIndentDoc, "indent", FoldIndentDoc); 74 | -------------------------------------------------------------------------------- /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 | typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, int tFold, int marginStyle, const void *lineMarker); 16 | 17 | /** 18 | */ 19 | class LineMarker { 20 | public: 21 | enum typeOfFold { undefined, head, body, tail, headWithTail }; 22 | 23 | int markType; 24 | ColourDesired fore; 25 | ColourDesired back; 26 | ColourDesired backSelected; 27 | int alpha; 28 | std::unique_ptr pxpm; 29 | std::unique_ptr image; 30 | /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native 31 | * Draw function for drawing line markers. Allow those platforms to override 32 | * it instead of creating a new method(s) in the Surface class that existing 33 | * platforms must implement as empty. */ 34 | DrawLineMarkerFn customDraw; 35 | LineMarker() { 36 | markType = SC_MARK_CIRCLE; 37 | fore = ColourDesired(0,0,0); 38 | back = ColourDesired(0xff,0xff,0xff); 39 | backSelected = ColourDesired(0xff,0x00,0x00); 40 | alpha = SC_ALPHA_NOALPHA; 41 | customDraw = nullptr; 42 | } 43 | LineMarker(const LineMarker &) { 44 | // Defined to avoid pxpm and image being blindly copied, not as a complete copy constructor. 45 | markType = SC_MARK_CIRCLE; 46 | fore = ColourDesired(0,0,0); 47 | back = ColourDesired(0xff,0xff,0xff); 48 | backSelected = ColourDesired(0xff,0x00,0x00); 49 | alpha = SC_ALPHA_NOALPHA; 50 | pxpm.reset(); 51 | image.reset(); 52 | customDraw = nullptr; 53 | } 54 | ~LineMarker() { 55 | } 56 | LineMarker &operator=(const LineMarker &other) { 57 | // Defined to avoid pxpm and image being blindly copied, not as a complete assignment operator. 58 | if (this != &other) { 59 | markType = SC_MARK_CIRCLE; 60 | fore = ColourDesired(0,0,0); 61 | back = ColourDesired(0xff,0xff,0xff); 62 | backSelected = ColourDesired(0xff,0x00,0x00); 63 | alpha = SC_ALPHA_NOALPHA; 64 | pxpm.reset(); 65 | image.reset(); 66 | customDraw = nullptr; 67 | } 68 | return *this; 69 | } 70 | void SetXPM(const char *textForm); 71 | void SetXPM(const char *const *linesForm); 72 | void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); 73 | void Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const; 74 | }; 75 | 76 | #ifdef SCI_NAMESPACE 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/Version.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Notepad2-mod 4 | * 5 | * Version.h 6 | * 7 | * See License.txt for details about distribution and modification. 8 | * 9 | * (c) XhmikosR 2010-2017 10 | * https://github.com/XhmikosR/notepad2-mod 11 | * 12 | * 13 | ******************************************************************************/ 14 | 15 | 16 | #ifndef NOTEPAD2_VERSION_H 17 | #define NOTEPAD2_VERSION_H 18 | 19 | #include "VersionRev.h" 20 | 21 | #ifndef _T 22 | #if !defined(ISPP_INVOKED) && (defined(UNICODE) || defined(_UNICODE)) 23 | #define _T(text) L##text 24 | #else 25 | #define _T(text) text 26 | #endif 27 | #endif 28 | 29 | #define DO_STRINGIFY(x) _T(#x) 30 | #define STRINGIFY(x) DO_STRINGIFY(x) 31 | 32 | #define VERSION_MAJOR 4 33 | #define VERSION_MINOR 2 34 | #define VERSION_BUILD 25 35 | 36 | #define MY_APPNAME L"Notepad2-mod" 37 | #define VERSION_FILEVERSION_NUM VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_REV 38 | #define VERSION_FILEVERSION STRINGIFY(VERSION_MAJOR) "." STRINGIFY(VERSION_MINOR) "." \ 39 | STRINGIFY(VERSION_BUILD) "." STRINGIFY(VERSION_REV) 40 | #define VERSION_LEGALCOPYRIGHT_SHORT L"Copyright © 2004-2017" 41 | #define VERSION_LEGALCOPYRIGHT_LONG L"© Florian Balmer 2004-2017" 42 | #define VERSION_AUTHORNAME L"Florian Balmer" 43 | #define VERSION_WEBPAGEDISPLAY L"flo's freeware - http://www.flos-freeware.ch" 44 | #define VERSION_EMAILDISPLAY L"florian.balmer@gmail.com" 45 | #define VERSION_COMPANYNAME L"Florian Balmer et al." 46 | #define VERSION_MODPAGEDISPLAY L"https://xhmikosr.github.io/notepad2-mod/" 47 | 48 | #if defined(_WIN64) 49 | #define VERSION_FILEVERSION_LONG L"Notepad2-mod (64-bit) " STRINGIFY(VERSION_MAJOR) L"." \ 50 | STRINGIFY(VERSION_MINOR) L"." STRINGIFY(VERSION_BUILD) \ 51 | L" r" STRINGIFY(VERSION_REV) L" (" VERSION_HASH L")" 52 | #else 53 | #define VERSION_FILEVERSION_LONG L"Notepad2-mod " STRINGIFY(VERSION_MAJOR) L"." \ 54 | STRINGIFY(VERSION_MINOR) L"." STRINGIFY(VERSION_BUILD) \ 55 | L" r" STRINGIFY(VERSION_REV) L" (" VERSION_HASH L")" 56 | #endif 57 | 58 | // Compiler specific 59 | #if defined(_MSC_VER) 60 | #if _MSC_VER == 1910 61 | #if (_MSC_FULL_VER >= 191025017 && _MSC_FULL_VER <= 191025019) 62 | #define VERSION_COMPILER L"MSVC 2017" 63 | #endif 64 | #else 65 | #define VERSION_COMPILER L"MSVC (version unknown)" 66 | #endif 67 | #else 68 | #define VERSION_COMPILER L"(Unknown compiler)" 69 | #endif 70 | 71 | #endif // NOTEPAD2_VERSION_H 72 | -------------------------------------------------------------------------------- /scintilla/doc/ScintillaDownload.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Download Scintilla 12 | 13 | 14 | 15 | 16 | 17 | 20 | 24 | 25 |
18 | Scintilla icon 19 | 21 | Download 22 | Scintilla 23 |
26 | 27 | 28 | 35 | 36 |
29 | 30 | Windows   31 | 32 | GTK+/Linux   33 | 34 |
37 |

38 | Download. 39 |

40 |

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

44 |

45 | Release 3.7.5 46 |

47 |

48 | Source Code 49 |

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

58 | Windows Executable Code 59 |

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

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

66 |

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

70 | 71 | 72 | -------------------------------------------------------------------------------- /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 | * This comment is not a doc-comment as that causes warnings from g-ir-scanner. 6 | */ 7 | /* Copyright 1998-2001 by Neil Hodgson 8 | * The License.txt file describes the conditions under which this software may be distributed. */ 9 | 10 | #ifndef SCINTILLAWIDGET_H 11 | #define SCINTILLAWIDGET_H 12 | 13 | #if defined(GTK) 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #define SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, scintilla_get_type (), ScintillaObject) 20 | #define SCINTILLA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) 21 | #define IS_SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, scintilla_get_type ()) 22 | 23 | #define SCINTILLA_TYPE_OBJECT (scintilla_object_get_type()) 24 | #define SCINTILLA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SCINTILLA_TYPE_OBJECT, ScintillaObject)) 25 | #define SCINTILLA_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCINTILLA_TYPE_OBJECT)) 26 | #define SCINTILLA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass)) 27 | #define SCINTILLA_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SCINTILLA_TYPE_OBJECT)) 28 | #define SCINTILLA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass)) 29 | 30 | typedef struct _ScintillaObject ScintillaObject; 31 | typedef struct _ScintillaClass ScintillaObjectClass; 32 | 33 | struct _ScintillaObject { 34 | GtkContainer cont; 35 | void *pscin; 36 | }; 37 | 38 | struct _ScintillaClass { 39 | GtkContainerClass parent_class; 40 | 41 | void (* command) (ScintillaObject *sci, int cmd, GtkWidget *window); 42 | void (* notify) (ScintillaObject *sci, int id, SCNotification *scn); 43 | }; 44 | 45 | GType scintilla_object_get_type (void); 46 | GtkWidget* scintilla_object_new (void); 47 | gintptr scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam); 48 | 49 | 50 | GType scnotification_get_type (void); 51 | #define SCINTILLA_TYPE_NOTIFICATION (scnotification_get_type()) 52 | 53 | #ifndef G_IR_SCANNING 54 | /* The legacy names confuse the g-ir-scanner program */ 55 | typedef struct _ScintillaClass ScintillaClass; 56 | 57 | GType scintilla_get_type (void); 58 | GtkWidget* scintilla_new (void); 59 | void scintilla_set_id (ScintillaObject *sci, uptr_t id); 60 | sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); 61 | void scintilla_release_resources(void); 62 | #endif 63 | 64 | #define SCINTILLA_NOTIFY "sci-notify" 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /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) const; 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, const 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 | int height; 47 | int width; 48 | float scale; 49 | std::vector pixelBytes; 50 | public: 51 | RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_); 52 | explicit RGBAImage(const XPM &xpm); 53 | // Deleted so RGBAImage objects can not be copied. 54 | RGBAImage(const RGBAImage &) = delete; 55 | RGBAImage &operator=(const RGBAImage &) = delete; 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/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 | std::unique_ptr lb; 31 | Sci::Position 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, Sci::Position 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 | void DrawChunk(Surface *surface, int &x, const char *s, 31 | int posStart, int posEnd, int ytext, PRectangle rcClient, 32 | bool highlight, bool draw); 33 | int PaintContents(Surface *surfaceWindow, bool draw); 34 | bool IsTabCharacter(char ch) const; 35 | int NextTabPos(int x) const; 36 | 37 | public: 38 | Window wCallTip; 39 | Window wDraw; 40 | bool inCallTipMode; 41 | Sci::Position posStartCallTip; 42 | ColourDesired colourBG; 43 | ColourDesired colourUnSel; 44 | ColourDesired colourSel; 45 | ColourDesired colourShade; 46 | ColourDesired colourLight; 47 | int codePage; 48 | int clickPlace; 49 | 50 | int insetX; // text inset in x from calltip border 51 | int widthArrow; 52 | int borderHeight; 53 | int verticalOffset; // pixel offset up or down of the calltip with respect to the line 54 | 55 | CallTip(); 56 | // Deleted so CallTip objects can not be copied. 57 | CallTip(const CallTip &) = delete; 58 | CallTip &operator=(const CallTip &) = delete; 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(Sci::Position 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 | -------------------------------------------------------------------------------- /src/Styles.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * 4 | * Notepad2 5 | * 6 | * Styles.h 7 | * Scintilla Style Management 8 | * 9 | * See Readme.txt for more information about this source code. 10 | * Please send me your comments to this work. 11 | * 12 | * See License.txt for details about distribution and modification. 13 | * 14 | * (c) Florian Balmer 1996-2011 15 | * florian.balmer@gmail.com 16 | * http://www.flos-freeware.ch 17 | * 18 | * 19 | ******************************************************************************/ 20 | 21 | 22 | typedef struct _editstyle 23 | { 24 | union 25 | { 26 | INT32 iStyle; 27 | UINT8 iStyle8[4]; 28 | }; 29 | int rid; 30 | WCHAR* pszName; 31 | WCHAR* pszDefault; 32 | WCHAR szValue[128]; 33 | 34 | } EDITSTYLE, *PEDITSTYLE; 35 | 36 | 37 | typedef struct _keywordlist 38 | { 39 | char *pszKeyWords[KEYWORDSET_MAX + 1]; 40 | 41 | } KEYWORDLIST, *PKEYWORDLIST; 42 | 43 | 44 | typedef struct _editlexer 45 | { 46 | int iLexer; 47 | int rid; 48 | WCHAR* pszName; 49 | WCHAR* pszDefExt; 50 | WCHAR szExtensions[128]; 51 | PKEYWORDLIST pKeyWords; 52 | EDITSTYLE Styles[]; 53 | 54 | } EDITLEXER, *PEDITLEXER; 55 | 56 | 57 | // Number of Lexers in pLexArray 58 | #define NUMLEXERS 38 59 | 60 | 61 | void Style_Load(); 62 | void Style_Save(); 63 | BOOL Style_Import(HWND); 64 | BOOL Style_Export(HWND); 65 | void Style_SetLexer(HWND,PEDITLEXER); 66 | void Style_SetLongLineColors(HWND); 67 | void Style_SetCurrentLineBackground(HWND); 68 | void Style_SetLexerFromFile(HWND,LPCWSTR); 69 | void Style_SetLexerFromName(HWND,LPCWSTR,LPCWSTR); 70 | void Style_SetDefaultLexer(HWND); 71 | void Style_SetHTMLLexer(HWND); 72 | void Style_SetXMLLexer(HWND); 73 | void Style_SetLexerFromID(HWND,int); 74 | void Style_SetDefaultFont(HWND); 75 | void Style_ToggleUse2ndDefault(HWND); 76 | BOOL Style_GetUse2ndDefault(HWND); 77 | void Style_SetIndentGuides(HWND,BOOL); 78 | BOOL Style_GetOpenDlgFilterStr(LPWSTR,int); 79 | BOOL Style_StrGetFont(LPCWSTR,LPWSTR,int); 80 | BOOL Style_StrGetFontQuality(LPCWSTR,LPWSTR,int); 81 | BOOL Style_StrGetCharSet(LPCWSTR,int*); 82 | BOOL Style_StrGetSize(LPCWSTR,int*); 83 | BOOL Style_StrGetSizeStr(LPCWSTR,LPWSTR,int); 84 | BOOL Style_StrGetColor(BOOL,LPCWSTR,int*); 85 | BOOL Style_StrGetCase(LPCWSTR,int*); 86 | BOOL Style_StrGetAlpha(LPCWSTR,int*); 87 | BOOL Style_SelectFont(HWND,LPWSTR,int,BOOL); 88 | BOOL Style_SelectColor(HWND,BOOL,LPWSTR,int); 89 | void Style_SetStyles(HWND,int,LPCWSTR); 90 | void Style_SetFontQuality(HWND,LPCWSTR); 91 | void Style_GetCurrentLexerName(LPWSTR,int); 92 | int Style_GetLexerIconId(PEDITLEXER); 93 | HTREEITEM Style_AddLexerToTreeView(HWND,PEDITLEXER); 94 | INT_PTR CALLBACK Styles_ConfigDlgProc(HWND,UINT,WPARAM,LPARAM); 95 | void Style_ConfigDlg(HWND); 96 | INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND,UINT,WPARAM,LPARAM); 97 | void Style_SelectLexerDlg(HWND); 98 | 99 | 100 | // End of Style.h 101 | -------------------------------------------------------------------------------- /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 | 11 | #include 12 | 13 | #include "ILexer.h" 14 | #include "Scintilla.h" 15 | #include "SciLexer.h" 16 | 17 | #include "PropSetSimple.h" 18 | #include "WordList.h" 19 | #include "LexAccessor.h" 20 | #include "Accessor.h" 21 | #include "LexerModule.h" 22 | #include "LexerBase.h" 23 | #include "LexerSimple.h" 24 | 25 | #ifdef SCI_NAMESPACE 26 | using namespace Scintilla; 27 | #endif 28 | 29 | LexerModule::LexerModule(int language_, 30 | LexerFunction fnLexer_, 31 | const char *languageName_, 32 | LexerFunction fnFolder_, 33 | const char *const wordListDescriptions_[]) : 34 | language(language_), 35 | fnLexer(fnLexer_), 36 | fnFolder(fnFolder_), 37 | fnFactory(0), 38 | wordListDescriptions(wordListDescriptions_), 39 | languageName(languageName_) { 40 | } 41 | 42 | LexerModule::LexerModule(int language_, 43 | LexerFactoryFunction fnFactory_, 44 | const char *languageName_, 45 | const char * const wordListDescriptions_[]) : 46 | language(language_), 47 | fnLexer(0), 48 | fnFolder(0), 49 | fnFactory(fnFactory_), 50 | wordListDescriptions(wordListDescriptions_), 51 | languageName(languageName_) { 52 | } 53 | 54 | int LexerModule::GetNumWordLists() const { 55 | if (wordListDescriptions == NULL) { 56 | return -1; 57 | } else { 58 | int numWordLists = 0; 59 | 60 | while (wordListDescriptions[numWordLists]) { 61 | ++numWordLists; 62 | } 63 | 64 | return numWordLists; 65 | } 66 | } 67 | 68 | const char *LexerModule::GetWordListDescription(int index) const { 69 | assert(index < GetNumWordLists()); 70 | if (!wordListDescriptions || (index >= GetNumWordLists())) { 71 | return ""; 72 | } else { 73 | return wordListDescriptions[index]; 74 | } 75 | } 76 | 77 | ILexer *LexerModule::Create() const { 78 | if (fnFactory) 79 | return fnFactory(); 80 | else 81 | return new LexerSimple(this); 82 | } 83 | 84 | void LexerModule::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, 85 | WordList *keywordlists[], Accessor &styler) const { 86 | if (fnLexer) 87 | fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler); 88 | } 89 | 90 | void LexerModule::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, 91 | WordList *keywordlists[], Accessor &styler) const { 92 | if (fnFolder) { 93 | Sci_Position lineCurrent = styler.GetLine(startPos); 94 | // Move back one line in case deletion wrecked current line fold state 95 | if (lineCurrent > 0) { 96 | lineCurrent--; 97 | Sci_Position newStartPos = styler.LineStart(lineCurrent); 98 | lengthDoc += startPos - newStartPos; 99 | startPos = newStartPos; 100 | initStyle = 0; 101 | if (startPos > 0) { 102 | initStyle = styler.StyleAt(startPos - 1); 103 | } 104 | } 105 | fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Readme.txt: -------------------------------------------------------------------------------- 1 | 2 | ======================================================================= 3 | = = 4 | = = 5 | = Notepad2 - light-weight Scintilla-based text editor for Windows = 6 | = = 7 | = = 8 | = Notepad2 4.2.25 = 9 | = (c) Florian Balmer 2004-2011 = 10 | = http://www.flos-freeware.ch = 11 | = = 12 | = = 13 | ======================================================================= 14 | 15 | 16 | The Notepad2 Source Code 17 | 18 | This package contains the full source code of Notepad2 4.2.25 for 19 | Windows. Project files for Visual C++ 7.0 are included. Chances are 20 | that Notepad2 can be rebuilt with other development tools, including 21 | the free Visual C++ Express Edition, but I haven't tested this. 22 | 23 | 24 | Rebuilding from the Source Code 25 | 26 | Notepad2 4.2.25 is based on Scintilla 2.24 [1]. 27 | 28 | [1] http://www.scintilla.org 29 | 30 | To be able to rebuild Notepad2, the source code of the Scintilla 31 | editing component has to be unzipped to the "scintilla" subdirectory 32 | of the Notepad2 source code directory. 33 | 34 | Many of the Scintilla lexing modules are not used by Notepad2. Run 35 | LinkLex.js to adapt the list (in "scintilla/src/Catalogue.cxx") and 36 | make linking work properly. 37 | 38 | 39 | Creating a Compact Executable Program File 40 | 41 | Linking to the system CRT slightly improves disk footprint, memory 42 | usage and startup because the pages for the system CRT are already 43 | loaded and shared in memory. To achieve this, the release version of 44 | Notepad2.exe is built using the Windows Driver Kit (WDK) 7.1.0 tools, 45 | available as a free download from Microsoft. The appropriate build 46 | scripts can be found in the "wdkbuild" subdirectory. Set %WDKBASEDIR% 47 | to the directory of the WDK tools on your system. 48 | 49 | 50 | How to add or modify Syntax Schemes 51 | 52 | The Scintilla documentation has an overview of syntax highlighting, 53 | and how to write your own lexing module, in case the language you 54 | would like to add is not currently supported by Scintilla. 55 | 56 | Add your own lexer data structs to the global pLexArray (Styles.c), 57 | then adjust NUMLEXERS (Styles.h) to the new total number of syntax 58 | schemes. Include the "scintilla/lexers/Lex*.cxx" file required for 59 | your language into your project. Ensure the new module is initialized 60 | (in "scintilla/src/Catalogue.cxx"), either by manually uncommenting 61 | the corresponding LINK_LEXER() macro call, or by updating and 62 | re-running LinkLex.js. 63 | 64 | 65 | Copyright 66 | 67 | See License.txt for details about distribution and modification. 68 | 69 | If you have any comments or questions, please drop me a note: 70 | florian.balmer@gmail.com 71 | 72 | (c) Florian Balmer 2004-2011 73 | http://www.flos-freeware.ch 74 | 75 | ### 76 | -------------------------------------------------------------------------------- /scintilla/scripts/HeaderCheck.py: -------------------------------------------------------------------------------- 1 | # Script to check that headers are in a consistent order 2 | # Requires Python 2.6 or later 3 | 4 | from __future__ import print_function 5 | import codecs, glob, os, platform, sys, unicodedata 6 | 7 | def ciCompare(a,b): 8 | return cmp(a.lower(), b.lower()) 9 | 10 | def ciKey(a): 11 | return a.lower() 12 | 13 | def SortListInsensitive(l): 14 | try: # Try key function 15 | l.sort(key=ciKey) 16 | except TypeError: # Earlier version of Python, so use comparison function 17 | l.sort(ciCompare) 18 | 19 | def IsHeader(x): 20 | return x.strip().startswith("#") and ("include" in x or "import" in x) 21 | 22 | def ExtractHeaders(filename): 23 | with codecs.open(filename, "r", "UTF-8") as infile: 24 | includeLines = [x.strip()[1:].strip()[7:].strip() for x in infile.readlines() if \ 25 | IsHeader(x)] 26 | if '.' not in filename: 27 | print(filename) 28 | for n in includeLines: 29 | print(n) 30 | print() 31 | return includeLines 32 | 33 | def CheckFiles(root): 34 | # Find all the lexer source code files 35 | filePaths = glob.glob(root + "/include/*.h") 36 | filePaths += glob.glob(root + "/src/*.cxx") 37 | SortListInsensitive(filePaths) 38 | filePaths += glob.glob(root + "/lexlib/*.cxx") 39 | filePaths += glob.glob(root + "/lexers/*.cxx") 40 | filePaths += glob.glob(root + "/win32/*.cxx") 41 | filePaths += glob.glob(root + "/gtk/*.cxx") 42 | filePaths += glob.glob(root + "/cocoa/*.mm") 43 | filePaths += glob.glob(root + "/cocoa/*.h") 44 | filePaths += glob.glob(root + "/test/unit/*.cxx") 45 | # The Qt platform code interleaves system and Scintilla headers 46 | #~ filePaths += glob.glob(root + "/qt/ScintillaEditBase/*.cpp") 47 | #~ filePaths += glob.glob(root + "/qt/ScintillaEdit/*.cpp") 48 | #~ print(filePaths) 49 | masterHeaderList = ExtractHeaders(root + "/scripts/HeaderOrder.txt") 50 | for f in filePaths: 51 | if "LexCaml" in f: 52 | continue 53 | print(" File ", f) 54 | try: 55 | incs = ExtractHeaders(f) 56 | except UnicodeDecodeError: 57 | #~ print("UnicodeDecodeError\n") 58 | continue 59 | #~ print("\n".join(incs)) 60 | news = set(incs) - set(masterHeaderList) 61 | #~ print("") 62 | #~ print("\n".join(incs)) 63 | #~ print("") 64 | ended = False 65 | m = 0 66 | i = 0 67 | while i < len(incs): 68 | if m == len(masterHeaderList): 69 | print("**** extend", incs[i:]) 70 | masterHeaderList.extend(incs[i:]) 71 | break 72 | if masterHeaderList[m] == incs[i]: 73 | #~ print("equal", masterHeaderList[m]) 74 | i += 1 75 | m += 1 76 | else: 77 | if masterHeaderList[m] not in incs: 78 | #~ print("skip", masterHeaderList[m]) 79 | m += 1 80 | elif incs[i] not in masterHeaderList: 81 | print(f + ":1: Add master", incs[i]) 82 | masterHeaderList.insert(m, incs[i]) 83 | i += 1 84 | m += 1 85 | else: 86 | print(f + ":1: Header out of order", incs[i], masterHeaderList[m]) 87 | print("incs", " ".join(incs)) 88 | i += 1 89 | #~ return 90 | #print("Master header list", " ".join(masterHeaderList)) 91 | 92 | 93 | CheckFiles("..") 94 | -------------------------------------------------------------------------------- /version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # (C) 2012-2013 see Authors.txt 3 | # 4 | # This file is part of MPC-HC. 5 | # 6 | # MPC-HC is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # MPC-HC is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | # This is the last svn changeset, the number and hash can be automatically 20 | # calculated, but it is slow to do that. So it is better to have it hardcoded. 21 | svnrev=760 22 | svnhash="0cd53aab71b006820233224bbf14c2b18b2caca6" 23 | 24 | versionfile="./src/VersionRev.h" 25 | manifestfile="./res/Notepad2.exe.manifest" 26 | 27 | # If we are not inside a git repo use hardcoded values 28 | if ! git rev-parse --git-dir > /dev/null 2>&1; then 29 | hash=0000000 30 | ver=0 31 | else 32 | # Get the current branch name 33 | branch=$(git symbolic-ref -q HEAD) && branch=${branch##refs/heads/} || branch="no branch" 34 | 35 | # If we are on another branch that isn't master, we want extra info like on 36 | # which commit from master it is based on and what its hash is. This assumes we 37 | # won't ever branch from a changeset from before the move to git 38 | if [[ "$branch" != "master" ]]; then 39 | version_info="#define BRANCH _T(\"$branch\")"$'\n' 40 | if git show-ref --verify --quiet refs/heads/master; then 41 | # Get where the branch is based on master 42 | base=$(git merge-base master HEAD) 43 | base_ver=$(git rev-list --count $svnhash..$base) 44 | base_ver=$((base_ver+svnrev)) 45 | ver_full=" ($branch) (master@${base_ver:0:7})" 46 | else 47 | ver_full=" ($branch)" 48 | fi 49 | fi 50 | 51 | # Count how many changesets we have since the last svn changeset 52 | ver=$(git rev-list --count $svnhash..HEAD) 53 | # Now add it with to last svn revision number 54 | ver=$((ver+svnrev)) 55 | 56 | # Get the abbreviated hash of the current changeset 57 | hash=$(git rev-parse --short HEAD) 58 | 59 | fi 60 | 61 | ver_full="_T(\"$ver ($hash)$ver_full\")" 62 | 63 | version_info+="#define VERSION_HASH _T(\"$hash\")"$'\n' 64 | version_info+="#define VERSION_REV $ver"$'\n' 65 | version_info+="#define VERSION_REV_FULL $ver_full" 66 | 67 | if [[ "$branch" ]]; then 68 | echo "On branch: $branch" 69 | fi 70 | echo "Hash: $hash" 71 | if [[ "$branch" ]] && ! git diff-index --quiet HEAD; then 72 | echo "Revision: $ver (Local modifications found)" 73 | else 74 | echo "Revision: $ver" 75 | fi 76 | if [[ -n "$base" ]]; then 77 | echo "Mergebase: master@${base_ver} (${base:0:7})" 78 | fi 79 | 80 | # Update VersionRev.h if it does not exist, or if version information was changed. 81 | if [[ ! -f "$versionfile" ]] || [[ "$version_info" != "$(<"$versionfile")" ]]; then 82 | # Write the version information to VersionRev.h 83 | echo "$version_info" > "$versionfile" 84 | fi 85 | 86 | # Update manifest file if it does not exist or if source manifest.conf was changed. 87 | newmanifest="$(sed -e "s/\\\$WCREV\\\$/${ver}/" "$manifestfile.conf")" 88 | if [[ ! -f "$manifestfile" ]] || [[ "$newmanifest" != "$(<"$manifestfile")" ]]; then 89 | # Update the revision number in the manifest file 90 | echo "$newmanifest" > "$manifestfile" 91 | fi 92 | -------------------------------------------------------------------------------- /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/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 | protected: 23 | /** Enumeration of commands and child windows. */ 24 | enum { 25 | idCallTip=1, 26 | idAutoComplete=2, 27 | 28 | idcmdUndo=10, 29 | idcmdRedo=11, 30 | idcmdCut=12, 31 | idcmdCopy=13, 32 | idcmdPaste=14, 33 | idcmdDelete=15, 34 | idcmdSelectAll=16 35 | }; 36 | 37 | enum { maxLenInputIME = 200 }; 38 | 39 | int displayPopupMenu; 40 | Menu popup; 41 | AutoComplete ac; 42 | 43 | CallTip ct; 44 | 45 | int listType; ///< 0 is an autocomplete list 46 | int maxListWidth; /// Maximum width of list, in average character widths 47 | int multiAutoCMode; /// Mode for autocompleting when multiple selections are present 48 | 49 | #ifdef SCI_LEXER 50 | LexState *DocumentLexState(); 51 | void SetLexer(uptr_t wParam); 52 | void SetLexerLanguage(const char *languageName); 53 | void Colourise(int start, int end); 54 | #endif 55 | 56 | ScintillaBase(); 57 | // Deleted so ScintillaBase objects can not be copied. 58 | explicit ScintillaBase(const ScintillaBase &) = delete; 59 | ScintillaBase &operator=(const ScintillaBase &) = delete; 60 | virtual ~ScintillaBase(); 61 | void Initialise() override {} 62 | void Finalise() override; 63 | 64 | void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false) override; 65 | void Command(int cmdId); 66 | void CancelModes() override; 67 | int KeyCommand(unsigned int iMessage) override; 68 | 69 | void AutoCompleteInsert(Sci::Position startPos, int removeLen, const char *text, int textLen); 70 | void AutoCompleteStart(int lenEntered, const char *list); 71 | void AutoCompleteCancel(); 72 | void AutoCompleteMove(int delta); 73 | int AutoCompleteGetCurrent() const; 74 | int AutoCompleteGetCurrentText(char *buffer) const; 75 | void AutoCompleteCharacterAdded(char ch); 76 | void AutoCompleteCharacterDeleted(); 77 | void AutoCompleteCompleted(char ch, unsigned int completionMethod); 78 | void AutoCompleteMoveToCurrentWord(); 79 | static void AutoCompleteDoubleClick(void *p); 80 | 81 | void CallTipClick(); 82 | void CallTipShow(Point pt, const char *defn); 83 | virtual void CreateCallTipWindow(PRectangle rc) = 0; 84 | 85 | virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0; 86 | bool ShouldDisplayPopup(Point ptInWindowCoordinates) const; 87 | void ContextMenu(Point pt); 88 | 89 | void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) override; 90 | void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) override; 91 | void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) override; 92 | 93 | void NotifyStyleToNeeded(Sci::Position endStyleNeeded) override; 94 | void NotifyLexerChanged(Document *doc, void *userData) override; 95 | 96 | public: 97 | // Public so scintilla_send_message can use it 98 | sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override; 99 | }; 100 | 101 | #ifdef SCI_NAMESPACE 102 | } 103 | #endif 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /src/Notepad2.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 6 | h;hpp;hxx;hm;inl;inc;xsd 7 | 8 | 9 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 10 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx 11 | 12 | 13 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 14 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | 70 | 71 | Resource Files 72 | 73 | 74 | Resource Files 75 | 76 | 77 | Resource Files 78 | 79 | 80 | Resource Files 81 | 82 | 83 | Resource Files 84 | 85 | 86 | Resource Files 87 | 88 | 89 | Resource Files 90 | 91 | 92 | Resource Files 93 | 94 | 95 | Resource Files 96 | 97 | 98 | Resource Files 99 | 100 | 101 | Resource Files 102 | 103 | 104 | 105 | 106 | Resource Files 107 | 108 | 109 | -------------------------------------------------------------------------------- /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 | currentComment = [] 86 | elif featureType == "evt": 87 | retType, name, value = decodeEvent(featureVal) 88 | self.features[name] = { 89 | "FeatureType": featureType, 90 | "ReturnType": retType, 91 | "Value": value, 92 | "Category": currentCategory, "Comment": currentComment 93 | } 94 | if value in self.events: 95 | raise Exception("Duplicate event " + value + " " + name) 96 | self.events[value] = 1 97 | self.order.append(name) 98 | elif featureType == "cat": 99 | currentCategory = featureVal 100 | elif featureType == "val": 101 | try: 102 | name, value = featureVal.split("=", 1) 103 | except ValueError: 104 | print("Failure %s" % featureVal) 105 | raise Exception() 106 | self.features[name] = { 107 | "FeatureType": featureType, 108 | "Category": currentCategory, 109 | "Value": value } 110 | self.order.append(name) 111 | elif featureType == "enu" or featureType == "lex": 112 | name, value = featureVal.split("=", 1) 113 | self.features[name] = { 114 | "FeatureType": featureType, 115 | "Category": currentCategory, 116 | "Value": value, 117 | "Comment": currentComment } 118 | self.order.append(name) 119 | currentComment = [] 120 | 121 | -------------------------------------------------------------------------------- /scintilla/src/ExternalLexer.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ExternalLexer.cxx 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 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "Platform.h" 18 | 19 | #include "ILexer.h" 20 | #include "Scintilla.h" 21 | #include "SciLexer.h" 22 | 23 | #include "LexerModule.h" 24 | #include "Catalogue.h" 25 | #include "ExternalLexer.h" 26 | 27 | #ifdef SCI_NAMESPACE 28 | using namespace Scintilla; 29 | #endif 30 | 31 | std::unique_ptr LexerManager::theInstance; 32 | 33 | //------------------------------------------ 34 | // 35 | // ExternalLexerModule 36 | // 37 | //------------------------------------------ 38 | 39 | void ExternalLexerModule::SetExternal(GetLexerFactoryFunction fFactory, int index) { 40 | fneFactory = fFactory; 41 | fnFactory = fFactory(index); 42 | } 43 | 44 | //------------------------------------------ 45 | // 46 | // LexerLibrary 47 | // 48 | //------------------------------------------ 49 | 50 | LexerLibrary::LexerLibrary(const char *moduleName_) { 51 | // Load the DLL 52 | lib.reset(DynamicLibrary::Load(moduleName_)); 53 | if (lib->IsValid()) { 54 | moduleName = moduleName_; 55 | //Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects 56 | GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount"); 57 | 58 | if (GetLexerCount) { 59 | // Find functions in the DLL 60 | GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName"); 61 | GetLexerFactoryFunction fnFactory = (GetLexerFactoryFunction)(sptr_t)lib->FindFunction("GetLexerFactory"); 62 | 63 | const int nl = GetLexerCount(); 64 | 65 | for (int i = 0; i < nl; i++) { 66 | // Assign a buffer for the lexer name. 67 | char lexname[100] = ""; 68 | GetLexerName(i, lexname, sizeof(lexname)); 69 | ExternalLexerModule *lex = new ExternalLexerModule(SCLEX_AUTOMATIC, NULL, lexname, NULL); 70 | Catalogue::AddLexerModule(lex); 71 | 72 | // Remember ExternalLexerModule so we don't leak it 73 | modules.push_back(std::unique_ptr(lex)); 74 | 75 | // The external lexer needs to know how to call into its DLL to 76 | // do its lexing and folding, we tell it here. 77 | lex->SetExternal(fnFactory, i); 78 | } 79 | } 80 | } 81 | } 82 | 83 | LexerLibrary::~LexerLibrary() { 84 | } 85 | 86 | //------------------------------------------ 87 | // 88 | // LexerManager 89 | // 90 | //------------------------------------------ 91 | 92 | /// Return the single LexerManager instance... 93 | LexerManager *LexerManager::GetInstance() { 94 | if (!theInstance) 95 | theInstance.reset(new LexerManager); 96 | return theInstance.get(); 97 | } 98 | 99 | /// Delete any LexerManager instance... 100 | void LexerManager::DeleteInstance() { 101 | theInstance.reset(); 102 | } 103 | 104 | /// protected constructor - this is a singleton... 105 | LexerManager::LexerManager() { 106 | } 107 | 108 | LexerManager::~LexerManager() { 109 | Clear(); 110 | } 111 | 112 | void LexerManager::Load(const char *path) { 113 | for (const std::unique_ptr &ll : libraries) { 114 | if (ll->moduleName == path) 115 | return; 116 | } 117 | LexerLibrary *lib = new LexerLibrary(path); 118 | libraries.push_back(std::unique_ptr(lib)); 119 | } 120 | 121 | void LexerManager::Clear() { 122 | libraries.clear(); 123 | } 124 | 125 | //------------------------------------------ 126 | // 127 | // LMMinder -- trigger to clean up at exit. 128 | // 129 | //------------------------------------------ 130 | 131 | LMMinder::~LMMinder() { 132 | LexerManager::DeleteInstance(); 133 | } 134 | 135 | LMMinder minder; 136 | -------------------------------------------------------------------------------- /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 | #include 17 | #include 18 | 19 | // C++ wrappers of C standard library 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | // C++ standard library 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | // GTK+ headers 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | // Windows headers 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | 67 | // Cocoa headers 68 | #include 69 | #import 70 | #import 71 | #import 72 | #import 73 | 74 | // Scintilla headers 75 | 76 | // Non-platform-specific headers 77 | 78 | // include 79 | #include "Platform.h" 80 | 81 | #include "Sci_Position.h" 82 | #include "ILexer.h" 83 | #include "Scintilla.h" 84 | #include "ScintillaWidget.h" 85 | 86 | #include "SciLexer.h" 87 | 88 | // lexlib 89 | #include "StringCopy.h" 90 | #include "PropSetSimple.h" 91 | #include "WordList.h" 92 | #include "LexAccessor.h" 93 | #include "Accessor.h" 94 | #include "StyleContext.h" 95 | #include "CharacterSet.h" 96 | #include "CharacterCategory.h" 97 | #include "LexerModule.h" 98 | #include "OptionSet.h" 99 | #include "SparseState.h" 100 | #include "SubStyles.h" 101 | #include "LexerBase.h" 102 | #include "LexerSimple.h" 103 | #include "LexerNoExceptions.h" 104 | 105 | // src 106 | #include "Catalogue.h" 107 | 108 | #include "Position.h" 109 | #include "UniqueString.h" 110 | #include "SplitVector.h" 111 | #include "Partitioning.h" 112 | #include "RunStyles.h" 113 | #include "SparseVector.h" 114 | #include "ContractionState.h" 115 | #include "CellBuffer.h" 116 | #include "PerLine.h" 117 | #include "CallTip.h" 118 | #include "KeyMap.h" 119 | #include "Indicator.h" 120 | #include "XPM.h" 121 | #include "LineMarker.h" 122 | #include "Style.h" 123 | #include "ViewStyle.h" 124 | #include "CharClassify.h" 125 | #include "Decoration.h" 126 | #include "CaseFolder.h" 127 | #include "Document.h" 128 | #include "RESearch.h" 129 | #include "CaseConvert.h" 130 | #include "UniConversion.h" 131 | #include "UnicodeFromUTF8.h" 132 | #include "Selection.h" 133 | #include "PositionCache.h" 134 | #include "FontQuality.h" 135 | #include "EditModel.h" 136 | #include "MarginView.h" 137 | #include "EditView.h" 138 | #include "Editor.h" 139 | 140 | #include "AutoComplete.h" 141 | #include "ScintillaBase.h" 142 | 143 | #include "ExternalLexer.h" 144 | 145 | // Platform-specific headers 146 | 147 | // win32 148 | #include "PlatWin.h" 149 | #include "HanjaDic.h" 150 | 151 | // gtk 152 | #include "ScintillaGTK.h" 153 | #include "scintilla-marshal.h" 154 | #include "ScintillaGTKAccessible.h" 155 | #include "Converter.h" 156 | 157 | // cocoa 158 | #include "QuartzTextStyle.h" 159 | #include "QuartzTextStyleAttribute.h" 160 | #include "QuartzTextLayout.h" 161 | #import "InfoBarCommunicator.h" 162 | #include "InfoBar.h" 163 | #import "ScintillaView.h" 164 | #import "ScintillaCocoa.h" 165 | #import "PlatCocoa.h" 166 | 167 | // Catch testing framework 168 | #include "catch.hpp" 169 | 170 | -------------------------------------------------------------------------------- /scintilla/lexlib/OptionSet.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file OptionSet.h 3 | ** Manage descriptive information about an options struct for a lexer. 4 | ** Hold the names, positions, and descriptions of boolean, integer and string options and 5 | ** allow setting options and retrieving metadata about the options. 6 | **/ 7 | // Copyright 2010 by Neil Hodgson 8 | // The License.txt file describes the conditions under which this software may be distributed. 9 | 10 | #ifndef OPTIONSET_H 11 | #define OPTIONSET_H 12 | 13 | #ifdef SCI_NAMESPACE 14 | namespace Scintilla { 15 | #endif 16 | 17 | template 18 | class OptionSet { 19 | typedef T Target; 20 | typedef bool T::*plcob; 21 | typedef int T::*plcoi; 22 | typedef std::string T::*plcos; 23 | struct Option { 24 | int opType; 25 | union { 26 | plcob pb; 27 | plcoi pi; 28 | plcos ps; 29 | }; 30 | std::string description; 31 | Option() : 32 | opType(SC_TYPE_BOOLEAN), pb(0), description("") { 33 | } 34 | Option(plcob pb_, std::string description_="") : 35 | opType(SC_TYPE_BOOLEAN), pb(pb_), description(description_) { 36 | } 37 | Option(plcoi pi_, std::string description_) : 38 | opType(SC_TYPE_INTEGER), pi(pi_), description(description_) { 39 | } 40 | Option(plcos ps_, std::string description_) : 41 | opType(SC_TYPE_STRING), ps(ps_), description(description_) { 42 | } 43 | bool Set(T *base, const char *val) const { 44 | switch (opType) { 45 | case SC_TYPE_BOOLEAN: { 46 | bool option = atoi(val) != 0; 47 | if ((*base).*pb != option) { 48 | (*base).*pb = option; 49 | return true; 50 | } 51 | break; 52 | } 53 | case SC_TYPE_INTEGER: { 54 | int option = atoi(val); 55 | if ((*base).*pi != option) { 56 | (*base).*pi = option; 57 | return true; 58 | } 59 | break; 60 | } 61 | case SC_TYPE_STRING: { 62 | if ((*base).*ps != val) { 63 | (*base).*ps = val; 64 | return true; 65 | } 66 | break; 67 | } 68 | } 69 | return false; 70 | } 71 | }; 72 | typedef std::map OptionMap; 73 | OptionMap nameToDef; 74 | std::string names; 75 | std::string wordLists; 76 | 77 | void AppendName(const char *name) { 78 | if (!names.empty()) 79 | names += "\n"; 80 | names += name; 81 | } 82 | public: 83 | virtual ~OptionSet() { 84 | } 85 | void DefineProperty(const char *name, plcob pb, std::string description="") { 86 | nameToDef[name] = Option(pb, description); 87 | AppendName(name); 88 | } 89 | void DefineProperty(const char *name, plcoi pi, std::string description="") { 90 | nameToDef[name] = Option(pi, description); 91 | AppendName(name); 92 | } 93 | void DefineProperty(const char *name, plcos ps, std::string description="") { 94 | nameToDef[name] = Option(ps, description); 95 | AppendName(name); 96 | } 97 | const char *PropertyNames() const { 98 | return names.c_str(); 99 | } 100 | int PropertyType(const char *name) { 101 | typename OptionMap::iterator it = nameToDef.find(name); 102 | if (it != nameToDef.end()) { 103 | return it->second.opType; 104 | } 105 | return SC_TYPE_BOOLEAN; 106 | } 107 | const char *DescribeProperty(const char *name) { 108 | typename OptionMap::iterator it = nameToDef.find(name); 109 | if (it != nameToDef.end()) { 110 | return it->second.description.c_str(); 111 | } 112 | return ""; 113 | } 114 | 115 | bool PropertySet(T *base, const char *name, const char *val) { 116 | typename OptionMap::iterator it = nameToDef.find(name); 117 | if (it != nameToDef.end()) { 118 | return it->second.Set(base, val); 119 | } 120 | return false; 121 | } 122 | 123 | void DefineWordListSets(const char * const wordListDescriptions[]) { 124 | if (wordListDescriptions) { 125 | for (size_t wl = 0; wordListDescriptions[wl]; wl++) { 126 | if (!wordLists.empty()) 127 | wordLists += "\n"; 128 | wordLists += wordListDescriptions[wl]; 129 | } 130 | } 131 | } 132 | 133 | const char *DescribeWordListSets() const { 134 | return wordLists.c_str(); 135 | } 136 | }; 137 | 138 | #ifdef SCI_NAMESPACE 139 | } 140 | #endif 141 | 142 | #endif 143 | -------------------------------------------------------------------------------- /scintilla/lexers/LexKix.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexKix.cxx 3 | ** Lexer for KIX-Scripts. 4 | **/ 5 | // Copyright 2004 by Manfred Becker 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | // Edited by Lee Wilmott (24-Jun-2014) added support for block comments 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "ILexer.h" 17 | #include "Scintilla.h" 18 | #include "SciLexer.h" 19 | 20 | #include "WordList.h" 21 | #include "LexAccessor.h" 22 | #include "Accessor.h" 23 | #include "StyleContext.h" 24 | #include "CharacterSet.h" 25 | #include "LexerModule.h" 26 | 27 | #ifdef SCI_NAMESPACE 28 | using namespace Scintilla; 29 | #endif 30 | 31 | // Extended to accept accented characters 32 | static inline bool IsAWordChar(int ch) { 33 | return ch >= 0x80 || isalnum(ch) || ch == '_'; 34 | } 35 | 36 | static inline bool IsOperator(const int ch) { 37 | return (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '&' || ch == '|' || ch == '<' || ch == '>' || ch == '='); 38 | } 39 | 40 | static void ColouriseKixDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, 41 | WordList *keywordlists[], Accessor &styler) { 42 | 43 | WordList &keywords = *keywordlists[0]; 44 | WordList &keywords2 = *keywordlists[1]; 45 | WordList &keywords3 = *keywordlists[2]; 46 | // WordList &keywords4 = *keywordlists[3]; 47 | 48 | styler.StartAt(startPos); 49 | 50 | StyleContext sc(startPos, length, initStyle, styler); 51 | 52 | for (; sc.More(); sc.Forward()) { 53 | 54 | if (sc.state == SCE_KIX_COMMENT) { 55 | if (sc.atLineEnd) { 56 | sc.SetState(SCE_KIX_DEFAULT); 57 | } 58 | } else if (sc.state == SCE_KIX_COMMENTSTREAM) { 59 | if (sc.ch == '/' && sc.chPrev == '*') { 60 | sc.ForwardSetState(SCE_KIX_DEFAULT); 61 | } 62 | } else if (sc.state == SCE_KIX_STRING1) { 63 | // This is a doubles quotes string 64 | if (sc.ch == '\"') { 65 | sc.ForwardSetState(SCE_KIX_DEFAULT); 66 | } 67 | } else if (sc.state == SCE_KIX_STRING2) { 68 | // This is a single quote string 69 | if (sc.ch == '\'') { 70 | sc.ForwardSetState(SCE_KIX_DEFAULT); 71 | } 72 | } else if (sc.state == SCE_KIX_NUMBER) { 73 | if (!IsADigit(sc.ch)) { 74 | sc.SetState(SCE_KIX_DEFAULT); 75 | } 76 | } else if (sc.state == SCE_KIX_VAR) { 77 | if (!IsAWordChar(sc.ch)) { 78 | sc.SetState(SCE_KIX_DEFAULT); 79 | } 80 | } else if (sc.state == SCE_KIX_MACRO) { 81 | if (!IsAWordChar(sc.ch) && !IsADigit(sc.ch)) { 82 | char s[100]; 83 | sc.GetCurrentLowered(s, sizeof(s)); 84 | 85 | if (!keywords3.InList(&s[1])) { 86 | sc.ChangeState(SCE_KIX_DEFAULT); 87 | } 88 | sc.SetState(SCE_KIX_DEFAULT); 89 | } 90 | } else if (sc.state == SCE_KIX_OPERATOR) { 91 | if (!IsOperator(sc.ch)) { 92 | sc.SetState(SCE_KIX_DEFAULT); 93 | } 94 | } else if (sc.state == SCE_KIX_IDENTIFIER) { 95 | if (!IsAWordChar(sc.ch)) { 96 | char s[100]; 97 | sc.GetCurrentLowered(s, sizeof(s)); 98 | 99 | if (keywords.InList(s)) { 100 | sc.ChangeState(SCE_KIX_KEYWORD); 101 | } else if (keywords2.InList(s)) { 102 | sc.ChangeState(SCE_KIX_FUNCTIONS); 103 | } 104 | sc.SetState(SCE_KIX_DEFAULT); 105 | } 106 | } 107 | 108 | // Determine if a new state should be entered. 109 | if (sc.state == SCE_KIX_DEFAULT) { 110 | if (sc.ch == ';') { 111 | sc.SetState(SCE_KIX_COMMENT); 112 | } else if (sc.ch == '/' && sc.chNext == '*') { 113 | sc.SetState(SCE_KIX_COMMENTSTREAM); 114 | } else if (sc.ch == '\"') { 115 | sc.SetState(SCE_KIX_STRING1); 116 | } else if (sc.ch == '\'') { 117 | sc.SetState(SCE_KIX_STRING2); 118 | } else if (sc.ch == '$') { 119 | sc.SetState(SCE_KIX_VAR); 120 | } else if (sc.ch == '@') { 121 | sc.SetState(SCE_KIX_MACRO); 122 | } else if (IsADigit(sc.ch) || ((sc.ch == '.' || sc.ch == '&') && IsADigit(sc.chNext))) { 123 | sc.SetState(SCE_KIX_NUMBER); 124 | } else if (IsOperator(sc.ch)) { 125 | sc.SetState(SCE_KIX_OPERATOR); 126 | } else if (IsAWordChar(sc.ch)) { 127 | sc.SetState(SCE_KIX_IDENTIFIER); 128 | } 129 | } 130 | } 131 | sc.Complete(); 132 | } 133 | 134 | 135 | LexerModule lmKix(SCLEX_KIX, ColouriseKixDoc, "kix"); 136 | 137 | -------------------------------------------------------------------------------- /scintilla/win32/HanjaDic.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file HanjaDic.cxx 3 | ** Korean Hanja Dictionary 4 | ** Convert between Korean Hanja and Hangul by COM interface. 5 | **/ 6 | // Copyright 2015 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include "UniConversion.h" 14 | #include "HanjaDic.h" 15 | 16 | #ifdef SCI_NAMESPACE 17 | namespace Scintilla { 18 | #endif 19 | 20 | namespace HanjaDict { 21 | 22 | interface IRadical; 23 | interface IHanja; 24 | interface IStrokes; 25 | 26 | typedef enum { HANJA_UNKNOWN = 0, HANJA_K0 = 1, HANJA_K1 = 2, HANJA_OTHER = 3 } HANJA_TYPE; 27 | 28 | interface IHanjaDic : IUnknown { 29 | STDMETHOD(OpenMainDic)(); 30 | STDMETHOD(CloseMainDic)(); 31 | STDMETHOD(GetHanjaWords)(BSTR bstrHangul, SAFEARRAY* ppsaHanja, VARIANT_BOOL* pfFound); 32 | STDMETHOD(GetHanjaChars)(unsigned short wchHangul, BSTR* pbstrHanjaChars, VARIANT_BOOL* pfFound); 33 | STDMETHOD(HanjaToHangul)(BSTR bstrHanja, BSTR* pbstrHangul); 34 | STDMETHOD(GetHanjaType)(unsigned short wchHanja, HANJA_TYPE* pHanjaType); 35 | STDMETHOD(GetHanjaSense)(unsigned short wchHanja, BSTR* pbstrSense); 36 | STDMETHOD(GetRadicalID)(short SeqNumOfRadical, short* pRadicalID, unsigned short* pwchRadical); 37 | STDMETHOD(GetRadical)(short nRadicalID, IRadical** ppIRadical); 38 | STDMETHOD(RadicalIDToHanja)(short nRadicalID, unsigned short* pwchRadical); 39 | STDMETHOD(GetHanja)(unsigned short wchHanja, IHanja** ppIHanja); 40 | STDMETHOD(GetStrokes)(short nStrokes, IStrokes** ppIStrokes); 41 | STDMETHOD(OpenDefaultCustomDic)(); 42 | STDMETHOD(OpenCustomDic)(BSTR bstrPath, long* plUdr); 43 | STDMETHOD(CloseDefaultCustomDic)(); 44 | STDMETHOD(CloseCustomDic)(long lUdr); 45 | STDMETHOD(CloseAllCustomDics)(); 46 | STDMETHOD(GetDefaultCustomHanjaWords)(BSTR bstrHangul, SAFEARRAY** ppsaHanja, VARIANT_BOOL* pfFound); 47 | STDMETHOD(GetCustomHanjaWords)(long lUdr, BSTR bstrHangul, SAFEARRAY** ppsaHanja, VARIANT_BOOL* pfFound); 48 | STDMETHOD(PutDefaultCustomHanjaWord)(BSTR bstrHangul, BSTR bstrHanja); 49 | STDMETHOD(PutCustomHanjaWord)(long lUdr, BSTR bstrHangul, BSTR bstrHanja); 50 | STDMETHOD(MaxNumOfRadicals)(short* pVal); 51 | STDMETHOD(MaxNumOfStrokes)(short* pVal); 52 | STDMETHOD(DefaultCustomDic)(long* pVal); 53 | STDMETHOD(DefaultCustomDic)(long pVal); 54 | STDMETHOD(MaxHanjaType)(HANJA_TYPE* pHanjaType); 55 | STDMETHOD(MaxHanjaType)(HANJA_TYPE pHanjaType); 56 | }; 57 | 58 | extern "C" const GUID __declspec(selectany) IID_IHanjaDic = 59 | { 0xad75f3ac, 0x18cd, 0x48c6, { 0xa2, 0x7d, 0xf1, 0xe9, 0xa7, 0xdc, 0xe4, 0x32 } }; 60 | 61 | class HanjaDic { 62 | private: 63 | HRESULT hr; 64 | CLSID CLSID_HanjaDic; 65 | 66 | public: 67 | IHanjaDic *HJinterface; 68 | 69 | HanjaDic() : HJinterface(NULL) { 70 | hr = CLSIDFromProgID(OLESTR("mshjdic.hanjadic"), &CLSID_HanjaDic); 71 | if (SUCCEEDED(hr)) { 72 | hr = CoCreateInstance(CLSID_HanjaDic, NULL, 73 | CLSCTX_INPROC_SERVER, IID_IHanjaDic, 74 | (LPVOID *)& HJinterface); 75 | if (SUCCEEDED(hr)) { 76 | hr = HJinterface->OpenMainDic(); 77 | } 78 | } 79 | } 80 | 81 | ~HanjaDic() { 82 | if (SUCCEEDED(hr)) { 83 | hr = HJinterface->CloseMainDic(); 84 | HJinterface->Release(); 85 | } 86 | } 87 | 88 | bool HJdictAvailable() { 89 | return SUCCEEDED(hr); 90 | } 91 | 92 | bool IsHanja(int hanja) { 93 | HANJA_TYPE hanjaType; 94 | hr = HJinterface->GetHanjaType(static_cast(hanja), &hanjaType); 95 | if (SUCCEEDED(hr)) { 96 | return (hanjaType > 0); 97 | } 98 | return false; 99 | } 100 | }; 101 | 102 | int GetHangulOfHanja(wchar_t *inout) { 103 | // Convert every hanja to hangul. 104 | // Return the number of characters converted. 105 | int changed = 0; 106 | HanjaDic dict; 107 | if (dict.HJdictAvailable()) { 108 | const size_t len = wcslen(inout); 109 | wchar_t conv[UTF8MaxBytes] = {0}; 110 | BSTR bstrHangul = SysAllocString(conv); 111 | for (size_t i=0; i(inout[i]))) { // Pass hanja only! 113 | conv[0] = inout[i]; 114 | BSTR bstrHanja = SysAllocString(conv); 115 | const HRESULT hr = dict.HJinterface->HanjaToHangul(bstrHanja, &bstrHangul); 116 | if (SUCCEEDED(hr)) { 117 | inout[i] = static_cast(bstrHangul[0]); 118 | changed += 1; 119 | } 120 | SysFreeString(bstrHanja); 121 | } 122 | } 123 | SysFreeString(bstrHangul); 124 | } 125 | return changed; 126 | } 127 | 128 | } 129 | #ifdef SCI_NAMESPACE 130 | } 131 | #endif 132 | -------------------------------------------------------------------------------- /scintilla/doc/ScintillaToDo.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Scintilla and SciTE To Do 12 | 13 | 14 | 15 | 16 | 17 | 20 | 24 | 25 |
18 | Scintilla icon 19 | 21 | Scintilla 22 | and SciTE 23 |
26 |

27 | Bugs and To Do List 28 |

29 |

30 | Feedback 31 |

32 |

33 | Issues can be reported on the Bug Tracker 34 | and features requested on the Feature Request Tracker. 35 |

36 |

37 | Scintilla Bugs 38 |

39 |

40 | Automatic scrolling when text dragged near edge of window. 41 |

42 |

43 | Scintilla To Do 44 |

45 |

46 | Folding for languages that don't have it yet and good folding for languages 47 | that inherited poor folding from another languages folding code. 48 |

49 |

50 | Simple pattern based styling. 51 |

52 |

53 | Different height lines based upon tallest text on the line rather than on the tallest style 54 | possible. 55 |

56 |

57 | Composition of lexing for mixed languages (such as ASP+ over COBOL) by 58 | combining lexers. 59 |

60 |

61 | Stream folding which could be used to fold up the contents of HTML elements. 62 |

63 |

64 | Printing of highlight lines and folding margin. 65 |

66 |

67 | Flow diagrams inside editor similar to 68 | GRASP. 69 |

70 |

71 | More lexers for other languages. 72 |

73 |

74 | SciTE To Do 75 |

76 |

77 | Good regular expression support through a plugin. 78 |

79 |

80 | Allow file name based selection on all properties rather than just a chosen few. 81 |

82 |

83 | Opening from and saving to FTP servers. 84 |

85 |

86 | Setting to fold away comments upon opening. 87 |

88 |

89 | User defined fold ranges. 90 |

91 |

92 | Silent mode that does not display any message boxes. 93 |

94 |

95 | Features I am unlikely to do 96 |

97 |

98 | These are features I don't like or don't think are important enough to work on. 99 | Implementations are welcome from others though. 100 |

101 |

102 | Mouse wheel panning (press the mouse wheel and then move the mouse) on 103 | Windows. 104 |

105 |

106 | Adding options to the save dialog to save in a particular encoding or with a 107 | chosen line ending. 108 |

109 |

110 | Directions 111 |

112 |

113 | The main point of this development is Scintilla, and this is where most effort will 114 | go. SciTE will get new features, but only when they make my life easier - I am 115 | not intending to make it grow up to be a huge full-function IDE like Visual 116 | Cafe. The lines I've currently decided not to step over in SciTE are any sort of 117 | project facility and any configuration dialogs. SciTE for Windows now has a 118 | Director interface for communicating with a separate project manager 119 | application. 120 |

121 |

122 | If you are interested in contributing code, do not feel any need to make it cross 123 | platform. 124 | Just code it for your platform and I'll either reimplement for the other platform or 125 | ensure that there is no effect on the other platform. 126 |

127 | 128 | 129 | -------------------------------------------------------------------------------- /scintilla/include/ILexer.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ILexer.h 3 | ** Interface 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 ILEXER_H 9 | #define ILEXER_H 10 | 11 | #include "Sci_Position.h" 12 | 13 | #ifdef SCI_NAMESPACE 14 | namespace Scintilla { 15 | #endif 16 | 17 | #ifdef _WIN32 18 | #define SCI_METHOD __stdcall 19 | #else 20 | #define SCI_METHOD 21 | #endif 22 | 23 | enum { dvOriginal=0, dvLineEnd=1 }; 24 | 25 | class IDocument { 26 | public: 27 | virtual int SCI_METHOD Version() const = 0; 28 | virtual void SCI_METHOD SetErrorStatus(int status) = 0; 29 | virtual Sci_Position SCI_METHOD Length() const = 0; 30 | virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0; 31 | virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0; 32 | virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0; 33 | virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0; 34 | virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0; 35 | virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0; 36 | virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0; 37 | virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0; 38 | virtual void SCI_METHOD StartStyling(Sci_Position position, char mask) = 0; 39 | virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0; 40 | virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0; 41 | virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0; 42 | virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0; 43 | virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) = 0; 44 | virtual int SCI_METHOD CodePage() const = 0; 45 | virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0; 46 | virtual const char * SCI_METHOD BufferPointer() = 0; 47 | virtual int SCI_METHOD GetLineIndentation(Sci_Position line) = 0; 48 | }; 49 | 50 | class IDocumentWithLineEnd : public IDocument { 51 | public: 52 | virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0; 53 | virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0; 54 | virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0; 55 | }; 56 | 57 | enum { lvOriginal=0, lvSubStyles=1 }; 58 | 59 | class ILexer { 60 | public: 61 | virtual int SCI_METHOD Version() const = 0; 62 | virtual void SCI_METHOD Release() = 0; 63 | virtual const char * SCI_METHOD PropertyNames() = 0; 64 | virtual int SCI_METHOD PropertyType(const char *name) = 0; 65 | virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0; 66 | virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0; 67 | virtual const char * SCI_METHOD DescribeWordListSets() = 0; 68 | virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0; 69 | virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; 70 | virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; 71 | virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0; 72 | }; 73 | 74 | class ILexerWithSubStyles : public ILexer { 75 | public: 76 | virtual int SCI_METHOD LineEndTypesSupported() = 0; 77 | virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0; 78 | virtual int SCI_METHOD SubStylesStart(int styleBase) = 0; 79 | virtual int SCI_METHOD SubStylesLength(int styleBase) = 0; 80 | virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0; 81 | virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0; 82 | virtual void SCI_METHOD FreeSubStyles() = 0; 83 | virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0; 84 | virtual int SCI_METHOD DistanceToSecondaryStyles() = 0; 85 | virtual const char * SCI_METHOD GetSubStyleBases() = 0; 86 | }; 87 | 88 | class ILoader { 89 | public: 90 | virtual int SCI_METHOD Release() = 0; 91 | // Returns a status code from SC_STATUS_* 92 | virtual int SCI_METHOD AddData(char *data, Sci_Position length) = 0; 93 | virtual void * SCI_METHOD ConvertToDocument() = 0; 94 | }; 95 | 96 | #ifdef SCI_NAMESPACE 97 | } 98 | #endif 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /scintilla/lexlib/SubStyles.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file SubStyles.h 3 | ** Manage substyles for a lexer. 4 | **/ 5 | // Copyright 2012 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef SUBSTYLES_H 9 | #define SUBSTYLES_H 10 | 11 | #ifdef SCI_NAMESPACE 12 | namespace Scintilla { 13 | #endif 14 | 15 | class WordClassifier { 16 | int baseStyle; 17 | int firstStyle; 18 | int lenStyles; 19 | std::map wordToStyle; 20 | 21 | public: 22 | 23 | explicit WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) { 24 | } 25 | 26 | void Allocate(int firstStyle_, int lenStyles_) { 27 | firstStyle = firstStyle_; 28 | lenStyles = lenStyles_; 29 | wordToStyle.clear(); 30 | } 31 | 32 | int Base() const { 33 | return baseStyle; 34 | } 35 | 36 | int Start() const { 37 | return firstStyle; 38 | } 39 | 40 | int Length() const { 41 | return lenStyles; 42 | } 43 | 44 | void Clear() { 45 | firstStyle = 0; 46 | lenStyles = 0; 47 | wordToStyle.clear(); 48 | } 49 | 50 | int ValueFor(const std::string &s) const { 51 | std::map::const_iterator it = wordToStyle.find(s); 52 | if (it != wordToStyle.end()) 53 | return it->second; 54 | else 55 | return -1; 56 | } 57 | 58 | bool IncludesStyle(int style) const { 59 | return (style >= firstStyle) && (style < (firstStyle + lenStyles)); 60 | } 61 | 62 | void SetIdentifiers(int style, const char *identifiers) { 63 | while (*identifiers) { 64 | const char *cpSpace = identifiers; 65 | while (*cpSpace && !(*cpSpace == ' ' || *cpSpace == '\t' || *cpSpace == '\r' || *cpSpace == '\n')) 66 | cpSpace++; 67 | if (cpSpace > identifiers) { 68 | std::string word(identifiers, cpSpace - identifiers); 69 | wordToStyle[word] = style; 70 | } 71 | identifiers = cpSpace; 72 | if (*identifiers) 73 | identifiers++; 74 | } 75 | } 76 | }; 77 | 78 | class SubStyles { 79 | int classifications; 80 | const char *baseStyles; 81 | int styleFirst; 82 | int stylesAvailable; 83 | int secondaryDistance; 84 | int allocated; 85 | std::vector classifiers; 86 | 87 | int BlockFromBaseStyle(int baseStyle) const { 88 | for (int b=0; b < classifications; b++) { 89 | if (baseStyle == baseStyles[b]) 90 | return b; 91 | } 92 | return -1; 93 | } 94 | 95 | int BlockFromStyle(int style) const { 96 | int b = 0; 97 | for (std::vector::const_iterator it=classifiers.begin(); it != classifiers.end(); ++it) { 98 | if (it->IncludesStyle(style)) 99 | return b; 100 | b++; 101 | } 102 | return -1; 103 | } 104 | 105 | public: 106 | 107 | SubStyles(const char *baseStyles_, int styleFirst_, int stylesAvailable_, int secondaryDistance_) : 108 | classifications(0), 109 | baseStyles(baseStyles_), 110 | styleFirst(styleFirst_), 111 | stylesAvailable(stylesAvailable_), 112 | secondaryDistance(secondaryDistance_), 113 | allocated(0) { 114 | while (baseStyles[classifications]) { 115 | classifiers.push_back(WordClassifier(baseStyles[classifications])); 116 | classifications++; 117 | } 118 | } 119 | 120 | int Allocate(int styleBase, int numberStyles) { 121 | int block = BlockFromBaseStyle(styleBase); 122 | if (block >= 0) { 123 | if ((allocated + numberStyles) > stylesAvailable) 124 | return -1; 125 | int startBlock = styleFirst + allocated; 126 | allocated += numberStyles; 127 | classifiers[block].Allocate(startBlock, numberStyles); 128 | return startBlock; 129 | } else { 130 | return -1; 131 | } 132 | } 133 | 134 | int Start(int styleBase) { 135 | int block = BlockFromBaseStyle(styleBase); 136 | return (block >= 0) ? classifiers[block].Start() : -1; 137 | } 138 | 139 | int Length(int styleBase) { 140 | int block = BlockFromBaseStyle(styleBase); 141 | return (block >= 0) ? classifiers[block].Length() : 0; 142 | } 143 | 144 | int BaseStyle(int subStyle) const { 145 | int block = BlockFromStyle(subStyle); 146 | if (block >= 0) 147 | return classifiers[block].Base(); 148 | else 149 | return subStyle; 150 | } 151 | 152 | int DistanceToSecondaryStyles() const { 153 | return secondaryDistance; 154 | } 155 | 156 | void SetIdentifiers(int style, const char *identifiers) { 157 | int block = BlockFromStyle(style); 158 | if (block >= 0) 159 | classifiers[block].SetIdentifiers(style, identifiers); 160 | } 161 | 162 | void Free() { 163 | allocated = 0; 164 | for (std::vector::iterator it=classifiers.begin(); it != classifiers.end(); ++it) 165 | it->Clear(); 166 | } 167 | 168 | const WordClassifier &Classifier(int baseStyle) const { 169 | const int block = BlockFromBaseStyle(baseStyle); 170 | return classifiers[block >= 0 ? block : 0]; 171 | } 172 | }; 173 | 174 | #ifdef SCI_NAMESPACE 175 | } 176 | #endif 177 | 178 | #endif 179 | -------------------------------------------------------------------------------- /scintilla/lexers/LexMake.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexMake.cxx 3 | ** Lexer for make files. 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 | #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 "WordList.h" 20 | #include "LexAccessor.h" 21 | #include "Accessor.h" 22 | #include "StyleContext.h" 23 | #include "CharacterSet.h" 24 | #include "LexerModule.h" 25 | 26 | #ifdef SCI_NAMESPACE 27 | using namespace Scintilla; 28 | #endif 29 | 30 | static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { 31 | return (styler[i] == '\n') || 32 | ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); 33 | } 34 | 35 | static void ColouriseMakeLine( 36 | char *lineBuffer, 37 | Sci_PositionU lengthLine, 38 | Sci_PositionU startLine, 39 | Sci_PositionU endPos, 40 | Accessor &styler) { 41 | 42 | Sci_PositionU i = 0; 43 | Sci_Position lastNonSpace = -1; 44 | unsigned int state = SCE_MAKE_DEFAULT; 45 | bool bSpecial = false; 46 | 47 | // check for a tab character in column 0 indicating a command 48 | bool bCommand = false; 49 | if ((lengthLine > 0) && (lineBuffer[0] == '\t')) 50 | bCommand = true; 51 | 52 | // Skip initial spaces 53 | while ((i < lengthLine) && isspacechar(lineBuffer[i])) { 54 | i++; 55 | } 56 | if (i < lengthLine) { 57 | if (lineBuffer[i] == '#') { // Comment 58 | styler.ColourTo(endPos, SCE_MAKE_COMMENT); 59 | return; 60 | } 61 | if (lineBuffer[i] == '!') { // Special directive 62 | styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR); 63 | return; 64 | } 65 | } 66 | int varCount = 0; 67 | while (i < lengthLine) { 68 | if (((i + 1) < lengthLine) && (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(')) { 69 | styler.ColourTo(startLine + i - 1, state); 70 | state = SCE_MAKE_IDENTIFIER; 71 | varCount++; 72 | } else if (state == SCE_MAKE_IDENTIFIER && lineBuffer[i] == ')') { 73 | if (--varCount == 0) { 74 | styler.ColourTo(startLine + i, state); 75 | state = SCE_MAKE_DEFAULT; 76 | } 77 | } 78 | 79 | // skip identifier and target styling if this is a command line 80 | if (!bSpecial && !bCommand) { 81 | if (lineBuffer[i] == ':') { 82 | if (((i + 1) < lengthLine) && (lineBuffer[i + 1] == '=')) { 83 | // it's a ':=', so style as an identifier 84 | if (lastNonSpace >= 0) 85 | styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER); 86 | styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); 87 | styler.ColourTo(startLine + i + 1, SCE_MAKE_OPERATOR); 88 | } else { 89 | // We should check that no colouring was made since the beginning of the line, 90 | // to avoid colouring stuff like /OUT:file 91 | if (lastNonSpace >= 0) 92 | styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET); 93 | styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); 94 | styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR); 95 | } 96 | bSpecial = true; // Only react to the first ':' of the line 97 | state = SCE_MAKE_DEFAULT; 98 | } else if (lineBuffer[i] == '=') { 99 | if (lastNonSpace >= 0) 100 | styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER); 101 | styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); 102 | styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR); 103 | bSpecial = true; // Only react to the first '=' of the line 104 | state = SCE_MAKE_DEFAULT; 105 | } 106 | } 107 | if (!isspacechar(lineBuffer[i])) { 108 | lastNonSpace = i; 109 | } 110 | i++; 111 | } 112 | if (state == SCE_MAKE_IDENTIFIER) { 113 | styler.ColourTo(endPos, SCE_MAKE_IDEOL); // Error, variable reference not ended 114 | } else { 115 | styler.ColourTo(endPos, SCE_MAKE_DEFAULT); 116 | } 117 | } 118 | 119 | static void ColouriseMakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { 120 | char lineBuffer[1024]; 121 | styler.StartAt(startPos); 122 | styler.StartSegment(startPos); 123 | Sci_PositionU linePos = 0; 124 | Sci_PositionU startLine = startPos; 125 | for (Sci_PositionU i = startPos; i < startPos + length; i++) { 126 | lineBuffer[linePos++] = styler[i]; 127 | if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { 128 | // End of line (or of line buffer) met, colourise it 129 | lineBuffer[linePos] = '\0'; 130 | ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler); 131 | linePos = 0; 132 | startLine = i + 1; 133 | } 134 | } 135 | if (linePos > 0) { // Last line does not have ending characters 136 | ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length - 1, styler); 137 | } 138 | } 139 | 140 | static const char *const emptyWordListDesc[] = { 141 | 0 142 | }; 143 | 144 | LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc); 145 | -------------------------------------------------------------------------------- /scintilla/scripts/GenerateCaseConvert.py: -------------------------------------------------------------------------------- 1 | # Script to generate CaseConvert.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 | # Current best approach divides case conversions into two cases: 7 | # simple symmetric and complex. 8 | # Simple symmetric is where a lower and upper case pair convert to each 9 | # other and the folded form is the same as the lower case. 10 | # There are 1006 symmetric pairs. 11 | # These are further divided into ranges (stored as lower, upper, range length, 12 | # range pitch and singletons (stored as lower, upper). 13 | # Complex is for cases that don't fit the above: where there are multiple 14 | # characters in one of the forms or fold is different to lower or 15 | # lower(upper(x)) or upper(lower(x)) are not x. These are represented as UTF-8 16 | # strings with original, folded, upper, and lower separated by '|'. 17 | # There are 126 complex cases. 18 | 19 | import codecs, itertools, os, string, sys, unicodedata 20 | 21 | from FileGenerator import Regenerate 22 | 23 | def contiguousRanges(l, diff): 24 | # l is s list of lists 25 | # group into lists where first element of each element differs by diff 26 | out = [[l[0]]] 27 | for s in l[1:]: 28 | if s[0] != out[-1][-1][0] + diff: 29 | out.append([]) 30 | out[-1].append(s) 31 | return out 32 | 33 | def flatten(listOfLists): 34 | "Flatten one level of nesting" 35 | return itertools.chain.from_iterable(listOfLists) 36 | 37 | def conversionSets(): 38 | # For all Unicode characters, see whether they have case conversions 39 | # Return 2 sets: one of simple symmetric conversion cases and another 40 | # with complex cases. 41 | complexes = [] 42 | symmetrics = [] 43 | for ch in range(sys.maxunicode): 44 | if ch >= 0xd800 and ch <= 0xDBFF: 45 | continue 46 | if ch >= 0xdc00 and ch <= 0xDFFF: 47 | continue 48 | uch = chr(ch) 49 | 50 | fold = uch.casefold() 51 | upper = uch.upper() 52 | lower = uch.lower() 53 | symmetric = False 54 | if uch != upper and len(upper) == 1 and uch == lower and uch == fold: 55 | lowerUpper = upper.lower() 56 | foldUpper = upper.casefold() 57 | if lowerUpper == foldUpper and lowerUpper == uch: 58 | symmetric = True 59 | symmetrics.append((ch, ord(upper), ch - ord(upper))) 60 | if uch != lower and len(lower) == 1 and uch == upper and lower == fold: 61 | upperLower = lower.upper() 62 | if upperLower == uch: 63 | symmetric = True 64 | 65 | if fold == uch: 66 | fold = "" 67 | if upper == uch: 68 | upper = "" 69 | if lower == uch: 70 | lower = "" 71 | 72 | if (fold or upper or lower) and not symmetric: 73 | complexes.append((uch, fold, upper, lower)) 74 | 75 | return symmetrics, complexes 76 | 77 | def groupRanges(symmetrics): 78 | # Group the symmetrics into groups where possible, returning a list 79 | # of ranges and a list of symmetrics that didn't fit into a range 80 | 81 | def distance(s): 82 | return s[2] 83 | 84 | groups = [] 85 | uniquekeys = [] 86 | for k, g in itertools.groupby(symmetrics, distance): 87 | groups.append(list(g)) # Store group iterator as a list 88 | uniquekeys.append(k) 89 | 90 | contiguousGroups = flatten([contiguousRanges(g, 1) for g in groups]) 91 | longGroups = [(x[0][0], x[0][1], len(x), 1) for x in contiguousGroups if len(x) > 4] 92 | 93 | oneDiffs = [s for s in symmetrics if s[2] == 1] 94 | contiguousOnes = flatten([contiguousRanges(g, 2) for g in [oneDiffs]]) 95 | longOneGroups = [(x[0][0], x[0][1], len(x), 2) for x in contiguousOnes if len(x) > 4] 96 | 97 | rangeGroups = sorted(longGroups+longOneGroups, key=lambda s: s[0]) 98 | 99 | rangeCoverage = list(flatten([range(r[0], r[0]+r[2]*r[3], r[3]) for r in rangeGroups])) 100 | 101 | nonRanges = [(l, u) for l, u, d in symmetrics if l not in rangeCoverage] 102 | 103 | return rangeGroups, nonRanges 104 | 105 | def escape(s): 106 | return "".join((chr(c) if chr(c) in string.ascii_letters else "\\x%x" % c) for c in s.encode('utf-8')) 107 | 108 | def updateCaseConvert(): 109 | symmetrics, complexes = conversionSets() 110 | 111 | rangeGroups, nonRanges = groupRanges(symmetrics) 112 | 113 | print(len(rangeGroups), "ranges") 114 | rangeLines = ["%d,%d,%d,%d, " % x for x in rangeGroups] 115 | 116 | print(len(nonRanges), "non ranges") 117 | nonRangeLines = ["%d,%d, " % x for x in nonRanges] 118 | 119 | print(len(symmetrics), "symmetric") 120 | 121 | complexLines = ['"%s|%s|%s|%s|"' % tuple(escape(t) for t in x) for x in complexes] 122 | print(len(complexLines), "complex") 123 | 124 | Regenerate("../src/CaseConvert.cxx", "//", rangeLines, nonRangeLines, complexLines) 125 | 126 | updateCaseConvert() 127 | -------------------------------------------------------------------------------- /src/Notepad2.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * 4 | * Notepad2 5 | * 6 | * Notepad2.h 7 | * Global definitions and declarations 8 | * 9 | * See Readme.txt for more information about this source code. 10 | * Please send me your comments to this work. 11 | * 12 | * See License.txt for details about distribution and modification. 13 | * 14 | * (c) Florian Balmer 1996-2011 15 | * florian.balmer@gmail.com 16 | * http://www.flos-freeware.ch 17 | * 18 | * 19 | ******************************************************************************/ 20 | 21 | 22 | 23 | //==== Main Window ============================================================ 24 | #define WC_NOTEPAD2 L"Notepad2" 25 | 26 | 27 | //==== Data Type for WM_COPYDATA ============================================== 28 | #define DATA_NOTEPAD2_PARAMS 0xFB10 29 | typedef struct np2params { 30 | 31 | int flagFileSpecified; 32 | int flagChangeNotify; 33 | int flagLexerSpecified; 34 | int iInitialLexer; 35 | int flagQuietCreate; 36 | int flagJumpTo; 37 | int iInitialLine; 38 | int iInitialColumn; 39 | int iSrcEncoding; 40 | int flagSetEncoding; 41 | int flagSetEOLMode; 42 | int flagTitleExcerpt; 43 | WCHAR wchData; 44 | 45 | } NP2PARAMS, *LPNP2PARAMS; 46 | 47 | 48 | //==== Toolbar Style ========================================================== 49 | #define WS_TOOLBAR (WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | \ 50 | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT | TBSTYLE_ALTDRAG | \ 51 | TBSTYLE_LIST | CCS_NODIVIDER | CCS_NOPARENTALIGN | \ 52 | CCS_ADJUSTABLE) 53 | 54 | 55 | //==== ReBar Style ============================================================ 56 | #define WS_REBAR (WS_CHILD | WS_CLIPCHILDREN | WS_BORDER | RBS_VARHEIGHT | \ 57 | RBS_BANDBORDERS | CCS_NODIVIDER | CCS_NOPARENTALIGN) 58 | 59 | 60 | //==== Ids ==================================================================== 61 | #define IDC_STATUSBAR 0xFB00 62 | #define IDC_TOOLBAR 0xFB01 63 | #define IDC_REBAR 0xFB02 64 | #define IDC_EDIT 0xFB03 65 | #define IDC_EDITFRAME 0xFB04 66 | #define IDC_FILENAME 0xFB05 67 | #define IDC_REUSELOCK 0xFB06 68 | 69 | 70 | //==== Statusbar ============================================================== 71 | #define STATUS_DOCPOS 0 72 | #define STATUS_DOCSIZE 1 73 | #define STATUS_CODEPAGE 2 74 | #define STATUS_EOLMODE 3 75 | #define STATUS_OVRMODE 4 76 | #define STATUS_LEXER 5 77 | #define STATUS_HELP 255 78 | 79 | 80 | //==== Change Notifications =================================================== 81 | #define ID_WATCHTIMER 0xA000 82 | #define WM_CHANGENOTIFY WM_USER+1 83 | //#define WM_CHANGENOTIFYCLEAR WM_USER+2 84 | 85 | 86 | //==== Callback Message from System Tray ====================================== 87 | #define WM_TRAYMESSAGE WM_USER 88 | 89 | 90 | //==== Paste Board Timer ====================================================== 91 | #define ID_PASTEBOARDTIMER 0xA001 92 | 93 | 94 | //==== Reuse Window Lock Timeout ============================================== 95 | #define REUSEWINDOWLOCKTIMEOUT 1000 96 | 97 | 98 | //==== Function Declarations ================================================== 99 | BOOL InitApplication(HINSTANCE); 100 | HWND InitInstance(HINSTANCE,LPSTR,int); 101 | BOOL ActivatePrevInst(); 102 | BOOL RelaunchMultiInst(); 103 | BOOL RelaunchElevated(); 104 | void SnapToDefaultPos(HWND); 105 | void ShowNotifyIcon(HWND,BOOL); 106 | void SetNotifyIconTitle(HWND); 107 | void InstallFileWatching(LPCWSTR); 108 | void CALLBACK WatchTimerProc(HWND,UINT,UINT_PTR,DWORD); 109 | void CALLBACK PasteBoardTimer(HWND,UINT,UINT_PTR,DWORD); 110 | 111 | 112 | void LoadSettings(); 113 | void SaveSettings(BOOL); 114 | void ParseCommandLine(); 115 | void LoadFlags(); 116 | int CheckIniFile(LPWSTR,LPCWSTR); 117 | int CheckIniFileRedirect(LPWSTR,LPCWSTR); 118 | int FindIniFile(); 119 | int TestIniFile(); 120 | int CreateIniFile(); 121 | int CreateIniFileEx(LPCWSTR); 122 | 123 | 124 | void UpdateStatusbar(); 125 | void UpdateToolbar(); 126 | void UpdateLineNumberWidth(); 127 | 128 | 129 | BOOL FileIO(BOOL,LPCWSTR,BOOL,int*,int*,BOOL*,BOOL*,BOOL*,BOOL); 130 | BOOL FileLoad(BOOL,BOOL,BOOL,BOOL,LPCWSTR); 131 | BOOL FileSave(BOOL,BOOL,BOOL,BOOL); 132 | BOOL OpenFileDlg(HWND,LPWSTR,int,LPCWSTR); 133 | BOOL SaveFileDlg(HWND,LPWSTR,int,LPCWSTR); 134 | 135 | 136 | LRESULT CALLBACK MainWndProc(HWND,UINT,WPARAM,LPARAM); 137 | LRESULT MsgCreate(HWND,WPARAM,LPARAM); 138 | void CreateBars(HWND,HINSTANCE); 139 | void MsgThemeChanged(HWND,WPARAM,LPARAM); 140 | void MsgSize(HWND,WPARAM,LPARAM); 141 | void MsgInitMenu(HWND,WPARAM,LPARAM); 142 | LRESULT MsgCommand(HWND,WPARAM,LPARAM); 143 | LRESULT MsgNotify(HWND,WPARAM,LPARAM); 144 | 145 | 146 | 147 | /// End of Notepad2.h \\\ 148 | -------------------------------------------------------------------------------- /scintilla/src/Style.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Style.cxx 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 | #include 9 | 10 | #include "Platform.h" 11 | 12 | #include "Scintilla.h" 13 | #include "Style.h" 14 | 15 | #ifdef SCI_NAMESPACE 16 | using namespace Scintilla; 17 | #endif 18 | 19 | FontAlias::FontAlias() { 20 | } 21 | 22 | FontAlias::FontAlias(const FontAlias &other) : Font() { 23 | SetID(other.fid); 24 | } 25 | 26 | FontAlias::~FontAlias() { 27 | SetID(0); 28 | // ~Font will not release the actual font resource since it is now 0 29 | } 30 | 31 | void FontAlias::MakeAlias(Font &fontOrigin) { 32 | SetID(fontOrigin.GetID()); 33 | } 34 | 35 | void FontAlias::ClearFont() { 36 | SetID(0); 37 | } 38 | 39 | bool FontSpecification::operator==(const FontSpecification &other) const { 40 | return fontName == other.fontName && 41 | weight == other.weight && 42 | italic == other.italic && 43 | size == other.size && 44 | characterSet == other.characterSet && 45 | extraFontFlag == other.extraFontFlag; 46 | } 47 | 48 | bool FontSpecification::operator<(const FontSpecification &other) const { 49 | if (fontName != other.fontName) 50 | return fontName < other.fontName; 51 | if (weight != other.weight) 52 | return weight < other.weight; 53 | if (italic != other.italic) 54 | return italic == false; 55 | if (size != other.size) 56 | return size < other.size; 57 | if (characterSet != other.characterSet) 58 | return characterSet < other.characterSet; 59 | if (extraFontFlag != other.extraFontFlag) 60 | return extraFontFlag < other.extraFontFlag; 61 | return false; 62 | } 63 | 64 | FontMeasurements::FontMeasurements() { 65 | Clear(); 66 | } 67 | 68 | void FontMeasurements::Clear() { 69 | ascent = 1; 70 | descent = 1; 71 | capitalHeight = 1; 72 | aveCharWidth = 1; 73 | spaceWidth = 1; 74 | sizeZoomed = 2; 75 | } 76 | 77 | Style::Style() : FontSpecification() { 78 | Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff), 79 | Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, 0, SC_CHARSET_DEFAULT, 80 | SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); 81 | } 82 | 83 | Style::Style(const Style &source) : FontSpecification(), FontMeasurements() { 84 | Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff), 85 | 0, 0, 0, 86 | SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); 87 | fore = source.fore; 88 | back = source.back; 89 | characterSet = source.characterSet; 90 | weight = source.weight; 91 | italic = source.italic; 92 | size = source.size; 93 | fontName = source.fontName; 94 | eolFilled = source.eolFilled; 95 | underline = source.underline; 96 | caseForce = source.caseForce; 97 | visible = source.visible; 98 | changeable = source.changeable; 99 | hotspot = source.hotspot; 100 | } 101 | 102 | Style::~Style() { 103 | } 104 | 105 | Style &Style::operator=(const Style &source) { 106 | if (this == &source) 107 | return * this; 108 | Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff), 109 | 0, 0, SC_CHARSET_DEFAULT, 110 | SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); 111 | fore = source.fore; 112 | back = source.back; 113 | characterSet = source.characterSet; 114 | weight = source.weight; 115 | italic = source.italic; 116 | size = source.size; 117 | fontName = source.fontName; 118 | eolFilled = source.eolFilled; 119 | underline = source.underline; 120 | caseForce = source.caseForce; 121 | visible = source.visible; 122 | changeable = source.changeable; 123 | return *this; 124 | } 125 | 126 | void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_, 127 | const char *fontName_, int characterSet_, 128 | int weight_, bool italic_, bool eolFilled_, 129 | bool underline_, ecaseForced caseForce_, 130 | bool visible_, bool changeable_, bool hotspot_) { 131 | fore = fore_; 132 | back = back_; 133 | characterSet = characterSet_; 134 | weight = weight_; 135 | italic = italic_; 136 | size = size_; 137 | fontName = fontName_; 138 | eolFilled = eolFilled_; 139 | underline = underline_; 140 | caseForce = caseForce_; 141 | visible = visible_; 142 | changeable = changeable_; 143 | hotspot = hotspot_; 144 | font.ClearFont(); 145 | FontMeasurements::Clear(); 146 | } 147 | 148 | void Style::ClearTo(const Style &source) { 149 | Clear( 150 | source.fore, 151 | source.back, 152 | source.size, 153 | source.fontName, 154 | source.characterSet, 155 | source.weight, 156 | source.italic, 157 | source.eolFilled, 158 | source.underline, 159 | source.caseForce, 160 | source.visible, 161 | source.changeable, 162 | source.hotspot); 163 | } 164 | 165 | void Style::Copy(Font &font_, const FontMeasurements &fm_) { 166 | font.MakeAlias(font_); 167 | (FontMeasurements &)(*this) = fm_; 168 | } 169 | -------------------------------------------------------------------------------- /scintilla/lexlib/PropSetSimple.cxx: -------------------------------------------------------------------------------- 1 | // SciTE - Scintilla based Text Editor 2 | /** @file PropSetSimple.cxx 3 | ** A Java style properties file module. 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 | // Maintain a dictionary of properties 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | #include "PropSetSimple.h" 17 | 18 | #ifdef SCI_NAMESPACE 19 | using namespace Scintilla; 20 | #endif 21 | 22 | typedef std::map mapss; 23 | 24 | PropSetSimple::PropSetSimple() { 25 | mapss *props = new mapss; 26 | impl = static_cast(props); 27 | } 28 | 29 | PropSetSimple::~PropSetSimple() { 30 | mapss *props = static_cast(impl); 31 | delete props; 32 | impl = 0; 33 | } 34 | 35 | void PropSetSimple::Set(const char *key, const char *val, int lenKey, int lenVal) { 36 | mapss *props = static_cast(impl); 37 | if (!*key) // Empty keys are not supported 38 | return; 39 | if (lenKey == -1) 40 | lenKey = static_cast(strlen(key)); 41 | if (lenVal == -1) 42 | lenVal = static_cast(strlen(val)); 43 | (*props)[std::string(key, lenKey)] = std::string(val, lenVal); 44 | } 45 | 46 | static bool IsASpaceCharacter(unsigned int ch) { 47 | return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); 48 | } 49 | 50 | void PropSetSimple::Set(const char *keyVal) { 51 | while (IsASpaceCharacter(*keyVal)) 52 | keyVal++; 53 | const char *endVal = keyVal; 54 | while (*endVal && (*endVal != '\n')) 55 | endVal++; 56 | const char *eqAt = strchr(keyVal, '='); 57 | if (eqAt) { 58 | Set(keyVal, eqAt + 1, static_cast(eqAt-keyVal), 59 | static_cast(endVal - eqAt - 1)); 60 | } else if (*keyVal) { // No '=' so assume '=1' 61 | Set(keyVal, "1", static_cast(endVal-keyVal), 1); 62 | } 63 | } 64 | 65 | void PropSetSimple::SetMultiple(const char *s) { 66 | const char *eol = strchr(s, '\n'); 67 | while (eol) { 68 | Set(s); 69 | s = eol + 1; 70 | eol = strchr(s, '\n'); 71 | } 72 | Set(s); 73 | } 74 | 75 | const char *PropSetSimple::Get(const char *key) const { 76 | mapss *props = static_cast(impl); 77 | mapss::const_iterator keyPos = props->find(std::string(key)); 78 | if (keyPos != props->end()) { 79 | return keyPos->second.c_str(); 80 | } else { 81 | return ""; 82 | } 83 | } 84 | 85 | // There is some inconsistency between GetExpanded("foo") and Expand("$(foo)"). 86 | // A solution is to keep a stack of variables that have been expanded, so that 87 | // recursive expansions can be skipped. For now I'll just use the C++ stack 88 | // for that, through a recursive function and a simple chain of pointers. 89 | 90 | struct VarChain { 91 | VarChain(const char *var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {} 92 | 93 | bool contains(const char *testVar) const { 94 | return (var && (0 == strcmp(var, testVar))) 95 | || (link && link->contains(testVar)); 96 | } 97 | 98 | const char *var; 99 | const VarChain *link; 100 | }; 101 | 102 | static int ExpandAllInPlace(const PropSetSimple &props, std::string &withVars, int maxExpands, const VarChain &blankVars) { 103 | size_t varStart = withVars.find("$("); 104 | while ((varStart != std::string::npos) && (maxExpands > 0)) { 105 | size_t varEnd = withVars.find(")", varStart+2); 106 | if (varEnd == std::string::npos) { 107 | break; 108 | } 109 | 110 | // For consistency, when we see '$(ab$(cde))', expand the inner variable first, 111 | // regardless whether there is actually a degenerate variable named 'ab$(cde'. 112 | size_t innerVarStart = withVars.find("$(", varStart+2); 113 | while ((innerVarStart != std::string::npos) && (innerVarStart > varStart) && (innerVarStart < varEnd)) { 114 | varStart = innerVarStart; 115 | innerVarStart = withVars.find("$(", varStart+2); 116 | } 117 | 118 | std::string var(withVars.c_str(), varStart + 2, varEnd - varStart - 2); 119 | std::string val = props.Get(var.c_str()); 120 | 121 | if (blankVars.contains(var.c_str())) { 122 | val = ""; // treat blankVar as an empty string (e.g. to block self-reference) 123 | } 124 | 125 | if (--maxExpands >= 0) { 126 | maxExpands = ExpandAllInPlace(props, val, maxExpands, VarChain(var.c_str(), &blankVars)); 127 | } 128 | 129 | withVars.erase(varStart, varEnd-varStart+1); 130 | withVars.insert(varStart, val.c_str(), val.length()); 131 | 132 | varStart = withVars.find("$("); 133 | } 134 | 135 | return maxExpands; 136 | } 137 | 138 | int PropSetSimple::GetExpanded(const char *key, char *result) const { 139 | std::string val = Get(key); 140 | ExpandAllInPlace(*this, val, 100, VarChain(key)); 141 | const int n = static_cast(val.size()); 142 | if (result) { 143 | memcpy(result, val.c_str(), n+1); 144 | } 145 | return n; // Not including NUL 146 | } 147 | 148 | int PropSetSimple::GetInt(const char *key, int defaultValue) const { 149 | std::string val = Get(key); 150 | ExpandAllInPlace(*this, val, 100, VarChain(key)); 151 | if (!val.empty()) { 152 | return atoi(val.c_str()); 153 | } 154 | return defaultValue; 155 | } 156 | -------------------------------------------------------------------------------- /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(int handle_, int number_) : handle(handle_), number(number_) {} 23 | }; 24 | 25 | /** 26 | * A marker handle set contains any number of MarkerHandleNumbers. 27 | */ 28 | class MarkerHandleSet { 29 | std::forward_list mhList; 30 | 31 | public: 32 | MarkerHandleSet(); 33 | // Deleted so MarkerHandleSet objects can not be copied. 34 | MarkerHandleSet(const MarkerHandleSet &) = delete; 35 | void operator=(const MarkerHandleSet &) = delete; 36 | ~MarkerHandleSet(); 37 | bool Empty() const; 38 | int MarkValue() const; ///< Bit set of marker numbers. 39 | bool Contains(int handle) const; 40 | bool InsertHandle(int handle, int markerNum); 41 | void RemoveHandle(int handle); 42 | bool RemoveNumber(int markerNum, bool all); 43 | void CombineWith(MarkerHandleSet *other); 44 | }; 45 | 46 | class LineMarkers : public PerLine { 47 | SplitVector> markers; 48 | /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big. 49 | int handleCurrent; 50 | public: 51 | LineMarkers() : handleCurrent(0) { 52 | } 53 | // Deleted so Worker objects can not be copied. 54 | LineMarkers(const LineMarkers &) = delete; 55 | void operator=(const LineMarkers &) = delete; 56 | virtual ~LineMarkers(); 57 | void Init() override; 58 | void InsertLine(Sci::Line line) override; 59 | void RemoveLine(Sci::Line line) override; 60 | 61 | int MarkValue(Sci::Line line); 62 | Sci::Line MarkerNext(Sci::Line lineStart, int mask) const; 63 | int AddMark(Sci::Line line, int markerNum, Sci::Line lines); 64 | void MergeMarkers(Sci::Line line); 65 | bool DeleteMark(Sci::Line line, int markerNum, bool all); 66 | void DeleteMarkFromHandle(int markerHandle); 67 | Sci::Line LineFromHandle(int markerHandle); 68 | }; 69 | 70 | class LineLevels : public PerLine { 71 | SplitVector levels; 72 | public: 73 | LineLevels() { 74 | } 75 | // Deleted so Worker objects can not be copied. 76 | LineLevels(const LineLevels &) = delete; 77 | void operator=(const LineLevels &) = delete; 78 | virtual ~LineLevels(); 79 | void Init() override; 80 | void InsertLine(Sci::Line line) override; 81 | void RemoveLine(Sci::Line line) override; 82 | 83 | void ExpandLevels(Sci::Line sizeNew=-1); 84 | void ClearLevels(); 85 | int SetLevel(Sci::Line line, int level, Sci::Line lines); 86 | int GetLevel(Sci::Line line) const; 87 | }; 88 | 89 | class LineState : public PerLine { 90 | SplitVector lineStates; 91 | public: 92 | LineState() { 93 | } 94 | // Deleted so Worker objects can not be copied. 95 | LineState(const LineState &) = delete; 96 | void operator=(const LineState &) = delete; 97 | virtual ~LineState(); 98 | void Init() override; 99 | void InsertLine(Sci::Line line) override; 100 | void RemoveLine(Sci::Line line) override; 101 | 102 | int SetLineState(Sci::Line line, int state); 103 | int GetLineState(Sci::Line line); 104 | Sci::Line GetMaxLineState() const; 105 | }; 106 | 107 | class LineAnnotation : public PerLine { 108 | SplitVector> annotations; 109 | public: 110 | LineAnnotation() { 111 | } 112 | // Deleted so Worker objects can not be copied. 113 | LineAnnotation(const LineAnnotation &) = delete; 114 | void operator=(const LineAnnotation &) = delete; 115 | virtual ~LineAnnotation(); 116 | void Init() override; 117 | void InsertLine(Sci::Line line) override; 118 | void RemoveLine(Sci::Line line) override; 119 | 120 | bool MultipleStyles(Sci::Line line) const; 121 | int Style(Sci::Line line) const; 122 | const char *Text(Sci::Line line) const; 123 | const unsigned char *Styles(Sci::Line line) const; 124 | void SetText(Sci::Line line, const char *text); 125 | void ClearAll(); 126 | void SetStyle(Sci::Line line, int style); 127 | void SetStyles(Sci::Line line, const unsigned char *styles); 128 | int Length(Sci::Line line) const; 129 | int Lines(Sci::Line line) const; 130 | }; 131 | 132 | typedef std::vector TabstopList; 133 | 134 | class LineTabstops : public PerLine { 135 | SplitVector> tabstops; 136 | public: 137 | LineTabstops() { 138 | } 139 | // Deleted so Worker objects can not be copied. 140 | LineTabstops(const LineTabstops &) = delete; 141 | void operator=(const LineTabstops &) = delete; 142 | virtual ~LineTabstops(); 143 | void Init() override; 144 | void InsertLine(Sci::Line line) override; 145 | void RemoveLine(Sci::Line line) override; 146 | 147 | bool ClearTabstops(Sci::Line line); 148 | bool AddTabstop(Sci::Line line, int x); 149 | int GetNextTabstop(Sci::Line line, int x) const; 150 | }; 151 | 152 | #ifdef SCI_NAMESPACE 153 | } 154 | #endif 155 | 156 | #endif 157 | --------------------------------------------------------------------------------