diff --git a/PowerEditor/Test/FunctionList/asm/unitTest b/PowerEditor/Test/FunctionList/asm/unitTest new file mode 100644 index 00000000..b7df3458 --- /dev/null +++ b/PowerEditor/Test/FunctionList/asm/unitTest @@ -0,0 +1,231 @@ + page ,132 + title strcat - concatenate (append) one string to another +;*** +;strcat.asm - contains strcat() and strcpy() routines +; +; Copyright (c) Microsoft Corporation. All rights reserved. +; +;Purpose: +; STRCAT concatenates (appends) a copy of the source string to the +; end of the destination string, returning the destination string. +; +;******************************************************************************* + + .xlist + include cruntime.inc + .list + + +page +;*** +;char *strcat(dst, src) - concatenate (append) one string to another +; +;Purpose: +; Concatenates src onto the end of dest. Assumes enough +; space in dest. +; +; Algorithm: +; char * strcat (char * dst, char * src) +; { +; char * cp = dst; +; +; while( *cp ) +; ++cp; /* Find end of dst */ +; while( *cp++ = *src++ ) +; ; /* Copy src to end of dst */ +; return( dst ); +; } +; +;Entry: +; char *dst - string to which "src" is to be appended +; const char *src - string to be appended to the end of "dst" +; +;Exit: +; The address of "dst" in EAX +; +;Uses: +; EAX, ECX +; +;Exceptions: +; +;******************************************************************************* + +page +;*** +;char *strcpy(dst, src) - copy one string over another +; +;Purpose: +; Copies the string src into the spot specified by +; dest; assumes enough room. +; +; Algorithm: +; char * strcpy (char * dst, char * src) +; { +; char * cp = dst; +; +; while( *cp++ = *src++ ) +; ; /* Copy src over dst */ +; return( dst ); +; } +; +;Entry: +; char * dst - string over which "src" is to be copied +; const char * src - string to be copied over "dst" +; +;Exit: +; The address of "dst" in EAX +; +;Uses: +; EAX, ECX +; +;Exceptions: +;******************************************************************************* + + + CODESEG + +% public strcat, strcpy ; make both functions available +strcpy proc \ + dst:ptr byte, \ + src:ptr byte + + OPTION PROLOGUE:NONE, EPILOGUE:NONE + + push edi ; preserve edi + mov edi,[esp+8] ; edi points to dest string + jmp short copy_start + +strcpy endp + + align 16 + +strcat proc \ + dst:ptr byte, \ + src:ptr byte + + OPTION PROLOGUE:NONE, EPILOGUE:NONE + + .FPO ( 0, 2, 0, 0, 0, 0 ) + + mov ecx,[esp+4] ; ecx -> dest string + push edi ; preserve edi + test ecx,3 ; test if string is aligned on 32 bits + je short find_end_of_dest_string_loop + +dest_misaligned: ; simple byte loop until string is aligned + mov al,byte ptr [ecx] + add ecx,1 + test al,al + je short start_byte_3 + test ecx,3 + jne short dest_misaligned + + align 4 + +find_end_of_dest_string_loop: + mov eax,dword ptr [ecx] ; read 4 bytes + mov edx,7efefeffh + add edx,eax + xor eax,-1 + xor eax,edx + add ecx,4 + test eax,81010100h + je short find_end_of_dest_string_loop + ; found zero byte in the loop + mov eax,[ecx - 4] + test al,al ; is it byte 0 + je short start_byte_0 + test ah,ah ; is it byte 1 + je short start_byte_1 + test eax,00ff0000h ; is it byte 2 + je short start_byte_2 + test eax,0ff000000h ; is it byte 3 + je short start_byte_3 + jmp short find_end_of_dest_string_loop + ; taken if bits 24-30 are clear and bit + ; 31 is set +start_byte_3: + lea edi,[ecx - 1] + jmp short copy_start +start_byte_2: + lea edi,[ecx - 2] + jmp short copy_start +start_byte_1: + lea edi,[ecx - 3] + jmp short copy_start +start_byte_0: + lea edi,[ecx - 4] +; jmp short copy_start + +; edi points to the end of dest string. +copy_start:: + mov ecx,[esp+0ch] ; ecx -> sorc string + test ecx,3 ; test if string is aligned on 32 bits + je short main_loop_entrance + +src_misaligned: ; simple byte loop until string is aligned + mov dl,byte ptr [ecx] + add ecx,1 + test dl,dl + je short byte_0 + mov [edi],dl + add edi,1 + test ecx,3 + jne short src_misaligned + jmp short main_loop_entrance + +main_loop: ; edx contains first dword of sorc string + mov [edi],edx ; store one more dword + add edi,4 ; kick dest pointer +main_loop_entrance: + mov edx,7efefeffh + mov eax,dword ptr [ecx] ; read 4 bytes + + add edx,eax + xor eax,-1 + + xor eax,edx + mov edx,[ecx] ; it's in cache now + + add ecx,4 ; kick dest pointer + test eax,81010100h + + je short main_loop + ; found zero byte in the loop +; main_loop_end: + test dl,dl ; is it byte 0 + je short byte_0 + test dh,dh ; is it byte 1 + je short byte_1 + test edx,00ff0000h ; is it byte 2 + je short byte_2 + test edx,0ff000000h ; is it byte 3 + je short byte_3 + jmp short main_loop ; taken if bits 24-30 are clear and bit + ; 31 is set +byte_3: + mov [edi],edx + mov eax,[esp+8] ; return in eax pointer to dest string + pop edi + ret +byte_2: + mov [edi],dx + mov eax,[esp+8] ; return in eax pointer to dest string + mov byte ptr [edi+2],0 + pop edi + ret +byte_1: + mov [edi],dx + mov eax,[esp+8] ; return in eax pointer to dest string + pop edi + ret +byte_0: + mov [edi],dl + mov eax,[esp+8] ; return in eax pointer to dest string + pop edi + ret + +strcat endp + + end + diff --git a/PowerEditor/Test/FunctionList/asm/unitTest.expected.result b/PowerEditor/Test/FunctionList/asm/unitTest.expected.result new file mode 100644 index 00000000..361dd6c0 --- /dev/null +++ b/PowerEditor/Test/FunctionList/asm/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["dst","src","dst","src","dest_misaligned","find_end_of_dest_string_loop","start_byte_3","start_byte_2","start_byte_1","start_byte_0","copy_start","src_misaligned","main_loop","main_loop_entrance","byte_3","byte_2","byte_1","byte_0"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/autoit/unitTest b/PowerEditor/Test/FunctionList/autoit/unitTest new file mode 100644 index 00000000..195338d0 --- /dev/null +++ b/PowerEditor/Test/FunctionList/autoit/unitTest @@ -0,0 +1,45 @@ +; Script Name : logoff.au3 +; Author : Craig Richards +; Created : 6th February 2012 +; Last Modified : +; Version : 1.0 + +; Modifications : + +; Description : This is a simple splash screen to wrap around my logoff.bat incase someone presses my logoff button by mistake (New Microsoft Keyboard) + +#Include ; Include the GuiConstants Header File +#Include ; Include the StaticConstants Header File + +Opt('GuiOnEventMode', 1) ; Set the Option, and enable GuiOnEventMode +GUICreate ("Logoff Warning", 750, 750) ; Create a simple window +;GUISetIcon("icon.ico") ; Give it an icon +GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit') ; Close the Window if the program is quit +GUICtrlCreatePic("1280.jpg",0,0,750,680) ; Put a picture in the background of the splash screen +GUICtrlCreateLabel("Please Choose an Option Below:", 220, 680, 300, 15, $SS_CENTER) ; A simple label on the screen +GUICtrlSetColor(-1,0xFF0000); ; Text of the label will be Red +GUICtrlCreateButton("Logoff", 170, 700, 200, 30) ; Create a simple button to run the logoff script +GUICTrlSetOnEvent(-1, 'logoff') ; If pressed run the logoff function +GUICtrlCreateButton("Cancel", 375, 700, 200, 30) ; Create a simple button to quit the program +GUICTrlSetOnEvent(-1, 'cancel') ; If pressed run the cancel function + +Func logoff() ; Start of the logoff function + GUISetState(@SW_HIDE) ; Hide the Window + Run("u:\logoff.bat") ; Run the logoff batch file + Exit ; Quit the program +EndFunc ; End of the logoff Function + +Func cancel() ; Start of the cancel function + GUISetState(@SW_HIDE) ; Hide the Window + Exit ; Quit the program +EndFunc ; End of the cancel Function + +GUISetState(@SW_SHOW) ; Show the application Windows + +While 1 ; A simple while loop + Sleep(500) ; Sleep to keep the window running +WEnd ; End of the While loop + +Func GUIExit() ; Start of the GUIExit function + Exit ; Quit the program +EndFunc \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/autoit/unitTest.expected.result b/PowerEditor/Test/FunctionList/autoit/unitTest.expected.result new file mode 100644 index 00000000..c553f5fc --- /dev/null +++ b/PowerEditor/Test/FunctionList/autoit/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["logoff","cancel","GUIExit"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/bash/unitTest b/PowerEditor/Test/FunctionList/bash/unitTest new file mode 100644 index 00000000..a13d651b --- /dev/null +++ b/PowerEditor/Test/FunctionList/bash/unitTest @@ -0,0 +1,261 @@ +#!/bin/sh + + +setenv() + +{ + # Define and export. + + eval ${1}="${2}" + export ${1} +} + + +case "${SCRIPTDIR}" in +/*) ;; +*) SCRIPTDIR="`pwd`/${SCRIPTDIR}" +esac + +while true +do case "${SCRIPTDIR}" in + */.) SCRIPTDIR="${SCRIPTDIR%/.}";; + *) break;; + esac +done + +# The script directory is supposed to be in $TOPDIR/packages/os400. + +TOPDIR=`dirname "${SCRIPTDIR}"` +TOPDIR=`dirname "${TOPDIR}"` +export SCRIPTDIR TOPDIR + +# Extract the SONAME from the library makefile. + +SONAME=`sed -e '/^VERSIONINFO=/!d' -e 's/^.* \([0-9]*\):.*$/\1/' -e 'q' \ + < "${TOPDIR}/lib/Makefile.am"` +export SONAME + + +################################################################################ +# +# Tunable configuration parameters. +# +################################################################################ + +setenv TARGETLIB 'CURL' # Target OS/400 program library. +setenv STATBNDDIR 'CURL_A' # Static binding directory. +setenv DYNBNDDIR 'CURL' # Dynamic binding directory. +setenv SRVPGM "CURL.${SONAME}" # Service program. +setenv TGTCCSID '500' # Target CCSID of objects. +setenv DEBUG '*ALL' # Debug level. +setenv OPTIMIZE '10' # Optimisation level +setenv OUTPUT '*NONE' # Compilation output option. +setenv TGTRLS 'V6R1M0' # Target OS release. +setenv IFSDIR '/curl' # Installation IFS directory. + +# Define ZLIB availability and locations. + +setenv WITH_ZLIB 0 # Define to 1 to enable. +setenv ZLIB_INCLUDE '/zlib/include' # ZLIB include IFS directory. +setenv ZLIB_LIB 'ZLIB' # ZLIB library. +setenv ZLIB_BNDDIR 'ZLIB_A' # ZLIB binding directory. + +# Define LIBSSH2 availability and locations. + +setenv WITH_LIBSSH2 0 # Define to 1 to enable. +setenv LIBSSH2_INCLUDE '/libssh2/include' # LIBSSH2 include IFS directory. +setenv LIBSSH2_LIB 'LIBSSH2' # LIBSSH2 library. +setenv LIBSSH2_BNDDIR 'LIBSSH2_A' # LIBSSH2 binding directory. + + +################################################################################ + +# Need to get the version definitions. + +LIBCURL_VERSION=`grep '^#define *LIBCURL_VERSION ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/.*"\(.*\)".*/\1/'` +LIBCURL_VERSION_MAJOR=`grep '^#define *LIBCURL_VERSION_MAJOR ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/^#define *LIBCURL_VERSION_MAJOR *\([^ ]*\).*/\1/'` +LIBCURL_VERSION_MINOR=`grep '^#define *LIBCURL_VERSION_MINOR ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/^#define *LIBCURL_VERSION_MINOR *\([^ ]*\).*/\1/'` +LIBCURL_VERSION_PATCH=`grep '^#define *LIBCURL_VERSION_PATCH ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/^#define *LIBCURL_VERSION_PATCH *\([^ ]*\).*/\1/'` +LIBCURL_VERSION_NUM=`grep '^#define *LIBCURL_VERSION_NUM ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/^#define *LIBCURL_VERSION_NUM *0x\([^ ]*\).*/\1/'` +LIBCURL_TIMESTAMP=`grep '^#define *LIBCURL_TIMESTAMP ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/.*"\(.*\)".*/\1/'` +export LIBCURL_VERSION +export LIBCURL_VERSION_MAJOR LIBCURL_VERSION_MINOR LIBCURL_VERSION_PATCH +export LIBCURL_VERSION_NUM LIBCURL_TIMESTAMP + +################################################################################ +# +# OS/400 specific definitions. +# +################################################################################ + +LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB" + + +################################################################################ +# +# Procedures. +# +################################################################################ + +# action_needed dest [src] +# +# dest is an object to build +# if specified, src is an object on which dest depends. +# +# exit 0 (succeeds) if some action has to be taken, else 1. + +action_needed() + +{ + [ ! -e "${1}" ] && return 0 + [ "${2}" ] || return 1 + [ "${1}" -ot "${2}" ] && return 0 + return 1 +} + + +# canonicalize_path path +# +# Return canonicalized path as: +# - Absolute +# - No . or .. component. + +canonicalize_path() + +{ + if expr "${1}" : '^/' > /dev/null + then P="${1}" + else P="`pwd`/${1}" + fi + + R= + IFSSAVE="${IFS}" + IFS="/" + + for C in ${P} + do IFS="${IFSSAVE}" + case "${C}" in + .) ;; + ..) R=`expr "${R}" : '^\(.*/\)..*'` + ;; + ?*) R="${R}${C}/" + ;; + *) ;; + esac + done + + IFS="${IFSSAVE}" + echo "/`expr "${R}" : '^\(.*\)/'`" +} + + +# make_module module_name source_name [additional_definitions] +# +# Compile source name into ASCII module if needed. +# As side effect, append the module name to variable MODULES. +# Set LINK to "YES" if the module has been compiled. + +make_module() + +{ + MODULES="${MODULES} ${1}" + MODIFSNAME="${LIBIFSNAME}/${1}.MODULE" + action_needed "${MODIFSNAME}" "${2}" || return 0; + SRCDIR=`dirname \`canonicalize_path "${2}"\`` + + # #pragma convert has to be in the source file itself, i.e. + # putting it in an include file makes it only active + # for that include file. + # Thus we build a temporary file with the pragma prepended to + # the source file and we compile that themporary file. + + echo "#line 1 \"${2}\"" > __tmpsrcf.c + echo "#pragma convert(819)" >> __tmpsrcf.c + echo "#line 1" >> __tmpsrcf.c + cat "${2}" >> __tmpsrcf.c + CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')" +# CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)" + CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST)" + CMD="${CMD} LOCALETYPE(*LOCALE) FLAG(10)" + CMD="${CMD} INCDIR('/qibm/proddata/qadrt/include'" + CMD="${CMD} '${TOPDIR}/include/curl' '${TOPDIR}/include' '${SRCDIR}'" + CMD="${CMD} '${TOPDIR}/packages/OS400'" + + if [ "${WITH_ZLIB}" != "0" ] + then CMD="${CMD} '${ZLIB_INCLUDE}'" + fi + + if [ "${WITH_LIBSSH2}" != "0" ] + then CMD="${CMD} '${LIBSSH2_INCLUDE}'" + fi + + CMD="${CMD} ${INCLUDES})" + CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})" + CMD="${CMD} OUTPUT(${OUTPUT})" + CMD="${CMD} OPTIMIZE(${OPTIMIZE})" + CMD="${CMD} DBGVIEW(${DEBUG})" + + DEFINES="${3} BUILDING_LIBCURL" + + if [ "${WITH_ZLIB}" != "0" ] + then DEFINES="${DEFINES} HAVE_LIBZ HAVE_ZLIB_H" + fi + + if [ "${WITH_LIBSSH2}" != "0" ] + then DEFINES="${DEFINES} USE_LIBSSH2 HAVE_LIBSSH2_H" + fi + + if [ "${DEFINES}" ] + then CMD="${CMD} DEFINE(${DEFINES})" + fi + + system "${CMD}" + rm -f __tmpsrcf.c + LINK=YES +} + + +# Determine DB2 object name from IFS name. + +db2_name() + +{ + if [ "${2}" = 'nomangle' ] + then basename "${1}" | + tr 'a-z-' 'A-Z_' | + sed -e 's/\..*//' \ + -e 's/^\(.\).*\(.........\)$/\1\2/' + else basename "${1}" | + tr 'a-z-' 'A-Z_' | + sed -e 's/\..*//' \ + -e 's/^CURL_*/C/' \ + -e 's/^\(.\).*\(.........\)$/\1\2/' + fi +} + + +# Copy IFS file replacing version info. + +versioned_copy() + +{ + sed -e "s/@LIBCURL_VERSION@/${LIBCURL_VERSION}/g" \ + -e "s/@LIBCURL_VERSION_MAJOR@/${LIBCURL_VERSION_MAJOR}/g" \ + -e "s/@LIBCURL_VERSION_MINOR@/${LIBCURL_VERSION_MINOR}/g" \ + -e "s/@LIBCURL_VERSION_PATCH@/${LIBCURL_VERSION_PATCH}/g" \ + -e "s/@LIBCURL_VERSION_NUM@/${LIBCURL_VERSION_NUM}/g" \ + -e "s/@LIBCURL_TIMESTAMP@/${LIBCURL_TIMESTAMP}/g" \ + < "${1}" > "${2}" +} diff --git a/PowerEditor/Test/FunctionList/bash/unitTest.expected.result b/PowerEditor/Test/FunctionList/bash/unitTest.expected.result new file mode 100644 index 00000000..71444fef --- /dev/null +++ b/PowerEditor/Test/FunctionList/bash/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["setenv","action_needed","canonicalize_path","make_module","db2_name","versioned_copy"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/batch/unitTest b/PowerEditor/Test/FunctionList/batch/unitTest new file mode 100644 index 00000000..42f840a0 --- /dev/null +++ b/PowerEditor/Test/FunctionList/batch/unitTest @@ -0,0 +1,115 @@ +@echo off + +rem Inno Setup +rem Copyright (C) 1997-2012 Jordan Russell +rem Portions by Martijn Laan +rem For conditions of distribution and use, see LICENSE.TXT. +rem +rem Batch file to compile all projects with Unicode support + +setlocal + +if exist compilesettings.bat goto compilesettingsfound +:compilesettingserror +echo compilesettings.bat is missing or incomplete. It needs to be created +echo with either of the following lines, adjusted for your system: +echo. +echo set DELPHI2009ROOT=C:\Program Files\CodeGear\RAD Studio\6.0 [Path to Delphi 2009 (or 2010)] +echo or +echo set DELPHIXEROOT=C:\Program Files\Embarcadero\RAD Studio\8.0 [Path to Delphi XE (or later)] +goto failed2 + +:compilesettingsfound +set DELPHI2009ROOT= +set DELPHIXEROOT= +call .\compilesettings.bat +if "%DELPHI2009ROOT%"=="" if "%DELPHIXEROOT%"=="" goto compilesettingserror +if not "%DELPHI2009ROOT%"=="" if not "%DELPHIXEROOT%"=="" goto compilesettingserror + +rem ------------------------------------------------------------------------- + +rem Compile each project separately because it seems Delphi +rem carries some settings (e.g. $APPTYPE) between projects +rem if multiple projects are specified on the command line. +rem Note: +rem Command line parameter "--peflags:1" below equals the +rem {$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED} directive. +rem This causes the Delphi compiler to not just set the flag +rem but also it actually strips relocations. Used instead of +rem calling StripReloc like compile.bat does. + +cd Projects +if errorlevel 1 goto exit + +cd ISPP +if errorlevel 1 goto failed + +echo - ISPP.dpr +if "%DELPHIXEROOT%"=="" ( +"%DELPHI2009ROOT%\bin\dcc32.exe" --no-config --string-checks:off -Q -B -H -W %1 -U"%DELPHI2009ROOT%\lib" -E..\..\Files ISPP.dpr +) else ( +"%DELPHIXEROOT%\bin\dcc32.exe" --no-config -NSsystem;system.win;winapi -Q -B -H -W %1 -U"%DELPHIXEROOT%\lib\win32\release" -E..\..\Files ISPP.dpr +) +if errorlevel 1 goto failed + +cd .. + +echo - Compil32.dpr +if "%DELPHIXEROOT%"=="" ( +"%DELPHI2009ROOT%\bin\dcc32.exe" --no-config --peflags:1 --string-checks:off -Q -B -H -W %1 -U"%DELPHI2009ROOT%\lib;..\Components;..\Components\UniPs\Source" -E..\Files -DPS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS Compil32.dpr +) else ( +"%DELPHIXEROOT%\bin\dcc32.exe" --no-config --peflags:1 -NSsystem;system.win;winapi;vcl -Q -B -H -W %1 -U"%DELPHIXEROOT%\lib\win32\release;..\Components;..\Components\UniPs\Source" -E..\Files -DPS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS Compil32.dpr +) +if errorlevel 1 goto failed + +echo - ISCC.dpr +if "%DELPHIXEROOT%"=="" ( +"%DELPHI2009ROOT%\bin\dcc32.exe" --no-config --peflags:1 --string-checks:off -Q -B -H -W %1 -U"%DELPHI2009ROOT%\lib;..\Components;..\Components\UniPs\Source" -E..\Files -DPS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS ISCC.dpr +) else ( +"%DELPHIXEROOT%\bin\dcc32.exe" --no-config --peflags:1 -NSsystem;system.win;winapi -Q -B -H -W %1 -U"%DELPHIXEROOT%\lib\win32\release;..\Components;..\Components\UniPs\Source" -E..\Files -DPS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS ISCC.dpr +) +if errorlevel 1 goto failed + +echo - ISCmplr.dpr +if "%DELPHIXEROOT%"=="" ( +"%DELPHI2009ROOT%\bin\dcc32.exe" --no-config --string-checks:off -Q -B -H -W %1 -U"%DELPHI2009ROOT%\lib;..\Components;..\Components\UniPs\Source" -E..\Files -DPS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS ISCmplr.dpr +) else ( +"%DELPHIXEROOT%\bin\dcc32.exe" --no-config -NSsystem;system.win;winapi -Q -B -H -W %1 -U"%DELPHIXEROOT%\lib\win32\release;..\Components;..\Components\UniPs\Source" -E..\Files -DPS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS ISCmplr.dpr +) +if errorlevel 1 goto failed + +echo - SetupLdr.dpr +if "%DELPHIXEROOT%"=="" ( +"%DELPHI2009ROOT%\bin\dcc32.exe" --no-config --peflags:1 --string-checks:off -Q -B -H -W %1 -U"%DELPHI2009ROOT%\lib;..\Components" -E..\Files SetupLdr.dpr +) else ( +"%DELPHIXEROOT%\bin\dcc32.exe" --no-config --peflags:1 -NSsystem;system.win;winapi -Q -B -H -W %1 -U"%DELPHIXEROOT%\lib\win32\release;..\Components" -E..\Files SetupLdr.dpr +) +if errorlevel 1 goto failed + +echo - Setup.dpr +if "%DELPHIXEROOT%"=="" ( +"%DELPHI2009ROOT%\bin\dcc32.exe" --no-config --peflags:1 --string-checks:off -Q -B -H -W %1 -U"%DELPHI2009ROOT%\lib;..\Components;..\Components\UniPs\Source" -E..\Files -DPS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS Setup.dpr +) else ( +"%DELPHIXEROOT%\bin\dcc32.exe" --no-config --peflags:1 -NSsystem;system.win;winapi;vcl -Q -B -H -W %1 -U"%DELPHIXEROOT%\lib\win32\release;..\Components;..\Components\UniPs\Source" -E..\Files -DPS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS Setup.dpr +) +if errorlevel 1 goto failed + +echo - Renaming files +cd ..\Files +if errorlevel 1 goto failed +move SetupLdr.exe SetupLdr.e32 +if errorlevel 1 goto failed +move Setup.exe Setup.e32 +if errorlevel 1 goto failed + +echo Success! +cd .. +goto exit + +:failed +echo *** FAILED *** +cd .. +:failed2 +exit /b 1 + +:exit \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/batch/unitTest.expected.result b/PowerEditor/Test/FunctionList/batch/unitTest.expected.result new file mode 100644 index 00000000..108626b6 --- /dev/null +++ b/PowerEditor/Test/FunctionList/batch/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["compilesettingserror","compilesettingsfound","failed","failed2"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/c/unitTest b/PowerEditor/Test/FunctionList/c/unitTest new file mode 100644 index 00000000..e69de29b diff --git a/PowerEditor/Test/FunctionList/c/unitTest.expected.result b/PowerEditor/Test/FunctionList/c/unitTest.expected.result new file mode 100644 index 00000000..a576e185 --- /dev/null +++ b/PowerEditor/Test/FunctionList/c/unitTest.expected.result @@ -0,0 +1 @@ +{"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/cpp/unitTest b/PowerEditor/Test/FunctionList/cpp/unitTest new file mode 100644 index 00000000..feea2748 --- /dev/null +++ b/PowerEditor/Test/FunctionList/cpp/unitTest @@ -0,0 +1,6656 @@ +// This file is part of Notepad++ project +// Copyright (C)2003 Don HO +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// Note that the GPL places important restrictions on "derived works", yet +// it does not provide a detailed definition of that term. To avoid +// misunderstandings, we consider an application to constitute a +// "derivative work" for the purpose of this license if it does any of the +// following: +// 1. Integrates source code from Notepad++. +// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable +// installer, such as those produced by InstallShield. +// 3. Links to a library or executes a program that does any of the above. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#include +#include +#include +#include "Parameters.h" +#include "FileDialog.h" +#include "ScintillaEditView.h" +#include "keys.h" +#include "localization.h" +#include "localizationString.h" +#include "UserDefineDialog.h" + +using namespace std; + + +namespace // anonymous namespace +{ + + +struct WinMenuKeyDefinition //more or less matches accelerator table definition, easy copy/paste +{ + //const TCHAR * name; //name retrieved from menu? + int vKey; + int functionId; + bool isCtrl; + bool isAlt; + bool isShift; + TCHAR * specialName; //Used when no real menu name exists (in case of toggle for example) +}; + + +struct ScintillaKeyDefinition +{ + const TCHAR * name; + int functionId; + bool isCtrl; + bool isAlt; + bool isShift; + int vKey; + int redirFunctionId; //this gets set when a function is being redirected through Notepad++ if Scintilla doesnt do it properly :) +}; + + +/*! +** \brief array of accelerator keys for all std menu items +** +** values can be 0 for vKey, which means its unused +*/ +static const WinMenuKeyDefinition winKeyDefs[] = +{ + // V_KEY, COMMAND_ID, Ctrl, Alt, Shift, cmdName + // ------------------------------------------------------------------------------------- + // + { VK_N, IDM_FILE_NEW, true, false, false, nullptr }, + { VK_O, IDM_FILE_OPEN, true, false, false, nullptr }, + { VK_NULL, IDM_FILE_OPEN_FOLDER, false, false, false, nullptr }, + { VK_NULL, IDM_FILE_OPEN_CMD, false, false, false, nullptr }, + { VK_NULL, IDM_FILE_OPEN_DEFAULT_VIEWER, false, false, false, nullptr }, + { VK_NULL, IDM_FILE_OPENFOLDERASWORSPACE, false, false, false, nullptr }, + { VK_NULL, IDM_FILE_RELOAD, false, false, false, nullptr }, + { VK_S, IDM_FILE_SAVE, true, false, false, nullptr }, + { VK_S, IDM_FILE_SAVEAS, true, true, false, nullptr }, + { VK_NULL, IDM_FILE_SAVECOPYAS, false, false, false, nullptr }, + { VK_S, IDM_FILE_SAVEALL, true, false, true, nullptr }, + { VK_NULL, IDM_FILE_RENAME, false, false, false, nullptr }, + { VK_W, IDM_FILE_CLOSE, true, false, false, nullptr }, + { VK_W, IDM_FILE_CLOSEALL, true, false, true, nullptr }, + { VK_NULL, IDM_FILE_CLOSEALL_BUT_CURRENT, false, false, false, nullptr }, + { VK_NULL, IDM_FILE_CLOSEALL_TOLEFT, false, false, false, nullptr }, + { VK_NULL, IDM_FILE_CLOSEALL_TORIGHT, false, false, false, nullptr }, + { VK_NULL, IDM_FILE_DELETE, false, false, false, nullptr }, + { VK_NULL, IDM_FILE_LOADSESSION, false, false, false, nullptr }, + { VK_NULL, IDM_FILE_SAVESESSION, false, false, false, nullptr }, + { VK_P, IDM_FILE_PRINT, true, false, false, nullptr }, + { VK_NULL, IDM_FILE_PRINTNOW, false, false, false, nullptr }, + { VK_F4, IDM_FILE_EXIT, false, true, false, nullptr }, + { VK_T, IDM_FILE_RESTORELASTCLOSEDFILE, true, false, true, TEXT("Restore Recent Closed File")}, + +// { VK_NULL, IDM_EDIT_UNDO, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_REDO, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_CUT, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_COPY, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_PASTE, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_DELETE, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_SELECTALL, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_BEGINENDSELECT, false, false, false, nullptr }, + + { VK_NULL, IDM_EDIT_FULLPATHTOCLIP, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_FILENAMETOCLIP, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_CURRENTDIRTOCLIP, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_INS_TAB, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_RMV_TAB, false, false, false, nullptr }, + { VK_U, IDM_EDIT_UPPERCASE, true, false, true, nullptr }, + { VK_U, IDM_EDIT_LOWERCASE, true, false, false, nullptr }, + { VK_U, IDM_EDIT_PROPERCASE_FORCE, false, true, false, nullptr }, + { VK_U, IDM_EDIT_PROPERCASE_BLEND, false, true, true, nullptr }, + { VK_U, IDM_EDIT_SENTENCECASE_FORCE, true, true, false, nullptr }, + { VK_U, IDM_EDIT_SENTENCECASE_BLEND, true, true, true, nullptr }, + { VK_NULL, IDM_EDIT_INVERTCASE, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_RANDOMCASE, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_DUP_LINE, false, false, false, nullptr }, + { VK_I, IDM_EDIT_SPLIT_LINES, true, false, false, nullptr }, + { VK_J, IDM_EDIT_JOIN_LINES, true, false, false, nullptr }, + { VK_UP, IDM_EDIT_LINE_UP, true, false, true, nullptr }, + { VK_DOWN, IDM_EDIT_LINE_DOWN, true, false, true, nullptr }, + { VK_NULL, IDM_EDIT_REMOVEEMPTYLINES, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_REMOVEEMPTYLINESWITHBLANK, false, false, false, nullptr }, + { VK_RETURN, IDM_EDIT_BLANKLINEABOVECURRENT, true, true, false, nullptr }, + { VK_RETURN, IDM_EDIT_BLANKLINEBELOWCURRENT, true, true, true, nullptr }, + { VK_NULL, IDM_EDIT_SORTLINES_LEXICOGRAPHIC_ASCENDING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SORTLINES_LEXICOGRAPHIC_DESCENDING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SORTLINES_INTEGER_ASCENDING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SORTLINES_INTEGER_DESCENDING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SORTLINES_DECIMALCOMMA_ASCENDING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SORTLINES_DECIMALCOMMA_DESCENDING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SORTLINES_DECIMALDOT_ASCENDING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING, false, false, false, nullptr }, + { VK_Q, IDM_EDIT_BLOCK_COMMENT, true, false, false, nullptr }, + { VK_K, IDM_EDIT_BLOCK_COMMENT_SET, true, false, false, nullptr }, + { VK_K, IDM_EDIT_BLOCK_UNCOMMENT, true, false, true, nullptr }, + { VK_Q, IDM_EDIT_STREAM_COMMENT, true, false, true, nullptr }, + { VK_NULL, IDM_EDIT_STREAM_UNCOMMENT, false, false, false, nullptr }, + { VK_SPACE, IDM_EDIT_AUTOCOMPLETE, true, false, false, nullptr }, + { VK_SPACE, IDM_EDIT_AUTOCOMPLETE_PATH, true, true, false, nullptr }, + { VK_RETURN, IDM_EDIT_AUTOCOMPLETE_CURRENTFILE, true, false, false, nullptr }, + { VK_SPACE, IDM_EDIT_FUNCCALLTIP, true, false, true, nullptr }, + { VK_NULL, IDM_FORMAT_TODOS, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_TOMAC, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_TRIMTRAILING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_TRIMLINEHEAD, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_TRIM_BOTH, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_EOL2WS, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_TRIMALL, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_TAB2SW, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SW2TAB_ALL, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SW2TAB_LEADING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_PASTE_AS_HTML, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_PASTE_AS_RTF, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_COPY_BINARY, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_CUT_BINARY, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_PASTE_BINARY, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_OPENASFILE, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_OPENINFOLDER, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SEARCHONINTERNET, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_CHANGESEARCHENGINE, false, false, false, nullptr }, +// { VK_NULL, IDM_EDIT_COLUMNMODETIP, false, false, false, nullptr }, + { VK_C, IDM_EDIT_COLUMNMODE, false, true, false, nullptr }, + { VK_NULL, IDM_EDIT_CHAR_PANEL, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_CLIPBOARDHISTORY_PANEL, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SETREADONLY, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_CLEARREADONLY, false, false, false, nullptr }, + { VK_F, IDM_SEARCH_FIND, true, false, false, nullptr }, + { VK_F, IDM_SEARCH_FINDINFILES, true, false, true, nullptr }, + { VK_F3, IDM_SEARCH_FINDNEXT, false, false, false, nullptr }, + { VK_F3, IDM_SEARCH_FINDPREV, false, false, true, nullptr }, + { VK_F3, IDM_SEARCH_SETANDFINDNEXT, true, false, false, nullptr }, + { VK_F3, IDM_SEARCH_SETANDFINDPREV, true, false, true, nullptr }, + { VK_F3, IDM_SEARCH_VOLATILE_FINDNEXT, true, true, false, nullptr }, + { VK_F3, IDM_SEARCH_VOLATILE_FINDPREV, true, true, true, nullptr }, + { VK_H, IDM_SEARCH_REPLACE, true, false, false, nullptr }, + { VK_I, IDM_SEARCH_FINDINCREMENT, true, true, false, nullptr }, + { VK_F7, IDM_FOCUS_ON_FOUND_RESULTS, false, false, false, nullptr }, + { VK_F4, IDM_SEARCH_GOTOPREVFOUND, false, false, true, nullptr }, + { VK_F4, IDM_SEARCH_GOTONEXTFOUND, false, false, false, nullptr }, + { VK_G, IDM_SEARCH_GOTOLINE, true, false, false, nullptr }, + { VK_B, IDM_SEARCH_GOTOMATCHINGBRACE, true, false, false, nullptr }, + { VK_B, IDM_SEARCH_SELECTMATCHINGBRACES, true, true, false, nullptr }, + { VK_NULL, IDM_SEARCH_MARK, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_MARKALLEXT1, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_MARKALLEXT2, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_MARKALLEXT3, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_MARKALLEXT4, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_MARKALLEXT5, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_UNMARKALLEXT1, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_UNMARKALLEXT2, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_UNMARKALLEXT3, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_UNMARKALLEXT4, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_UNMARKALLEXT5, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_CLEARALLMARKS, false, false, false, nullptr }, + { VK_1, IDM_SEARCH_GOPREVMARKER1, true, false, true, nullptr }, + { VK_2, IDM_SEARCH_GOPREVMARKER2, true, false, true, nullptr }, + { VK_3, IDM_SEARCH_GOPREVMARKER3, true, false, true, nullptr }, + { VK_4, IDM_SEARCH_GOPREVMARKER4, true, false, true, nullptr }, + { VK_5, IDM_SEARCH_GOPREVMARKER5, true, false, true, nullptr }, + { VK_0, IDM_SEARCH_GOPREVMARKER_DEF, true, false, true, nullptr }, + { VK_1, IDM_SEARCH_GONEXTMARKER1, true, false, false, nullptr }, + { VK_2, IDM_SEARCH_GONEXTMARKER2, true, false, false, nullptr }, + { VK_3, IDM_SEARCH_GONEXTMARKER3, true, false, false, nullptr }, + { VK_4, IDM_SEARCH_GONEXTMARKER4, true, false, false, nullptr }, + { VK_5, IDM_SEARCH_GONEXTMARKER5, true, false, false, nullptr }, + { VK_0, IDM_SEARCH_GONEXTMARKER_DEF, true, false, false, nullptr }, + + { VK_F2, IDM_SEARCH_TOGGLE_BOOKMARK, true, false, false, nullptr }, + { VK_F2, IDM_SEARCH_NEXT_BOOKMARK, false, false, false, nullptr }, + { VK_F2, IDM_SEARCH_PREV_BOOKMARK, false, false, true, nullptr }, + { VK_NULL, IDM_SEARCH_CLEAR_BOOKMARKS, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_CUTMARKEDLINES, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_COPYMARKEDLINES, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_PASTEMARKEDLINES, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_DELETEMARKEDLINES, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_DELETEUNMARKEDLINES, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_INVERSEMARKS, false, false, false, nullptr }, + { VK_NULL, IDM_SEARCH_FINDCHARINRANGE, false, false, false, nullptr }, + + { VK_NULL, IDM_VIEW_ALWAYSONTOP, false, false, false, nullptr }, + { VK_F11, IDM_VIEW_FULLSCREENTOGGLE, false, false, false, nullptr }, + {VK_F12, IDM_VIEW_POSTIT, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_TAB_SPACE, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_EOL, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_ALL_CHARACTERS, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_INDENT_GUIDE, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_WRAP_SYMBOL, false, false, false, nullptr }, +// { VK_NULL, IDM_VIEW_ZOOMIN, false, false, false, nullptr }, +// { VK_NULL, IDM_VIEW_ZOOMOUT, false, false, false, nullptr }, +// { VK_NULL, IDM_VIEW_ZOOMRESTORE, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_GOTO_ANOTHER_VIEW, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_CLONE_TO_ANOTHER_VIEW, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_GOTO_NEW_INSTANCE, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_LOAD_IN_NEW_INSTANCE, false, false, false, nullptr }, + + { VK_NUMPAD1, IDM_VIEW_TAB1, true, false, false, nullptr }, + { VK_NUMPAD2, IDM_VIEW_TAB2, true, false, false, nullptr }, + { VK_NUMPAD3, IDM_VIEW_TAB3, true, false, false, nullptr }, + { VK_NUMPAD4, IDM_VIEW_TAB4, true, false, false, nullptr }, + { VK_NUMPAD5, IDM_VIEW_TAB5, true, false, false, nullptr }, + { VK_NUMPAD6, IDM_VIEW_TAB6, true, false, false, nullptr }, + { VK_NUMPAD7, IDM_VIEW_TAB7, true, false, false, nullptr }, + { VK_NUMPAD8, IDM_VIEW_TAB8, true, false, false, nullptr }, + { VK_NUMPAD9, IDM_VIEW_TAB9, true, false, false, nullptr }, + { VK_NEXT, IDM_VIEW_TAB_NEXT, true, false, false, nullptr }, + { VK_PRIOR, IDM_VIEW_TAB_PREV, true, false, false, nullptr }, + { VK_NEXT, IDM_VIEW_TAB_MOVEFORWARD, true, false, true, nullptr }, + { VK_PRIOR, IDM_VIEW_TAB_MOVEBACKWARD, true, false, true, nullptr }, + { VK_TAB, IDC_PREV_DOC, true, false, true, TEXT("Switch to previous document") }, + { VK_TAB, IDC_NEXT_DOC, true, false, false, TEXT("Switch to next document") }, + { VK_NULL, IDM_VIEW_WRAP, false, false, false, nullptr }, + { VK_H, IDM_VIEW_HIDELINES, false, true, false, nullptr }, + { VK_F8, IDM_VIEW_SWITCHTO_OTHER_VIEW, false, false, false, nullptr }, + + { VK_0, IDM_VIEW_TOGGLE_FOLDALL, false, true, false, nullptr }, + { VK_0, IDM_VIEW_TOGGLE_UNFOLDALL, false, true, true, nullptr }, + { VK_F, IDM_VIEW_FOLD_CURRENT, true, true, false, nullptr }, + { VK_F, IDM_VIEW_UNFOLD_CURRENT, true, true, true, nullptr }, + { VK_1, IDM_VIEW_FOLD_1, false, true, false, nullptr }, + { VK_2, IDM_VIEW_FOLD_2, false, true, false, nullptr }, + { VK_3, IDM_VIEW_FOLD_3, false, true, false, nullptr }, + { VK_4, IDM_VIEW_FOLD_4, false, true, false, nullptr }, + { VK_5, IDM_VIEW_FOLD_5, false, true, false, nullptr }, + { VK_6, IDM_VIEW_FOLD_6, false, true, false, nullptr }, + { VK_7, IDM_VIEW_FOLD_7, false, true, false, nullptr }, + { VK_8, IDM_VIEW_FOLD_8, false, true, false, nullptr }, + + { VK_1, IDM_VIEW_UNFOLD_1, false, true, true, nullptr }, + { VK_2, IDM_VIEW_UNFOLD_2, false, true, true, nullptr }, + { VK_3, IDM_VIEW_UNFOLD_3, false, true, true, nullptr }, + { VK_4, IDM_VIEW_UNFOLD_4, false, true, true, nullptr }, + { VK_5, IDM_VIEW_UNFOLD_5, false, true, true, nullptr }, + { VK_6, IDM_VIEW_UNFOLD_6, false, true, true, nullptr }, + { VK_7, IDM_VIEW_UNFOLD_7, false, true, true, nullptr }, + { VK_8, IDM_VIEW_UNFOLD_8, false, true, true, nullptr }, + { VK_NULL, IDM_VIEW_SUMMARY, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_PROJECT_PANEL_1, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_PROJECT_PANEL_2, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_PROJECT_PANEL_3, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_FILEBROWSER, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_DOC_MAP, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_FUNC_LIST, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_SYNSCROLLV, false, false, false, nullptr }, + { VK_NULL, IDM_VIEW_SYNSCROLLH, false, false, false, nullptr }, + { VK_R, IDM_EDIT_RTL, true, true, false, nullptr }, + { VK_L, IDM_EDIT_LTR, true, true, false, nullptr }, + { VK_NULL, IDM_VIEW_MONITORING, false, false, false, nullptr }, + + { VK_NULL, IDM_FORMAT_ANSI, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_AS_UTF_8, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_UTF_8, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_UCS_2BE, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_UCS_2LE, false, false, false, nullptr }, + + { VK_NULL, IDM_FORMAT_ISO_8859_6, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_WIN_1256, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_13, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_WIN_1257, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_14, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_5, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_MAC_CYRILLIC, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_KOI8R_CYRILLIC, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_KOI8U_CYRILLIC, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_WIN_1251, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_WIN_1250, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_437, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_720, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_737, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_775, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_850, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_852, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_855, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_857, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_858, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_860, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_861, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_862, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_863, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_865, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_866, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_DOS_869, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_BIG5, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_GB2312, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_2, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_7, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_WIN_1253, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_8, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_WIN_1255, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_SHIFT_JIS, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_EUC_KR, false, false, false, nullptr }, + //{ VK_NULL, IDM_FORMAT_ISO_8859_10, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_15, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_4, false, false, false, nullptr }, + //{ VK_NULL, IDM_FORMAT_ISO_8859_16, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_3, false, false, false, nullptr }, + //{ VK_NULL, IDM_FORMAT_ISO_8859_11, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_TIS_620, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_9, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_WIN_1254, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_WIN_1252, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_ISO_8859_1, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_WIN_1258, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_CONV2_ANSI, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_CONV2_AS_UTF_8, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_CONV2_UTF_8, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_CONV2_UCS_2BE, false, false, false, nullptr }, + { VK_NULL, IDM_FORMAT_CONV2_UCS_2LE, false, false, false, nullptr }, + + { VK_NULL, IDM_LANG_USER_DLG, false, false, false, nullptr }, + { VK_NULL, IDM_LANG_USER, false, false, false, nullptr }, + + { VK_NULL, IDM_SETTING_PREFERECE, false, false, false, nullptr }, + { VK_NULL, IDM_LANGSTYLE_CONFIG_DLG, false, false, false, nullptr }, + { VK_NULL, IDM_SETTING_SHORTCUT_MAPPER, false, false, false, nullptr }, + { VK_NULL, IDM_SETTING_IMPORTPLUGIN, false, false, false, nullptr }, + { VK_NULL, IDM_SETTING_IMPORTSTYLETHEMS, false, false, false, nullptr }, + { VK_NULL, IDM_SETTING_EDITCONTEXTMENU, false, false, false, nullptr }, + + { VK_R, IDC_EDIT_TOGGLEMACRORECORDING, true, false, true, TEXT("Toggle macro record")}, + { VK_NULL, IDM_MACRO_STARTRECORDINGMACRO, false, false, false, nullptr }, + { VK_NULL, IDM_MACRO_STOPRECORDINGMACRO, false, false, false, nullptr }, + { VK_P, IDM_MACRO_PLAYBACKRECORDEDMACRO, true, false, true, nullptr }, + { VK_NULL, IDM_MACRO_SAVECURRENTMACRO, false, false, false, nullptr }, + { VK_NULL, IDM_MACRO_RUNMULTIMACRODLG, false, false, false, nullptr }, + + { VK_F5, IDM_EXECUTE, false, false, false, nullptr }, + + { VK_NULL, IDM_CMDLINEARGUMENTS, false, false, false, nullptr }, + { VK_NULL, IDM_HOMESWEETHOME, false, false, false, nullptr }, + { VK_NULL, IDM_PROJECTPAGE, false, false, false, nullptr }, +// { VK_NULL, IDM_ONLINEHELP, false, false, false, nullptr }, + { VK_NULL, IDM_FORUM, false, false, false, nullptr }, + { VK_NULL, IDM_ONLINESUPPORT, false, false, false, nullptr }, + { VK_NULL, IDM_PLUGINSHOME, false, false, false, nullptr }, + { VK_NULL, IDM_UPDATE_NPP, false, false, false, nullptr }, + { VK_NULL, IDM_CONFUPDATERPROXY, false, false, false, nullptr }, + { VK_NULL, IDM_DEBUGINFO, false, false, false, nullptr }, + { VK_F1, IDM_ABOUT, false, false, false, nullptr } +// { VK_F1, IDM_HELP, false, false, true, nullptr } +}; + + + + +/*! +** \brief array of accelerator keys for all possible scintilla functions +** +** values can be 0 for vKey, which means its unused +*/ +static const ScintillaKeyDefinition scintKeyDefs[] = +{ + {TEXT("SCI_CUT"), SCI_CUT, true, false, false, VK_X, IDM_EDIT_CUT}, + {TEXT(""), SCI_CUT, false, false, true, VK_DELETE, 0}, + {TEXT("SCI_COPY"), SCI_COPY, true, false, false, VK_C, IDM_EDIT_COPY}, + {TEXT(""), SCI_COPY, true, false, false, VK_INSERT, 0}, + {TEXT("SCI_PASTE"), SCI_PASTE, true, false, false, VK_V, IDM_EDIT_PASTE}, + {TEXT(""), SCI_PASTE, false, false, true, VK_INSERT, 0}, + {TEXT("SCI_SELECTALL"), SCI_SELECTALL, true, false, false, VK_A, IDM_EDIT_SELECTALL}, + {TEXT("SCI_CLEAR"), SCI_CLEAR, false, false, false, VK_DELETE, IDM_EDIT_DELETE}, + {TEXT("SCI_CLEARALL"), SCI_CLEARALL, false, false, false, 0, 0}, + {TEXT("SCI_UNDO"), SCI_UNDO, true, false, false, VK_Z, IDM_EDIT_UNDO}, + {TEXT(""), SCI_UNDO, false, true, false, VK_BACK, 0}, + {TEXT("SCI_REDO"), SCI_REDO, true, false, false, VK_Y, IDM_EDIT_REDO}, + {TEXT(""), SCI_REDO, true, false, true, VK_Z, 0}, + {TEXT("SCI_NEWLINE"), SCI_NEWLINE, false, false, false, VK_RETURN, 0}, + {TEXT(""), SCI_NEWLINE, false, false, true, VK_RETURN, 0}, + {TEXT("SCI_TAB"), SCI_TAB, false, false, false, VK_TAB, IDM_EDIT_INS_TAB}, + {TEXT("SCI_BACKTAB"), SCI_BACKTAB, false, false, true, VK_TAB, IDM_EDIT_RMV_TAB}, + {TEXT("SCI_FORMFEED"), SCI_FORMFEED, false, false, false, 0, 0}, + {TEXT("SCI_ZOOMIN"), SCI_ZOOMIN, true, false, false, VK_ADD, IDM_VIEW_ZOOMIN}, + {TEXT("SCI_ZOOMOUT"), SCI_ZOOMOUT, true, false, false, VK_SUBTRACT, IDM_VIEW_ZOOMOUT}, + {TEXT("SCI_SETZOOM"), SCI_SETZOOM, true, false, false, VK_DIVIDE, IDM_VIEW_ZOOMRESTORE}, + {TEXT("SCI_SELECTIONDUPLICATE"), SCI_SELECTIONDUPLICATE, true, false, false, VK_D, IDM_EDIT_DUP_LINE}, + {TEXT("SCI_LINESJOIN"), SCI_LINESJOIN, false, false, false, 0, 0}, + {TEXT("SCI_SCROLLCARET"), SCI_SCROLLCARET, false, false, false, 0, 0}, + {TEXT("SCI_EDITTOGGLEOVERTYPE"), SCI_EDITTOGGLEOVERTYPE, false, false, false, VK_INSERT, 0}, + {TEXT("SCI_MOVECARETINSIDEVIEW"), SCI_MOVECARETINSIDEVIEW, false, false, false, 0, 0}, + {TEXT("SCI_LINEDOWN"), SCI_LINEDOWN, false, false, false, VK_DOWN, 0}, + {TEXT("SCI_LINEDOWNEXTEND"), SCI_LINEDOWNEXTEND, false, false, true, VK_DOWN, 0}, + {TEXT("SCI_LINEDOWNRECTEXTEND"), SCI_LINEDOWNRECTEXTEND, false, true, true, VK_DOWN, 0}, + {TEXT("SCI_LINESCROLLDOWN"), SCI_LINESCROLLDOWN, true, false, false, VK_DOWN, 0}, + {TEXT("SCI_LINEUP"), SCI_LINEUP, false, false, false, VK_UP, 0}, + {TEXT("SCI_LINEUPEXTEND"), SCI_LINEUPEXTEND, false, false, true, VK_UP, 0}, + {TEXT("SCI_LINEUPRECTEXTEND"), SCI_LINEUPRECTEXTEND, false, true, true, VK_UP, 0}, + {TEXT("SCI_LINESCROLLUP"), SCI_LINESCROLLUP, true, false, false, VK_UP, 0}, + {TEXT("SCI_PARADOWN"), SCI_PARADOWN, true, false, false, VK_OEM_6, 0}, + {TEXT("SCI_PARADOWNEXTEND"), SCI_PARADOWNEXTEND, true, false, true, VK_OEM_6, 0}, + {TEXT("SCI_PARAUP"), SCI_PARAUP, true, false, false, VK_OEM_4, 0}, + {TEXT("SCI_PARAUPEXTEND"), SCI_PARAUPEXTEND, true, false, true, VK_OEM_4, 0}, + {TEXT("SCI_CHARLEFT"), SCI_CHARLEFT, false, false, false, VK_LEFT, 0}, + {TEXT("SCI_CHARLEFTEXTEND"), SCI_CHARLEFTEXTEND, false, false, true, VK_LEFT, 0}, + {TEXT("SCI_CHARLEFTRECTEXTEND"), SCI_CHARLEFTRECTEXTEND, false, true, true, VK_LEFT, 0}, + {TEXT("SCI_CHARRIGHT"), SCI_CHARRIGHT, false, false, false, VK_RIGHT, 0}, + {TEXT("SCI_CHARRIGHTEXTEND"), SCI_CHARRIGHTEXTEND, false, false, true, VK_RIGHT, 0}, + {TEXT("SCI_CHARRIGHTRECTEXTEND"), SCI_CHARRIGHTRECTEXTEND, false, true, true, VK_RIGHT, 0}, + {TEXT("SCI_WORDLEFT"), SCI_WORDLEFT, true, false, false, VK_LEFT, 0}, + {TEXT("SCI_WORDLEFTEXTEND"), SCI_WORDLEFTEXTEND, true, false, true, VK_LEFT, 0}, + {TEXT("SCI_WORDRIGHT"), SCI_WORDRIGHT, true, false, false, VK_RIGHT, 0}, + {TEXT("SCI_WORDRIGHTEXTEND"), SCI_WORDRIGHTEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_WORDLEFTEND"), SCI_WORDLEFTEND, false, false, false, 0, 0}, + {TEXT("SCI_WORDLEFTENDEXTEND"), SCI_WORDLEFTENDEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_WORDRIGHTEND"), SCI_WORDRIGHTEND, false, false, false, 0, 0}, + {TEXT("SCI_WORDRIGHTENDEXTEND"), SCI_WORDRIGHTENDEXTEND, true, false, true, VK_RIGHT, 0}, + {TEXT("SCI_WORDPARTLEFT"), SCI_WORDPARTLEFT, true, false, false, VK_OEM_2, 0}, + {TEXT("SCI_WORDPARTLEFTEXTEND"), SCI_WORDPARTLEFTEXTEND, true, false, true, VK_OEM_2, 0}, + {TEXT("SCI_WORDPARTRIGHT"), SCI_WORDPARTRIGHT, true, false, false, VK_OEM_5, 0}, + {TEXT("SCI_WORDPARTRIGHTEXTEND"), SCI_WORDPARTRIGHTEXTEND, true, false, true, VK_OEM_5, 0}, + {TEXT("SCI_HOME"), SCI_HOME, false, false, false, 0, 0}, + {TEXT("SCI_HOMEEXTEND"), SCI_HOMEEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_HOMERECTEXTEND"), SCI_HOMERECTEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_HOMEDISPLAY"), SCI_HOMEDISPLAY, false, true, false, VK_HOME, 0}, + {TEXT("SCI_HOMEDISPLAYEXTEND"), SCI_HOMEDISPLAYEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_HOMEWRAP"), SCI_HOMEWRAP, false, false, false, 0, 0}, + {TEXT("SCI_HOMEWRAPEXTEND"), SCI_HOMEWRAPEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_VCHOME"), SCI_VCHOME, false, false, false, 0, 0}, + {TEXT("SCI_VCHOMEWRAPEXTEND"), SCI_VCHOMEWRAPEXTEND, false, false, true, VK_HOME, 0}, + {TEXT("SCI_VCHOMERECTEXTEND"), SCI_VCHOMERECTEXTEND, false, true, true, VK_HOME, 0}, + {TEXT("SCI_VCHOMEWRAP"), SCI_VCHOMEWRAP, false, false, false, VK_HOME, 0}, + {TEXT("SCI_LINEEND"), SCI_LINEEND, false, false, false, 0, 0}, + {TEXT("SCI_LINEENDWRAPEXTEND"), SCI_LINEENDWRAPEXTEND, false, false, true, VK_END, 0}, + {TEXT("SCI_LINEENDRECTEXTEND"), SCI_LINEENDRECTEXTEND, false, true, true, VK_END, 0}, + {TEXT("SCI_LINEENDDISPLAY"), SCI_LINEENDDISPLAY, false, true, false, VK_END, 0}, + {TEXT("SCI_LINEENDDISPLAYEXTEND"), SCI_LINEENDDISPLAYEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_LINEENDWRAP"), SCI_LINEENDWRAP, false, false, false, VK_END, 0}, + {TEXT("SCI_LINEENDEXTEND"), SCI_LINEENDEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_DOCUMENTSTART"), SCI_DOCUMENTSTART, true, false, false, VK_HOME, 0}, + {TEXT("SCI_DOCUMENTSTARTEXTEND"), SCI_DOCUMENTSTARTEXTEND, true, false, true, VK_HOME, 0}, + {TEXT("SCI_DOCUMENTEND"), SCI_DOCUMENTEND, true, false, false, VK_END, 0}, + {TEXT("SCI_DOCUMENTENDEXTEND"), SCI_DOCUMENTENDEXTEND, true, false, true, VK_END, 0}, + {TEXT("SCI_PAGEUP"), SCI_PAGEUP, false, false, false, VK_PRIOR, 0}, + {TEXT("SCI_PAGEUPEXTEND"), SCI_PAGEUPEXTEND, false, false, true, VK_PRIOR, 0}, + {TEXT("SCI_PAGEUPRECTEXTEND"), SCI_PAGEUPRECTEXTEND, false, true, true, VK_PRIOR, 0}, + {TEXT("SCI_PAGEDOWN"), SCI_PAGEDOWN, false, false, false, VK_NEXT, 0}, + {TEXT("SCI_PAGEDOWNEXTEND"), SCI_PAGEDOWNEXTEND, false, false, true, VK_NEXT, 0}, + {TEXT("SCI_PAGEDOWNRECTEXTEND"), SCI_PAGEDOWNRECTEXTEND, false, true, true, VK_NEXT, 0}, + {TEXT("SCI_STUTTEREDPAGEUP"), SCI_STUTTEREDPAGEUP, false, false, false, 0, 0}, + {TEXT("SCI_STUTTEREDPAGEUPEXTEND"), SCI_STUTTEREDPAGEUPEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_STUTTEREDPAGEDOWN"), SCI_STUTTEREDPAGEDOWN, false, false, false, 0, 0}, + {TEXT("SCI_STUTTEREDPAGEDOWNEXTEND"), SCI_STUTTEREDPAGEDOWNEXTEND, false, false, false, 0, 0}, + {TEXT("SCI_DELETEBACK"), SCI_DELETEBACK, false, false, false, VK_BACK, 0}, + {TEXT(""), SCI_DELETEBACK, false, false, true, VK_BACK, 0}, + {TEXT("SCI_DELETEBACKNOTLINE"), SCI_DELETEBACKNOTLINE, false, false, false, 0, 0}, + {TEXT("SCI_DELWORDLEFT"), SCI_DELWORDLEFT, true, false, false, VK_BACK, 0}, + {TEXT("SCI_DELWORDRIGHT"), SCI_DELWORDRIGHT, true, false, false, VK_DELETE, 0}, + {TEXT("SCI_DELLINELEFT"), SCI_DELLINELEFT, true, false, true, VK_BACK, 0}, + {TEXT("SCI_DELLINERIGHT"), SCI_DELLINERIGHT, true, false, true, VK_DELETE, 0}, + {TEXT("SCI_LINEDELETE"), SCI_LINEDELETE, true, false, true, VK_L, 0}, + {TEXT("SCI_LINECUT"), SCI_LINECUT, true, false, false, VK_L, 0}, + {TEXT("SCI_LINECOPY"), SCI_LINECOPY, true, false, true, VK_X, 0}, + {TEXT("SCI_LINETRANSPOSE"), SCI_LINETRANSPOSE, true, false, false, VK_T, 0}, + {TEXT("SCI_LINEDUPLICATE"), SCI_LINEDUPLICATE, false, false, false, 0, 0}, + {TEXT("SCI_CANCEL"), SCI_CANCEL, false, false, false, VK_ESCAPE, 0}, + {TEXT("SCI_SWAPMAINANCHORCARET"), SCI_SWAPMAINANCHORCARET, false, false, false, 0, 0}, + {TEXT("SCI_ROTATESELECTION"), SCI_ROTATESELECTION, false, false, false, 0, 0} +}; + + +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); + +int strVal(const TCHAR *str, int base) +{ + if (!str) return -1; + if (!str[0]) return 0; + + TCHAR *finStr; + int result = generic_strtol(str, &finStr, base); + if (*finStr != '\0') + return -1; + return result; +} + + +int decStrVal(const TCHAR *str) +{ + return strVal(str, 10); +} + +int hexStrVal(const TCHAR *str) +{ + return strVal(str, 16); +} + +int getKwClassFromName(const TCHAR *str) +{ + if (!lstrcmp(TEXT("instre1"), str)) return LANG_INDEX_INSTR; + if (!lstrcmp(TEXT("instre2"), str)) return LANG_INDEX_INSTR2; + if (!lstrcmp(TEXT("type1"), str)) return LANG_INDEX_TYPE; + if (!lstrcmp(TEXT("type2"), str)) return LANG_INDEX_TYPE2; + if (!lstrcmp(TEXT("type3"), str)) return LANG_INDEX_TYPE3; + if (!lstrcmp(TEXT("type4"), str)) return LANG_INDEX_TYPE4; + if (!lstrcmp(TEXT("type5"), str)) return LANG_INDEX_TYPE5; + + if ((str[1] == '\0') && (str[0] >= '0') && (str[0] <= '8')) // up to KEYWORDSET_MAX + return str[0] - '0'; + + return -1; +} + + +size_t getAsciiLenFromBase64Len(size_t base64StrLen) +{ + return (base64StrLen % 4) ? 0 : (base64StrLen - base64StrLen / 4); +} + + +int base64ToAscii(char *dest, const char *base64Str) +{ + static const int base64IndexArray[123] = + { + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 62, -1, -1, -1, 63, + 52, 53, 54, 55 ,56, 57, 58, 59, + 60, 61, -1, -1, -1, -1, -1, -1, + -1, 0, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, -1, -1, -1, -1 ,-1, + -1, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51 + }; + + size_t b64StrLen = strlen(base64Str); + size_t nbLoop = b64StrLen / 4; + + size_t i = 0; + int k = 0; + + enum {b64_just, b64_1padded, b64_2padded} padd = b64_just; + for ( ; i < nbLoop ; i++) + { + size_t j = i * 4; + UCHAR uc0, uc1, uc2, uc3, p0, p1; + + uc0 = (UCHAR)base64IndexArray[base64Str[j]]; + uc1 = (UCHAR)base64IndexArray[base64Str[j+1]]; + uc2 = (UCHAR)base64IndexArray[base64Str[j+2]]; + uc3 = (UCHAR)base64IndexArray[base64Str[j+3]]; + + if ((uc0 == -1) || (uc1 == -1) || (uc2 == -1) || (uc3 == -1)) + return -1; + + if (base64Str[j+2] == '=') // && (uc3 == '=') + { + uc2 = uc3 = 0; + padd = b64_2padded; + } + else if (base64Str[j+3] == '=') + { + uc3 = 0; + padd = b64_1padded; + } + + p0 = uc0 << 2; + p1 = uc1 << 2; + p1 >>= 6; + dest[k++] = p0 | p1; + + p0 = uc1 << 4; + p1 = uc2 << 2; + p1 >>= 4; + dest[k++] = p0 | p1; + + p0 = uc2 << 6; + p1 = uc3; + dest[k++] = p0 | p1; + } + + //dest[k] = '\0'; + if (padd == b64_1padded) + // dest[k-1] = '\0'; + return k-1; + else if (padd == b64_2padded) + // dest[k-2] = '\0'; + return k-2; + + return k; +} + +} // anonymous namespace + + +void cutString(const TCHAR* str2cut, vector& patternVect) +{ + if (str2cut == nullptr) return; + + const TCHAR *pBegin = str2cut; + const TCHAR *pEnd = pBegin; + + while (*pEnd != '\0') + { + if (_istspace(*pEnd)) + { + if (pBegin != pEnd) + patternVect.emplace_back(pBegin, pEnd); + pBegin = pEnd + 1; + + } + ++pEnd; + } + + if (pBegin != pEnd) + patternVect.emplace_back(pBegin, pEnd); +} + + +std::wstring LocalizationSwitcher::getLangFromXmlFileName(const wchar_t *fn) const +{ + size_t nbItem = sizeof(localizationDefs)/sizeof(LocalizationSwitcher::LocalizationDefinition); + for (size_t i = 0 ; i < nbItem ; ++i) + { + if (0 == wcsicmp(fn, localizationDefs[i]._xmlFileName)) + return localizationDefs[i]._langName; + } + return std::wstring(); +} + + +std::wstring LocalizationSwitcher::getXmlFilePathFromLangName(const wchar_t *langName) const +{ + for (size_t i = 0, len = _localizationList.size(); i < len ; ++i) + { + if (0 == wcsicmp(langName, _localizationList[i].first.c_str())) + return _localizationList[i].second; + } + return std::wstring(); +} + + +bool LocalizationSwitcher::addLanguageFromXml(wstring xmlFullPath) +{ + wchar_t * fn = ::PathFindFileNameW(xmlFullPath.c_str()); + wstring foundLang = getLangFromXmlFileName(fn); + if (not foundLang.empty()) + { + _localizationList.push_back(pair(foundLang, xmlFullPath)); + return true; + } + return false; +} + + +bool LocalizationSwitcher::switchToLang(wchar_t *lang2switch) const +{ + wstring langPath = getXmlFilePathFromLangName(lang2switch); + if (langPath.empty()) + return false; + + return ::CopyFileW(langPath.c_str(), _nativeLangPath.c_str(), FALSE) != FALSE; +} + + +generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) const +{ + if (!xmlFullPath || !xmlFullPath[0]) + return generic_string(); + generic_string fn(::PathFindFileName(xmlFullPath)); + PathRemoveExtension(const_cast(fn.c_str())); + return fn; +} + + +winVer NppParameters::getWindowsVersion() +{ + OSVERSIONINFOEX osvi; + SYSTEM_INFO si; + PGNSI pGNSI; + + ZeroMemory(&si, sizeof(SYSTEM_INFO)); + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + BOOL bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *)&osvi); + if (!bOsVersionInfoEx) + { + osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); + if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) + return WV_UNKNOWN; + } + + pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); + if(pGNSI != NULL) + pGNSI(&si); + else + GetSystemInfo(&si); + + switch (si.wProcessorArchitecture) + { + case PROCESSOR_ARCHITECTURE_IA64: + _platForm = PF_IA64; + break; + + case PROCESSOR_ARCHITECTURE_AMD64: + _platForm = PF_X64; + break; + + case PROCESSOR_ARCHITECTURE_INTEL: + _platForm = PF_X86; + break; + + default: + _platForm = PF_UNKNOWN; + } + + switch (osvi.dwPlatformId) + { + case VER_PLATFORM_WIN32_NT: + { + if (osvi.dwMajorVersion == 10 && osvi.dwMinorVersion == 0) + return WV_WIN10; + + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 3) + return WV_WIN81; + + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2) + return WV_WIN8; + + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1) + return WV_WIN7; + + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) + return WV_VISTA; + + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) + { + if (osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) + return WV_XPX64; + return WV_S2003; + } + + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) + return WV_XP; + + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) + return WV_W2K; + + if (osvi.dwMajorVersion <= 4) + return WV_NT; + break; + } + + // Test for the Windows Me/98/95. + case VER_PLATFORM_WIN32_WINDOWS: + { + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) + return WV_95; + + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) + return WV_98; + + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) + return WV_ME; + break; + } + + case VER_PLATFORM_WIN32s: + return WV_WIN32S; + + default: + return WV_UNKNOWN; + } + + return WV_UNKNOWN; +} + + + +NppParameters * NppParameters::_pSelf = new NppParameters; + +int FileDialog::_dialogFileBoxId = (NppParameters::getInstance())->getWinVersion() < WV_W2K?edt1:cmb13; + + +NppParameters::NppParameters() +{ + // init import UDL array + _nbImportedULD = 0; + for (int i = 0 ; i < NB_MAX_IMPORTED_UDL ; ++i) + _importedULD[i] = nullptr; + + //Get windows version + _winVersion = getWindowsVersion(); + + // Prepare for default path + TCHAR nppPath[MAX_PATH]; + ::GetModuleFileName(NULL, nppPath, MAX_PATH); + + PathRemoveFileSpec(nppPath); + _nppPath = nppPath; + + //Initialize current directory to startup directory + TCHAR curDir[MAX_PATH]; + ::GetCurrentDirectory(MAX_PATH, curDir); + _currentDirectory = curDir; + + _appdataNppDir.clear(); + generic_string notepadStylePath(_nppPath); + PathAppend(notepadStylePath, notepadStyleFile); + + _asNotepadStyle = (PathFileExists(notepadStylePath.c_str()) == TRUE); + + //Load initial accelerator key definitions + initMenuKeys(); + initScintillaKeys(); +} + + +NppParameters::~NppParameters() +{ + for (int i = 0 ; i < _nbLang ; ++i) + delete _langList[i]; + for (int i = 0 ; i < _nbRecentFile ; ++i) + delete _LRFileList[i]; + for (int i = 0 ; i < _nbUserLang ; ++i) + delete _userLangArray[i]; + if (_hUXTheme) + FreeLibrary(_hUXTheme); + + for (std::vector::iterator it = _pXmlExternalLexerDoc.begin(), end = _pXmlExternalLexerDoc.end(); it != end; ++it ) + delete (*it); + + _pXmlExternalLexerDoc.clear(); +} + + +bool NppParameters::reloadStylers(TCHAR* stylePath) +{ + if (_pXmlUserStylerDoc) + delete _pXmlUserStylerDoc; + + const TCHAR* stylePathToLoad = stylePath != nullptr ? stylePath : _stylerPath.c_str(); + _pXmlUserStylerDoc = new TiXmlDocument(stylePathToLoad); + + bool loadOkay = _pXmlUserStylerDoc->LoadFile(); + if (!loadOkay) + { + _pNativeLangSpeaker->messageBox("LoadStylersFailed", + NULL, + TEXT("Load \"$STR_REPLACE$\" failed!"), + TEXT("Load stylers.xml failed"), + MB_OK, + 0, + stylePathToLoad); + + delete _pXmlUserStylerDoc; + _pXmlUserStylerDoc = NULL; + return false; + } + _lexerStylerArray.eraseAll(); + _widgetStyleArray.setNbStyler( 0 ); + + getUserStylersFromXmlTree(); + + // Reload plugin styles. + for( size_t i = 0; i < getExternalLexerDoc()->size(); ++i) + { + getExternalLexerFromXmlTree( getExternalLexerDoc()->at(i) ); + } + return true; +} + +bool NppParameters::reloadLang() +{ + // use user path + generic_string nativeLangPath(_localizationSwitcher._nativeLangPath); + + // if "nativeLang.xml" does not exist, use npp path + if (!PathFileExists(nativeLangPath.c_str())) + { + nativeLangPath = _nppPath; + PathAppend(nativeLangPath, generic_string(TEXT("nativeLang.xml"))); + if (!PathFileExists(nativeLangPath.c_str())) + return false; + } + + if (_pXmlNativeLangDocA) + delete _pXmlNativeLangDocA; + + _pXmlNativeLangDocA = new TiXmlDocumentA(); + + bool loadOkay = _pXmlNativeLangDocA->LoadUnicodeFilePath(nativeLangPath.c_str()); + if (!loadOkay) + { + delete _pXmlNativeLangDocA; + _pXmlNativeLangDocA = nullptr; + return false; + } + return loadOkay; +} + +generic_string NppParameters::getSpecialFolderLocation(int folderKind) +{ + TCHAR path[MAX_PATH]; + const HRESULT specialLocationResult = SHGetFolderPath(nullptr, folderKind, nullptr, SHGFP_TYPE_CURRENT, path); + + generic_string result; + if (SUCCEEDED(specialLocationResult)) + { + result = path; + } + return result; +} + + +generic_string NppParameters::getSettingsFolder() +{ + if (_isLocal) + return _nppPath; + + generic_string settingsFolderPath = getSpecialFolderLocation(CSIDL_APPDATA); + + if (settingsFolderPath.empty()) + return _nppPath; + + PathAppend(settingsFolderPath, TEXT("Notepad++")); + return settingsFolderPath; +} + + +bool NppParameters::load() +{ + L_END = L_EXTERNAL; + bool isAllLaoded = true; + for (int i = 0 ; i < NB_LANG ; _langList[i] = NULL, ++i) + {} + + _isx64 = sizeof(void *) == 8; + + // Make localConf.xml path + generic_string localConfPath(_nppPath); + PathAppend(localConfPath, localConfFile); + + // Test if localConf.xml exist + _isLocal = (PathFileExists(localConfPath.c_str()) == TRUE); + + // Under vista and windows 7, the usage of doLocalConf.xml is not allowed + // if Notepad++ is installed in "program files" directory, because of UAC + if (_isLocal) + { + // We check if OS is Vista or greater version + if (_winVersion >= WV_VISTA) + { + generic_string progPath = getSpecialFolderLocation(CSIDL_PROGRAM_FILES); + TCHAR nppDirLocation[MAX_PATH]; + lstrcpy(nppDirLocation, _nppPath.c_str()); + ::PathRemoveFileSpec(nppDirLocation); + + if (progPath == nppDirLocation) + _isLocal = false; + } + } + + if (_isLocal) + { + _userPath = _nppPath; + } + else + { + _userPath = getSpecialFolderLocation(CSIDL_APPDATA); + + PathAppend(_userPath, TEXT("Notepad++")); + _appdataNppDir = _userPath; + + // Plugin System V1 + if (!PathFileExists(_userPath.c_str())) + ::CreateDirectory(_userPath.c_str(), NULL); + + // Plugin System V2 + _localAppdataNppDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); + PathAppend(_localAppdataNppDir, TEXT("Notepad++")); + if (!PathFileExists(_localAppdataNppDir.c_str())) + ::CreateDirectory(_localAppdataNppDir.c_str(), NULL); + } + + + + _sessionPath = _userPath; // Session stock the absolute file path, it should never be on cloud + + // Detection cloud settings + generic_string cloudChoicePath{_userPath}; + cloudChoicePath += TEXT("\\cloud\\choice"); + + // cloudChoicePath doesn't exist, just quit + if (::PathFileExists(cloudChoicePath.c_str())) + { + // Read cloud choice + std::string cloudChoiceStr = getFileContent(cloudChoicePath.c_str()); + WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + std::wstring cloudChoiceStrW = wmc->char2wchar(cloudChoiceStr.c_str(), SC_CP_UTF8); + + if (not cloudChoiceStrW.empty() and ::PathFileExists(cloudChoiceStrW.c_str())) + { + _userPath = cloudChoiceStrW; + _nppGUI._cloudPath = cloudChoiceStrW; + _initialCloudChoice = _nppGUI._cloudPath; + } + } + + + //-------------------------------------// + // Transparent function for w2k and xp // + //-------------------------------------// + HMODULE hUser32 = ::GetModuleHandle(TEXT("User32")); + if (hUser32) + _transparentFuncAddr = (WNDPROC)::GetProcAddress(hUser32, "SetLayeredWindowAttributes"); + + //---------------------------------------------// + // Dlg theme texture function for xp and vista // + //---------------------------------------------// + _hUXTheme = ::LoadLibrary(TEXT("uxtheme.dll")); + if (_hUXTheme) + _enableThemeDialogTextureFuncAddr = (WNDPROC)::GetProcAddress(_hUXTheme, "EnableThemeDialogTexture"); + + //--------------------------// + // langs.xml : for per user // + //--------------------------// + generic_string langs_xml_path(_userPath); + PathAppend(langs_xml_path, TEXT("langs.xml")); + + BOOL doRecover = FALSE; + if (::PathFileExists(langs_xml_path.c_str())) + { + struct _stat buf; + + if (generic_stat(langs_xml_path.c_str(), &buf)==0) + if (buf.st_size == 0) + doRecover = _pNativeLangSpeaker->messageBox("LoadLangsFailed", + NULL, + TEXT("Load langs.xml failed!\rDo you want to recover your langs.xml?"), + TEXT("Configurator"), + MB_YESNO); + } + else + doRecover = true; + + if (doRecover) + { + generic_string srcLangsPath(_nppPath); + PathAppend(srcLangsPath, TEXT("langs.model.xml")); + ::CopyFile(srcLangsPath.c_str(), langs_xml_path.c_str(), FALSE); + } + + _pXmlDoc = new TiXmlDocument(langs_xml_path); + + + bool loadOkay = _pXmlDoc->LoadFile(); + if (!loadOkay) + { + _pNativeLangSpeaker->messageBox("LoadLangsFailedFinal", + NULL, + TEXT("Load langs.xml failed!"), + TEXT("Configurator"), + MB_OK); + + delete _pXmlDoc; + _pXmlDoc = nullptr; + isAllLaoded = false; + } + else + getLangKeywordsFromXmlTree(); + + //---------------------------// + // config.xml : for per user // + //---------------------------// + generic_string configPath(_userPath); + PathAppend(configPath, TEXT("config.xml")); + + generic_string srcConfigPath(_nppPath); + PathAppend(srcConfigPath, TEXT("config.model.xml")); + + if (!::PathFileExists(configPath.c_str())) + ::CopyFile(srcConfigPath.c_str(), configPath.c_str(), FALSE); + + _pXmlUserDoc = new TiXmlDocument(configPath); + loadOkay = _pXmlUserDoc->LoadFile(); + + if (!loadOkay) + { + TiXmlDeclaration* decl = new TiXmlDeclaration(TEXT("1.0"), TEXT("Windows-1252"), TEXT("")); + _pXmlUserDoc->LinkEndChild(decl); + } + else + { + getUserParametersFromXmlTree(); + } + + //----------------------------// + // stylers.xml : for per user // + //----------------------------// + + _stylerPath = _userPath; + PathAppend(_stylerPath, TEXT("stylers.xml")); + + if (!PathFileExists(_stylerPath.c_str())) + { + generic_string srcStylersPath(_nppPath); + PathAppend(srcStylersPath, TEXT("stylers.model.xml")); + + ::CopyFile(srcStylersPath.c_str(), _stylerPath.c_str(), TRUE); + } + + if (_nppGUI._themeName.empty() || (!PathFileExists(_nppGUI._themeName.c_str()))) + _nppGUI._themeName.assign(_stylerPath); + + _pXmlUserStylerDoc = new TiXmlDocument(_nppGUI._themeName.c_str()); + + loadOkay = _pXmlUserStylerDoc->LoadFile(); + if (!loadOkay) + { + _pNativeLangSpeaker->messageBox("LoadStylersFailed", + NULL, + TEXT("Load \"$STR_REPLACE$\" failed!"), + TEXT("Load stylers.xml failed"), + MB_OK, + 0, + _stylerPath.c_str()); + + delete _pXmlUserStylerDoc; + _pXmlUserStylerDoc = NULL; + isAllLaoded = false; + } + else + getUserStylersFromXmlTree(); + + _themeSwitcher._stylesXmlPath = _stylerPath; + // Firstly, add the default theme + _themeSwitcher.addDefaultThemeFromXml(_stylerPath); + + //-----------------------------------// + // userDefineLang.xml : for per user // + //-----------------------------------// + _userDefineLangPath = _userPath; + PathAppend(_userDefineLangPath, TEXT("userDefineLang.xml")); + + _pXmlUserLangDoc = new TiXmlDocument(_userDefineLangPath); + loadOkay = _pXmlUserLangDoc->LoadFile(); + if (!loadOkay) + { + delete _pXmlUserLangDoc; + _pXmlUserLangDoc = nullptr; + isAllLaoded = false; + } + else + getUserDefineLangsFromXmlTree(); + + //----------------------------------------------// + // nativeLang.xml : for per user // + // In case of absence of user's nativeLang.xml, // + // We'll look in the Notepad++ Dir. // + //----------------------------------------------// + + generic_string nativeLangPath; + nativeLangPath = _userPath; + PathAppend(nativeLangPath, TEXT("nativeLang.xml")); + + // LocalizationSwitcher should use always user path + _localizationSwitcher._nativeLangPath = nativeLangPath; + + if (not _startWithLocFileName.empty()) // localization argument detected, use user wished localization + { + // overwrite nativeLangPath variable + nativeLangPath = _nppPath; + PathAppend(nativeLangPath, TEXT("localization\\")); + PathAppend(nativeLangPath, _startWithLocFileName); + } + else // use %appdata% location, or (if absence then) npp installed location + { + if (!PathFileExists(nativeLangPath.c_str())) + { + nativeLangPath = _nppPath; + PathAppend(nativeLangPath, TEXT("nativeLang.xml")); + } + } + + + _pXmlNativeLangDocA = new TiXmlDocumentA(); + + loadOkay = _pXmlNativeLangDocA->LoadUnicodeFilePath(nativeLangPath.c_str()); + if (!loadOkay) + { + delete _pXmlNativeLangDocA; + _pXmlNativeLangDocA = nullptr; + isAllLaoded = false; + } + + //---------------------------------// + // toolbarIcons.xml : for per user // + //---------------------------------// + generic_string toolbarIconsPath(_userPath); + PathAppend(toolbarIconsPath, TEXT("toolbarIcons.xml")); + + _pXmlToolIconsDoc = new TiXmlDocument(toolbarIconsPath); + loadOkay = _pXmlToolIconsDoc->LoadFile(); + if (!loadOkay) + { + delete _pXmlToolIconsDoc; + _pXmlToolIconsDoc = nullptr; + isAllLaoded = false; + } + + //------------------------------// + // shortcuts.xml : for per user // + //------------------------------// + _shortcutsPath = _userPath; + PathAppend(_shortcutsPath, TEXT("shortcuts.xml")); + + if (!PathFileExists(_shortcutsPath.c_str())) + { + generic_string srcShortcutsPath(_nppPath); + PathAppend(srcShortcutsPath, TEXT("shortcuts.xml")); + + ::CopyFile(srcShortcutsPath.c_str(), _shortcutsPath.c_str(), TRUE); + } + + _pXmlShortcutDoc = new TiXmlDocument(_shortcutsPath); + loadOkay = _pXmlShortcutDoc->LoadFile(); + if (!loadOkay) + { + delete _pXmlShortcutDoc; + _pXmlShortcutDoc = nullptr; + isAllLaoded = false; + } + else + { + getShortcutsFromXmlTree(); + getMacrosFromXmlTree(); + getUserCmdsFromXmlTree(); + + // fill out _scintillaModifiedKeys : + // those user defined Scintilla key will be used remap Scintilla Key Array + getScintKeysFromXmlTree(); + } + + //---------------------------------// + // contextMenu.xml : for per user // + //---------------------------------// + _contextMenuPath = _userPath; + PathAppend(_contextMenuPath, TEXT("contextMenu.xml")); + + if (!PathFileExists(_contextMenuPath.c_str())) + { + generic_string srcContextMenuPath(_nppPath); + PathAppend(srcContextMenuPath, TEXT("contextMenu.xml")); + + ::CopyFile(srcContextMenuPath.c_str(), _contextMenuPath.c_str(), TRUE); + } + + _pXmlContextMenuDocA = new TiXmlDocumentA(); + loadOkay = _pXmlContextMenuDocA->LoadUnicodeFilePath(_contextMenuPath.c_str()); + if (!loadOkay) + { + delete _pXmlContextMenuDocA; + _pXmlContextMenuDocA = nullptr; + isAllLaoded = false; + } + + //----------------------------// + // session.xml : for per user // + //----------------------------// + + PathAppend(_sessionPath, TEXT("session.xml")); + + // Don't load session.xml if not required in order to speed up!! + const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI(); + if (nppGUI._rememberLastSession) + { + _pXmlSessionDoc = new TiXmlDocument(_sessionPath); + + loadOkay = _pXmlSessionDoc->LoadFile(); + if (!loadOkay) + isAllLaoded = false; + else + getSessionFromXmlTree(); + + delete _pXmlSessionDoc; + for (size_t i = 0, len = _pXmlExternalLexerDoc.size() ; i < len ; ++i) + if (_pXmlExternalLexerDoc[i]) + delete _pXmlExternalLexerDoc[i]; + + _pXmlSessionDoc = nullptr; + } + + //------------------------------// + // blacklist.xml : for per user // + //------------------------------// + _blacklistPath = _userPath; + PathAppend(_blacklistPath, TEXT("blacklist.xml")); + + if (PathFileExists(_blacklistPath.c_str())) + { + _pXmlBlacklistDoc = new TiXmlDocument(_blacklistPath); + loadOkay = _pXmlBlacklistDoc->LoadFile(); + if (loadOkay) + getBlackListFromXmlTree(); + } + return isAllLaoded; +} + + +void NppParameters::destroyInstance() +{ + delete _pXmlDoc; + delete _pXmlUserDoc; + delete _pXmlUserStylerDoc; + delete _pXmlUserLangDoc; + + for (int i = 0 ; i < _nbImportedULD ; ++i) + { + delete _importedULD[i]; + _importedULD[i] = nullptr; + } + _nbImportedULD = 0; + + delete _pXmlNativeLangDocA; + delete _pXmlToolIconsDoc; + delete _pXmlShortcutDoc; + delete _pXmlContextMenuDocA; + delete _pXmlSessionDoc; + delete _pXmlBlacklistDoc; + delete _pSelf; + _pSelf = nullptr; +} + + +void NppParameters::saveConfig_xml() +{ + if (_pXmlUserDoc) + _pXmlUserDoc->SaveFile(); +} + + +void NppParameters::setWorkSpaceFilePath(int i, const TCHAR* wsFile) +{ + if (i < 0 || i > 2 || !wsFile) + return; + _workSpaceFilePathes[i] = wsFile; +} + + +void NppParameters::removeTransparent(HWND hwnd) +{ + if (hwnd != NULL) + ::SetWindowLongPtr(hwnd, GWL_EXSTYLE, ::GetWindowLongPtr(hwnd, GWL_EXSTYLE) & ~0x00080000); +} + + +void NppParameters::SetTransparent(HWND hwnd, int percent) +{ + if (nullptr != _transparentFuncAddr) + { + ::SetWindowLongPtr(hwnd, GWL_EXSTYLE, ::GetWindowLongPtr(hwnd, GWL_EXSTYLE) | 0x00080000); + if (percent > 255) + percent = 255; + if (percent < 0) + percent = 0; + _transparentFuncAddr(hwnd, 0, percent, 0x00000002); + } +} + + +bool NppParameters::isExistingExternalLangName(const TCHAR *newName) const +{ + if ((!newName) || (!newName[0])) + return true; + + for (int i = 0 ; i < _nbExternalLang ; ++i) + { + if (!lstrcmp(_externalLangArray[i]->_name, newName)) + return true; + } + return false; +} + + +const TCHAR* NppParameters::getUserDefinedLangNameFromExt(TCHAR *ext, TCHAR *fullName) const +{ + if ((!ext) || (!ext[0])) + return nullptr; + + std::vector extVect; + for (int i = 0 ; i < _nbUserLang ; ++i) + { + extVect.clear(); + cutString(_userLangArray[i]->_ext.c_str(), extVect); + + for (size_t j = 0, len = extVect.size(); j < len; ++j) + { + if (!generic_stricmp(extVect[j].c_str(), ext) || (_tcschr(fullName, '.') && !generic_stricmp(extVect[j].c_str(), fullName))) + return _userLangArray[i]->_name.c_str(); + } + } + return nullptr; +} + + +int NppParameters::getExternalLangIndexFromName(const TCHAR* externalLangName) const +{ + for (int i = 0 ; i < _nbExternalLang ; ++i) + { + if (!lstrcmp(externalLangName, _externalLangArray[i]->_name)) + return i; + } + return -1; +} + + +UserLangContainer* NppParameters::getULCFromName(const TCHAR *userLangName) +{ + for (int i = 0 ; i < _nbUserLang ; ++i) + { + if (0 == lstrcmp(userLangName, _userLangArray[i]->_name.c_str())) + return _userLangArray[i]; + } + + //qui doit etre jamais passer + return nullptr; +} + + +COLORREF NppParameters::getCurLineHilitingColour() +{ + int i = _widgetStyleArray.getStylerIndexByName(TEXT("Current line background colour")); + if (i == -1) + return i; + Style & style = _widgetStyleArray.getStyler(i); + return style._bgColor; +} + + +void NppParameters::setCurLineHilitingColour(COLORREF colour2Set) +{ + int i = _widgetStyleArray.getStylerIndexByName(TEXT("Current line background colour")); + if (i == -1) + return; + + Style& style = _widgetStyleArray.getStyler(i); + style._bgColor = colour2Set; +} + + + +static int CALLBACK EnumFontFamExProc(const LOGFONT* lpelfe, const TEXTMETRIC*, DWORD, LPARAM lParam) +{ + std::vector& strVect = *(std::vector *)lParam; + const int32_t vectSize = static_cast(strVect.size()); + const TCHAR* lfFaceName = ((ENUMLOGFONTEX*)lpelfe)->elfLogFont.lfFaceName; + + //Search through all the fonts, EnumFontFamiliesEx never states anything about order + //Start at the end though, that's the most likely place to find a duplicate + for (int i = vectSize - 1 ; i >= 0 ; i--) + { + if (0 == lstrcmp(strVect[i].c_str(), lfFaceName)) + return 1; //we already have seen this typeface, ignore it + } + + //We can add the font + //Add the face name and not the full name, we do not care about any styles + strVect.push_back(lfFaceName); + return 1; // I want to get all fonts +} + + +void NppParameters::setFontList(HWND hWnd) +{ + //---------------// + // Sys font list // + //---------------// + LOGFONT lf; + _fontlist.clear(); + _fontlist.reserve(64); // arbitrary + _fontlist.push_back(generic_string()); + + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfFaceName[0]='\0'; + lf.lfPitchAndFamily = 0; + HDC hDC = ::GetDC(hWnd); + ::EnumFontFamiliesEx(hDC, &lf, EnumFontFamExProc, reinterpret_cast(&_fontlist), 0); +} + +bool NppParameters::isInFontList(const generic_string fontName2Search) const +{ + if (fontName2Search.empty()) + return false; + + for (size_t i = 0, len = _fontlist.size(); i < len; i++) + { + if (_fontlist[i] == fontName2Search) + return true; + } + return false; +} + +void NppParameters::getLangKeywordsFromXmlTree() +{ + TiXmlNode *root = + _pXmlDoc->FirstChild(TEXT("NotepadPlus")); + if (!root) return; + feedKeyWordsParameters(root); +} + + +void NppParameters::getExternalLexerFromXmlTree(TiXmlDocument *doc) +{ + TiXmlNode *root = doc->FirstChild(TEXT("NotepadPlus")); + if (!root) return; + feedKeyWordsParameters(root); + feedStylerArray(root); +} + + +int NppParameters::addExternalLangToEnd(ExternalLangContainer * externalLang) +{ + _externalLangArray[_nbExternalLang] = externalLang; + ++_nbExternalLang; + ++L_END; + return _nbExternalLang-1; +} + + +bool NppParameters::getUserStylersFromXmlTree() +{ + TiXmlNode *root = _pXmlUserStylerDoc->FirstChild(TEXT("NotepadPlus")); + if (!root) return false; + return feedStylerArray(root); +} + + +bool NppParameters::getUserParametersFromXmlTree() +{ + if (!_pXmlUserDoc) + return false; + + TiXmlNode *root = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); + if (not root) + return false; + + // Get GUI parameters + feedGUIParameters(root); + + // Get History parameters + feedFileListParameters(root); + + // Erase the History root + TiXmlNode *node = root->FirstChildElement(TEXT("History")); + root->RemoveChild(node); + + // Add a new empty History root + TiXmlElement HistoryNode(TEXT("History")); + root->InsertEndChild(HistoryNode); + + //Get Find history parameters + feedFindHistoryParameters(root); + + //Get Project Panel parameters + feedProjectPanelsParameters(root); + + //Get File browser parameters + feedFileBrowserParameters(root); + + return true; +} + + +bool NppParameters::getUserDefineLangsFromXmlTree(TiXmlDocument *tixmldoc) +{ + if (!tixmldoc) + return false; + + TiXmlNode *root = tixmldoc->FirstChild(TEXT("NotepadPlus")); + if (!root) + return false; + + return feedUserLang(root); +} + + + +bool NppParameters::getShortcutsFromXmlTree() +{ + if (!_pXmlShortcutDoc) + return false; + + TiXmlNode *root = _pXmlShortcutDoc->FirstChild(TEXT("NotepadPlus")); + if (!root) + return false; + + feedShortcut(root); + return true; +} + + +bool NppParameters::getMacrosFromXmlTree() +{ + if (!_pXmlShortcutDoc) + return false; + + TiXmlNode *root = _pXmlShortcutDoc->FirstChild(TEXT("NotepadPlus")); + if (!root) + return false; + + feedMacros(root); + return true; +} + + +bool NppParameters::getUserCmdsFromXmlTree() +{ + if (!_pXmlShortcutDoc) + return false; + + TiXmlNode *root = _pXmlShortcutDoc->FirstChild(TEXT("NotepadPlus")); + if (!root) + return false; + + feedUserCmds(root); + return true; +} + + +bool NppParameters::getPluginCmdsFromXmlTree() +{ + if (!_pXmlShortcutDoc) + return false; + + TiXmlNode *root = _pXmlShortcutDoc->FirstChild(TEXT("NotepadPlus")); + if (!root) + return false; + + feedPluginCustomizedCmds(root); + return true; +} + + +bool NppParameters::getScintKeysFromXmlTree() +{ + if (!_pXmlShortcutDoc) + return false; + + TiXmlNode *root = _pXmlShortcutDoc->FirstChild(TEXT("NotepadPlus")); + if (!root) + return false; + + feedScintKeys(root); + return true; +} + +bool NppParameters::getBlackListFromXmlTree() +{ + if (!_pXmlBlacklistDoc) + return false; + + TiXmlNode *root = _pXmlBlacklistDoc->FirstChild(TEXT("NotepadPlus")); + if (!root) + return false; + + return feedBlacklist(root); +} + +void NppParameters::initMenuKeys() +{ + int nbCommands = sizeof(winKeyDefs)/sizeof(WinMenuKeyDefinition); + WinMenuKeyDefinition wkd; + for(int i = 0; i < nbCommands; ++i) + { + wkd = winKeyDefs[i]; + Shortcut sc((wkd.specialName ? wkd.specialName : TEXT("")), wkd.isCtrl, wkd.isAlt, wkd.isShift, static_cast(wkd.vKey)); + _shortcuts.push_back( CommandShortcut(sc, wkd.functionId) ); + } +} + +void NppParameters::initScintillaKeys() { + + int nbCommands = sizeof(scintKeyDefs)/sizeof(ScintillaKeyDefinition); + + //Warning! Matching function have to be consecutive + ScintillaKeyDefinition skd; + int prevIndex = -1; + int prevID = -1; + for(int i = 0; i < nbCommands; ++i) + { + skd = scintKeyDefs[i]; + if (skd.functionId == prevID) + { + KeyCombo kc; + kc._isCtrl = skd.isCtrl; + kc._isAlt = skd.isAlt; + kc._isShift = skd.isShift; + kc._key = static_cast(skd.vKey); + _scintillaKeyCommands[prevIndex].addKeyCombo(kc); + } + else + { + Shortcut s = Shortcut(skd.name, skd.isCtrl, skd.isAlt, skd.isShift, static_cast(skd.vKey)); + ScintillaKeyMap sm = ScintillaKeyMap(s, skd.functionId, skd.redirFunctionId); + _scintillaKeyCommands.push_back(sm); + ++prevIndex; + } + prevID = skd.functionId; + } +} +bool NppParameters::reloadContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu) +{ + _contextMenuItems.clear(); + return getContextMenuFromXmlTree(mainMenuHadle, pluginsMenu); +} + +int NppParameters::getCmdIdFromMenuEntryItemName(HMENU mainMenuHadle, generic_string menuEntryName, generic_string menuItemName) +{ + int nbMenuEntry = ::GetMenuItemCount(mainMenuHadle); + for (int i = 0; i < nbMenuEntry; ++i) + { + TCHAR menuEntryString[64]; + ::GetMenuString(mainMenuHadle, i, menuEntryString, 64, MF_BYPOSITION); + if (generic_stricmp(menuEntryName.c_str(), purgeMenuItemString(menuEntryString).c_str()) == 0) + { + vector< pair > parentMenuPos; + HMENU topMenu = ::GetSubMenu(mainMenuHadle, i); + int maxTopMenuPos = ::GetMenuItemCount(topMenu); + HMENU currMenu = topMenu; + int currMaxMenuPos = maxTopMenuPos; + + int currMenuPos = 0; + bool notFound = false; + + do { + if (::GetSubMenu(currMenu, currMenuPos)) + { + // Go into sub menu + parentMenuPos.push_back(::make_pair(currMenu, currMenuPos)); + currMenu = ::GetSubMenu(currMenu, currMenuPos); + currMenuPos = 0; + currMaxMenuPos = ::GetMenuItemCount(currMenu); + } + else + { + // Check current menu position. + TCHAR cmdStr[256]; + ::GetMenuString(currMenu, currMenuPos, cmdStr, 256, MF_BYPOSITION); + if (generic_stricmp(menuItemName.c_str(), purgeMenuItemString(cmdStr).c_str()) == 0) + { + return ::GetMenuItemID(currMenu, currMenuPos); + } + + if ((currMenuPos >= currMaxMenuPos) && (parentMenuPos.size() > 0)) + { + currMenu = parentMenuPos.back().first; + currMenuPos = parentMenuPos.back().second; + parentMenuPos.pop_back(); + currMaxMenuPos = ::GetMenuItemCount(currMenu); + } + + if ((currMenu == topMenu) && (currMenuPos >= maxTopMenuPos)) + { + notFound = true; + } + else + { + ++currMenuPos; + } + } + } while (!notFound); + } + } + return -1; +} + +int NppParameters::getPluginCmdIdFromMenuEntryItemName(HMENU pluginsMenu, generic_string pluginName, generic_string pluginCmdName) +{ + int nbPlugins = ::GetMenuItemCount(pluginsMenu); + for (int i = 0; i < nbPlugins; ++i) + { + TCHAR menuItemString[256]; + ::GetMenuString(pluginsMenu, i, menuItemString, 256, MF_BYPOSITION); + if (generic_stricmp(pluginName.c_str(), purgeMenuItemString(menuItemString).c_str()) == 0) + { + HMENU pluginMenu = ::GetSubMenu(pluginsMenu, i); + int nbPluginCmd = ::GetMenuItemCount(pluginMenu); + for (int j = 0; j < nbPluginCmd; ++j) + { + TCHAR pluginCmdStr[256]; + ::GetMenuString(pluginMenu, j, pluginCmdStr, 256, MF_BYPOSITION); + if (generic_stricmp(pluginCmdName.c_str(), purgeMenuItemString(pluginCmdStr).c_str()) == 0) + { + return ::GetMenuItemID(pluginMenu, j); + } + } + } + } + return -1; +} + +bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu) +{ + if (!_pXmlContextMenuDocA) + return false; + TiXmlNodeA *root = _pXmlContextMenuDocA->FirstChild("NotepadPlus"); + if (!root) + return false; + + WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + + TiXmlNodeA *contextMenuRoot = root->FirstChildElement("ScintillaContextMenu"); + if (contextMenuRoot) + { + for (TiXmlNodeA *childNode = contextMenuRoot->FirstChildElement("Item"); + childNode ; + childNode = childNode->NextSibling("Item") ) + { + const char *folderNameA = (childNode->ToElement())->Attribute("FolderName"); + const char *displayAsA = (childNode->ToElement())->Attribute("ItemNameAs"); + + generic_string folderName; + generic_string displayAs; + folderName = folderNameA?wmc->char2wchar(folderNameA, SC_CP_UTF8):TEXT(""); + displayAs = displayAsA?wmc->char2wchar(displayAsA, SC_CP_UTF8):TEXT(""); + + int id; + const char *idStr = (childNode->ToElement())->Attribute("id", &id); + if (idStr) + { + _contextMenuItems.push_back(MenuItemUnit(id, displayAs.c_str(), folderName.c_str())); + } + else + { + const char *menuEntryNameA = (childNode->ToElement())->Attribute("MenuEntryName"); + const char *menuItemNameA = (childNode->ToElement())->Attribute("MenuItemName"); + + generic_string menuEntryName; + generic_string menuItemName; + menuEntryName = menuEntryNameA?wmc->char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT(""); + menuItemName = menuItemNameA?wmc->char2wchar(menuItemNameA, SC_CP_UTF8):TEXT(""); + + if (not menuEntryName.empty() and not menuItemName.empty()) + { + int cmd = getCmdIdFromMenuEntryItemName(mainMenuHadle, menuEntryName, menuItemName); + if (cmd != -1) + _contextMenuItems.push_back(MenuItemUnit(cmd, displayAs.c_str(), folderName.c_str())); + } + else + { + const char *pluginNameA = (childNode->ToElement())->Attribute("PluginEntryName"); + const char *pluginCmdNameA = (childNode->ToElement())->Attribute("PluginCommandItemName"); + + generic_string pluginName; + generic_string pluginCmdName; + pluginName = pluginNameA?wmc->char2wchar(pluginNameA, SC_CP_UTF8):TEXT(""); + pluginCmdName = pluginCmdNameA?wmc->char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT(""); + + // if plugin menu existing plls the value of PluginEntryName and PluginCommandItemName are valid + if (pluginsMenu && not pluginName.empty() && not pluginCmdName.empty()) + { + int pluginCmdId = getPluginCmdIdFromMenuEntryItemName(pluginsMenu, pluginName, pluginCmdName); + if (pluginCmdId != -1) + _contextMenuItems.push_back(MenuItemUnit(pluginCmdId, displayAs.c_str(), folderName.c_str())); + } + } + } + } + } + return true; +} + + +void NppParameters::setWorkingDir(const TCHAR * newPath) +{ + if (newPath && newPath[0]) + { + _currentDirectory = newPath; + } + else + { + if (PathFileExists(_nppGUI._defaultDirExp)) + _currentDirectory = _nppGUI._defaultDirExp; + else + _currentDirectory = _nppPath.c_str(); + } +} + + +bool NppParameters::loadSession(Session & session, const TCHAR *sessionFileName) +{ + TiXmlDocument *pXmlSessionDocument = new TiXmlDocument(sessionFileName); + bool loadOkay = pXmlSessionDocument->LoadFile(); + if (loadOkay) + loadOkay = getSessionFromXmlTree(pXmlSessionDocument, &session); + + delete pXmlSessionDocument; + return loadOkay; +} + + +bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session *pSession) +{ + if ((pSessionDoc) && (!pSession)) + return false; + + TiXmlDocument **ppSessionDoc = &_pXmlSessionDoc; + Session *ptrSession = &_session; + + if (pSessionDoc) + { + ppSessionDoc = &pSessionDoc; + ptrSession = pSession; + } + + if (!*ppSessionDoc) + return false; + + TiXmlNode *root = (*ppSessionDoc)->FirstChild(TEXT("NotepadPlus")); + if (!root) + return false; + + TiXmlNode *sessionRoot = root->FirstChildElement(TEXT("Session")); + if (!sessionRoot) + return false; + + TiXmlElement *actView = sessionRoot->ToElement(); + size_t index; + const TCHAR *str = actView->Attribute(TEXT("activeView"), reinterpret_cast(&index)); + if (str) + { + (*ptrSession)._activeView = index; + } + + const size_t nbView = 2; + TiXmlNode *viewRoots[nbView]; + viewRoots[0] = sessionRoot->FirstChildElement(TEXT("mainView")); + viewRoots[1] = sessionRoot->FirstChildElement(TEXT("subView")); + for (size_t k = 0; k < nbView; ++k) + { + if (viewRoots[k]) + { + size_t index2; + TiXmlElement *actIndex = viewRoots[k]->ToElement(); + str = actIndex->Attribute(TEXT("activeIndex"), reinterpret_cast(&index2)); + if (str) + { + if (k == 0) + (*ptrSession)._activeMainIndex = index2; + else // k == 1 + (*ptrSession)._activeSubIndex = index2; + } + for (TiXmlNode *childNode = viewRoots[k]->FirstChildElement(TEXT("File")); + childNode ; + childNode = childNode->NextSibling(TEXT("File")) ) + { + const TCHAR *fileName = (childNode->ToElement())->Attribute(TEXT("filename")); + if (fileName) + { + Position position; + (childNode->ToElement())->Attribute(TEXT("firstVisibleLine"), &position._firstVisibleLine); + (childNode->ToElement())->Attribute(TEXT("xOffset"), &position._xOffset); + (childNode->ToElement())->Attribute(TEXT("startPos"), &position._startPos); + (childNode->ToElement())->Attribute(TEXT("endPos"), &position._endPos); + (childNode->ToElement())->Attribute(TEXT("selMode"), &position._selMode); + (childNode->ToElement())->Attribute(TEXT("scrollWidth"), &position._scrollWidth); + + MapPosition mapPosition; + int32_t mapPosVal; + const TCHAR *mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapFirstVisibleDisplayLine"), &mapPosVal); + if (mapPosStr) + mapPosition._firstVisibleDisplayLine = mapPosVal; + mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapFirstVisibleDocLine"), &mapPosVal); + if (mapPosStr) + mapPosition._firstVisibleDocLine = mapPosVal; + mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapLastVisibleDocLine"), &mapPosVal); + if (mapPosStr) + mapPosition._lastVisibleDocLine = mapPosVal; + mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapNbLine"), &mapPosVal); + if (mapPosStr) + mapPosition._nbLine = mapPosVal; + mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapHigherPos"), &mapPosVal); + if (mapPosStr) + mapPosition._higherPos = mapPosVal; + mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapWidth"), &mapPosVal); + if (mapPosStr) + mapPosition._width = mapPosVal; + mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapHeight"), &mapPosVal); + if (mapPosStr) + mapPosition._height = mapPosVal; + mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapKByteInDoc"), &mapPosVal); + if (mapPosStr) + mapPosition._KByteInDoc = mapPosVal; + mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapWrapIndentMode"), &mapPosVal); + if (mapPosStr) + mapPosition._wrapIndentMode = mapPosVal; + const TCHAR *boolStr = (childNode->ToElement())->Attribute(TEXT("mapIsWrap")); + if (boolStr) + mapPosition._isWrap = (lstrcmp(TEXT("yes"), boolStr) == 0); + + const TCHAR *langName; + langName = (childNode->ToElement())->Attribute(TEXT("lang")); + int encoding = -1; + const TCHAR *encStr = (childNode->ToElement())->Attribute(TEXT("encoding"), &encoding); + const TCHAR *backupFilePath = (childNode->ToElement())->Attribute(TEXT("backupFilePath")); + + int fileModifiedTimestamp = 0; + (childNode->ToElement())->Attribute(TEXT("originalFileLastModifTimestamp"), &fileModifiedTimestamp); + + sessionFileInfo sfi(fileName, langName, encStr?encoding:-1, position, backupFilePath, fileModifiedTimestamp, mapPosition); + + for (TiXmlNode *markNode = childNode->FirstChildElement(TEXT("Mark")); + markNode ; + markNode = markNode->NextSibling(TEXT("Mark"))) + { + int lineNumber; + const TCHAR *lineNumberStr = (markNode->ToElement())->Attribute(TEXT("line"), &lineNumber); + if (lineNumberStr) + { + sfi._marks.push_back(lineNumber); + } + } + + for (TiXmlNode *foldNode = childNode->FirstChildElement(TEXT("Fold")); + foldNode ; + foldNode = foldNode->NextSibling(TEXT("Fold"))) + { + int lineNumber; + const TCHAR *lineNumberStr = (foldNode->ToElement())->Attribute(TEXT("line"), &lineNumber); + if (lineNumberStr) + { + sfi._foldStates.push_back(lineNumber); + } + } + if (k == 0) + (*ptrSession)._mainViewFiles.push_back(sfi); + else // k == 1 + (*ptrSession)._subViewFiles.push_back(sfi); + } + } + } + } + + return true; +} + +void NppParameters::feedFileListParameters(TiXmlNode *node) +{ + TiXmlNode *historyRoot = node->FirstChildElement(TEXT("History")); + if (!historyRoot) return; + + // nbMaxFile value + int nbMaxFile; + const TCHAR *strVal = (historyRoot->ToElement())->Attribute(TEXT("nbMaxFile"), &nbMaxFile); + if (strVal && (nbMaxFile >= 0) && (nbMaxFile <= 50)) + _nbMaxRecentFile = nbMaxFile; + + // customLen value + int customLen; + strVal = (historyRoot->ToElement())->Attribute(TEXT("customLength"), &customLen); + if (strVal) + _recentFileCustomLength = customLen; + + // inSubMenu value + strVal = (historyRoot->ToElement())->Attribute(TEXT("inSubMenu")); + if (strVal) + _putRecentFileInSubMenu = (lstrcmp(strVal, TEXT("yes")) == 0); + + for (TiXmlNode *childNode = historyRoot->FirstChildElement(TEXT("File")); + childNode && (_nbRecentFile < NB_MAX_LRF_FILE); + childNode = childNode->NextSibling(TEXT("File")) ) + { + const TCHAR *filePath = (childNode->ToElement())->Attribute(TEXT("filename")); + if (filePath) + { + _LRFileList[_nbRecentFile] = new generic_string(filePath); + ++_nbRecentFile; + } + } +} + +void NppParameters::feedProjectPanelsParameters(TiXmlNode *node) +{ + TiXmlNode *fileBrowserRoot = node->FirstChildElement(TEXT("FileBrowser")); + if (!fileBrowserRoot) return; + + for (TiXmlNode *childNode = fileBrowserRoot->FirstChildElement(TEXT("root")); + childNode; + childNode = childNode->NextSibling(TEXT("root")) ) + { + const TCHAR *filePath = (childNode->ToElement())->Attribute(TEXT("foldername")); + if (filePath) + { + _fileBrowserRoot.push_back(filePath); + } + } +} + +void NppParameters::feedFileBrowserParameters(TiXmlNode *node) +{ + TiXmlNode *projPanelRoot = node->FirstChildElement(TEXT("ProjectPanels")); + if (!projPanelRoot) return; + + for (TiXmlNode *childNode = projPanelRoot->FirstChildElement(TEXT("ProjectPanel")); + childNode; + childNode = childNode->NextSibling(TEXT("ProjectPanel")) ) + { + int index = 0; + const TCHAR *idStr = (childNode->ToElement())->Attribute(TEXT("id"), &index); + if (idStr && (index >= 0 && index <= 2)) + { + const TCHAR *filePath = (childNode->ToElement())->Attribute(TEXT("workSpaceFile")); + if (filePath) + { + _workSpaceFilePathes[index] = filePath; + } + } + } +} + +void NppParameters::feedFindHistoryParameters(TiXmlNode *node) +{ + TiXmlNode *findHistoryRoot = node->FirstChildElement(TEXT("FindHistory")); + if (!findHistoryRoot) return; + + (findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryPath"), &_findHistory._nbMaxFindHistoryPath); + if ((_findHistory._nbMaxFindHistoryPath > 0) && (_findHistory._nbMaxFindHistoryPath <= NB_MAX_FINDHISTORY_PATH)) + { + for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Path")); + childNode && (_findHistory._findHistoryPaths.size() < NB_MAX_FINDHISTORY_PATH); + childNode = childNode->NextSibling(TEXT("Path")) ) + { + const TCHAR *filePath = (childNode->ToElement())->Attribute(TEXT("name")); + if (filePath) + { + _findHistory._findHistoryPaths.push_back(generic_string(filePath)); + } + } + } + + (findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryFilter"), &_findHistory._nbMaxFindHistoryFilter); + if ((_findHistory._nbMaxFindHistoryFilter > 0) && (_findHistory._nbMaxFindHistoryFilter <= NB_MAX_FINDHISTORY_FILTER)) + { + for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Filter")); + childNode && (_findHistory._findHistoryFilters.size() < NB_MAX_FINDHISTORY_FILTER); + childNode = childNode->NextSibling(TEXT("Filter"))) + { + const TCHAR *fileFilter = (childNode->ToElement())->Attribute(TEXT("name")); + if (fileFilter) + { + _findHistory._findHistoryFilters.push_back(generic_string(fileFilter)); + } + } + } + + (findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryFind"), &_findHistory._nbMaxFindHistoryFind); + if ((_findHistory._nbMaxFindHistoryFind > 0) && (_findHistory._nbMaxFindHistoryFind <= NB_MAX_FINDHISTORY_FIND)) + { + for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Find")); + childNode && (_findHistory._findHistoryFinds.size() < NB_MAX_FINDHISTORY_FIND); + childNode = childNode->NextSibling(TEXT("Find"))) + { + const TCHAR *fileFind = (childNode->ToElement())->Attribute(TEXT("name")); + if (fileFind) + { + _findHistory._findHistoryFinds.push_back(generic_string(fileFind)); + } + } + } + + (findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryReplace"), &_findHistory._nbMaxFindHistoryReplace); + if ((_findHistory._nbMaxFindHistoryReplace > 0) && (_findHistory._nbMaxFindHistoryReplace <= NB_MAX_FINDHISTORY_REPLACE)) + { + for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Replace")); + childNode && (_findHistory._findHistoryReplaces.size() < NB_MAX_FINDHISTORY_REPLACE); + childNode = childNode->NextSibling(TEXT("Replace"))) + { + const TCHAR *fileReplace = (childNode->ToElement())->Attribute(TEXT("name")); + if (fileReplace) + { + _findHistory._findHistoryReplaces.push_back(generic_string(fileReplace)); + } + } + } + + const TCHAR *boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("matchWord")); + if (boolStr) + _findHistory._isMatchWord = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("matchCase")); + if (boolStr) + _findHistory._isMatchCase = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("wrap")); + if (boolStr) + _findHistory._isWrap = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("directionDown")); + if (boolStr) + _findHistory._isDirectionDown = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("fifRecuisive")); + if (boolStr) + _findHistory._isFifRecuisive = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("fifInHiddenFolder")); + if (boolStr) + _findHistory._isFifInHiddenFolder = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("dlgAlwaysVisible")); + if (boolStr) + _findHistory._isDlgAlwaysVisible = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("fifFilterFollowsDoc")); + if (boolStr) + _findHistory._isFilterFollowDoc = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("fifFolderFollowsDoc")); + if (boolStr) + _findHistory._isFolderFollowDoc = (lstrcmp(TEXT("yes"), boolStr) == 0); + + int mode = 0; + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("searchMode"), &mode); + if (boolStr) + _findHistory._searchMode = (FindHistory::searchMode)mode; + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("transparencyMode"), &mode); + if (boolStr) + _findHistory._transparencyMode = (FindHistory::transparencyMode)mode; + + (findHistoryRoot->ToElement())->Attribute(TEXT("transparency"), &_findHistory._transparency); + if (_findHistory._transparency <= 0 || _findHistory._transparency > 200) + _findHistory._transparency = 150; + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("dotMatchesNewline")); + if (boolStr) + _findHistory._dotMatchesNewline = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("isSearch2ButtonsMode")); + if (boolStr) + _findHistory._isSearch2ButtonsMode = (lstrcmp(TEXT("yes"), boolStr) == 0); +} + +void NppParameters::feedShortcut(TiXmlNode *node) +{ + TiXmlNode *shortcutsRoot = node->FirstChildElement(TEXT("InternalCommands")); + if (!shortcutsRoot) return; + + for (TiXmlNode *childNode = shortcutsRoot->FirstChildElement(TEXT("Shortcut")); + childNode ; + childNode = childNode->NextSibling(TEXT("Shortcut")) ) + { + int id; + const TCHAR *idStr = (childNode->ToElement())->Attribute(TEXT("id"), &id); + if (idStr) + { + //find the commandid that matches this Shortcut sc and alter it, push back its index in the modified list, if not present + size_t len = _shortcuts.size(); + for(size_t i = 0; i < len; ++i) + { + if (_shortcuts[i].getID() == (unsigned long)id) + { //found our match + getShortcuts(childNode, _shortcuts[i]); + addUserModifiedIndex(i); + } + } + } + } +} + +void NppParameters::feedMacros(TiXmlNode *node) +{ + TiXmlNode *macrosRoot = node->FirstChildElement(TEXT("Macros")); + if (!macrosRoot) return; + + for (TiXmlNode *childNode = macrosRoot->FirstChildElement(TEXT("Macro")); + childNode ; + childNode = childNode->NextSibling(TEXT("Macro")) ) + { + Shortcut sc; + if (getShortcuts(childNode, sc))// && sc.isValid()) + { + Macro macro; + getActions(childNode, macro); + int cmdID = ID_MACRO + static_cast(_macros.size()); + MacroShortcut ms(sc, macro, cmdID); + _macros.push_back(ms); + } + } +} + + +void NppParameters::getActions(TiXmlNode *node, Macro & macro) +{ + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("Action")); + childNode ; + childNode = childNode->NextSibling(TEXT("Action")) ) + { + int type; + const TCHAR *typeStr = (childNode->ToElement())->Attribute(TEXT("type"), &type); + if ((!typeStr) || (type > 3)) + continue; + + int msg = 0; + (childNode->ToElement())->Attribute(TEXT("message"), &msg); + + int wParam = 0; + (childNode->ToElement())->Attribute(TEXT("wParam"), &wParam); + + int lParam = 0; + (childNode->ToElement())->Attribute(TEXT("lParam"), &lParam); + + const TCHAR *sParam = (childNode->ToElement())->Attribute(TEXT("sParam")); + if (!sParam) + sParam = TEXT(""); + recordedMacroStep step(msg, wParam, lParam, sParam, type); + if (step.isValid()) + macro.push_back(step); + + } +} + +void NppParameters::feedUserCmds(TiXmlNode *node) +{ + TiXmlNode *userCmdsRoot = node->FirstChildElement(TEXT("UserDefinedCommands")); + if (!userCmdsRoot) return; + + for (TiXmlNode *childNode = userCmdsRoot->FirstChildElement(TEXT("Command")); + childNode ; + childNode = childNode->NextSibling(TEXT("Command")) ) + { + Shortcut sc; + if (getShortcuts(childNode, sc)) + { + TiXmlNode *aNode = childNode->FirstChild(); + if (aNode) + { + const TCHAR *cmdStr = aNode->Value(); + if (cmdStr) + { + int cmdID = ID_USER_CMD + static_cast(_userCommands.size()); + UserCommand uc(sc, cmdStr, cmdID); + _userCommands.push_back(uc); + } + } + } + } +} + +void NppParameters::feedPluginCustomizedCmds(TiXmlNode *node) +{ + TiXmlNode *pluginCustomizedCmdsRoot = node->FirstChildElement(TEXT("PluginCommands")); + if (!pluginCustomizedCmdsRoot) return; + + for (TiXmlNode *childNode = pluginCustomizedCmdsRoot->FirstChildElement(TEXT("PluginCommand")); + childNode ; + childNode = childNode->NextSibling(TEXT("PluginCommand")) ) + { + const TCHAR *moduleName = (childNode->ToElement())->Attribute(TEXT("moduleName")); + if (!moduleName) + continue; + + int internalID = -1; + const TCHAR *internalIDStr = (childNode->ToElement())->Attribute(TEXT("internalID"), &internalID); + + if (!internalIDStr) + continue; + + //Find the corresponding plugincommand and alter it, put the index in the list + size_t len = _pluginCommands.size(); + for(size_t i = 0; i < len; ++i) + { + PluginCmdShortcut & pscOrig = _pluginCommands[i]; + if (!generic_strnicmp(pscOrig.getModuleName(), moduleName, lstrlen(moduleName)) && pscOrig.getInternalID() == internalID) + { + //Found matching command + getShortcuts(childNode, _pluginCommands[i]); + addPluginModifiedIndex(i); + break; + } + } + } +} + +void NppParameters::feedScintKeys(TiXmlNode *node) +{ + TiXmlNode *scintKeysRoot = node->FirstChildElement(TEXT("ScintillaKeys")); + if (!scintKeysRoot) return; + + for (TiXmlNode *childNode = scintKeysRoot->FirstChildElement(TEXT("ScintKey")); + childNode ; + childNode = childNode->NextSibling(TEXT("ScintKey")) ) + { + int scintKey; + const TCHAR *keyStr = (childNode->ToElement())->Attribute(TEXT("ScintID"), &scintKey); + if (!keyStr) + continue; + + int menuID; + keyStr = (childNode->ToElement())->Attribute(TEXT("menuCmdID"), &menuID); + if (!keyStr) + continue; + + //Find the corresponding scintillacommand and alter it, put the index in the list + size_t len = _scintillaKeyCommands.size(); + for (int32_t i = 0; i < static_cast(len); ++i) + { + ScintillaKeyMap & skmOrig = _scintillaKeyCommands[i]; + if (skmOrig.getScintillaKeyID() == (unsigned long)scintKey && skmOrig.getMenuCmdID() == menuID) + { + //Found matching command + _scintillaKeyCommands[i].clearDups(); + getShortcuts(childNode, _scintillaKeyCommands[i]); + _scintillaKeyCommands[i].setKeyComboByIndex(0, _scintillaKeyCommands[i].getKeyCombo()); + addScintillaModifiedIndex(i); + KeyCombo kc; + for (TiXmlNode *nextNode = childNode->FirstChildElement(TEXT("NextKey")); + nextNode ; + nextNode = nextNode->NextSibling(TEXT("NextKey"))) + { + const TCHAR *str = (nextNode->ToElement())->Attribute(TEXT("Ctrl")); + if (!str) + continue; + kc._isCtrl = (lstrcmp(TEXT("yes"), str) == 0); + + str = (nextNode->ToElement())->Attribute(TEXT("Alt")); + if (!str) + continue; + kc._isAlt = (lstrcmp(TEXT("yes"), str) == 0); + + str = (nextNode->ToElement())->Attribute(TEXT("Shift")); + if (!str) + continue; + kc._isShift = (lstrcmp(TEXT("yes"), str) == 0); + + int key; + str = (nextNode->ToElement())->Attribute(TEXT("Key"), &key); + if (!str) + continue; + kc._key = static_cast(key); + _scintillaKeyCommands[i].addKeyCombo(kc); + } + break; + } + } + } +} + +bool NppParameters::feedBlacklist(TiXmlNode *node) +{ + TiXmlNode *blackListRoot = node->FirstChildElement(TEXT("PluginBlackList")); + if (!blackListRoot) return false; + + for (TiXmlNode *childNode = blackListRoot->FirstChildElement(TEXT("Plugin")); + childNode ; + childNode = childNode->NextSibling(TEXT("Plugin")) ) + { + const TCHAR *name = (childNode->ToElement())->Attribute(TEXT("name")); + if (name) + { + _blacklist.push_back(name); + } + } + return true; +} + +bool NppParameters::getShortcuts(TiXmlNode *node, Shortcut & sc) +{ + if (!node) return false; + + const TCHAR *name = (node->ToElement())->Attribute(TEXT("name")); + if (!name) + name = TEXT(""); + + bool isCtrl = false; + const TCHAR *isCtrlStr = (node->ToElement())->Attribute(TEXT("Ctrl")); + if (isCtrlStr) + isCtrl = (lstrcmp(TEXT("yes"), isCtrlStr) == 0); + + bool isAlt = false; + const TCHAR *isAltStr = (node->ToElement())->Attribute(TEXT("Alt")); + if (isAltStr) + isAlt = (lstrcmp(TEXT("yes"), isAltStr) == 0); + + bool isShift = false; + const TCHAR *isShiftStr = (node->ToElement())->Attribute(TEXT("Shift")); + if (isShiftStr) + isShift = (lstrcmp(TEXT("yes"), isShiftStr) == 0); + + int key; + const TCHAR *keyStr = (node->ToElement())->Attribute(TEXT("Key"), &key); + if (!keyStr) + return false; + + sc = Shortcut(name, isCtrl, isAlt, isShift, static_cast(key)); + return true; +} + + +bool NppParameters::feedUserLang(TiXmlNode *node) +{ + bool isEverythingOK = true; + bool hasFoundElement = false; + + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("UserLang")); + childNode && (_nbUserLang < NB_MAX_USER_LANG); + childNode = childNode->NextSibling(TEXT("UserLang")) ) + { + const TCHAR *name = (childNode->ToElement())->Attribute(TEXT("name")); + const TCHAR *ext = (childNode->ToElement())->Attribute(TEXT("ext")); + const TCHAR *udlVersion = (childNode->ToElement())->Attribute(TEXT("udlVersion")); + hasFoundElement = true; + try { + if (!name || !name[0] || !ext) + throw std::runtime_error("NppParameters::feedUserLang : UserLang name is missing"); + + if (!udlVersion) + _userLangArray[_nbUserLang] = new UserLangContainer(name, ext, TEXT("")); + else + _userLangArray[_nbUserLang] = new UserLangContainer(name, ext, udlVersion); + ++_nbUserLang; + + TiXmlNode *settingsRoot = childNode->FirstChildElement(TEXT("Settings")); + if (!settingsRoot) + throw std::runtime_error("NppParameters::feedUserLang : Settings node is missing"); + + feedUserSettings(settingsRoot); + + TiXmlNode *keywordListsRoot = childNode->FirstChildElement(TEXT("KeywordLists")); + if (!keywordListsRoot) + throw std::runtime_error("NppParameters::feedUserLang : KeywordLists node is missing"); + + feedUserKeywordList(keywordListsRoot); + + TiXmlNode *stylesRoot = childNode->FirstChildElement(TEXT("Styles")); + if (!stylesRoot) + throw std::runtime_error("NppParameters::feedUserLang : Styles node is missing"); + + feedUserStyles(stylesRoot); + + // styles that were not read from xml file should get default values + for (int i=0; i_styleArray.getStyler(i); + if (style._styleID == -1) + _userLangArray[_nbUserLang - 1]->_styleArray.addStyler(i, globalMappper().styleNameMapper[i].c_str()); + } + + } catch (std::exception e) { + delete _userLangArray[--_nbUserLang]; + isEverythingOK = false; + } + } + if (isEverythingOK) + isEverythingOK = hasFoundElement; + return isEverythingOK; +} + +bool NppParameters::importUDLFromFile(generic_string sourceFile) +{ + if (_nbImportedULD >= NB_MAX_IMPORTED_UDL) + return false; + + TiXmlDocument *pXmlUserLangDoc = new TiXmlDocument(sourceFile); + bool loadOkay = pXmlUserLangDoc->LoadFile(); + if (loadOkay) + { + loadOkay = getUserDefineLangsFromXmlTree(pXmlUserLangDoc); + } + _importedULD[_nbImportedULD++] = pXmlUserLangDoc; + return loadOkay; +} + +bool NppParameters::exportUDLToFile(size_t langIndex2export, generic_string fileName2save) +{ + if (langIndex2export >= NB_MAX_USER_LANG) + return false; + + if (static_cast(langIndex2export) >= _nbUserLang) + return false; + + TiXmlDocument *pNewXmlUserLangDoc = new TiXmlDocument(fileName2save); + TiXmlNode *newRoot2export = pNewXmlUserLangDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + + insertUserLang2Tree(newRoot2export, _userLangArray[langIndex2export]); + bool result = pNewXmlUserLangDoc->SaveFile(); + + delete pNewXmlUserLangDoc; + return result; +} + +LangType NppParameters::getLangFromExt(const TCHAR *ext) +{ + int i = getNbLang(); + i--; + while (i >= 0) + { + Lang *l = getLangFromIndex(i--); + + const TCHAR *defList = l->getDefaultExtList(); + const TCHAR *userList = NULL; + + LexerStylerArray &lsa = getLStylerArray(); + const TCHAR *lName = l->getLangName(); + LexerStyler *pLS = lsa.getLexerStylerByName(lName); + + if (pLS) + userList = pLS->getLexerUserExt(); + + generic_string list; + if (defList) + list += defList; + + if (userList) + { + list += TEXT(" "); + list += userList; + } + if (isInList(ext, list.c_str())) + return l->getLangID(); + } + return L_TEXT; +} + +void NppParameters::setCloudChoice(const TCHAR *pathChoice) +{ + generic_string cloudChoicePath = getSettingsFolder(); + cloudChoicePath += TEXT("\\cloud\\"); + + if (!PathFileExists(cloudChoicePath.c_str())) + { + ::CreateDirectory(cloudChoicePath.c_str(), NULL); + } + cloudChoicePath += TEXT("choice"); + + WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + std::string cloudPathA = wmc->wchar2char(pathChoice, SC_CP_UTF8); + + writeFileContent(cloudChoicePath.c_str(), cloudPathA.c_str()); +} + +void NppParameters::removeCloudChoice() +{ + generic_string cloudChoicePath = getSettingsFolder(); + + cloudChoicePath += TEXT("\\cloud\\choice"); + if (PathFileExists(cloudChoicePath.c_str())) + { + ::DeleteFile(cloudChoicePath.c_str()); + } +} + +bool NppParameters::isCloudPathChanged() const +{ + if (_initialCloudChoice == _nppGUI._cloudPath) + return false; + else if (_initialCloudChoice.size() - _nppGUI._cloudPath.size() == 1) + { + TCHAR c = _initialCloudChoice.at(_initialCloudChoice.size()-1); + if (c == '\\' || c == '/') + { + if (_initialCloudChoice.find(_nppGUI._cloudPath) == 0) + return false; + } + } + else if (_nppGUI._cloudPath.size() - _initialCloudChoice.size() == 1) + { + TCHAR c = _nppGUI._cloudPath.at(_nppGUI._cloudPath.size() - 1); + if (c == '\\' || c == '/') + { + if (_nppGUI._cloudPath.find(_initialCloudChoice) == 0) + return false; + } + } + return true; +} + +bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string & cloudSettingsPath) +{ + bool isOK = false; + + if (cloudSettingsPath.empty()) + return false; + + // config.xml + generic_string cloudConfigPath = cloudSettingsPath; + PathAppend(cloudConfigPath, TEXT("config.xml")); + if (!::PathFileExists(cloudConfigPath.c_str()) && _pXmlUserDoc) + { + isOK = _pXmlUserDoc->SaveFile(cloudConfigPath.c_str()); + if (!isOK) + return false; + } + + // stylers.xml + generic_string cloudStylersPath = cloudSettingsPath; + PathAppend(cloudStylersPath, TEXT("stylers.xml")); + if (!::PathFileExists(cloudStylersPath.c_str()) && _pXmlUserStylerDoc) + { + isOK = _pXmlUserStylerDoc->SaveFile(cloudStylersPath.c_str()); + if (!isOK) + return false; + } + + // langs.xml + generic_string cloudLangsPath = cloudSettingsPath; + PathAppend(cloudLangsPath, TEXT("langs.xml")); + if (!::PathFileExists(cloudLangsPath.c_str()) && _pXmlUserDoc) + { + isOK = _pXmlDoc->SaveFile(cloudLangsPath.c_str()); + if (!isOK) + return false; + } +/* + // session.xml: Session stock the absolute file path, it should never be on cloud + generic_string cloudSessionPath = cloudSettingsPath; + PathAppend(cloudSessionPath, TEXT("session.xml")); + if (!::PathFileExists(cloudSessionPath.c_str()) && _pXmlSessionDoc) + { + _pXmlSessionDoc->SaveFile(cloudSessionPath.c_str()); + } +*/ + // userDefineLang.xml + generic_string cloudUserLangsPath = cloudSettingsPath; + PathAppend(cloudUserLangsPath, TEXT("userDefineLang.xml")); + if (!::PathFileExists(cloudUserLangsPath.c_str()) && _pXmlUserLangDoc) + { + isOK = _pXmlUserLangDoc->SaveFile(cloudUserLangsPath.c_str()); + if (!isOK) + return false; + } + + // shortcuts.xml + generic_string cloudShortcutsPath = cloudSettingsPath; + PathAppend(cloudShortcutsPath, TEXT("shortcuts.xml")); + if (!::PathFileExists(cloudShortcutsPath.c_str()) && _pXmlShortcutDoc) + { + isOK = _pXmlShortcutDoc->SaveFile(cloudShortcutsPath.c_str()); + if (!isOK) + return false; + } + + // contextMenu.xml + generic_string cloudContextMenuPath = cloudSettingsPath; + PathAppend(cloudContextMenuPath, TEXT("contextMenu.xml")); + if (!::PathFileExists(cloudContextMenuPath.c_str()) && _pXmlContextMenuDocA) + { + isOK = _pXmlContextMenuDocA->SaveUnicodeFilePath(cloudContextMenuPath.c_str()); + if (!isOK) + return false; + } + + // nativeLang.xml + generic_string cloudNativeLangPath = cloudSettingsPath; + PathAppend(cloudNativeLangPath, TEXT("nativeLang.xml")); + if (!::PathFileExists(cloudNativeLangPath.c_str()) && _pXmlNativeLangDocA) + { + isOK = _pXmlNativeLangDocA->SaveUnicodeFilePath(cloudNativeLangPath.c_str()); + if (!isOK) + return false; + } + + /* + // functionList.xml + generic_string cloudFunctionListPath = cloudSettingsPath; + PathAppend(cloudFunctionListPath, TEXT("functionList.xml")); + if (!::PathFileExists(cloudFunctionListPath.c_str())) + { + + } + */ + return true; +} + + +void NppParameters::writeUserDefinedLang() +{ + if (!_pXmlUserLangDoc) + { + //do the treatment + _pXmlUserLangDoc = new TiXmlDocument(_userDefineLangPath); + } + + //before remove the branch, we allocate and copy the TCHAR * which will be destroyed + stylerStrOp(DUP); + + TiXmlNode *root = _pXmlUserLangDoc->FirstChild(TEXT("NotepadPlus")); + if (root) + { + _pXmlUserLangDoc->RemoveChild(root); + } + + _pXmlUserLangDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + + root = _pXmlUserLangDoc->FirstChild(TEXT("NotepadPlus")); + + for (int i = 0 ; i < _nbUserLang ; ++i) + { + insertUserLang2Tree(root, _userLangArray[i]); + } + _pXmlUserLangDoc->SaveFile(); + stylerStrOp(FREE); +} + + +void NppParameters::insertCmd(TiXmlNode *shortcutsRoot, const CommandShortcut & cmd) +{ + const KeyCombo & key = cmd.getKeyCombo(); + TiXmlNode *sc = shortcutsRoot->InsertEndChild(TiXmlElement(TEXT("Shortcut"))); + sc->ToElement()->SetAttribute(TEXT("id"), cmd.getID()); + sc->ToElement()->SetAttribute(TEXT("Ctrl"), key._isCtrl?TEXT("yes"):TEXT("no")); + sc->ToElement()->SetAttribute(TEXT("Alt"), key._isAlt?TEXT("yes"):TEXT("no")); + sc->ToElement()->SetAttribute(TEXT("Shift"), key._isShift?TEXT("yes"):TEXT("no")); + sc->ToElement()->SetAttribute(TEXT("Key"), key._key); +} + + +void NppParameters::insertMacro(TiXmlNode *macrosRoot, const MacroShortcut & macro) +{ + const KeyCombo & key = macro.getKeyCombo(); + TiXmlNode *macroRoot = macrosRoot->InsertEndChild(TiXmlElement(TEXT("Macro"))); + macroRoot->ToElement()->SetAttribute(TEXT("name"), macro.getMenuName()); + macroRoot->ToElement()->SetAttribute(TEXT("Ctrl"), key._isCtrl?TEXT("yes"):TEXT("no")); + macroRoot->ToElement()->SetAttribute(TEXT("Alt"), key._isAlt?TEXT("yes"):TEXT("no")); + macroRoot->ToElement()->SetAttribute(TEXT("Shift"), key._isShift?TEXT("yes"):TEXT("no")); + macroRoot->ToElement()->SetAttribute(TEXT("Key"), key._key); + + for (size_t i = 0, len = macro._macro.size(); i < len ; ++i) + { + TiXmlNode *actionNode = macroRoot->InsertEndChild(TiXmlElement(TEXT("Action"))); + const recordedMacroStep & action = macro._macro[i]; + actionNode->ToElement()->SetAttribute(TEXT("type"), action._macroType); + actionNode->ToElement()->SetAttribute(TEXT("message"), action._message); + actionNode->ToElement()->SetAttribute(TEXT("wParam"), static_cast(action._wParameter)); + actionNode->ToElement()->SetAttribute(TEXT("lParam"), static_cast(action._lParameter)); + actionNode->ToElement()->SetAttribute(TEXT("sParam"), action._sParameter.c_str()); + } +} + + +void NppParameters::insertUserCmd(TiXmlNode *userCmdRoot, const UserCommand & userCmd) +{ + const KeyCombo & key = userCmd.getKeyCombo(); + TiXmlNode *cmdRoot = userCmdRoot->InsertEndChild(TiXmlElement(TEXT("Command"))); + cmdRoot->ToElement()->SetAttribute(TEXT("name"), userCmd.getMenuName()); + cmdRoot->ToElement()->SetAttribute(TEXT("Ctrl"), key._isCtrl?TEXT("yes"):TEXT("no")); + cmdRoot->ToElement()->SetAttribute(TEXT("Alt"), key._isAlt?TEXT("yes"):TEXT("no")); + cmdRoot->ToElement()->SetAttribute(TEXT("Shift"), key._isShift?TEXT("yes"):TEXT("no")); + cmdRoot->ToElement()->SetAttribute(TEXT("Key"), key._key); + cmdRoot->InsertEndChild(TiXmlText(userCmd._cmd.c_str())); +} + + +void NppParameters::insertPluginCmd(TiXmlNode *pluginCmdRoot, const PluginCmdShortcut & pluginCmd) +{ + const KeyCombo & key = pluginCmd.getKeyCombo(); + TiXmlNode *pluginCmdNode = pluginCmdRoot->InsertEndChild(TiXmlElement(TEXT("PluginCommand"))); + pluginCmdNode->ToElement()->SetAttribute(TEXT("moduleName"), pluginCmd.getModuleName()); + pluginCmdNode->ToElement()->SetAttribute(TEXT("internalID"), pluginCmd.getInternalID()); + pluginCmdNode->ToElement()->SetAttribute(TEXT("Ctrl"), key._isCtrl?TEXT("yes"):TEXT("no")); + pluginCmdNode->ToElement()->SetAttribute(TEXT("Alt"), key._isAlt?TEXT("yes"):TEXT("no")); + pluginCmdNode->ToElement()->SetAttribute(TEXT("Shift"), key._isShift?TEXT("yes"):TEXT("no")); + pluginCmdNode->ToElement()->SetAttribute(TEXT("Key"), key._key); +} + + +void NppParameters::insertScintKey(TiXmlNode *scintKeyRoot, const ScintillaKeyMap & scintKeyMap) +{ + TiXmlNode *keyRoot = scintKeyRoot->InsertEndChild(TiXmlElement(TEXT("ScintKey"))); + keyRoot->ToElement()->SetAttribute(TEXT("ScintID"), scintKeyMap.getScintillaKeyID()); + keyRoot->ToElement()->SetAttribute(TEXT("menuCmdID"), scintKeyMap.getMenuCmdID()); + + //Add main shortcut + KeyCombo key = scintKeyMap.getKeyComboByIndex(0); + keyRoot->ToElement()->SetAttribute(TEXT("Ctrl"), key._isCtrl?TEXT("yes"):TEXT("no")); + keyRoot->ToElement()->SetAttribute(TEXT("Alt"), key._isAlt?TEXT("yes"):TEXT("no")); + keyRoot->ToElement()->SetAttribute(TEXT("Shift"), key._isShift?TEXT("yes"):TEXT("no")); + keyRoot->ToElement()->SetAttribute(TEXT("Key"), key._key); + + //Add additional shortcuts + size_t size = scintKeyMap.getSize(); + if (size > 1) + { + for (size_t i = 1; i < size; ++i) + { + TiXmlNode *keyNext = keyRoot->InsertEndChild(TiXmlElement(TEXT("NextKey"))); + key = scintKeyMap.getKeyComboByIndex(i); + keyNext->ToElement()->SetAttribute(TEXT("Ctrl"), key._isCtrl?TEXT("yes"):TEXT("no")); + keyNext->ToElement()->SetAttribute(TEXT("Alt"), key._isAlt?TEXT("yes"):TEXT("no")); + keyNext->ToElement()->SetAttribute(TEXT("Shift"), key._isShift?TEXT("yes"):TEXT("no")); + keyNext->ToElement()->SetAttribute(TEXT("Key"), key._key); + } + } +} + + +void NppParameters::writeSession(const Session & session, const TCHAR *fileName) +{ + const TCHAR *pathName = fileName?fileName:_sessionPath.c_str(); + + _pXmlSessionDoc = new TiXmlDocument(pathName); + TiXmlNode *root = _pXmlSessionDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + + if (root) + { + TiXmlNode *sessionNode = root->InsertEndChild(TiXmlElement(TEXT("Session"))); + (sessionNode->ToElement())->SetAttribute(TEXT("activeView"), static_cast(session._activeView)); + + struct ViewElem { + TiXmlNode *viewNode; + vector *viewFiles; + size_t activeIndex; + }; + const int nbElem = 2; + ViewElem viewElems[nbElem]; + viewElems[0].viewNode = sessionNode->InsertEndChild(TiXmlElement(TEXT("mainView"))); + viewElems[1].viewNode = sessionNode->InsertEndChild(TiXmlElement(TEXT("subView"))); + viewElems[0].viewFiles = (vector *)(&(session._mainViewFiles)); + viewElems[1].viewFiles = (vector *)(&(session._subViewFiles)); + viewElems[0].activeIndex = session._activeMainIndex; + viewElems[1].activeIndex = session._activeSubIndex; + + for (size_t k = 0; k < nbElem ; ++k) + { + (viewElems[k].viewNode->ToElement())->SetAttribute(TEXT("activeIndex"), static_cast(viewElems[k].activeIndex)); + vector & viewSessionFiles = *(viewElems[k].viewFiles); + + for (size_t i = 0, len = viewElems[k].viewFiles->size(); i < len ; ++i) + { + TiXmlNode *fileNameNode = viewElems[k].viewNode->InsertEndChild(TiXmlElement(TEXT("File"))); + + (fileNameNode->ToElement())->SetAttribute(TEXT("firstVisibleLine"), viewSessionFiles[i]._firstVisibleLine); + (fileNameNode->ToElement())->SetAttribute(TEXT("xOffset"), viewSessionFiles[i]._xOffset); + (fileNameNode->ToElement())->SetAttribute(TEXT("scrollWidth"), viewSessionFiles[i]._scrollWidth); + (fileNameNode->ToElement())->SetAttribute(TEXT("startPos"), viewSessionFiles[i]._startPos); + (fileNameNode->ToElement())->SetAttribute(TEXT("endPos"), viewSessionFiles[i]._endPos); + (fileNameNode->ToElement())->SetAttribute(TEXT("selMode"), viewSessionFiles[i]._selMode); + (fileNameNode->ToElement())->SetAttribute(TEXT("lang"), viewSessionFiles[i]._langName.c_str()); + (fileNameNode->ToElement())->SetAttribute(TEXT("encoding"), viewSessionFiles[i]._encoding); + (fileNameNode->ToElement())->SetAttribute(TEXT("filename"), viewSessionFiles[i]._fileName.c_str()); + (fileNameNode->ToElement())->SetAttribute(TEXT("backupFilePath"), viewSessionFiles[i]._backupFilePath.c_str()); + (fileNameNode->ToElement())->SetAttribute(TEXT("originalFileLastModifTimestamp"), static_cast(viewSessionFiles[i]._originalFileLastModifTimestamp)); + + // docMap + (fileNameNode->ToElement())->SetAttribute(TEXT("mapFirstVisibleDisplayLine"), viewSessionFiles[i]._mapPos._firstVisibleDisplayLine); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapFirstVisibleDocLine"), viewSessionFiles[i]._mapPos._firstVisibleDocLine); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapLastVisibleDocLine"), viewSessionFiles[i]._mapPos._lastVisibleDocLine); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapNbLine"), viewSessionFiles[i]._mapPos._nbLine); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapHigherPos"), viewSessionFiles[i]._mapPos._higherPos); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapWidth"), viewSessionFiles[i]._mapPos._width); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapHeight"), viewSessionFiles[i]._mapPos._height); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapKByteInDoc"), static_cast(viewSessionFiles[i]._mapPos._KByteInDoc)); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapWrapIndentMode"), viewSessionFiles[i]._mapPos._wrapIndentMode); + fileNameNode->ToElement()->SetAttribute(TEXT("mapIsWrap"), viewSessionFiles[i]._mapPos._isWrap ? TEXT("yes") : TEXT("no")); + + for (size_t j = 0, len = viewSessionFiles[i]._marks.size() ; j < len ; ++j) + { + size_t markLine = viewSessionFiles[i]._marks[j]; + TiXmlNode *markNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Mark"))); + markNode->ToElement()->SetAttribute(TEXT("line"), static_cast(markLine)); + } + + for (size_t j = 0, len = viewSessionFiles[i]._foldStates.size() ; j < len ; ++j) + { + size_t foldLine = viewSessionFiles[i]._foldStates[j]; + TiXmlNode *foldNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Fold"))); + foldNode->ToElement()->SetAttribute(TEXT("line"), static_cast(foldLine)); + } + } + } + } + _pXmlSessionDoc->SaveFile(); +} + + +void NppParameters::writeShortcuts() +{ + if (not _isAnyShortcutModified) return; + + if (not _pXmlShortcutDoc) + { + //do the treatment + _pXmlShortcutDoc = new TiXmlDocument(_shortcutsPath); + } + + TiXmlNode *root = _pXmlShortcutDoc->FirstChild(TEXT("NotepadPlus")); + if (!root) + { + root = _pXmlShortcutDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + } + + TiXmlNode *cmdRoot = root->FirstChild(TEXT("InternalCommands")); + if (cmdRoot) + root->RemoveChild(cmdRoot); + + cmdRoot = root->InsertEndChild(TiXmlElement(TEXT("InternalCommands"))); + for (size_t i = 0, len = _customizedShortcuts.size(); i < len ; ++i) + { + size_t index = _customizedShortcuts[i]; + CommandShortcut csc = _shortcuts[index]; + insertCmd(cmdRoot, csc); + } + + TiXmlNode *macrosRoot = root->FirstChild(TEXT("Macros")); + if (macrosRoot) + root->RemoveChild(macrosRoot); + + macrosRoot = root->InsertEndChild(TiXmlElement(TEXT("Macros"))); + + for (size_t i = 0, len = _macros.size(); i < len ; ++i) + { + insertMacro(macrosRoot, _macros[i]); + } + + TiXmlNode *userCmdRoot = root->FirstChild(TEXT("UserDefinedCommands")); + if (userCmdRoot) + root->RemoveChild(userCmdRoot); + + userCmdRoot = root->InsertEndChild(TiXmlElement(TEXT("UserDefinedCommands"))); + + for (size_t i = 0, len = _userCommands.size(); i < len ; ++i) + { + insertUserCmd(userCmdRoot, _userCommands[i]); + } + + TiXmlNode *pluginCmdRoot = root->FirstChild(TEXT("PluginCommands")); + if (pluginCmdRoot) + root->RemoveChild(pluginCmdRoot); + + pluginCmdRoot = root->InsertEndChild(TiXmlElement(TEXT("PluginCommands"))); + for (size_t i = 0, len = _pluginCustomizedCmds.size(); i < len ; ++i) + { + insertPluginCmd(pluginCmdRoot, _pluginCommands[_pluginCustomizedCmds[i]]); + } + + TiXmlNode *scitillaKeyRoot = root->FirstChild(TEXT("ScintillaKeys")); + if (scitillaKeyRoot) + root->RemoveChild(scitillaKeyRoot); + + scitillaKeyRoot = root->InsertEndChild(TiXmlElement(TEXT("ScintillaKeys"))); + for (size_t i = 0, len = _scintillaModifiedKeyIndices.size(); i < len ; ++i) + { + insertScintKey(scitillaKeyRoot, _scintillaKeyCommands[_scintillaModifiedKeyIndices[i]]); + } + _pXmlShortcutDoc->SaveFile(); +} + + +int NppParameters::addUserLangToEnd(const UserLangContainer & userLang, const TCHAR *newName) +{ + if (isExistingUserLangName(newName)) + return -1; + + _userLangArray[_nbUserLang] = new UserLangContainer(); + *(_userLangArray[_nbUserLang]) = userLang; + _userLangArray[_nbUserLang]->_name = newName; + ++_nbUserLang; + return _nbUserLang-1; +} + + +void NppParameters::removeUserLang(size_t index) +{ + if (static_cast(index) >= _nbUserLang) + return; + delete _userLangArray[index]; + + for (int32_t i = static_cast(index); i < (_nbUserLang - 1); ++i) + _userLangArray[i] = _userLangArray[i+1]; + _nbUserLang--; +} + + +void NppParameters::feedUserSettings(TiXmlNode *settingsRoot) +{ + const TCHAR *boolStr; + TiXmlNode *globalSettingNode = settingsRoot->FirstChildElement(TEXT("Global")); + if (globalSettingNode) + { + boolStr = (globalSettingNode->ToElement())->Attribute(TEXT("caseIgnored")); + if (boolStr) + _userLangArray[_nbUserLang - 1]->_isCaseIgnored = (lstrcmp(TEXT("yes"), boolStr) == 0); + + boolStr = (globalSettingNode->ToElement())->Attribute(TEXT("allowFoldOfComments")); + if (boolStr) + _userLangArray[_nbUserLang - 1]->_allowFoldOfComments = (lstrcmp(TEXT("yes"), boolStr) == 0); + + (globalSettingNode->ToElement())->Attribute(TEXT("forcePureLC"), &_userLangArray[_nbUserLang - 1]->_forcePureLC); + (globalSettingNode->ToElement())->Attribute(TEXT("decimalSeparator"), &_userLangArray[_nbUserLang - 1]->_decimalSeparator); + + boolStr = (globalSettingNode->ToElement())->Attribute(TEXT("foldCompact")); + if (boolStr) + _userLangArray[_nbUserLang - 1]->_foldCompact = (lstrcmp(TEXT("yes"), boolStr) == 0); + } + + TiXmlNode *prefixNode = settingsRoot->FirstChildElement(TEXT("Prefix")); + if (prefixNode) + { + const TCHAR *udlVersion = _userLangArray[_nbUserLang - 1]->_udlVersion.c_str(); + if (!lstrcmp(udlVersion, TEXT("2.1")) || !lstrcmp(udlVersion, TEXT("2.0"))) + { + for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; ++i) + { + boolStr = (prefixNode->ToElement())->Attribute(globalMappper().keywordNameMapper[i+SCE_USER_KWLIST_KEYWORDS1]); + if (boolStr) + _userLangArray[_nbUserLang - 1]->_isPrefix[i] = (lstrcmp(TEXT("yes"), boolStr) == 0); + } + } + else // support for old style (pre 2.0) + { + TCHAR names[SCE_USER_TOTAL_KEYWORD_GROUPS][7] = {TEXT("words1"), TEXT("words2"), TEXT("words3"), TEXT("words4")}; + for (int i = 0 ; i < 4 ; ++i) + { + boolStr = (prefixNode->ToElement())->Attribute(names[i]); + if (boolStr) + _userLangArray[_nbUserLang - 1]->_isPrefix[i] = (lstrcmp(TEXT("yes"), boolStr) == 0); + } + } + } +} + + +void NppParameters::feedUserKeywordList(TiXmlNode *node) +{ + const TCHAR * udlVersion = _userLangArray[_nbUserLang - 1]->_udlVersion.c_str(); + int id = -1; + + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("Keywords")); + childNode ; + childNode = childNode->NextSibling(TEXT("Keywords"))) + { + const TCHAR * keywordsName = (childNode->ToElement())->Attribute(TEXT("name")); + TiXmlNode *valueNode = childNode->FirstChild(); + if (valueNode) + { + TCHAR *kwl = nullptr; + if (!lstrcmp(udlVersion, TEXT("")) && !lstrcmp(keywordsName, TEXT("Delimiters"))) // support for old style (pre 2.0) + { + basic_string temp; + kwl = (valueNode)?valueNode->Value():TEXT("000000"); + + temp += TEXT("00"); if (kwl[0] != '0') temp += kwl[0]; temp += TEXT(" 01"); + temp += TEXT(" 02"); if (kwl[3] != '0') temp += kwl[3]; + temp += TEXT(" 03"); if (kwl[1] != '0') temp += kwl[1]; temp += TEXT(" 04"); + temp += TEXT(" 05"); if (kwl[4] != '0') temp += kwl[4]; + temp += TEXT(" 06"); if (kwl[2] != '0') temp += kwl[2]; temp += TEXT(" 07"); + temp += TEXT(" 08"); if (kwl[5] != '0') temp += kwl[5]; + + temp += TEXT(" 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23"); + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_DELIMITERS], temp.c_str()); + } + else if (!lstrcmp(keywordsName, TEXT("Comment"))) + { + kwl = (valueNode)?valueNode->Value():TEXT(""); + //int len = _tcslen(kwl); + basic_string temp{TEXT(" ")}; + + temp += kwl; + size_t pos = 0; + + pos = temp.find(TEXT(" 0")); + while (pos != string::npos) + { + temp.replace(pos, 2, TEXT(" 00")); + pos = temp.find(TEXT(" 0"), pos+1); + } + pos = temp.find(TEXT(" 1")); + while (pos != string::npos) + { + temp.replace(pos, 2, TEXT(" 03")); + pos = temp.find(TEXT(" 1")); + } + pos = temp.find(TEXT(" 2")); + while (pos != string::npos) + { + temp.replace(pos, 2, TEXT(" 04")); + pos = temp.find(TEXT(" 2")); + } + + temp += TEXT(" 01 02"); + if (temp[0] == ' ') + temp.erase(0, 1); + + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_COMMENTS], temp.c_str()); + } + else + { + kwl = (valueNode)?valueNode->Value():TEXT(""); + if (globalMappper().keywordIdMapper.find(keywordsName) != globalMappper().keywordIdMapper.end()) + { + id = globalMappper().keywordIdMapper[keywordsName]; + if (_tcslen(kwl) < max_char) + { + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], kwl); + } + else + { + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], TEXT("imported string too long, needs to be < max_char(30720)")); + } + } + } + } + } +} + +void NppParameters::feedUserStyles(TiXmlNode *node) +{ + int id = -1; + + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("WordsStyle")); + childNode ; + childNode = childNode->NextSibling(TEXT("WordsStyle"))) + { + const TCHAR *styleName = (childNode->ToElement())->Attribute(TEXT("name")); + if (styleName) + { + if (globalMappper().styleIdMapper.find(styleName) != globalMappper().styleIdMapper.end()) + { + id = globalMappper().styleIdMapper[styleName]; + _userLangArray[_nbUserLang - 1]->_styleArray.addStyler((id | L_USER << 16), childNode); + } + } + } +} + +bool NppParameters::feedStylerArray(TiXmlNode *node) +{ + TiXmlNode *styleRoot = node->FirstChildElement(TEXT("LexerStyles")); + if (!styleRoot) return false; + + // For each lexer + for (TiXmlNode *childNode = styleRoot->FirstChildElement(TEXT("LexerType")); + childNode ; + childNode = childNode->NextSibling(TEXT("LexerType")) ) + { + if (!_lexerStylerArray.hasEnoughSpace()) return false; + + TiXmlElement *element = childNode->ToElement(); + const TCHAR *lexerName = element->Attribute(TEXT("name")); + const TCHAR *lexerDesc = element->Attribute(TEXT("desc")); + const TCHAR *lexerUserExt = element->Attribute(TEXT("ext")); + const TCHAR *lexerExcluded = element->Attribute(TEXT("excluded")); + if (lexerName) + { + _lexerStylerArray.addLexerStyler(lexerName, lexerDesc, lexerUserExt, childNode); + if (lexerExcluded != NULL && (lstrcmp(lexerExcluded, TEXT("yes")) == 0)) + { + int index = getExternalLangIndexFromName(lexerName); + if (index != -1) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)(index + L_EXTERNAL))); + } + } + } + + // The global styles for all lexers + TiXmlNode *globalStyleRoot = node->FirstChildElement(TEXT("GlobalStyles")); + if (!globalStyleRoot) return false; + + for (TiXmlNode *childNode = globalStyleRoot->FirstChildElement(TEXT("WidgetStyle")); + childNode ; + childNode = childNode->NextSibling(TEXT("WidgetStyle")) ) + { + if (!_widgetStyleArray.hasEnoughSpace()) return false; + + TiXmlElement *element = childNode->ToElement(); + const TCHAR *styleIDStr = element->Attribute(TEXT("styleID")); + + int styleID = -1; + if ((styleID = decStrVal(styleIDStr)) != -1) + { + _widgetStyleArray.addStyler(styleID, childNode); + } + } + return true; +} + +void LexerStylerArray::addLexerStyler(const TCHAR *lexerName, const TCHAR *lexerDesc, const TCHAR *lexerUserExt , TiXmlNode *lexerNode) +{ + LexerStyler & ls = _lexerStylerArray[_nbLexerStyler++]; + ls.setLexerName(lexerName); + if (lexerDesc) + ls.setLexerDesc(lexerDesc); + + if (lexerUserExt) + ls.setLexerUserExt(lexerUserExt); + + for (TiXmlNode *childNode = lexerNode->FirstChildElement(TEXT("WordsStyle")); + childNode ; + childNode = childNode->NextSibling(TEXT("WordsStyle")) ) + { + if (!ls.hasEnoughSpace()) + return; + + TiXmlElement *element = childNode->ToElement(); + const TCHAR *styleIDStr = element->Attribute(TEXT("styleID")); + + if (styleIDStr) + { + int styleID = -1; + if ((styleID = decStrVal(styleIDStr)) != -1) + { + ls.addStyler(styleID, childNode); + } + } + } +} + +void LexerStylerArray::eraseAll() +{ + + for (int i = 0 ; i < _nbLexerStyler ; ++i) + { + _lexerStylerArray[i].setNbStyler( 0 ); + } + + _nbLexerStyler = 0; +} + +void StyleArray::addStyler(int styleID, TiXmlNode *styleNode) +{ + int index = _nbStyler; + bool isUser = styleID >> 16 == L_USER; + if (isUser) + { + styleID = (styleID & 0xFFFF); + index = styleID; + if (index >= SCE_USER_STYLE_TOTAL_STYLES || _styleArray[index]._styleID != -1) + return; + } + + _styleArray[index]._styleID = styleID; + + if (styleNode) + { + TiXmlElement *element = styleNode->ToElement(); + + // TODO: translate to English + // Pour _fgColor, _bgColor : + // RGB() | (result & 0xFF000000) c'est pour le cas de -1 (0xFFFFFFFF) + // retourné par hexStrVal(str) + const TCHAR *str = element->Attribute(TEXT("name")); + if (str) + { + if (isUser) + _styleArray[index]._styleDesc = globalMappper().styleNameMapper[index].c_str(); + else + _styleArray[index]._styleDesc = str; + } + + str = element->Attribute(TEXT("fgColor")); + if (str) + { + unsigned long result = hexStrVal(str); + _styleArray[index]._fgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000); + + } + + str = element->Attribute(TEXT("bgColor")); + if (str) + { + unsigned long result = hexStrVal(str); + _styleArray[index]._bgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000); + } + + str = element->Attribute(TEXT("colorStyle")); + if (str) + { + _styleArray[index]._colorStyle = decStrVal(str); + } + + str = element->Attribute(TEXT("fontName")); + _styleArray[index]._fontName = str; + + str = element->Attribute(TEXT("fontStyle")); + if (str) + { + _styleArray[index]._fontStyle = decStrVal(str); + } + + str = element->Attribute(TEXT("fontSize")); + if (str) + { + _styleArray[index]._fontSize = decStrVal(str); + } + str = element->Attribute(TEXT("nesting")); + + if (str) + { + _styleArray[index]._nesting = decStrVal(str); + } + + str = element->Attribute(TEXT("keywordClass")); + if (str) + { + _styleArray[index]._keywordClass = getKwClassFromName(str); + } + + TiXmlNode *v = styleNode->FirstChild(); + if (v) + { + _styleArray[index]._keywords = new generic_string(v->Value()); + } + } + ++_nbStyler; +} + +bool NppParameters::writeRecentFileHistorySettings(int nbMaxFile) const +{ + if (not _pXmlUserDoc) return false; + + TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); + if (not nppRoot) + { + nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + } + + TiXmlNode *historyNode = nppRoot->FirstChildElement(TEXT("History")); + if (not historyNode) + { + historyNode = nppRoot->InsertEndChild(TiXmlElement(TEXT("History"))); + } + + (historyNode->ToElement())->SetAttribute(TEXT("nbMaxFile"), nbMaxFile!=-1?nbMaxFile:_nbMaxRecentFile); + (historyNode->ToElement())->SetAttribute(TEXT("inSubMenu"), _putRecentFileInSubMenu?TEXT("yes"):TEXT("no")); + (historyNode->ToElement())->SetAttribute(TEXT("customLength"), _recentFileCustomLength); + return true; +} + +bool NppParameters::writeProjectPanelsSettings() const +{ + if (!_pXmlUserDoc) return false; + + TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); + if (not nppRoot) + { + nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + } + + TiXmlNode *oldProjPanelRootNode = nppRoot->FirstChildElement(TEXT("ProjectPanels")); + if (oldProjPanelRootNode) + { + // Erase the Project Panel root + nppRoot->RemoveChild(oldProjPanelRootNode); + } + + // Create the Project Panel root + TiXmlElement projPanelRootNode{TEXT("ProjectPanels")}; + + // Add 3 Project Panel parameters + for (int32_t i = 0 ; i < 3 ; ++i) + { + TiXmlElement projPanelNode{TEXT("ProjectPanel")}; + (projPanelNode.ToElement())->SetAttribute(TEXT("id"), i); + (projPanelNode.ToElement())->SetAttribute(TEXT("workSpaceFile"), _workSpaceFilePathes[i]); + + (projPanelRootNode.ToElement())->InsertEndChild(projPanelNode); + } + + // (Re)Insert the Project Panel root + (nppRoot->ToElement())->InsertEndChild(projPanelRootNode); + return true; +} + +bool NppParameters::writeFileBrowserSettings(const vector & rootPaths, const generic_string & latestSelectedItemPath) const +{ + if (!_pXmlUserDoc) return false; + + TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); + if (not nppRoot) + { + nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + } + + TiXmlNode *oldFileBrowserRootNode = nppRoot->FirstChildElement(TEXT("FileBrowser")); + if (oldFileBrowserRootNode) + { + // Erase the file broser root + nppRoot->RemoveChild(oldFileBrowserRootNode); + } + + // Create the file browser root + TiXmlElement fileBrowserRootNode{ TEXT("FileBrowser") }; + + if (rootPaths.size() != 0) + { + fileBrowserRootNode.SetAttribute(TEXT("latestSelectedItem"), latestSelectedItemPath.c_str()); + + // add roots + size_t len = rootPaths.size(); + for (size_t i = 0; i < len; ++i) + { + TiXmlElement fbRootNode{ TEXT("root") }; + (fbRootNode.ToElement())->SetAttribute(TEXT("foldername"), rootPaths[i].c_str()); + + (fileBrowserRootNode.ToElement())->InsertEndChild(fbRootNode); + } + } + + // (Re)Insert the file browser root + (nppRoot->ToElement())->InsertEndChild(fileBrowserRootNode); + return true; +} + +bool NppParameters::writeHistory(const TCHAR *fullpath) +{ + TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); + if (not nppRoot) + { + nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + } + + TiXmlNode *historyNode = nppRoot->FirstChildElement(TEXT("History")); + if (not historyNode) + { + historyNode = nppRoot->InsertEndChild(TiXmlElement(TEXT("History"))); + } + + TiXmlElement recentFileNode(TEXT("File")); + (recentFileNode.ToElement())->SetAttribute(TEXT("filename"), fullpath); + + (historyNode->ToElement())->InsertEndChild(recentFileNode); + return true; +} + +TiXmlNode * NppParameters::getChildElementByAttribut(TiXmlNode *pere, const TCHAR *childName,\ + const TCHAR *attributName, const TCHAR *attributVal) const +{ + for (TiXmlNode *childNode = pere->FirstChildElement(childName); + childNode ; + childNode = childNode->NextSibling(childName)) + { + TiXmlElement *element = childNode->ToElement(); + const TCHAR *val = element->Attribute(attributName); + if (val) + { + if (!lstrcmp(val, attributVal)) + return childNode; + } + } + return NULL; +} + +// 2 restes : L_H, L_USER +LangType NppParameters::getLangIDFromStr(const TCHAR *langName) +{ + int lang = static_cast(L_TEXT); + for(; lang < L_EXTERNAL; ++lang) + { + const TCHAR * name = ScintillaEditView::langNames[lang].lexerName; + if (!lstrcmp(name, langName)) //found lang? + { + return (LangType)lang; + } + } + + //Cannot find language, check if its an external one + + LangType l = (LangType)lang; + if (l == L_EXTERNAL) //try find external lexer + { + int id = _pSelf->getExternalLangIndexFromName(langName); + if (id != -1) return (LangType)(id + L_EXTERNAL); + } + + return L_TEXT; +} + +generic_string NppParameters::getLocPathFromStr(const generic_string & localizationCode) +{ + if (localizationCode == TEXT("af")) + return TEXT("afrikaans.xml"); + if (localizationCode == TEXT("sq")) + return TEXT("albanian.xml"); + if (localizationCode == TEXT("ar") || localizationCode == TEXT("ar-dz") || localizationCode == TEXT("ar-bh") || localizationCode == TEXT("ar-eg") ||localizationCode == TEXT("ar-iq") || localizationCode == TEXT("ar-jo") || localizationCode == TEXT("ar-kw") || localizationCode == TEXT("ar-lb") || localizationCode == TEXT("ar-ly") || localizationCode == TEXT("ar-ma") || localizationCode == TEXT("ar-om") || localizationCode == TEXT("ar-qa") || localizationCode == TEXT("ar-sa") || localizationCode == TEXT("ar-sy") || localizationCode == TEXT("ar-tn") || localizationCode == TEXT("ar-ae") || localizationCode == TEXT("ar-ye")) + return TEXT("arabic.xml"); + if (localizationCode == TEXT("an")) + return TEXT("aragonese.xml"); + if (localizationCode == TEXT("az")) + return TEXT("azerbaijani.xml"); + if (localizationCode == TEXT("eu")) + return TEXT("basque.xml"); + if (localizationCode == TEXT("be")) + return TEXT("belarusian.xml"); + if (localizationCode == TEXT("bn")) + return TEXT("bengali.xml"); + if (localizationCode == TEXT("bs")) + return TEXT("bosnian.xml"); + if (localizationCode == TEXT("pt-br")) + return TEXT("brazilian_portuguese.xml"); + if (localizationCode == TEXT("br-fr")) + return TEXT("breton.xml"); + if (localizationCode == TEXT("bg")) + return TEXT("bulgarian.xml"); + if (localizationCode == TEXT("ca")) + return TEXT("catalan.xml"); + if (localizationCode == TEXT("zh-tw") || localizationCode == TEXT("zh-hk") || localizationCode == TEXT("zh-sg")) + return TEXT("chinese.xml"); + if (localizationCode == TEXT("zh") || localizationCode == TEXT("zh-cn")) + return TEXT("chineseSimplified.xml"); + if (localizationCode == TEXT("co") || localizationCode == TEXT("co-fr")) + return TEXT("corsican.xml"); + if (localizationCode == TEXT("hr")) + return TEXT("croatian.xml"); + if (localizationCode == TEXT("cs")) + return TEXT("czech.xml"); + if (localizationCode == TEXT("da")) + return TEXT("danish.xml"); + if (localizationCode == TEXT("nl") || localizationCode == TEXT("nl-be")) + return TEXT("dutch.xml"); + if (localizationCode == TEXT("eo")) + return TEXT("esperanto.xml"); + if (localizationCode == TEXT("et")) + return TEXT("estonian.xml"); + if (localizationCode == TEXT("fa")) + return TEXT("farsi.xml"); + if (localizationCode == TEXT("fi")) + return TEXT("finnish.xml"); + if (localizationCode == TEXT("fr") || localizationCode == TEXT("fr-be") || localizationCode == TEXT("fr-ca") || localizationCode == TEXT("fr-fr") || localizationCode == TEXT("fr-lu") || localizationCode == TEXT("fr-mc") || localizationCode == TEXT("fr-ch")) + return TEXT("french.xml"); + if (localizationCode == TEXT("fur")) + return TEXT("friulian.xml"); + if (localizationCode == TEXT("gl")) + return TEXT("galician.xml"); + if (localizationCode == TEXT("ka")) + return TEXT("georgian.xml"); + if (localizationCode == TEXT("de") || localizationCode == TEXT("de-at") || localizationCode == TEXT("de-de") || localizationCode == TEXT("de-li") || localizationCode == TEXT("de-lu") || localizationCode == TEXT("de-ch")) + return TEXT("german.xml"); + if (localizationCode == TEXT("el")) + return TEXT("greek.xml"); + if (localizationCode == TEXT("gu")) + return TEXT("gujarati.xml"); + if (localizationCode == TEXT("he")) + return TEXT("hebrew.xml"); + if (localizationCode == TEXT("hi")) + return TEXT("hindi.xml"); + if (localizationCode == TEXT("hu")) + return TEXT("hungarian.xml"); + if (localizationCode == TEXT("id")) + return TEXT("indonesian.xml"); + if (localizationCode == TEXT("it") || localizationCode == TEXT("it-ch")) + return TEXT("italian.xml"); + if (localizationCode == TEXT("ja")) + return TEXT("japanese.xml"); + if (localizationCode == TEXT("kn")) + return TEXT("kannada.xml"); + if (localizationCode == TEXT("kk")) + return TEXT("kazakh.xml"); + if (localizationCode == TEXT("ko") || localizationCode == TEXT("ko-kp") || localizationCode == TEXT("ko-kr")) + return TEXT("korean.xml"); + if (localizationCode == TEXT("ku")) + return TEXT("kurdish.xml"); + if (localizationCode == TEXT("ky")) + return TEXT("kyrgyz.xml"); + if (localizationCode == TEXT("lv")) + return TEXT("latvian.xml"); + if (localizationCode == TEXT("lt")) + return TEXT("lithuanian.xml"); + if (localizationCode == TEXT("lb")) + return TEXT("luxembourgish.xml"); + if (localizationCode == TEXT("mk")) + return TEXT("macedonian.xml"); + if (localizationCode == TEXT("ms")) + return TEXT("malay.xml"); + if (localizationCode == TEXT("mr")) + return TEXT("marathi.xml"); + if (localizationCode == TEXT("mn")) + return TEXT("mongolian.xml"); + if (localizationCode == TEXT("no") || localizationCode == TEXT("nb")) + return TEXT("norwegian.xml"); + if (localizationCode == TEXT("nn")) + return TEXT("nynorsk.xml"); + if (localizationCode == TEXT("oc")) + return TEXT("occitan.xml"); + if (localizationCode == TEXT("pl")) + return TEXT("polish.xml"); + if (localizationCode == TEXT("pt") || localizationCode == TEXT("pt-pt")) + return TEXT("portuguese.xml"); + if (localizationCode == TEXT("pa") || localizationCode == TEXT("pa-in")) + return TEXT("punjabi.xml"); + if (localizationCode == TEXT("ro") || localizationCode == TEXT("ro-mo")) + return TEXT("romanian.xml"); + if (localizationCode == TEXT("ru") || localizationCode == TEXT("ru-mo")) + return TEXT("russian.xml"); + if (localizationCode == TEXT("sc")) + return TEXT("sardinian.xml"); + if (localizationCode == TEXT("sr")) + return TEXT("serbian.xml"); + if (localizationCode == TEXT("sr-cyrl-ba") || localizationCode == TEXT("sr-cyrl-sp")) + return TEXT("serbianCyrillic.xml"); + if (localizationCode == TEXT("si")) + return TEXT("sinhala.xml"); + if (localizationCode == TEXT("sk")) + return TEXT("slovak.xml"); + if (localizationCode == TEXT("sl")) + return TEXT("slovenian.xml"); + if (localizationCode == TEXT("es") || localizationCode == TEXT("es-bo") || localizationCode == TEXT("es-cl") || localizationCode == TEXT("es-co") || localizationCode == TEXT("es-cr") || localizationCode == TEXT("es-do") || localizationCode == TEXT("es-ec") || localizationCode == TEXT("es-sv") || localizationCode == TEXT("es-gt") || localizationCode == TEXT("es-hn") || localizationCode == TEXT("es-mx") || localizationCode == TEXT("es-ni") || localizationCode == TEXT("es-pa") || localizationCode == TEXT("es-py") || localizationCode == TEXT("es-pe") || localizationCode == TEXT("es-pr") || localizationCode == TEXT("es-es") || localizationCode == TEXT("es-uy") || localizationCode == TEXT("es-ve")) + return TEXT("spanish.xml"); + if (localizationCode == TEXT("es-ar")) + return TEXT("spanish_ar.xml"); + if (localizationCode == TEXT("sv")) + return TEXT("swedish.xml"); + if (localizationCode == TEXT("tl")) + return TEXT("tagalog.xml"); + if (localizationCode == TEXT("tg-cyrl-tj")) + return TEXT("tajikCyrillic.xml"); + if (localizationCode == TEXT("ta")) + return TEXT("tamil.xml"); + if (localizationCode == TEXT("tt")) + return TEXT("tatar.xml"); + if (localizationCode == TEXT("te")) + return TEXT("telugu.xml"); + if (localizationCode == TEXT("th")) + return TEXT("thai.xml"); + if (localizationCode == TEXT("tr")) + return TEXT("turkish.xml"); + if (localizationCode == TEXT("uk")) + return TEXT("ukrainian.xml"); + if (localizationCode == TEXT("ur") || localizationCode == TEXT("ur-pk")) + return TEXT("urdu.xml"); + if (localizationCode == TEXT("ug-cn")) + return TEXT("uyghur.xml"); + if (localizationCode == TEXT("uz")) + return TEXT("uzbek.xml"); + if (localizationCode == TEXT("uz-cyrl-uz")) + return TEXT("uzbekCyrillic.xml"); + if (localizationCode == TEXT("vi") || localizationCode == TEXT("vi-vn")) + return TEXT("vietnamese.xml"); + if (localizationCode == TEXT("cy-gb")) + return TEXT("welsh.xml"); + + return generic_string(); +} + + +void NppParameters::feedKeyWordsParameters(TiXmlNode *node) +{ + TiXmlNode *langRoot = node->FirstChildElement(TEXT("Languages")); + if (!langRoot) + return; + + for (TiXmlNode *langNode = langRoot->FirstChildElement(TEXT("Language")); + langNode ; + langNode = langNode->NextSibling(TEXT("Language")) ) + { + if (_nbLang < NB_LANG) + { + TiXmlElement* element = langNode->ToElement(); + const TCHAR* name = element->Attribute(TEXT("name")); + if (name) + { + _langList[_nbLang] = new Lang(getLangIDFromStr(name), name); + _langList[_nbLang]->setDefaultExtList(element->Attribute(TEXT("ext"))); + _langList[_nbLang]->setCommentLineSymbol(element->Attribute(TEXT("commentLine"))); + _langList[_nbLang]->setCommentStart(element->Attribute(TEXT("commentStart"))); + _langList[_nbLang]->setCommentEnd(element->Attribute(TEXT("commentEnd"))); + + int tabSettings; + if (element->Attribute(TEXT("tabSettings"), &tabSettings)) + _langList[_nbLang]->setTabInfo(tabSettings); + + for (TiXmlNode *kwNode = langNode->FirstChildElement(TEXT("Keywords")); + kwNode ; + kwNode = kwNode->NextSibling(TEXT("Keywords")) ) + { + const TCHAR *indexName = (kwNode->ToElement())->Attribute(TEXT("name")); + TiXmlNode *kwVal = kwNode->FirstChild(); + const TCHAR *keyWords = TEXT(""); + if ((indexName) && (kwVal)) + keyWords = kwVal->Value(); + + int i = getKwClassFromName(indexName); + + if (i >= 0 && i <= KEYWORDSET_MAX) + _langList[_nbLang]->setWords(keyWords, i); + } + ++_nbLang; + } + } + } +} + +extern "C" { +typedef DWORD (WINAPI * EESFUNC) (LPCTSTR, LPTSTR, DWORD); +} + +void NppParameters::feedGUIParameters(TiXmlNode *node) +{ + TiXmlNode *GUIRoot = node->FirstChildElement(TEXT("GUIConfigs")); + if (nullptr == GUIRoot) + return; + + for (TiXmlNode *childNode = GUIRoot->FirstChildElement(TEXT("GUIConfig")); + childNode ; + childNode = childNode->NextSibling(TEXT("GUIConfig")) ) + { + TiXmlElement* element = childNode->ToElement(); + const TCHAR* nm = element->Attribute(TEXT("name")); + if (nullptr == nm) + continue; + + if (!lstrcmp(nm, TEXT("ToolBar"))) + { + const TCHAR* val = element->Attribute(TEXT("visible")); + if (val) + { + if (!lstrcmp(val, TEXT("no"))) + _nppGUI._toolbarShow = false; + else// if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._toolbarShow = true; + } + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + val = n->Value(); + if (val) + { + if (!lstrcmp(val, TEXT("small"))) + _nppGUI._toolBarStatus = TB_SMALL; + else if (!lstrcmp(val, TEXT("large"))) + _nppGUI._toolBarStatus = TB_LARGE; + else// if (!lstrcmp(val, TEXT("standard"))) //assume standard in all other cases + _nppGUI._toolBarStatus = TB_STANDARD; + } + } + } + else if (!lstrcmp(nm, TEXT("StatusBar"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (!lstrcmp(val, TEXT("hide"))) + _nppGUI._statusBarShow = false; + else if (!lstrcmp(val, TEXT("show"))) + _nppGUI._statusBarShow = true; + } + } + } + else if (!lstrcmp(nm, TEXT("MenuBar"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (!lstrcmp(val, TEXT("hide"))) + _nppGUI._menuBarShow = false; + else if (!lstrcmp(val, TEXT("show"))) + _nppGUI._menuBarShow = true; + } + } + } + else if (!lstrcmp(nm, TEXT("TabBar"))) + { + bool isFailed = false; + int oldValue = _nppGUI._tabStatus; + const TCHAR* val = element->Attribute(TEXT("dragAndDrop")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus = TAB_DRAGNDROP; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus = 0; + else + isFailed = true; + } + + val = element->Attribute(TEXT("drawTopBar")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus |= TAB_DRAWTOPBAR; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + + val = element->Attribute(TEXT("drawInactiveTab")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus |= TAB_DRAWINACTIVETAB; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + + val = element->Attribute(TEXT("reduce")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus |= TAB_REDUCE; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + + val = element->Attribute(TEXT("closeButton")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus |= TAB_CLOSEBUTTON; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + + val = element->Attribute(TEXT("doubleClick2Close")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus |= TAB_DBCLK2CLOSE; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + val = element->Attribute(TEXT("vertical")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus |= TAB_VERTICAL; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + + val = element->Attribute(TEXT("multiLine")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus |= TAB_MULTILINE; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + + val = element->Attribute(TEXT("hide")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus |= TAB_HIDE; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + + val = element->Attribute(TEXT("quitOnEmpty")); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._tabStatus |= TAB_QUITONEMPTY; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + if (isFailed) + _nppGUI._tabStatus = oldValue; + + + } + else if (!lstrcmp(nm, TEXT("Auto-detection"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._fileAutoDetection = cdEnabled; + else if (!lstrcmp(val, TEXT("auto"))) + _nppGUI._fileAutoDetection = cdAutoUpdate; + else if (!lstrcmp(val, TEXT("Update2End"))) + _nppGUI._fileAutoDetection = cdGo2end; + else if (!lstrcmp(val, TEXT("autoUpdate2End"))) + _nppGUI._fileAutoDetection = cdAutoUpdateGo2end; + else //(!lstrcmp(val, TEXT("no"))) + _nppGUI._fileAutoDetection = cdDisabled; + + _nppGUI._fileAutoDetectionOriginalValue = _nppGUI._fileAutoDetection; + } + } + } + + else if (!lstrcmp(nm, TEXT("TrayIcon"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + _nppGUI._isMinimizedToTray = (lstrcmp(val, TEXT("yes")) == 0); + } + } + } + else if (!lstrcmp(nm, TEXT("RememberLastSession"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._rememberLastSession = true; + else + _nppGUI._rememberLastSession = false; + } + } + } + else if (!lstrcmp(nm, TEXT("DetectEncoding"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._detectEncoding = true; + else + _nppGUI._detectEncoding = false; + } + } + } + else if (lstrcmp(nm, TEXT("MaitainIndent")) == 0) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._maitainIndent = true; + else + _nppGUI._maitainIndent = false; + } + } + } + // yes + else if (!lstrcmp(nm, TEXT("SmartHighLight"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._enableSmartHilite = true; + else + _nppGUI._enableSmartHilite = false; + } + + val = element->Attribute(TEXT("matchCase")); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._smartHiliteCaseSensitive = true; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._smartHiliteCaseSensitive = false; + } + + val = element->Attribute(TEXT("wholeWordOnly")); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._smartHiliteWordOnly = true; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._smartHiliteWordOnly = false; + } + + val = element->Attribute(TEXT("useFindSettings")); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._smartHiliteUseFindSettings = true; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._smartHiliteUseFindSettings = false; + } + + val = element->Attribute(TEXT("onAnotherView")); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._smartHiliteOnAnotherView = true; + else if (!lstrcmp(val, TEXT("no"))) + _nppGUI._smartHiliteOnAnotherView = false; + } + } + } + + else if (!lstrcmp(nm, TEXT("TagsMatchHighLight"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + _nppGUI._enableTagsMatchHilite = !lstrcmp(val, TEXT("yes")); + const TCHAR *tahl = element->Attribute(TEXT("TagAttrHighLight")); + if (tahl) + _nppGUI._enableTagAttrsHilite = !lstrcmp(tahl, TEXT("yes")); + + tahl = element->Attribute(TEXT("HighLightNonHtmlZone")); + if (tahl) + _nppGUI._enableHiliteNonHTMLZone = !lstrcmp(tahl, TEXT("yes")); + } + } + } + + else if (!lstrcmp(nm, TEXT("TaskList"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + _nppGUI._doTaskList = (!lstrcmp(val, TEXT("yes")))?true:false; + } + } + } + + else if (!lstrcmp(nm, TEXT("MRU"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + _nppGUI._styleMRU = (!lstrcmp(val, TEXT("yes"))); + } + } + + else if (!lstrcmp(nm, TEXT("URL"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (!lstrcmp(val, TEXT("1"))) + _nppGUI._styleURL = 1; + else if (!lstrcmp(val, TEXT("2"))) + _nppGUI._styleURL = 2; + else + _nppGUI._styleURL = 0; + } + } + } + + else if (!lstrcmp(nm, TEXT("CheckHistoryFiles"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (!lstrcmp(val, TEXT("no"))) + _nppGUI._checkHistoryFiles = false; + else if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._checkHistoryFiles = true; + } + } + } + else if (!lstrcmp(nm, TEXT("ScintillaViewsSplitter"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (!lstrcmp(val, TEXT("vertical"))) + _nppGUI._splitterPos = POS_VERTICAL; + else if (!lstrcmp(val, TEXT("horizontal"))) + _nppGUI._splitterPos = POS_HORIZOTAL; + } + } + } + else if (!lstrcmp(nm, TEXT("UserDefineDlg"))) + { + bool isFailed = false; + int oldValue = _nppGUI._userDefineDlgStatus; + + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + { + if (!lstrcmp(val, TEXT("hide"))) + _nppGUI._userDefineDlgStatus = 0; + else if (!lstrcmp(val, TEXT("show"))) + _nppGUI._userDefineDlgStatus = UDD_SHOW; + else + isFailed = true; + } + } + + const TCHAR* val = element->Attribute(TEXT("position")); + if (val) + { + if (!lstrcmp(val, TEXT("docked"))) + _nppGUI._userDefineDlgStatus |= UDD_DOCKED; + else if (!lstrcmp(val, TEXT("undocked"))) + _nppGUI._userDefineDlgStatus |= 0; + else + isFailed = true; + } + if (isFailed) + _nppGUI._userDefineDlgStatus = oldValue; + } + else if (!lstrcmp(nm, TEXT("TabSetting"))) + { + int i; + const TCHAR* val = element->Attribute(TEXT("size"), &i); + if (val) + _nppGUI._tabSize = i; + + if ((_nppGUI._tabSize == -1) || (_nppGUI._tabSize == 0)) + _nppGUI._tabSize = 4; + + val = element->Attribute(TEXT("replaceBySpace")); + if (val) + _nppGUI._tabReplacedBySpace = (!lstrcmp(val, TEXT("yes"))); + } + + else if (!lstrcmp(nm, TEXT("Caret"))) + { + int i; + const TCHAR* val = element->Attribute(TEXT("width"), &i); + if (val) + _nppGUI._caretWidth = i; + + val = element->Attribute(TEXT("blinkRate"), &i); + if (val) + _nppGUI._caretBlinkRate = i; + } + + else if (!lstrcmp(nm, TEXT("ScintillaGlobalSettings"))) + { + const TCHAR* val = element->Attribute(TEXT("enableMultiSelection")); + if (val) + { + if (lstrcmp(val, TEXT("yes")) == 0) + _nppGUI._enableMultiSelection = true; + else if (lstrcmp(val, TEXT("no")) == 0) + _nppGUI._enableMultiSelection = false; + } + } + + else if (!lstrcmp(nm, TEXT("AppPosition"))) + { + RECT oldRect = _nppGUI._appPos; + bool fuckUp = true; + int i; + + if (element->Attribute(TEXT("x"), &i)) + { + _nppGUI._appPos.left = i; + + if (element->Attribute(TEXT("y"), &i)) + { + _nppGUI._appPos.top = i; + + if (element->Attribute(TEXT("width"), &i)) + { + _nppGUI._appPos.right = i; + + if (element->Attribute(TEXT("height"), &i)) + { + _nppGUI._appPos.bottom = i; + fuckUp = false; + } + } + } + } + if (fuckUp) + _nppGUI._appPos = oldRect; + + const TCHAR* val = element->Attribute(TEXT("isMaximized")); + if (val) + _nppGUI._isMaximized = (lstrcmp(val, TEXT("yes")) == 0); + } + else if (!lstrcmp(nm, TEXT("NewDocDefaultSettings"))) + { + int i; + if (element->Attribute(TEXT("format"), &i)) + { + EolType newFormat = EolType::osdefault; + switch (i) + { + case static_cast(EolType::windows) : + newFormat = EolType::windows; + break; + case static_cast(EolType::macos) : + newFormat = EolType::macos; + break; + case static_cast(EolType::unix) : + newFormat = EolType::unix; + break; + default: + assert(false and "invalid buffer format - fallback to default"); + } + _nppGUI._newDocDefaultSettings._format = newFormat; + } + + if (element->Attribute(TEXT("encoding"), &i)) + _nppGUI._newDocDefaultSettings._unicodeMode = (UniMode)i; + + if (element->Attribute(TEXT("lang"), &i)) + _nppGUI._newDocDefaultSettings._lang = (LangType)i; + + if (element->Attribute(TEXT("codepage"), &i)) + _nppGUI._newDocDefaultSettings._codepage = (LangType)i; + + const TCHAR* val = element->Attribute(TEXT("openAnsiAsUTF8")); + if (val) + _nppGUI._newDocDefaultSettings._openAnsiAsUtf8 = (lstrcmp(val, TEXT("yes")) == 0); + + } + else if (!lstrcmp(nm, TEXT("langsExcluded"))) + { + // TODO + int g0 = 0; // up to 8 + int g1 = 0; // up to 16 + int g2 = 0; // up to 24 + int g3 = 0; // up to 32 + int g4 = 0; // up to 40 + int g5 = 0; // up to 48 + int g6 = 0; // up to 56 + int g7 = 0; // up to 64 + int g8 = 0; // up to 72 + int g9 = 0; // up to 80 + int g10= 0; // up to 88 + int g11= 0; // up to 96 + int g12= 0; // up to 104 + + // TODO some refactoring needed here.... + { + int i; + if (element->Attribute(TEXT("gr0"), &i)) + { + if (i <= 255) + g0 = i; + } + if (element->Attribute(TEXT("gr1"), &i)) + { + if (i <= 255) + g1 = i; + } + if (element->Attribute(TEXT("gr2"), &i)) + { + if (i <= 255) + g2 = i; + } + if (element->Attribute(TEXT("gr3"), &i)) + { + if (i <= 255) + g3 = i; + } + if (element->Attribute(TEXT("gr4"), &i)) + { + if (i <= 255) + g4 = i; + } + if (element->Attribute(TEXT("gr5"), &i)) + { + if (i <= 255) + g5 = i; + } + if (element->Attribute(TEXT("gr6"), &i)) + { + if (i <= 255) + g6 = i; + } + if (element->Attribute(TEXT("gr7"), &i)) + { + if (i <= 255) + g7 = i; + } + if (element->Attribute(TEXT("gr8"), &i)) + { + if (i <= 255) + g8 = i; + } + if (element->Attribute(TEXT("gr9"), &i)) + { + if (i <= 255) + g9 = i; + } + if (element->Attribute(TEXT("gr10"), &i)) + { + if (i <= 255) + g10 = i; + } + if (element->Attribute(TEXT("gr11"), &i)) + { + if (i <= 255) + g11 = i; + } + if (element->Attribute(TEXT("gr12"), &i)) + { + if (i <= 255) + g12 = i; + } + } + + UCHAR mask = 1; + for (int i = 0 ; i < 8 ; ++i) + { + if (mask & g0) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 8 ; i < 16 ; ++i) + { + if (mask & g1) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 16 ; i < 24 ; ++i) + { + if (mask & g2) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 24 ; i < 32 ; ++i) + { + if (mask & g3) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 32 ; i < 40 ; ++i) + { + if (mask & g4) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 40 ; i < 48 ; ++i) + { + if (mask & g5) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 48 ; i < 56 ; ++i) + { + if (mask & g6) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 56 ; i < 64 ; ++i) + { + if (mask & g7) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 64; i < 72; ++i) + { + if (mask & g8) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 72; i < 80; ++i) + { + if (mask & g9) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 80; i < 88; ++i) + { + if (mask & g10) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 88; i < 96; ++i) + { + if (mask & g11) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + mask = 1; + for (int i = 96; i < 104; ++i) + { + if (mask & g12) + _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); + mask <<= 1; + } + + const TCHAR* val = element->Attribute(TEXT("langMenuCompact")); + if (val) + _nppGUI._isLangMenuCompact = (!lstrcmp(val, TEXT("yes"))); + } + + else if (!lstrcmp(nm, TEXT("Print"))) + { + const TCHAR* val = element->Attribute(TEXT("lineNumber")); + if (val) + _nppGUI._printSettings._printLineNumber = (!lstrcmp(val, TEXT("yes"))); + + int i; + if (element->Attribute(TEXT("printOption"), &i)) + _nppGUI._printSettings._printOption = i; + + val = element->Attribute(TEXT("headerLeft")); + if (val) + _nppGUI._printSettings._headerLeft = val; + + val = element->Attribute(TEXT("headerMiddle")); + if (val) + _nppGUI._printSettings._headerMiddle = val; + + val = element->Attribute(TEXT("headerRight")); + if (val) + _nppGUI._printSettings._headerRight = val; + + + val = element->Attribute(TEXT("footerLeft")); + if (val) + _nppGUI._printSettings._footerLeft = val; + + val = element->Attribute(TEXT("footerMiddle")); + if (val) + _nppGUI._printSettings._footerMiddle = val; + + val = element->Attribute(TEXT("footerRight")); + if (val) + _nppGUI._printSettings._footerRight = val; + + + val = element->Attribute(TEXT("headerFontName")); + if (val) + _nppGUI._printSettings._headerFontName = val; + + val = element->Attribute(TEXT("footerFontName")); + if (val) + _nppGUI._printSettings._footerFontName = val; + + if (element->Attribute(TEXT("headerFontStyle"), &i)) + _nppGUI._printSettings._headerFontStyle = i; + + if (element->Attribute(TEXT("footerFontStyle"), &i)) + _nppGUI._printSettings._footerFontStyle = i; + + if (element->Attribute(TEXT("headerFontSize"), &i)) + _nppGUI._printSettings._headerFontSize = i; + + if (element->Attribute(TEXT("footerFontSize"), &i)) + _nppGUI._printSettings._footerFontSize = i; + + + if (element->Attribute(TEXT("margeLeft"), &i)) + _nppGUI._printSettings._marge.left = i; + + if (element->Attribute(TEXT("margeTop"), &i)) + _nppGUI._printSettings._marge.top = i; + + if (element->Attribute(TEXT("margeRight"), &i)) + _nppGUI._printSettings._marge.right = i; + + if (element->Attribute(TEXT("margeBottom"), &i)) + _nppGUI._printSettings._marge.bottom = i; + } + + else if (!lstrcmp(nm, TEXT("ScintillaPrimaryView"))) + { + feedScintillaParam(element); + } + + else if (!lstrcmp(nm, TEXT("Backup"))) + { + int i; + if (element->Attribute(TEXT("action"), &i)) + _nppGUI._backup = (BackupFeature)i; + + const TCHAR *bDir = element->Attribute(TEXT("useCustumDir")); + if (bDir) + { + _nppGUI._useDir = (lstrcmp(bDir, TEXT("yes")) == 0);; + } + const TCHAR *pDir = element->Attribute(TEXT("dir")); + if (pDir) + _nppGUI._backupDir = pDir; + + const TCHAR *isSnapshotModeStr = element->Attribute(TEXT("isSnapshotMode")); + if (isSnapshotModeStr && !lstrcmp(isSnapshotModeStr, TEXT("no"))) + _nppGUI._isSnapshotMode = false; + + int timing; + if (element->Attribute(TEXT("snapshotBackupTiming"), &timing)) + _nppGUI._snapshotBackupTiming = timing; + + } + else if (!lstrcmp(nm, TEXT("DockingManager"))) + { + feedDockingManager(element); + } + + else if (!lstrcmp(nm, TEXT("globalOverride"))) + { + const TCHAR *bDir = element->Attribute(TEXT("fg")); + if (bDir) + _nppGUI._globalOverride.enableFg = (lstrcmp(bDir, TEXT("yes")) == 0); + + bDir = element->Attribute(TEXT("bg")); + if (bDir) + _nppGUI._globalOverride.enableBg = (lstrcmp(bDir, TEXT("yes")) == 0); + + bDir = element->Attribute(TEXT("font")); + if (bDir) + _nppGUI._globalOverride.enableFont = (lstrcmp(bDir, TEXT("yes")) == 0); + + bDir = element->Attribute(TEXT("fontSize")); + if (bDir) + _nppGUI._globalOverride.enableFontSize = (lstrcmp(bDir, TEXT("yes")) == 0); + + bDir = element->Attribute(TEXT("bold")); + if (bDir) + _nppGUI._globalOverride.enableBold = (lstrcmp(bDir, TEXT("yes")) == 0); + + bDir = element->Attribute(TEXT("italic")); + if (bDir) + _nppGUI._globalOverride.enableItalic = (lstrcmp(bDir, TEXT("yes")) == 0); + + bDir = element->Attribute(TEXT("underline")); + if (bDir) + _nppGUI._globalOverride.enableUnderLine = (lstrcmp(bDir, TEXT("yes")) == 0); + } + else if (!lstrcmp(nm, TEXT("auto-completion"))) + { + int i; + if (element->Attribute(TEXT("autoCAction"), &i)) + _nppGUI._autocStatus = static_cast(i); + + if (element->Attribute(TEXT("triggerFromNbChar"), &i)) + _nppGUI._autocFromLen = i; + + const TCHAR * optName = element->Attribute(TEXT("autoCIgnoreNumbers")); + if (optName) + _nppGUI._autocIgnoreNumbers = (lstrcmp(optName, TEXT("yes")) == 0); + + optName = element->Attribute(TEXT("funcParams")); + if (optName) + _nppGUI._funcParams = (lstrcmp(optName, TEXT("yes")) == 0); + } + else if (!lstrcmp(nm, TEXT("auto-insert"))) + { + const TCHAR * optName = element->Attribute(TEXT("htmlXmlTag")); + if (optName) + _nppGUI._matchedPairConf._doHtmlXmlTag = (lstrcmp(optName, TEXT("yes")) == 0); + + optName = element->Attribute(TEXT("parentheses")); + if (optName) + _nppGUI._matchedPairConf._doParentheses = (lstrcmp(optName, TEXT("yes")) == 0); + + optName = element->Attribute(TEXT("brackets")); + if (optName) + _nppGUI._matchedPairConf._doBrackets = (lstrcmp(optName, TEXT("yes")) == 0); + + optName = element->Attribute(TEXT("curlyBrackets")); + if (optName) + _nppGUI._matchedPairConf._doCurlyBrackets = (lstrcmp(optName, TEXT("yes")) == 0); + + optName = element->Attribute(TEXT("quotes")); + if (optName) + _nppGUI._matchedPairConf._doQuotes = (lstrcmp(optName, TEXT("yes")) == 0); + + optName = element->Attribute(TEXT("doubleQuotes")); + if (optName) + _nppGUI._matchedPairConf._doDoubleQuotes = (lstrcmp(optName, TEXT("yes")) == 0); + + for (TiXmlNode *subChildNode = childNode->FirstChildElement(TEXT("UserDefinePair")); + subChildNode; + subChildNode = subChildNode->NextSibling(TEXT("UserDefinePair")) ) + { + int open = -1; + int openVal = 0; + const TCHAR *openValStr = (subChildNode->ToElement())->Attribute(TEXT("open"), &openVal); + if (openValStr && (openVal >= 0 && openVal < 128)) + open = openVal; + + int close = -1; + int closeVal = 0; + const TCHAR *closeValStr = (subChildNode->ToElement())->Attribute(TEXT("close"), &closeVal); + if (closeValStr && (closeVal >= 0 && closeVal <= 128)) + close = closeVal; + + if (open != -1 && close != -1) + _nppGUI._matchedPairConf._matchedPairsInit.push_back(pair(char(open), char(close))); + } + } + else if (!lstrcmp(nm, TEXT("sessionExt"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + _nppGUI._definedSessionExt = val; + } + } + else if (!lstrcmp(nm, TEXT("workspaceExt"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + _nppGUI._definedWorkspaceExt = val; + } + } + else if (!lstrcmp(nm, TEXT("noUpdate"))) + { + TiXmlNode *n = childNode->FirstChild(); + if (n) + { + const TCHAR* val = n->Value(); + if (val) + _nppGUI._autoUpdateOpt._doAutoUpdate = (!lstrcmp(val, TEXT("yes")))?false:true; + + int i; + val = element->Attribute(TEXT("intervalDays"), &i); + if (val) + _nppGUI._autoUpdateOpt._intervalDays = i; + + val = element->Attribute(TEXT("nextUpdateDate")); + if (val) + _nppGUI._autoUpdateOpt._nextUpdateDate = Date(val); + } + } + else if (!lstrcmp(nm, TEXT("openSaveDir"))) + { + const TCHAR * value = element->Attribute(TEXT("value")); + if (value && value[0]) + { + if (lstrcmp(value, TEXT("1")) == 0) + _nppGUI._openSaveDir = dir_last; + else if (lstrcmp(value, TEXT("2")) == 0) + _nppGUI._openSaveDir = dir_userDef; + else + _nppGUI._openSaveDir = dir_followCurrent; + } + + const TCHAR * path = element->Attribute(TEXT("defaultDirPath")); + if (path && path[0]) + { + lstrcpyn(_nppGUI._defaultDir, path, MAX_PATH); + ::ExpandEnvironmentStrings(_nppGUI._defaultDir, _nppGUI._defaultDirExp, MAX_PATH); + } + } + else if (!lstrcmp(nm, TEXT("titleBar"))) + { + const TCHAR * value = element->Attribute(TEXT("short")); + _nppGUI._shortTitlebar = false; //default state + if (value && value[0]) + { + if (lstrcmp(value, TEXT("yes")) == 0) + _nppGUI._shortTitlebar = true; + else if (lstrcmp(value, TEXT("no")) == 0) + _nppGUI._shortTitlebar = false; + } + } + else if (!lstrcmp(nm, TEXT("stylerTheme"))) + { + const TCHAR *themePath = element->Attribute(TEXT("path")); + if (themePath != NULL && themePath[0]) + _nppGUI._themeName.assign(themePath); + } + else if (!lstrcmp(nm, TEXT("wordCharList"))) + { + const TCHAR * value = element->Attribute(TEXT("useDefault")); + if (value && value[0]) + { + if (lstrcmp(value, TEXT("yes")) == 0) + _nppGUI._isWordCharDefault = true; + else if (lstrcmp(value, TEXT("no")) == 0) + _nppGUI._isWordCharDefault = false; + } + + const TCHAR *charsAddedW = element->Attribute(TEXT("charsAdded")); + if (charsAddedW) + { + WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + _nppGUI._customWordChars = wmc->wchar2char(charsAddedW, SC_CP_UTF8); + } + } + else if (!lstrcmp(nm, TEXT("delimiterSelection"))) + { + int leftmost = 0; + element->Attribute(TEXT("leftmostDelimiter"), &leftmost); + if(leftmost > 0 && leftmost < 256) + _nppGUI._leftmostDelimiter = static_cast(leftmost); + + int rightmost = 0; + element->Attribute(TEXT("rightmostDelimiter"), &rightmost); + if(rightmost > 0 && rightmost < 256) + _nppGUI._rightmostDelimiter = static_cast(rightmost); + + const TCHAR *delimiterSelectionOnEntireDocument = element->Attribute(TEXT("delimiterSelectionOnEntireDocument")); + if(delimiterSelectionOnEntireDocument != NULL && !lstrcmp(delimiterSelectionOnEntireDocument, TEXT("yes"))) + _nppGUI._delimiterSelectionOnEntireDocument = true; + else + _nppGUI._delimiterSelectionOnEntireDocument = false; + } + else if (!lstrcmp(nm, TEXT("multiInst"))) + { + int val = 0; + element->Attribute(TEXT("setting"), &val); + if (val < 0 || val > 2) + val = 0; + _nppGUI._multiInstSetting = (MultiInstSetting)val; + } + else if (!lstrcmp(nm, TEXT("searchEngine"))) + { + int i; + if (element->Attribute(TEXT("searchEngineChoice"), &i)) + _nppGUI._searchEngineChoice = static_cast(i); + + const TCHAR * searchEngineCustom = element->Attribute(TEXT("searchEngineCustom")); + if (searchEngineCustom && searchEngineCustom[0]) + _nppGUI._searchEngineCustom = searchEngineCustom; + } + else if (!lstrcmp(nm, TEXT("MISC"))) + { + const TCHAR * optName = element->Attribute(TEXT("fileSwitcherWithoutExtColumn")); + if (optName) + _nppGUI._fileSwitcherWithoutExtColumn = (lstrcmp(optName, TEXT("yes")) == 0); + + const TCHAR * optNameBackSlashEscape = element->Attribute(TEXT("backSlashIsEscapeCharacterForSql")); + if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no"))) + _nppGUI._backSlashIsEscapeCharacterForSql = false; + + const TCHAR * optNameNewStyleSaveDlg = element->Attribute(TEXT("newStyleSaveDlg")); + if (optNameNewStyleSaveDlg) + _nppGUI._useNewStyleSaveDlg = (lstrcmp(optNameNewStyleSaveDlg, TEXT("yes")) == 0); + + const TCHAR * optNameFolderDroppedOpenFiles = element->Attribute(TEXT("isFolderDroppedOpenFiles")); + if (optNameFolderDroppedOpenFiles) + _nppGUI._isFolderDroppedOpenFiles = (lstrcmp(optNameFolderDroppedOpenFiles, TEXT("yes")) == 0); + + const TCHAR * optDocPeekOnTab = element->Attribute(TEXT("docPeekOnTab")); + if (optDocPeekOnTab) + _nppGUI._isDocPeekOnTab = (lstrcmp(optDocPeekOnTab, TEXT("yes")) == 0); + + const TCHAR * optDocPeekOnMap = element->Attribute(TEXT("docPeekOnMap")); + if (optDocPeekOnMap) + _nppGUI._isDocPeekOnMap = (lstrcmp(optDocPeekOnMap, TEXT("yes")) == 0); + + } + } +} + +void NppParameters::feedScintillaParam(TiXmlNode *node) +{ + TiXmlElement* element = node->ToElement(); + + // Line Number Margin + const TCHAR *nm = element->Attribute(TEXT("lineNumberMargin")); + if (nm) + { + if (!lstrcmp(nm, TEXT("show"))) + _svp._lineNumberMarginShow = true; + else if (!lstrcmp(nm, TEXT("hide"))) + _svp._lineNumberMarginShow = false; + } + + // Bookmark Margin + nm = element->Attribute(TEXT("bookMarkMargin")); + if (nm) + { + + if (!lstrcmp(nm, TEXT("show"))) + _svp._bookMarkMarginShow = true; + else if (!lstrcmp(nm, TEXT("hide"))) + _svp._bookMarkMarginShow = false; + } + + // Indent GuideLine + nm = element->Attribute(TEXT("indentGuideLine")); + if (nm) + { + if (!lstrcmp(nm, TEXT("show"))) + _svp._indentGuideLineShow = true; + else if (!lstrcmp(nm, TEXT("hide"))) + _svp._indentGuideLineShow= false; + } + + // Folder Mark Style + nm = element->Attribute(TEXT("folderMarkStyle")); + if (nm) + { + if (!lstrcmp(nm, TEXT("box"))) + _svp._folderStyle = FOLDER_STYLE_BOX; + else if (!lstrcmp(nm, TEXT("circle"))) + _svp._folderStyle = FOLDER_STYLE_CIRCLE; + else if (!lstrcmp(nm, TEXT("arrow"))) + _svp._folderStyle = FOLDER_STYLE_ARROW; + else if (!lstrcmp(nm, TEXT("simple"))) + _svp._folderStyle = FOLDER_STYLE_SIMPLE; + else if (!lstrcmp(nm, TEXT("none"))) + _svp._folderStyle = FOLDER_STYLE_NONE; + } + + // Line Wrap method + nm = element->Attribute(TEXT("lineWrapMethod")); + if (nm) + { + if (!lstrcmp(nm, TEXT("default"))) + _svp._lineWrapMethod = LINEWRAP_DEFAULT; + else if (!lstrcmp(nm, TEXT("aligned"))) + _svp._lineWrapMethod = LINEWRAP_ALIGNED; + else if (!lstrcmp(nm, TEXT("indent"))) + _svp._lineWrapMethod = LINEWRAP_INDENT; + } + + // Current Line Highlighting State + nm = element->Attribute(TEXT("currentLineHilitingShow")); + if (nm) + { + if (!lstrcmp(nm, TEXT("show"))) + _svp._currentLineHilitingShow = true; + else if (!lstrcmp(nm, TEXT("hide"))) + _svp._currentLineHilitingShow = false; + } + + // Scrolling Beyond Last Line State + nm = element->Attribute(TEXT("scrollBeyondLastLine")); + if (nm) + { + if (!lstrcmp(nm, TEXT("yes"))) + _svp._scrollBeyondLastLine = true; + else if (!lstrcmp(nm, TEXT("no"))) + _svp._scrollBeyondLastLine = false; + } + + // Disable Advanced Scrolling + nm = element->Attribute(TEXT("disableAdvancedScrolling")); + if (nm) + { + if (!lstrcmp(nm, TEXT("yes"))) + _svp._disableAdvancedScrolling = true; + else if (!lstrcmp(nm, TEXT("no"))) + _svp._disableAdvancedScrolling = false; + } + + // Current wrap symbol visibility State + nm = element->Attribute(TEXT("wrapSymbolShow")); + if (nm) + { + if (!lstrcmp(nm, TEXT("show"))) + _svp._wrapSymbolShow = true; + else if (!lstrcmp(nm, TEXT("hide"))) + _svp._wrapSymbolShow = false; + } + + // Do Wrap + nm = element->Attribute(TEXT("Wrap")); + if (nm) + { + if (!lstrcmp(nm, TEXT("yes"))) + _svp._doWrap = true; + else if (!lstrcmp(nm, TEXT("no"))) + _svp._doWrap = false; + } + + // Do Edge + nm = element->Attribute(TEXT("edge")); + if (nm) + { + if (!lstrcmp(nm, TEXT("background"))) + _svp._edgeMode = EDGE_BACKGROUND; + else if (!lstrcmp(nm, TEXT("line"))) + _svp._edgeMode = EDGE_LINE; + else + _svp._edgeMode = EDGE_NONE; + } + + // Do Scintilla border edge + nm = element->Attribute(TEXT("borderEdge")); + if (nm) + { + if (!lstrcmp(nm, TEXT("yes"))) + _svp._showBorderEdge = true; + else if (!lstrcmp(nm, TEXT("no"))) + _svp._showBorderEdge = false; + } + + int val; + nm = element->Attribute(TEXT("edgeNbColumn"), &val); + if (nm) + { + _svp._edgeNbColumn = val; + } + + nm = element->Attribute(TEXT("zoom"), &val); + if (nm) + { + _svp._zoom = val; + } + + nm = element->Attribute(TEXT("zoom2"), &val); + if (nm) + { + _svp._zoom2 = val; + } + + // White Space visibility State + nm = element->Attribute(TEXT("whiteSpaceShow")); + if (nm) + { + if (!lstrcmp(nm, TEXT("show"))) + _svp._whiteSpaceShow = true; + else if (!lstrcmp(nm, TEXT("hide"))) + _svp._whiteSpaceShow = false; + } + + // EOL visibility State + nm = element->Attribute(TEXT("eolShow")); + if (nm) + { + if (!lstrcmp(nm, TEXT("show"))) + _svp._eolShow = true; + else if (!lstrcmp(nm, TEXT("hide"))) + _svp._eolShow = false; + } + + nm = element->Attribute(TEXT("borderWidth"), &val); + if (nm) + { + if (val >= 0 && val <= 30) + _svp._borderWidth = val; + } + + // Do antialiased font + nm = element->Attribute(TEXT("smoothFont")); + if (nm) + { + if (!lstrcmp(nm, TEXT("yes"))) + _svp._doSmoothFont = true; + else if (!lstrcmp(nm, TEXT("no"))) + _svp._doSmoothFont = false; + } +} + + +void NppParameters::feedDockingManager(TiXmlNode *node) +{ + TiXmlElement *element = node->ToElement(); + + int i; + if (element->Attribute(TEXT("leftWidth"), &i)) + _nppGUI._dockingData._leftWidth = i; + + if (element->Attribute(TEXT("rightWidth"), &i)) + _nppGUI._dockingData._rightWidth = i; + + if (element->Attribute(TEXT("topHeight"), &i)) + _nppGUI._dockingData._topHeight = i; + + if (element->Attribute(TEXT("bottomHeight"), &i)) + _nppGUI._dockingData._bottomHight = i; + + + + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("FloatingWindow")); + childNode ; + childNode = childNode->NextSibling(TEXT("FloatingWindow")) ) + { + TiXmlElement *floatElement = childNode->ToElement(); + int cont; + if (floatElement->Attribute(TEXT("cont"), &cont)) + { + int x = 0; + int y = 0; + int w = 100; + int h = 100; + + floatElement->Attribute(TEXT("x"), &x); + floatElement->Attribute(TEXT("y"), &y); + floatElement->Attribute(TEXT("width"), &w); + floatElement->Attribute(TEXT("height"), &h); + _nppGUI._dockingData._flaotingWindowInfo.push_back(FloatingWindowInfo(cont, x, y, w, h)); + } + } + + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("PluginDlg")); + childNode ; + childNode = childNode->NextSibling(TEXT("PluginDlg")) ) + { + TiXmlElement *dlgElement = childNode->ToElement(); + const TCHAR *name = dlgElement->Attribute(TEXT("pluginName")); + + int id; + const TCHAR *idStr = dlgElement->Attribute(TEXT("id"), &id); + if (name && idStr) + { + int curr = 0; // on left + int prev = 0; // on left + + dlgElement->Attribute(TEXT("curr"), &curr); + dlgElement->Attribute(TEXT("prev"), &prev); + + bool isVisible = false; + const TCHAR *val = dlgElement->Attribute(TEXT("isVisible")); + if (val) + { + isVisible = (lstrcmp(val, TEXT("yes")) == 0); + } + + _nppGUI._dockingData._pluginDockInfo.push_back(PluginDlgDockingInfo(name, id, curr, prev, isVisible)); + } + } + + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("ActiveTabs")); + childNode ; + childNode = childNode->NextSibling(TEXT("ActiveTabs")) ) + { + TiXmlElement *dlgElement = childNode->ToElement(); + + int cont; + if (dlgElement->Attribute(TEXT("cont"), &cont)) + { + int activeTab = 0; + dlgElement->Attribute(TEXT("activeTab"), &activeTab); + _nppGUI._dockingData._containerTabInfo.push_back(ContainerTabInfo(cont, activeTab)); + } + } +} + +bool NppParameters::writeScintillaParams() +{ + if (!_pXmlUserDoc) return false; + + const TCHAR *pViewName = TEXT("ScintillaPrimaryView"); + TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); + if (not nppRoot) + { + nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + } + + TiXmlNode *configsRoot = nppRoot->FirstChildElement(TEXT("GUIConfigs")); + if (not configsRoot) + { + configsRoot = nppRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfigs"))); + } + + TiXmlNode *scintNode = getChildElementByAttribut(configsRoot, TEXT("GUIConfig"), TEXT("name"), pViewName); + if (not scintNode) + { + scintNode = configsRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))); + (scintNode->ToElement())->SetAttribute(TEXT("name"), pViewName); + } + + (scintNode->ToElement())->SetAttribute(TEXT("lineNumberMargin"), _svp._lineNumberMarginShow?TEXT("show"):TEXT("hide")); + (scintNode->ToElement())->SetAttribute(TEXT("bookMarkMargin"), _svp._bookMarkMarginShow?TEXT("show"):TEXT("hide")); + (scintNode->ToElement())->SetAttribute(TEXT("indentGuideLine"), _svp._indentGuideLineShow?TEXT("show"):TEXT("hide")); + const TCHAR *pFolderStyleStr = (_svp._folderStyle == FOLDER_STYLE_SIMPLE)?TEXT("simple"): + (_svp._folderStyle == FOLDER_STYLE_ARROW)?TEXT("arrow"): + (_svp._folderStyle == FOLDER_STYLE_CIRCLE)?TEXT("circle"): + (_svp._folderStyle == FOLDER_STYLE_NONE)?TEXT("none"):TEXT("box"); + (scintNode->ToElement())->SetAttribute(TEXT("folderMarkStyle"), pFolderStyleStr); + + const TCHAR *pWrapMethodStr = (_svp._lineWrapMethod == LINEWRAP_ALIGNED)?TEXT("aligned"): + (_svp._lineWrapMethod == LINEWRAP_INDENT)?TEXT("indent"):TEXT("default"); + (scintNode->ToElement())->SetAttribute(TEXT("lineWrapMethod"), pWrapMethodStr); + + (scintNode->ToElement())->SetAttribute(TEXT("currentLineHilitingShow"), _svp._currentLineHilitingShow?TEXT("show"):TEXT("hide")); + (scintNode->ToElement())->SetAttribute(TEXT("scrollBeyondLastLine"), _svp._scrollBeyondLastLine?TEXT("yes"):TEXT("no")); + (scintNode->ToElement())->SetAttribute(TEXT("disableAdvancedScrolling"), _svp._disableAdvancedScrolling?TEXT("yes"):TEXT("no")); + (scintNode->ToElement())->SetAttribute(TEXT("wrapSymbolShow"), _svp._wrapSymbolShow?TEXT("show"):TEXT("hide")); + (scintNode->ToElement())->SetAttribute(TEXT("Wrap"), _svp._doWrap?TEXT("yes"):TEXT("no")); + (scintNode->ToElement())->SetAttribute(TEXT("borderEdge"), _svp._showBorderEdge ? TEXT("yes") : TEXT("no")); + + TCHAR *edgeStr = NULL; + if (_svp._edgeMode == EDGE_NONE) + edgeStr = TEXT("no"); + else if (_svp._edgeMode == EDGE_LINE) + edgeStr = TEXT("line"); + else + edgeStr = TEXT("background"); + (scintNode->ToElement())->SetAttribute(TEXT("edge"), edgeStr); + (scintNode->ToElement())->SetAttribute(TEXT("edgeNbColumn"), _svp._edgeNbColumn); + (scintNode->ToElement())->SetAttribute(TEXT("zoom"), _svp._zoom); + (scintNode->ToElement())->SetAttribute(TEXT("zoom2"), _svp._zoom2); + (scintNode->ToElement())->SetAttribute(TEXT("whiteSpaceShow"), _svp._whiteSpaceShow?TEXT("show"):TEXT("hide")); + (scintNode->ToElement())->SetAttribute(TEXT("eolShow"), _svp._eolShow?TEXT("show"):TEXT("hide")); + (scintNode->ToElement())->SetAttribute(TEXT("borderWidth"), _svp._borderWidth); + (scintNode->ToElement())->SetAttribute(TEXT("smoothFont"), _svp._doSmoothFont ? TEXT("yes") : TEXT("no")); + return true; +} + +void NppParameters::createXmlTreeFromGUIParams() +{ + TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); + if (not nppRoot) + { + nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + } + + TiXmlNode *oldGUIRoot = nppRoot->FirstChildElement(TEXT("GUIConfigs")); + // Remove the old root nod if it exist + if (oldGUIRoot) + { + nppRoot->RemoveChild(oldGUIRoot); + } + + TiXmlNode *newGUIRoot = nppRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfigs"))); + + // standard + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("ToolBar")); + const TCHAR *pStr = (_nppGUI._toolbarShow) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("visible"), pStr); + pStr = _nppGUI._toolBarStatus == TB_SMALL ? TEXT("small") : (_nppGUI._toolBarStatus == TB_STANDARD ? TEXT("standard") : TEXT("large")); + GUIConfigElement->InsertEndChild(TiXmlText(pStr)); + } + + // show + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("StatusBar")); + const TCHAR *pStr = _nppGUI._statusBarShow ? TEXT("show") : TEXT("hide"); + GUIConfigElement->InsertEndChild(TiXmlText(pStr)); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("TabBar")); + + const TCHAR *pStr = (_nppGUI._tabStatus & TAB_DRAWTOPBAR) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("dragAndDrop"), pStr); + + pStr = (_nppGUI._tabStatus & TAB_DRAGNDROP) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("drawTopBar"), pStr); + + pStr = (_nppGUI._tabStatus & TAB_DRAWINACTIVETAB) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("drawInactiveTab"), pStr); + + pStr = (_nppGUI._tabStatus & TAB_REDUCE) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("reduce"), pStr); + + pStr = (_nppGUI._tabStatus & TAB_CLOSEBUTTON) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("closeButton"), pStr); + + pStr = (_nppGUI._tabStatus & TAB_DBCLK2CLOSE) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("doubleClick2Close"), pStr); + + pStr = (_nppGUI._tabStatus & TAB_VERTICAL) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("vertical"), pStr); + + pStr = (_nppGUI._tabStatus & TAB_MULTILINE) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("multiLine"), pStr); + + pStr = (_nppGUI._tabStatus & TAB_HIDE) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("hide"), pStr); + + pStr = (_nppGUI._tabStatus & TAB_QUITONEMPTY) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("quitOnEmpty"), pStr); + } + + // vertical + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("ScintillaViewsSplitter")); + const TCHAR *pStr = _nppGUI._splitterPos == POS_VERTICAL ? TEXT("vertical") : TEXT("horizontal"); + GUIConfigElement->InsertEndChild(TiXmlText(pStr)); + } + + // hide + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("UserDefineDlg")); + const TCHAR *pStr = (_nppGUI._userDefineDlgStatus & UDD_DOCKED) ? TEXT("docked") : TEXT("undocked"); + GUIConfigElement->SetAttribute(TEXT("position"), pStr); + pStr = (_nppGUI._userDefineDlgStatus & UDD_SHOW) ? TEXT("show") : TEXT("hide"); + GUIConfigElement->InsertEndChild(TiXmlText(pStr)); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("TabSetting")); + const TCHAR *pStr = _nppGUI._tabReplacedBySpace ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("replaceBySpace"), pStr); + GUIConfigElement->SetAttribute(TEXT("size"), _nppGUI._tabSize); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("AppPosition")); + GUIConfigElement->SetAttribute(TEXT("x"), _nppGUI._appPos.left); + GUIConfigElement->SetAttribute(TEXT("y"), _nppGUI._appPos.top); + GUIConfigElement->SetAttribute(TEXT("width"), _nppGUI._appPos.right); + GUIConfigElement->SetAttribute(TEXT("height"), _nppGUI._appPos.bottom); + GUIConfigElement->SetAttribute(TEXT("isMaximized"), _nppGUI._isMaximized ? TEXT("yes") : TEXT("no")); + } + + // no + { + TiXmlElement *element = insertGUIConfigBoolNode(newGUIRoot, TEXT("noUpdate"), !_nppGUI._autoUpdateOpt._doAutoUpdate); + element->SetAttribute(TEXT("intervalDays"), _nppGUI._autoUpdateOpt._intervalDays); + element->SetAttribute(TEXT("nextUpdateDate"), _nppGUI._autoUpdateOpt._nextUpdateDate.toString().c_str()); + } + + // yes + { + const TCHAR *pStr = TEXT("no"); + switch (_nppGUI._fileAutoDetection) + { + case cdEnabled: + pStr = TEXT("yes"); + break; + case cdAutoUpdate: + pStr = TEXT("auto"); + break; + case cdGo2end: + pStr = TEXT("Update2End"); + break; + case cdAutoUpdateGo2end: + pStr = TEXT("autoUpdate2End"); + break; + } + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Auto-detection")); + GUIConfigElement->InsertEndChild(TiXmlText(pStr)); + } + + // no + { + insertGUIConfigBoolNode(newGUIRoot, TEXT("CheckHistoryFiles"), _nppGUI._checkHistoryFiles); + } + + // no + { + insertGUIConfigBoolNode(newGUIRoot, TEXT("TrayIcon"), _nppGUI._isMinimizedToTray); + } + + // yes + { + insertGUIConfigBoolNode(newGUIRoot, TEXT("MaitainIndent"), _nppGUI._maitainIndent); + } + + // yes< / GUIConfig> + { + TiXmlElement * ele = insertGUIConfigBoolNode(newGUIRoot, TEXT("TagsMatchHighLight"), _nppGUI._enableTagsMatchHilite); + ele->SetAttribute(TEXT("TagAttrHighLight"), _nppGUI._enableTagAttrsHilite ? TEXT("yes") : TEXT("no")); + ele->SetAttribute(TEXT("HighLightNonHtmlZone"), _nppGUI._enableHiliteNonHTMLZone ? TEXT("yes") : TEXT("no")); + } + + // yes< / GUIConfig> + { + insertGUIConfigBoolNode(newGUIRoot, TEXT("RememberLastSession"), _nppGUI._rememberLastSession); + } + + // yes< / GUIConfig> + { + insertGUIConfigBoolNode(newGUIRoot, TEXT("DetectEncoding"), _nppGUI._detectEncoding); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("NewDocDefaultSettings")); + GUIConfigElement->SetAttribute(TEXT("format"), static_cast(_nppGUI._newDocDefaultSettings._format)); + GUIConfigElement->SetAttribute(TEXT("encoding"), _nppGUI._newDocDefaultSettings._unicodeMode); + GUIConfigElement->SetAttribute(TEXT("lang"), _nppGUI._newDocDefaultSettings._lang); + GUIConfigElement->SetAttribute(TEXT("codepage"), _nppGUI._newDocDefaultSettings._codepage); + GUIConfigElement->SetAttribute(TEXT("openAnsiAsUTF8"), _nppGUI._newDocDefaultSettings._openAnsiAsUtf8 ? TEXT("yes") : TEXT("no")); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("langsExcluded")); + writeExcludedLangList(GUIConfigElement); + GUIConfigElement->SetAttribute(TEXT("langMenuCompact"), _nppGUI._isLangMenuCompact ? TEXT("yes") : TEXT("no")); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Print")); + writePrintSetting(GUIConfigElement); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Backup")); + GUIConfigElement->SetAttribute(TEXT("action"), _nppGUI._backup); + GUIConfigElement->SetAttribute(TEXT("useCustumDir"), _nppGUI._useDir ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("dir"), _nppGUI._backupDir.c_str()); + + GUIConfigElement->SetAttribute(TEXT("isSnapshotMode"), _nppGUI.isSnapshotMode() ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("snapshotBackupTiming"), static_cast(_nppGUI._snapshotBackupTiming)); + } + + // yes< / GUIConfig> + { + insertGUIConfigBoolNode(newGUIRoot, TEXT("TaskList"), _nppGUI._doTaskList); + } + + // yes< / GUIConfig> + { + insertGUIConfigBoolNode(newGUIRoot, TEXT("MRU"), _nppGUI._styleMRU); + } + + // 2 + { + const TCHAR *pStr = TEXT("0"); + if (_nppGUI._styleURL == 1) + pStr = TEXT("1"); + else if (_nppGUI._styleURL == 2) + pStr = TEXT("2"); + + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("URL")); + GUIConfigElement->InsertEndChild(TiXmlText(pStr)); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("globalOverride")); + GUIConfigElement->SetAttribute(TEXT("fg"), _nppGUI._globalOverride.enableFg ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("bg"), _nppGUI._globalOverride.enableBg ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("font"), _nppGUI._globalOverride.enableFont ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("fontSize"), _nppGUI._globalOverride.enableFontSize ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("bold"), _nppGUI._globalOverride.enableBold ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("italic"), _nppGUI._globalOverride.enableItalic ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("underline"), _nppGUI._globalOverride.enableUnderLine ? TEXT("yes") : TEXT("no")); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("auto-completion")); + GUIConfigElement->SetAttribute(TEXT("autoCAction"), _nppGUI._autocStatus); + GUIConfigElement->SetAttribute(TEXT("triggerFromNbChar"), static_cast(_nppGUI._autocFromLen)); + + const TCHAR * pStr = _nppGUI._autocIgnoreNumbers ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("autoCIgnoreNumbers"), pStr); + + pStr = _nppGUI._funcParams ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("funcParams"), pStr); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("auto-insert")); + + GUIConfigElement->SetAttribute(TEXT("parentheses"), _nppGUI._matchedPairConf._doParentheses ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("brackets"), _nppGUI._matchedPairConf._doBrackets ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("curlyBrackets"), _nppGUI._matchedPairConf._doCurlyBrackets ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("quotes"), _nppGUI._matchedPairConf._doQuotes ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("doubleQuotes"), _nppGUI._matchedPairConf._doDoubleQuotes ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("htmlXmlTag"), _nppGUI._matchedPairConf._doHtmlXmlTag ? TEXT("yes") : TEXT("no")); + + TiXmlElement hist_element{ TEXT("") }; + hist_element.SetValue(TEXT("UserDefinePair")); + for (size_t i = 0, nb = _nppGUI._matchedPairConf._matchedPairs.size(); i < nb; ++i) + { + int open = _nppGUI._matchedPairConf._matchedPairs[i].first; + int close = _nppGUI._matchedPairConf._matchedPairs[i].second; + + (hist_element.ToElement())->SetAttribute(TEXT("open"), open); + (hist_element.ToElement())->SetAttribute(TEXT("close"), close); + GUIConfigElement->InsertEndChild(hist_element); + } + } + + // < / GUIConfig> + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("sessionExt")); + GUIConfigElement->InsertEndChild(TiXmlText(_nppGUI._definedSessionExt.c_str())); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("workspaceExt")); + GUIConfigElement->InsertEndChild(TiXmlText(_nppGUI._definedWorkspaceExt.c_str())); + } + + // show + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MenuBar")); + GUIConfigElement->InsertEndChild(TiXmlText(_nppGUI._menuBarShow ? TEXT("show") : TEXT("hide"))); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Caret")); + GUIConfigElement->SetAttribute(TEXT("width"), _nppGUI._caretWidth); + GUIConfigElement->SetAttribute(TEXT("blinkRate"), _nppGUI._caretBlinkRate); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("ScintillaGlobalSettings")); + GUIConfigElement->SetAttribute(TEXT("enableMultiSelection"), _nppGUI._enableMultiSelection ? TEXT("yes") : TEXT("no")); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("openSaveDir")); + GUIConfigElement->SetAttribute(TEXT("value"), _nppGUI._openSaveDir); + GUIConfigElement->SetAttribute(TEXT("defaultDirPath"), _nppGUI._defaultDir); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("titleBar")); + const TCHAR *pStr = (_nppGUI._shortTitlebar) ? TEXT("yes") : TEXT("no"); + GUIConfigElement->SetAttribute(TEXT("short"), pStr); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("stylerTheme")); + GUIConfigElement->SetAttribute(TEXT("path"), _nppGUI._themeName.c_str()); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("wordCharList")); + GUIConfigElement->SetAttribute(TEXT("useDefault"), _nppGUI._isWordCharDefault ? TEXT("yes") : TEXT("no")); + WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + const wchar_t* charsAddStr = wmc->char2wchar(_nppGUI._customWordChars.c_str(), SC_CP_UTF8); + GUIConfigElement->SetAttribute(TEXT("charsAdded"), charsAddStr); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("delimiterSelection")); + GUIConfigElement->SetAttribute(TEXT("leftmostDelimiter"), _nppGUI._leftmostDelimiter); + GUIConfigElement->SetAttribute(TEXT("rightmostDelimiter"), _nppGUI._rightmostDelimiter); + GUIConfigElement->SetAttribute(TEXT("delimiterSelectionOnEntireDocument"), _nppGUI._delimiterSelectionOnEntireDocument ? TEXT("yes") : TEXT("no")); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("multiInst")); + GUIConfigElement->SetAttribute(TEXT("setting"), _nppGUI._multiInstSetting); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MISC")); + + GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("newStyleSaveDlg"), _nppGUI._useNewStyleSaveDlg ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("isFolderDroppedOpenFiles"), _nppGUI._isFolderDroppedOpenFiles ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("docPeekOnTab"), _nppGUI._isDocPeekOnTab ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("docPeekOnMap"), _nppGUI._isDocPeekOnMap ? TEXT("yes") : TEXT("no")); + } + + // + { + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("searchEngine")); + GUIConfigElement->SetAttribute(TEXT("searchEngineChoice"), _nppGUI._searchEngineChoice); + GUIConfigElement->SetAttribute(TEXT("searchEngineCustom"), _nppGUI._searchEngineCustom); + } + + // yes + { + TiXmlElement *GUIConfigElement = insertGUIConfigBoolNode(newGUIRoot, TEXT("SmartHighLight"), _nppGUI._enableSmartHilite); + GUIConfigElement->SetAttribute(TEXT("matchCase"), _nppGUI._smartHiliteCaseSensitive ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("wholeWordOnly"), _nppGUI._smartHiliteWordOnly ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("useFindSettings"), _nppGUI._smartHiliteUseFindSettings ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("onAnotherView"), _nppGUI._smartHiliteOnAnotherView ? TEXT("yes") : TEXT("no")); + } + + // + writeScintillaParams(); + + // + // ... + insertDockingParamNode(newGUIRoot); +} + +bool NppParameters::writeFindHistory() +{ + if (not _pXmlUserDoc) return false; + + TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); + if (not nppRoot) + { + nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); + } + + TiXmlNode *findHistoryRoot = nppRoot->FirstChildElement(TEXT("FindHistory")); + if (!findHistoryRoot) + { + TiXmlElement element(TEXT("FindHistory")); + findHistoryRoot = nppRoot->InsertEndChild(element); + } + findHistoryRoot->Clear(); + + (findHistoryRoot->ToElement())->SetAttribute(TEXT("nbMaxFindHistoryPath"), _findHistory._nbMaxFindHistoryPath); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("nbMaxFindHistoryFilter"), _findHistory._nbMaxFindHistoryFilter); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("nbMaxFindHistoryFind"), _findHistory._nbMaxFindHistoryFind); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("nbMaxFindHistoryReplace"), _findHistory._nbMaxFindHistoryReplace); + + (findHistoryRoot->ToElement())->SetAttribute(TEXT("matchWord"), _findHistory._isMatchWord?TEXT("yes"):TEXT("no")); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("matchCase"), _findHistory._isMatchCase?TEXT("yes"):TEXT("no")); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("wrap"), _findHistory._isWrap?TEXT("yes"):TEXT("no")); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("directionDown"), _findHistory._isDirectionDown?TEXT("yes"):TEXT("no")); + + (findHistoryRoot->ToElement())->SetAttribute(TEXT("fifRecuisive"), _findHistory._isFifRecuisive?TEXT("yes"):TEXT("no")); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("fifInHiddenFolder"), _findHistory._isFifInHiddenFolder?TEXT("yes"):TEXT("no")); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("dlgAlwaysVisible"), _findHistory._isDlgAlwaysVisible?TEXT("yes"):TEXT("no")); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("fifFilterFollowsDoc"), _findHistory._isFilterFollowDoc?TEXT("yes"):TEXT("no")); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("fifFolderFollowsDoc"), _findHistory._isFolderFollowDoc?TEXT("yes"):TEXT("no")); + + (findHistoryRoot->ToElement())->SetAttribute(TEXT("searchMode"), _findHistory._searchMode); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("transparencyMode"), _findHistory._transparencyMode); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("transparency"), _findHistory._transparency); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("dotMatchesNewline"), _findHistory._dotMatchesNewline?TEXT("yes"):TEXT("no")); + (findHistoryRoot->ToElement())->SetAttribute(TEXT("isSearch2ButtonsMode"), _findHistory._isSearch2ButtonsMode?TEXT("yes"):TEXT("no")); + + TiXmlElement hist_element{TEXT("")}; + + hist_element.SetValue(TEXT("Path")); + for (size_t i = 0, len = _findHistory._findHistoryPaths.size(); i < len; ++i) + { + (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryPaths[i].c_str()); + findHistoryRoot->InsertEndChild(hist_element); + } + + hist_element.SetValue(TEXT("Filter")); + for (size_t i = 0, len = _findHistory._findHistoryFilters.size(); i < len; ++i) + { + (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryFilters[i].c_str()); + findHistoryRoot->InsertEndChild(hist_element); + } + + hist_element.SetValue(TEXT("Find")); + for (size_t i = 0, len = _findHistory._findHistoryFinds.size(); i < len; ++i) + { + (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryFinds[i].c_str()); + findHistoryRoot->InsertEndChild(hist_element); + } + + hist_element.SetValue(TEXT("Replace")); + for (size_t i = 0, len = _findHistory._findHistoryReplaces.size(); i < len; ++i) + { + (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryReplaces[i].c_str()); + findHistoryRoot->InsertEndChild(hist_element); + } + + return true; +} + +void NppParameters::insertDockingParamNode(TiXmlNode *GUIRoot) +{ + TiXmlElement DMNode(TEXT("GUIConfig")); + DMNode.SetAttribute(TEXT("name"), TEXT("DockingManager")); + DMNode.SetAttribute(TEXT("leftWidth"), _nppGUI._dockingData._leftWidth); + DMNode.SetAttribute(TEXT("rightWidth"), _nppGUI._dockingData._rightWidth); + DMNode.SetAttribute(TEXT("topHeight"), _nppGUI._dockingData._topHeight); + DMNode.SetAttribute(TEXT("bottomHeight"), _nppGUI._dockingData._bottomHight); + + for (size_t i = 0, len = _nppGUI._dockingData._flaotingWindowInfo.size(); i < len ; ++i) + { + FloatingWindowInfo & fwi = _nppGUI._dockingData._flaotingWindowInfo[i]; + TiXmlElement FWNode(TEXT("FloatingWindow")); + FWNode.SetAttribute(TEXT("cont"), fwi._cont); + FWNode.SetAttribute(TEXT("x"), fwi._pos.left); + FWNode.SetAttribute(TEXT("y"), fwi._pos.top); + FWNode.SetAttribute(TEXT("width"), fwi._pos.right); + FWNode.SetAttribute(TEXT("height"), fwi._pos.bottom); + + DMNode.InsertEndChild(FWNode); + } + + for (size_t i = 0, len = _nppGUI._dockingData._pluginDockInfo.size() ; i < len ; ++i) + { + PluginDlgDockingInfo & pdi = _nppGUI._dockingData._pluginDockInfo[i]; + TiXmlElement PDNode(TEXT("PluginDlg")); + PDNode.SetAttribute(TEXT("pluginName"), pdi._name); + PDNode.SetAttribute(TEXT("id"), pdi._internalID); + PDNode.SetAttribute(TEXT("curr"), pdi._currContainer); + PDNode.SetAttribute(TEXT("prev"), pdi._prevContainer); + PDNode.SetAttribute(TEXT("isVisible"), pdi._isVisible?TEXT("yes"):TEXT("no")); + + DMNode.InsertEndChild(PDNode); + } + + for (size_t i = 0, len = _nppGUI._dockingData._containerTabInfo.size(); i < len ; ++i) + { + ContainerTabInfo & cti = _nppGUI._dockingData._containerTabInfo[i]; + TiXmlElement CTNode(TEXT("ActiveTabs")); + CTNode.SetAttribute(TEXT("cont"), cti._cont); + CTNode.SetAttribute(TEXT("activeTab"), cti._activeTab); + DMNode.InsertEndChild(CTNode); + } + + GUIRoot->InsertEndChild(DMNode); +} + +void NppParameters::writePrintSetting(TiXmlElement *element) +{ + const TCHAR *pStr = _nppGUI._printSettings._printLineNumber?TEXT("yes"):TEXT("no"); + element->SetAttribute(TEXT("lineNumber"), pStr); + + element->SetAttribute(TEXT("printOption"), _nppGUI._printSettings._printOption); + + element->SetAttribute(TEXT("headerLeft"), _nppGUI._printSettings._headerLeft.c_str()); + element->SetAttribute(TEXT("headerMiddle"), _nppGUI._printSettings._headerMiddle.c_str()); + element->SetAttribute(TEXT("headerRight"), _nppGUI._printSettings._headerRight.c_str()); + element->SetAttribute(TEXT("footerLeft"), _nppGUI._printSettings._footerLeft.c_str()); + element->SetAttribute(TEXT("footerMiddle"), _nppGUI._printSettings._footerMiddle.c_str()); + element->SetAttribute(TEXT("footerRight"), _nppGUI._printSettings._footerRight.c_str()); + + element->SetAttribute(TEXT("headerFontName"), _nppGUI._printSettings._headerFontName.c_str()); + element->SetAttribute(TEXT("headerFontStyle"), _nppGUI._printSettings._headerFontStyle); + element->SetAttribute(TEXT("headerFontSize"), _nppGUI._printSettings._headerFontSize); + element->SetAttribute(TEXT("footerFontName"), _nppGUI._printSettings._footerFontName.c_str()); + element->SetAttribute(TEXT("footerFontStyle"), _nppGUI._printSettings._footerFontStyle); + element->SetAttribute(TEXT("footerFontSize"), _nppGUI._printSettings._footerFontSize); + + element->SetAttribute(TEXT("margeLeft"), _nppGUI._printSettings._marge.left); + element->SetAttribute(TEXT("margeRight"), _nppGUI._printSettings._marge.right); + element->SetAttribute(TEXT("margeTop"), _nppGUI._printSettings._marge.top); + element->SetAttribute(TEXT("margeBottom"), _nppGUI._printSettings._marge.bottom); +} + +void NppParameters::writeExcludedLangList(TiXmlElement *element) +{ + int g0 = 0; // up to 8 + int g1 = 0; // up to 16 + int g2 = 0; // up to 24 + int g3 = 0; // up to 32 + int g4 = 0; // up to 40 + int g5 = 0; // up to 48 + int g6 = 0; // up to 56 + int g7 = 0; // up to 64 + int g8 = 0; // up to 72 + int g9 = 0; // up to 80 + int g10= 0; // up to 88 + int g11= 0; // up to 96 + int g12= 0; // up to 104 + + const int groupNbMember = 8; + + for (size_t i = 0, len = _nppGUI._excludedLangList.size(); i < len ; ++i) + { + LangType langType = _nppGUI._excludedLangList[i]._langType; + if (langType >= L_EXTERNAL && langType < L_END) + continue; + + int nGrp = langType / groupNbMember; + int nMask = 1 << langType % groupNbMember; + + + switch (nGrp) + { + case 0 : + g0 |= nMask; + break; + case 1 : + g1 |= nMask; + break; + case 2 : + g2 |= nMask; + break; + case 3 : + g3 |= nMask; + break; + case 4 : + g4 |= nMask; + break; + case 5 : + g5 |= nMask; + break; + case 6 : + g6 |= nMask; + break; + case 7 : + g7 |= nMask; + break; + case 8: + g8 |= nMask; + break; + case 9: + g9 |= nMask; + break; + case 10: + g10 |= nMask; + break; + case 11: + g11 |= nMask; + break; + case 12: + g12 |= nMask; + break; + } + } + + element->SetAttribute(TEXT("gr0"), g0); + element->SetAttribute(TEXT("gr1"), g1); + element->SetAttribute(TEXT("gr2"), g2); + element->SetAttribute(TEXT("gr3"), g3); + element->SetAttribute(TEXT("gr4"), g4); + element->SetAttribute(TEXT("gr5"), g5); + element->SetAttribute(TEXT("gr6"), g6); + element->SetAttribute(TEXT("gr7"), g7); + element->SetAttribute(TEXT("gr8"), g8); + element->SetAttribute(TEXT("gr9"), g9); + element->SetAttribute(TEXT("gr10"), g10); + element->SetAttribute(TEXT("gr11"), g11); + element->SetAttribute(TEXT("gr12"), g12); +} + +TiXmlElement * NppParameters::insertGUIConfigBoolNode(TiXmlNode *r2w, const TCHAR *name, bool bVal) +{ + const TCHAR *pStr = bVal?TEXT("yes"):TEXT("no"); + TiXmlElement *GUIConfigElement = (r2w->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); + GUIConfigElement->SetAttribute(TEXT("name"), name); + GUIConfigElement->InsertEndChild(TiXmlText(pStr)); + return GUIConfigElement; +} + +int RGB2int(COLORREF color) { + return (((((DWORD)color) & 0x0000FF) << 16) | ((((DWORD)color) & 0x00FF00)) | ((((DWORD)color) & 0xFF0000) >> 16)); +} + +int NppParameters::langTypeToCommandID(LangType lt) const +{ + int id; + switch (lt) + { + case L_C : + id = IDM_LANG_C; break; + case L_CPP : + id = IDM_LANG_CPP; break; + case L_JAVA : + id = IDM_LANG_JAVA; break; + case L_CS : + id = IDM_LANG_CS; break; + case L_OBJC : + id = IDM_LANG_OBJC; break; + case L_HTML : + id = IDM_LANG_HTML; break; + case L_XML : + id = IDM_LANG_XML; break; + case L_JS : + case L_JAVASCRIPT: + id = IDM_LANG_JS; break; + case L_JSON: + id = IDM_LANG_JSON; break; + case L_PHP : + id = IDM_LANG_PHP; break; + case L_ASP : + id = IDM_LANG_ASP; break; + case L_JSP : + id = IDM_LANG_JSP; break; + case L_CSS : + id = IDM_LANG_CSS; break; + case L_LUA : + id = IDM_LANG_LUA; break; + case L_PERL : + id = IDM_LANG_PERL; break; + case L_PYTHON : + id = IDM_LANG_PYTHON; break; + case L_BATCH : + id = IDM_LANG_BATCH; break; + case L_PASCAL : + id = IDM_LANG_PASCAL; break; + case L_MAKEFILE : + id = IDM_LANG_MAKEFILE; break; + case L_INI : + id = IDM_LANG_INI; break; + case L_ASCII : + id = IDM_LANG_ASCII; break; + case L_RC : + id = IDM_LANG_RC; break; + case L_TEX : + id = IDM_LANG_TEX; break; + case L_FORTRAN : + id = IDM_LANG_FORTRAN; break; + case L_FORTRAN_77 : + id = IDM_LANG_FORTRAN_77; break; + case L_BASH : + id = IDM_LANG_BASH; break; + case L_FLASH : + id = IDM_LANG_FLASH; break; + case L_NSIS : + id = IDM_LANG_NSIS; break; + case L_USER : + id = IDM_LANG_USER; break; + case L_SQL : + id = IDM_LANG_SQL; break; + case L_VB : + id = IDM_LANG_VB; break; + case L_TCL : + id = IDM_LANG_TCL; break; + + case L_LISP : + id = IDM_LANG_LISP; break; + case L_SCHEME : + id = IDM_LANG_SCHEME; break; + case L_ASM : + id = IDM_LANG_ASM; break; + case L_DIFF : + id = IDM_LANG_DIFF; break; + case L_PROPS : + id = IDM_LANG_PROPS; break; + case L_PS : + id = IDM_LANG_PS; break; + case L_RUBY : + id = IDM_LANG_RUBY; break; + case L_SMALLTALK : + id = IDM_LANG_SMALLTALK; break; + case L_VHDL : + id = IDM_LANG_VHDL; break; + + case L_ADA : + id = IDM_LANG_ADA; break; + case L_MATLAB : + id = IDM_LANG_MATLAB; break; + + case L_HASKELL : + id = IDM_LANG_HASKELL; break; + + case L_KIX : + id = IDM_LANG_KIX; break; + case L_AU3 : + id = IDM_LANG_AU3; break; + case L_VERILOG : + id = IDM_LANG_VERILOG; break; + case L_CAML : + id = IDM_LANG_CAML; break; + + case L_INNO : + id = IDM_LANG_INNO; break; + + case L_CMAKE : + id = IDM_LANG_CMAKE; break; + + case L_YAML : + id = IDM_LANG_YAML; break; + + case L_COBOL : + id = IDM_LANG_COBOL; break; + + case L_D : + id = IDM_LANG_D; break; + + case L_GUI4CLI : + id = IDM_LANG_GUI4CLI; break; + + case L_POWERSHELL : + id = IDM_LANG_POWERSHELL; break; + + case L_R : + id = IDM_LANG_R; break; + + case L_COFFEESCRIPT : + id = IDM_LANG_COFFEESCRIPT; break; + + case L_BAANC: + id = IDM_LANG_BAANC; break; + + case L_SREC : + id = IDM_LANG_SREC; break; + + case L_IHEX : + id = IDM_LANG_IHEX; break; + + case L_TEHEX : + id = IDM_LANG_TEHEX; break; + + case L_SWIFT: + id = IDM_LANG_SWIFT; break; + + case L_ASN1 : + id = IDM_LANG_ASN1; break; + + case L_AVS : + id = IDM_LANG_AVS; break; + + case L_BLITZBASIC : + id = IDM_LANG_BLITZBASIC; break; + + case L_PUREBASIC : + id = IDM_LANG_PUREBASIC; break; + + case L_FREEBASIC : + id = IDM_LANG_FREEBASIC; break; + + case L_CSOUND : + id = IDM_LANG_CSOUND; break; + + case L_ERLANG : + id = IDM_LANG_ERLANG; break; + + case L_ESCRIPT : + id = IDM_LANG_ESCRIPT; break; + + case L_FORTH : + id = IDM_LANG_FORTH; break; + + case L_LATEX : + id = IDM_LANG_LATEX; break; + + case L_MMIXAL : + id = IDM_LANG_MMIXAL; break; + + case L_NIMROD : + id = IDM_LANG_NIMROD; break; + + case L_NNCRONTAB : + id = IDM_LANG_NNCRONTAB; break; + + case L_OSCRIPT : + id = IDM_LANG_OSCRIPT; break; + + case L_REBOL : + id = IDM_LANG_REBOL; break; + + case L_REGISTRY : + id = IDM_LANG_REGISTRY; break; + + case L_RUST : + id = IDM_LANG_RUST; break; + + case L_SPICE : + id = IDM_LANG_SPICE; break; + + case L_TXT2TAGS : + id = IDM_LANG_TXT2TAGS; break; + + case L_VISUALPROLOG: + id = IDM_LANG_VISUALPROLOG; break; + + case L_SEARCHRESULT : + id = -1; break; + + case L_TEXT : + id = IDM_LANG_TEXT; break; + + + default : + if(lt >= L_EXTERNAL && lt < L_END) + id = lt - L_EXTERNAL + IDM_LANG_EXTERNAL; + else + id = IDM_LANG_TEXT; + } + return id; +} + +generic_string NppParameters:: getWinVersionStr() const +{ + switch (_winVersion) + { + case WV_WIN32S: return TEXT("Windows 3.1"); + case WV_95: return TEXT("Windows 95"); + case WV_98: return TEXT("Windows 98"); + case WV_ME: return TEXT("Windows Millennium Edition"); + case WV_NT: return TEXT("Windows NT"); + case WV_W2K: return TEXT("Windows 2000"); + case WV_XP: return TEXT("Windows XP"); + case WV_S2003: return TEXT("Windows Server 2003"); + case WV_XPX64: return TEXT("Windows XP 64 bits"); + case WV_VISTA: return TEXT("Windows Vista"); + case WV_WIN7: return TEXT("Windows 7"); + case WV_WIN8: return TEXT("Windows 8"); + case WV_WIN81: return TEXT("Windows 8.1"); + case WV_WIN10: return TEXT("Windows 10"); + default: /*case WV_UNKNOWN:*/ return TEXT("Windows unknown version"); + } +} + +generic_string NppParameters::getWinVerBitStr() const +{ + switch (_platForm) + { + case PF_X86: + return TEXT("32-bit"); + + case PF_X64: + case PF_IA64: + return TEXT("64-bit"); + + default: + return TEXT("Unknown-bit"); + } +} + +void NppParameters::writeStyles(LexerStylerArray & lexersStylers, StyleArray & globalStylers) +{ + TiXmlNode *lexersRoot = (_pXmlUserStylerDoc->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles")); + for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType")); + childNode ; + childNode = childNode->NextSibling(TEXT("LexerType"))) + { + TiXmlElement *element = childNode->ToElement(); + const TCHAR *nm = element->Attribute(TEXT("name")); + + LexerStyler *pLs = _lexerStylerArray.getLexerStylerByName(nm); + LexerStyler *pLs2 = lexersStylers.getLexerStylerByName(nm); + + if (pLs) + { + const TCHAR *extStr = pLs->getLexerUserExt(); + element->SetAttribute(TEXT("ext"), extStr); + for (TiXmlNode *grChildNode = childNode->FirstChildElement(TEXT("WordsStyle")); + grChildNode ; + grChildNode = grChildNode->NextSibling(TEXT("WordsStyle"))) + { + TiXmlElement *grElement = grChildNode->ToElement(); + const TCHAR *styleName = grElement->Attribute(TEXT("name")); + + int i = pLs->getStylerIndexByName(styleName); + if (i != -1) + { + Style & style = pLs->getStyler(i); + Style & style2Sync = pLs2->getStyler(i); + + writeStyle2Element(style, style2Sync, grElement); + } + } + } + } + + for(size_t x = 0; x < _pXmlExternalLexerDoc.size(); ++x) + { + TiXmlNode *lexersRoot = ( _pXmlExternalLexerDoc[x]->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles")); + for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType")); + childNode ; + childNode = childNode->NextSibling(TEXT("LexerType"))) + { + TiXmlElement *element = childNode->ToElement(); + const TCHAR *nm = element->Attribute(TEXT("name")); + + LexerStyler *pLs = _lexerStylerArray.getLexerStylerByName(nm); + LexerStyler *pLs2 = lexersStylers.getLexerStylerByName(nm); + + if (pLs) + { + const TCHAR *extStr = pLs->getLexerUserExt(); + element->SetAttribute(TEXT("ext"), extStr); + + for (TiXmlNode *grChildNode = childNode->FirstChildElement(TEXT("WordsStyle")); + grChildNode ; + grChildNode = grChildNode->NextSibling(TEXT("WordsStyle"))) + { + TiXmlElement *grElement = grChildNode->ToElement(); + const TCHAR *styleName = grElement->Attribute(TEXT("name")); + + int i = pLs->getStylerIndexByName(styleName); + if (i != -1) + { + Style & style = pLs->getStyler(i); + Style & style2Sync = pLs2->getStyler(i); + + writeStyle2Element(style, style2Sync, grElement); + } + } + } + } + _pXmlExternalLexerDoc[x]->SaveFile(); + } + + TiXmlNode *globalStylesRoot = (_pXmlUserStylerDoc->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("GlobalStyles")); + + for (TiXmlNode *childNode = globalStylesRoot->FirstChildElement(TEXT("WidgetStyle")); + childNode ; + childNode = childNode->NextSibling(TEXT("WidgetStyle"))) + { + TiXmlElement *pElement = childNode->ToElement(); + const TCHAR *styleName = pElement->Attribute(TEXT("name")); + int i = _widgetStyleArray.getStylerIndexByName(styleName); + + if (i != -1) + { + Style & style = _widgetStyleArray.getStyler(i); + Style & style2Sync = globalStylers.getStyler(i); + + writeStyle2Element(style, style2Sync, pElement); + } + } + + _pXmlUserStylerDoc->SaveFile(); +} + + +bool NppParameters::insertTabInfo(const TCHAR *langName, int tabInfo) +{ + if (!_pXmlDoc) return false; + TiXmlNode *langRoot = (_pXmlDoc->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("Languages")); + for (TiXmlNode *childNode = langRoot->FirstChildElement(TEXT("Language")); + childNode ; + childNode = childNode->NextSibling(TEXT("Language"))) + { + TiXmlElement *element = childNode->ToElement(); + const TCHAR *nm = element->Attribute(TEXT("name")); + if (nm && lstrcmp(langName, nm) == 0) + { + childNode->ToElement()->SetAttribute(TEXT("tabSettings"), tabInfo); + _pXmlDoc->SaveFile(); + return true; + } + } + return false; +} + +void NppParameters::writeStyle2Element(Style & style2Write, Style & style2Sync, TiXmlElement *element) +{ + if (HIBYTE(HIWORD(style2Write._fgColor)) != 0xFF) + { + int rgbVal = RGB2int(style2Write._fgColor); + TCHAR fgStr[7]; + wsprintf(fgStr, TEXT("%.6X"), rgbVal); + element->SetAttribute(TEXT("fgColor"), fgStr); + } + + if (HIBYTE(HIWORD(style2Write._bgColor)) != 0xFF) + { + int rgbVal = RGB2int(style2Write._bgColor); + TCHAR bgStr[7]; + wsprintf(bgStr, TEXT("%.6X"), rgbVal); + element->SetAttribute(TEXT("bgColor"), bgStr); + } + + if (style2Write._colorStyle != COLORSTYLE_ALL) + { + element->SetAttribute(TEXT("colorStyle"), style2Write._colorStyle); + } + + if (style2Write._fontName) + { + const TCHAR *oldFontName = element->Attribute(TEXT("fontName")); + if (lstrcmp(oldFontName, style2Write._fontName)) + { + element->SetAttribute(TEXT("fontName"), style2Write._fontName); + style2Sync._fontName = style2Write._fontName = element->Attribute(TEXT("fontName")); + } + } + + if (style2Write._fontSize != STYLE_NOT_USED) + { + if (!style2Write._fontSize) + element->SetAttribute(TEXT("fontSize"), TEXT("")); + else + element->SetAttribute(TEXT("fontSize"), style2Write._fontSize); + } + + if (style2Write._fontStyle != STYLE_NOT_USED) + { + element->SetAttribute(TEXT("fontStyle"), style2Write._fontStyle); + } + + + if (style2Write._keywords) + { + TiXmlNode *teteDeNoeud = element->LastChild(); + + if (teteDeNoeud) + teteDeNoeud->SetValue(style2Write._keywords->c_str()); + else + element->InsertEndChild(TiXmlText(style2Write._keywords->c_str())); + } +} + +void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *userLang) +{ + TiXmlElement *rootElement = (node->InsertEndChild(TiXmlElement(TEXT("UserLang"))))->ToElement(); + + TCHAR temp[32]; + generic_string udlVersion; + udlVersion += generic_itoa(SCE_UDL_VERSION_MAJOR, temp, 10); + udlVersion += TEXT("."); + udlVersion += generic_itoa(SCE_UDL_VERSION_MINOR, temp, 10); + + rootElement->SetAttribute(TEXT("name"), userLang->_name); + rootElement->SetAttribute(TEXT("ext"), userLang->_ext); + rootElement->SetAttribute(TEXT("udlVersion"), udlVersion.c_str()); + + TiXmlElement *settingsElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("Settings"))))->ToElement(); + { + TiXmlElement *globalElement = (settingsElement->InsertEndChild(TiXmlElement(TEXT("Global"))))->ToElement(); + globalElement->SetAttribute(TEXT("caseIgnored"), userLang->_isCaseIgnored ? TEXT("yes"):TEXT("no")); + globalElement->SetAttribute(TEXT("allowFoldOfComments"), userLang->_allowFoldOfComments ? TEXT("yes"):TEXT("no")); + globalElement->SetAttribute(TEXT("foldCompact"), userLang->_foldCompact ? TEXT("yes"):TEXT("no")); + globalElement->SetAttribute(TEXT("forcePureLC"), userLang->_forcePureLC); + globalElement->SetAttribute(TEXT("decimalSeparator"), userLang->_decimalSeparator); + + TiXmlElement *prefixElement = (settingsElement->InsertEndChild(TiXmlElement(TEXT("Prefix"))))->ToElement(); + for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; ++i) + prefixElement->SetAttribute(globalMappper().keywordNameMapper[i+SCE_USER_KWLIST_KEYWORDS1], userLang->_isPrefix[i]?TEXT("yes"):TEXT("no")); + } + + TiXmlElement *kwlElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("KeywordLists"))))->ToElement(); + + for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i) + { + TiXmlElement *kwElement = (kwlElement->InsertEndChild(TiXmlElement(TEXT("Keywords"))))->ToElement(); + kwElement->SetAttribute(TEXT("name"), globalMappper().keywordNameMapper[i]); + kwElement->InsertEndChild(TiXmlText(userLang->_keywordLists[i])); + } + + TiXmlElement *styleRootElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("Styles"))))->ToElement(); + + for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; ++i) + { + TiXmlElement *styleElement = (styleRootElement->InsertEndChild(TiXmlElement(TEXT("WordsStyle"))))->ToElement(); + Style style2Write = userLang->_styleArray.getStyler(i); + + if (style2Write._styleID == -1) + continue; + + styleElement->SetAttribute(TEXT("name"), style2Write._styleDesc); + + //if (HIBYTE(HIWORD(style2Write._fgColor)) != 0xFF) + { + int rgbVal = RGB2int(style2Write._fgColor); + TCHAR fgStr[7]; + wsprintf(fgStr, TEXT("%.6X"), rgbVal); + styleElement->SetAttribute(TEXT("fgColor"), fgStr); + } + + //if (HIBYTE(HIWORD(style2Write._bgColor)) != 0xFF) + { + int rgbVal = RGB2int(style2Write._bgColor); + TCHAR bgStr[7]; + wsprintf(bgStr, TEXT("%.6X"), rgbVal); + styleElement->SetAttribute(TEXT("bgColor"), bgStr); + } + + if (style2Write._colorStyle != COLORSTYLE_ALL) + { + styleElement->SetAttribute(TEXT("colorStyle"), style2Write._colorStyle); + } + + if (style2Write._fontName) + { + styleElement->SetAttribute(TEXT("fontName"), style2Write._fontName); + } + + if (style2Write._fontStyle == STYLE_NOT_USED) + { + styleElement->SetAttribute(TEXT("fontStyle"), TEXT("0")); + } + else + { + styleElement->SetAttribute(TEXT("fontStyle"), style2Write._fontStyle); + } + + if (style2Write._fontSize != STYLE_NOT_USED) + { + if (!style2Write._fontSize) + styleElement->SetAttribute(TEXT("fontSize"), TEXT("")); + else + styleElement->SetAttribute(TEXT("fontSize"), style2Write._fontSize); + } + + styleElement->SetAttribute(TEXT("nesting"), style2Write._nesting); + } +} + +void NppParameters::stylerStrOp(bool op) +{ + for (int i = 0 ; i < _nbUserLang ; ++i) + { + for (int j = 0 ; j < SCE_USER_STYLE_TOTAL_STYLES ; ++j) + { + Style & style = _userLangArray[i]->_styleArray.getStyler(j); + + if (op == DUP) + { + TCHAR *str = new TCHAR[lstrlen(style._styleDesc) + 1]; + style._styleDesc = lstrcpy(str, style._styleDesc); + if (style._fontName) + { + str = new TCHAR[lstrlen(style._fontName) + 1]; + style._fontName = lstrcpy(str, style._fontName); + } + else + { + str = new TCHAR[2]; + str[0] = str[1] = '\0'; + style._fontName = str; + } + } + else + { + delete [] style._styleDesc; + delete [] style._fontName; + } + } + } +} + +void NppParameters::addUserModifiedIndex(size_t index) +{ + size_t len = _customizedShortcuts.size(); + bool found = false; + for(size_t i = 0; i < len; ++i) + { + if (_customizedShortcuts[i] == index) + { + found = true; + break; + } + } + if (!found) + { + _customizedShortcuts.push_back(index); + } +} + +void NppParameters::addPluginModifiedIndex(size_t index) +{ + size_t len = _pluginCustomizedCmds.size(); + bool found = false; + for(size_t i = 0; i < len; ++i) + { + if (_pluginCustomizedCmds[i] == index) + { + found = true; + break; + } + } + if (!found) + { + _pluginCustomizedCmds.push_back(index); + } +} + +void NppParameters::addScintillaModifiedIndex(int index) +{ + size_t len = _scintillaModifiedKeyIndices.size(); + bool found = false; + for(size_t i = 0; i < len; ++i) + { + if (_scintillaModifiedKeyIndices[i] == index) + { + found = true; + break; + } + } + if (!found) + { + _scintillaModifiedKeyIndices.push_back(index); + } +} + +void NppParameters::safeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirection) +{ + HMODULE kernel = GetModuleHandle(TEXT("kernel32")); + if (kernel) + { + BOOL isWow64 = FALSE; + typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); + LPFN_ISWOW64PROCESS IsWow64ProcessFunc = (LPFN_ISWOW64PROCESS) GetProcAddress(kernel,"IsWow64Process"); + + if (IsWow64ProcessFunc) + { + IsWow64ProcessFunc(GetCurrentProcess(),&isWow64); + + if (isWow64) + { + typedef BOOL (WINAPI *LPFN_WOW64ENABLEWOW64FSREDIRECTION)(BOOL); + LPFN_WOW64ENABLEWOW64FSREDIRECTION Wow64EnableWow64FsRedirectionFunc = (LPFN_WOW64ENABLEWOW64FSREDIRECTION)GetProcAddress(kernel, "Wow64EnableWow64FsRedirection"); + if (Wow64EnableWow64FsRedirectionFunc) + { + Wow64EnableWow64FsRedirectionFunc(Wow64FsEnableRedirection); + } + } + } + } +} + + +Date::Date(const TCHAR *dateStr) +{ + // timeStr should be Notepad++ date format : YYYYMMDD + assert(dateStr); + if (lstrlen(dateStr) == 8) + { + generic_string ds(dateStr); + generic_string yyyy(ds, 0, 4); + generic_string mm(ds, 4, 2); + generic_string dd(ds, 6, 2); + + int y = generic_atoi(yyyy.c_str()); + int m = generic_atoi(mm.c_str()); + int d = generic_atoi(dd.c_str()); + + if ((y > 0 && y <= 9999) && (m > 0 && m <= 12) && (d > 0 && d <= 31)) + { + _year = y; + _month = m; + _day = d; + return; + } + } + now(); +} + +// The constructor which makes the date of number of days from now +// nbDaysFromNow could be negative if user want to make a date in the past +// if the value of nbDaysFromNow is 0 then the date will be now +Date::Date(int nbDaysFromNow) +{ + const time_t oneDay = (60 * 60 * 24); + + time_t rawtime; + tm* timeinfo; + + time(&rawtime); + rawtime += (nbDaysFromNow * oneDay); + + timeinfo = localtime(&rawtime); + + _year = timeinfo->tm_year + 1900; + _month = timeinfo->tm_mon + 1; + _day = timeinfo->tm_mday; +} + +void Date::now() +{ + time_t rawtime; + tm* timeinfo; + + time(&rawtime); + timeinfo = localtime(&rawtime); + + _year = timeinfo->tm_year + 1900; + _month = timeinfo->tm_mon + 1; + _day = timeinfo->tm_mday; +} + + +EolType convertIntToFormatType(int value, EolType defvalue) +{ + switch (value) + { + case static_cast(EolType::windows) : + return EolType::windows; + case static_cast(EolType::macos) : + return EolType::macos; + case static_cast(EolType::unix) : + return EolType::unix; + default: + return defvalue; + } +} diff --git a/PowerEditor/Test/FunctionList/cpp/unitTest.expected.result b/PowerEditor/Test/FunctionList/cpp/unitTest.expected.result new file mode 100644 index 00000000..b2bd5185 --- /dev/null +++ b/PowerEditor/Test/FunctionList/cpp/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["strVal","decStrVal","hexStrVal","getKwClassFromName","getAsciiLenFromBase64Len","base64ToAscii","cutString","EnumFontFamExProc","RGB2int","convertIntToFormatType"],"nodes":[{"leaves":["addLanguageFromXml","switchToLang"],"name":"LocalizationSwitcher"},{"leaves":["getThemeFromXmlFileName"],"name":"ThemeSwitcher"},{"leaves":["getWindowsVersion","reloadStylers","reloadLang","getSpecialFolderLocation","getSettingsFolder","load","destroyInstance","saveConfig_xml","setWorkSpaceFilePath","removeTransparent","SetTransparent","isExistingExternalLangName","getUserDefinedLangNameFromExt","getExternalLangIndexFromName","getULCFromName","getCurLineHilitingColour","setCurLineHilitingColour","setFontList","isInFontList","getLangKeywordsFromXmlTree","getExternalLexerFromXmlTree","addExternalLangToEnd","getUserStylersFromXmlTree","getUserParametersFromXmlTree","getUserDefineLangsFromXmlTree","getShortcutsFromXmlTree","getMacrosFromXmlTree","getUserCmdsFromXmlTree","getPluginCmdsFromXmlTree","getScintKeysFromXmlTree","getBlackListFromXmlTree","initMenuKeys","initScintillaKeys","reloadContextMenuFromXmlTree","getCmdIdFromMenuEntryItemName","getPluginCmdIdFromMenuEntryItemName","getContextMenuFromXmlTree","setWorkingDir","loadSession","getSessionFromXmlTree","feedFileListParameters","feedProjectPanelsParameters","feedFileBrowserParameters","feedFindHistoryParameters","feedShortcut","feedMacros","getActions","feedUserCmds","feedPluginCustomizedCmds","feedScintKeys","feedBlacklist","getShortcuts","feedUserLang","importUDLFromFile","exportUDLToFile","getLangFromExt","setCloudChoice","removeCloudChoice","isCloudPathChanged","writeSettingsFilesOnCloudForThe1stTime","writeUserDefinedLang","insertCmd","insertMacro","insertUserCmd","insertPluginCmd","insertScintKey","writeSession","writeShortcuts","addUserLangToEnd","removeUserLang","feedUserSettings","feedUserKeywordList","feedUserStyles","feedStylerArray","writeRecentFileHistorySettings","writeProjectPanelsSettings","writeFileBrowserSettings","writeHistory","getChildElementByAttribut","getLangIDFromStr","getLocPathFromStr","feedKeyWordsParameters","feedGUIParameters","feedScintillaParam","feedDockingManager","writeScintillaParams","createXmlTreeFromGUIParams","writeFindHistory","insertDockingParamNode","writePrintSetting","writeExcludedLangList","insertGUIConfigBoolNode","langTypeToCommandID","getWinVerBitStr","writeStyles","insertTabInfo","writeStyle2Element","insertUserLang2Tree","stylerStrOp","addUserModifiedIndex","addPluginModifiedIndex","addScintillaModifiedIndex","safeWow64EnableWow64FsRedirection"],"name":"NppParameters"},{"leaves":["addLexerStyler","eraseAll"],"name":"LexerStylerArray"},{"leaves":["addStyler"],"name":"StyleArray"},{"leaves":["now"],"name":"Date"}],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/cs/unitTest b/PowerEditor/Test/FunctionList/cs/unitTest new file mode 100644 index 00000000..db6064cf --- /dev/null +++ b/PowerEditor/Test/FunctionList/cs/unitTest @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Globalization; +using System.Linq; +using System.Web; +using Owin; +using Microsoft.Owin.Security; +using Microsoft.Owin.Security.Cookies; +using Microsoft.Owin.Security.OpenIdConnect; + +namespace $OwinNamespace$ +{ + public partial class $OwinClass$ + { + private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"]; + private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"]; + private static string tenantId = ConfigurationManager.AppSettings["ida:TenantId"]; + private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"]; + private static string authority = aadInstance + tenantId; + + public void ConfigureAuth(IAppBuilder app) + { + app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); + + app.UseCookieAuthentication(new CookieAuthenticationOptions()); + + app.UseOpenIdConnectAuthentication( + new OpenIdConnectAuthenticationOptions + { + ClientId = clientId, + Authority = authority, + PostLogoutRedirectUri = postLogoutRedirectUri + }); + } + } +} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/cs/unitTest.expected.result b/PowerEditor/Test/FunctionList/cs/unitTest.expected.result new file mode 100644 index 00000000..7409e38a --- /dev/null +++ b/PowerEditor/Test/FunctionList/cs/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["ConfigureAuth"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/ini/unitTest b/PowerEditor/Test/FunctionList/ini/unitTest new file mode 100644 index 00000000..774eee90 --- /dev/null +++ b/PowerEditor/Test/FunctionList/ini/unitTest @@ -0,0 +1,28 @@ +[Flow] +CurrentPhase=OOBEBoot,Start +CurrentOperation=132,end +OperationResult=0 +[BootEntries] +DownlevelCurrent={B92EB69E-B2DB-11E7-934D-C49DED11D19D} +DownlevelDefault={B92EB69E-B2DB-11E7-934D-C49DED11D19D} +NewOS={541947F5-B2DC-11E7-BA3E-C49DED11D19E} +Rollback={7254A080-1510-4E85-AC0F-E7FB3D444736} +RollbackExternal=No +[BootManager] +Timeout=0 +[OldOS] +ConnectedStandby=Yes +[RecoveryPartition] +Backup=Yes +[Quarantine.WinOld] +0=GlobalPath,{826A734A-88FA-4773-AF09-B90072E096D3},0,407896064,2727568020,Windows.old +[Quarantine.NewPaths] +0=GlobalPath,{826A734A-88FA-4773-AF09-B90072E096D3},0,407896064,2727568020,PerfLogs +1=GlobalPath,{826A734A-88FA-4773-AF09-B90072E096D3},0,407896064,2727568020,Program Files +2=GlobalPath,{826A734A-88FA-4773-AF09-B90072E096D3},0,407896064,2727568020,Program Files (x86) +3=GlobalPath,{826A734A-88FA-4773-AF09-B90072E096D3},0,407896064,2727568020,ProgramData +4=GlobalPath,{826A734A-88FA-4773-AF09-B90072E096D3},0,407896064,2727568020,Users +5=GlobalPath,{826A734A-88FA-4773-AF09-B90072E096D3},0,407896064,2727568020,Windows +[Profiles] +S-1-5-21-1753568369-220679467-1382890926-1001.Profile.Old=GlobalPath,{826A734A-88FA-4773-AF09-B90072E096D3},0,407896064,2727568020,Users\Don Ho +S-1-5-21-1753568369-220679467-1382890926-1001.Profile.New=GlobalPath,{826A734A-88FA-4773-AF09-B90072E096D3},0,407896064,2727568020,Users\Don Ho diff --git a/PowerEditor/Test/FunctionList/ini/unitTest.expected.result b/PowerEditor/Test/FunctionList/ini/unitTest.expected.result new file mode 100644 index 00000000..7a23c3aa --- /dev/null +++ b/PowerEditor/Test/FunctionList/ini/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["Flow","BootEntries","BootManager","OldOS","RecoveryPartition","Quarantine.WinOld","Quarantine.NewPaths","Profiles"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/inno/unitTest b/PowerEditor/Test/FunctionList/inno/unitTest new file mode 100644 index 00000000..316c871c --- /dev/null +++ b/PowerEditor/Test/FunctionList/inno/unitTest @@ -0,0 +1,394 @@ +;contribute: http://github.com/stfx/innodependencyinstaller +;original article: http://codeproject.com/Articles/20868/NET-Framework-1-1-2-0-3-5-Installer-for-InnoSetup + +;comment out product defines to disable installing them +;#define use_iis +#define use_kb835732 + +#define use_msi20 +#define use_msi31 +#define use_msi45 + +#define use_ie6 + +#define use_dotnetfx11 +#define use_dotnetfx11lp + +#define use_dotnetfx20 +#define use_dotnetfx20lp + +#define use_dotnetfx35 +#define use_dotnetfx35lp + +#define use_dotnetfx40 +#define use_wic + +#define use_dotnetfx45 +#define use_dotnetfx46 +#define use_dotnetfx47 + +#define use_msiproduct +#define use_vc2005 +#define use_vc2008 +#define use_vc2010 +#define use_vc2012 +#define use_vc2013 +#define use_vc2015 +#define use_vc2017 + +;requires dxwebsetup.exe in src dir +;#define use_directxruntime + +#define use_mdac28 +#define use_jet4sp8 + +#define use_sqlcompact35sp2 + +#define use_sql2005express +#define use_sql2008express + +#define MyAppSetupName 'MyProgram' +#define MyAppVersion '6.0' + +[Setup] +AppName={#MyAppSetupName} +AppVersion={#MyAppVersion} +AppVerName={#MyAppSetupName} {#MyAppVersion} +AppCopyright=Copyright © 2007-2017 stfx +VersionInfoVersion={#MyAppVersion} +VersionInfoCompany=stfx +AppPublisher=stfx +;AppPublisherURL=http://... +;AppSupportURL=http://... +;AppUpdatesURL=http://... +OutputBaseFilename={#MyAppSetupName}-{#MyAppVersion} +DefaultGroupName={#MyAppSetupName} +DefaultDirName={pf}\{#MyAppSetupName} +UninstallDisplayIcon={app}\MyProgram.exe +OutputDir=bin +SourceDir=. +AllowNoIcons=yes +;SetupIconFile=MyProgramIcon +SolidCompression=yes + +;MinVersion default value: "0,5.0 (Windows 2000+) if Unicode Inno Setup, else 4.0,4.0 (Windows 95+)" +;MinVersion=0,5.0 +PrivilegesRequired=admin +ArchitecturesAllowed=x86 x64 ia64 +ArchitecturesInstallIn64BitMode=x64 ia64 + +; downloading and installing dependencies will only work if the memo/ready page is enabled (default and current behaviour) +DisableReadyPage=no +DisableReadyMemo=no + +; supported languages +#include "scripts\lang\english.iss" +#include "scripts\lang\german.iss" +#include "scripts\lang\french.iss" +#include "scripts\lang\italian.iss" +#include "scripts\lang\dutch.iss" + +#ifdef UNICODE +#include "scripts\lang\chinese.iss" +#include "scripts\lang\polish.iss" +#include "scripts\lang\russian.iss" +#include "scripts\lang\japanese.iss" +#endif + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}" +Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Files] +Source: "src\MyProgram-x64.exe"; DestDir: "{app}"; DestName: "MyProgram.exe"; Check: IsX64 +Source: "src\MyProgram-IA64.exe"; DestDir: "{app}"; DestName: "MyProgram.exe"; Check: IsIA64 +Source: "src\MyProgram.exe"; DestDir: "{app}"; Check: not Is64BitInstallMode + +[Icons] +Name: "{group}\{#MyAppSetupName}"; Filename: "{app}\MyProgram.exe" +Name: "{group}\{cm:UninstallProgram,{#MyAppSetupName}}"; Filename: "{uninstallexe}" +Name: "{commondesktop}\{#MyAppSetupName}"; Filename: "{app}\MyProgram.exe"; Tasks: desktopicon +Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppSetupName}"; Filename: "{app}\MyProgram.exe"; Tasks: quicklaunchicon + +[Run] +Filename: "{app}\MyProgram.exe"; Description: "{cm:LaunchProgram,{#MyAppSetupName}}"; Flags: nowait postinstall skipifsilent + +[CustomMessages] +DependenciesDir=MyProgramDependencies +WindowsServicePack=Windows %1 Service Pack %2 + +; shared code for installing the products +#include "scripts\products.iss" + +; helper functions +#include "scripts\products\stringversion.iss" +#include "scripts\products\winversion.iss" +#include "scripts\products\fileversion.iss" +#include "scripts\products\dotnetfxversion.iss" + +; actual products +#ifdef use_iis +#include "scripts\products\iis.iss" +#endif + +#ifdef use_kb835732 +#include "scripts\products\kb835732.iss" +#endif + +#ifdef use_msi20 +#include "scripts\products\msi20.iss" +#endif +#ifdef use_msi31 +#include "scripts\products\msi31.iss" +#endif +#ifdef use_msi45 +#include "scripts\products\msi45.iss" +#endif + +#ifdef use_ie6 +#include "scripts\products\ie6.iss" +#endif + +#ifdef use_dotnetfx11 +#include "scripts\products\dotnetfx11.iss" +#include "scripts\products\dotnetfx11sp1.iss" +#ifdef use_dotnetfx11lp +#include "scripts\products\dotnetfx11lp.iss" +#endif +#endif + +#ifdef use_dotnetfx20 +#include "scripts\products\dotnetfx20.iss" +#include "scripts\products\dotnetfx20sp1.iss" +#include "scripts\products\dotnetfx20sp2.iss" +#ifdef use_dotnetfx20lp +#include "scripts\products\dotnetfx20lp.iss" +#include "scripts\products\dotnetfx20sp1lp.iss" +#include "scripts\products\dotnetfx20sp2lp.iss" +#endif +#endif + +#ifdef use_dotnetfx35 +;#include "scripts\products\dotnetfx35.iss" +#include "scripts\products\dotnetfx35sp1.iss" +#ifdef use_dotnetfx35lp +;#include "scripts\products\dotnetfx35lp.iss" +#include "scripts\products\dotnetfx35sp1lp.iss" +#endif +#endif + +#ifdef use_dotnetfx40 +#include "scripts\products\dotnetfx40client.iss" +#include "scripts\products\dotnetfx40full.iss" +#endif + +#ifdef use_dotnetfx45 +#include "scripts\products\dotnetfx45.iss" +#endif + +#ifdef use_dotnetfx46 +#include "scripts\products\dotnetfx46.iss" +#endif + +#ifdef use_dotnetfx47 +#include "scripts\products\dotnetfx47.iss" +#endif + +#ifdef use_wic +#include "scripts\products\wic.iss" +#endif + +#ifdef use_msiproduct +#include "scripts\products\msiproduct.iss" +#endif +#ifdef use_vc2005 +#include "scripts\products\vcredist2005.iss" +#endif +#ifdef use_vc2008 +#include "scripts\products\vcredist2008.iss" +#endif +#ifdef use_vc2010 +#include "scripts\products\vcredist2010.iss" +#endif +#ifdef use_vc2012 +#include "scripts\products\vcredist2012.iss" +#endif +#ifdef use_vc2013 +#include "scripts\products\vcredist2013.iss" +#endif +#ifdef use_vc2015 +#include "scripts\products\vcredist2015.iss" +#endif +#ifdef use_vc2017 +#include "scripts\products\vcredist2017.iss" +#endif + +#ifdef use_directxruntime +#include "scripts\products\directxruntime.iss" +#endif + +#ifdef use_mdac28 +#include "scripts\products\mdac28.iss" +#endif +#ifdef use_jet4sp8 +#include "scripts\products\jet4sp8.iss" +#endif + +#ifdef use_sqlcompact35sp2 +#include "scripts\products\sqlcompact35sp2.iss" +#endif + +#ifdef use_sql2005express +#include "scripts\products\sql2005express.iss" +#endif +#ifdef use_sql2008express +#include "scripts\products\sql2008express.iss" +#endif + +[Code] +function InitializeSetup(): boolean; +begin + // initialize windows version + initwinversion(); + +#ifdef use_iis + if (not iis()) then exit; +#endif + +#ifdef use_msi20 + msi20('2.0'); // min allowed version is 2.0 +#endif +#ifdef use_msi31 + msi31('3.1'); // min allowed version is 3.1 +#endif +#ifdef use_msi45 + msi45('4.5'); // min allowed version is 4.5 +#endif +#ifdef use_ie6 + ie6('5.0.2919'); // min allowed version is 5.0.2919 +#endif + +#ifdef use_dotnetfx11 + dotnetfx11(); +#ifdef use_dotnetfx11lp + dotnetfx11lp(); +#endif + dotnetfx11sp1(); +#endif + + // install .netfx 2.0 sp2 if possible; if not sp1 if possible; if not .netfx 2.0 +#ifdef use_dotnetfx20 + // check if .netfx 2.0 can be installed on this OS + if not minwinspversion(5, 0, 3) then begin + MsgBox(FmtMessage(CustomMessage('depinstall_missing'), [FmtMessage(CustomMessage('WindowsServicePack'), ['2000', '3'])]), mbError, MB_OK); + exit; + end; + if not minwinspversion(5, 1, 2) then begin + MsgBox(FmtMessage(CustomMessage('depinstall_missing'), [FmtMessage(CustomMessage('WindowsServicePack'), ['XP', '2'])]), mbError, MB_OK); + exit; + end; + + if minwinversion(5, 1) then begin + dotnetfx20sp2(); +#ifdef use_dotnetfx20lp + dotnetfx20sp2lp(); +#endif + end else begin + if minwinversion(5, 0) and minwinspversion(5, 0, 4) then begin +#ifdef use_kb835732 + kb835732(); +#endif + dotnetfx20sp1(); +#ifdef use_dotnetfx20lp + dotnetfx20sp1lp(); +#endif + end else begin + dotnetfx20(); +#ifdef use_dotnetfx20lp + dotnetfx20lp(); +#endif + end; + end; +#endif + +#ifdef use_dotnetfx35 + //dotnetfx35(); + dotnetfx35sp1(); +#ifdef use_dotnetfx35lp + //dotnetfx35lp(); + dotnetfx35sp1lp(); +#endif +#endif + +#ifdef use_wic + wic(); +#endif + + // if no .netfx 4.0 is found, install the client (smallest) +#ifdef use_dotnetfx40 + if (not netfxinstalled(NetFx40Client, '') and not netfxinstalled(NetFx40Full, '')) then + dotnetfx40client(); +#endif + +#ifdef use_dotnetfx45 + dotnetfx45(50); // min allowed version is 4.5.0 +#endif + +#ifdef use_dotnetfx46 + dotnetfx46(50); // min allowed version is 4.5.0 +#endif + +#ifdef use_dotnetfx47 + dotnetfx47(50); // min allowed version is 4.5.0 +#endif + +#ifdef use_vc2005 + vcredist2005('6'); // min allowed version is 6.0 +#endif +#ifdef use_vc2008 + vcredist2008('9'); // min allowed version is 9.0 +#endif +#ifdef use_vc2010 + vcredist2010('10'); // min allowed version is 10.0 +#endif +#ifdef use_vc2012 + vcredist2012('11'); // min allowed version is 11.0 +#endif +#ifdef use_vc2013 + //SetForceX86(true); // force 32-bit install of next products + vcredist2013('12'); // min allowed version is 12.0 + //SetForceX86(false); // disable forced 32-bit install again +#endif +#ifdef use_vc2015 + vcredist2015('14'); // min allowed version is 14.0 +#endif +#ifdef use_vc2017 + vcredist2017('14'); // min allowed version is 14.0 +#endif + +#ifdef use_directxruntime + // extracts included setup file to temp folder so that we don't need to download it + // and always runs directxruntime installer as we don't know how to check if it is required + directxruntime(); +#endif + +#ifdef use_mdac28 + mdac28('2.7'); // min allowed version is 2.7 +#endif +#ifdef use_jet4sp8 + jet4sp8('4.0.8015'); // min allowed version is 4.0.8015 +#endif + +#ifdef use_sqlcompact35sp2 + sqlcompact35sp2(); +#endif + +#ifdef use_sql2005express + sql2005express(); +#endif +#ifdef use_sql2008express + sql2008express(); +#endif + + Result := true; +end; \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/inno/unitTest.expected.result b/PowerEditor/Test/FunctionList/inno/unitTest.expected.result new file mode 100644 index 00000000..ee5a5a91 --- /dev/null +++ b/PowerEditor/Test/FunctionList/inno/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["Setup","Tasks","Files","Icons","Run","CustomMessages"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/java/unitTest b/PowerEditor/Test/FunctionList/java/unitTest new file mode 100644 index 00000000..c8754a7d --- /dev/null +++ b/PowerEditor/Test/FunctionList/java/unitTest @@ -0,0 +1,78 @@ +//this file is part of Notepad++ plugin Pork2Sausage +//Copyright (C)2010 Don HO +// +//This program is free software; you can redistribute it and/or +//modify it under the terms of the GNU General Public License +//as published by the Free Software Foundation; either +//version 2 of the License, or (at your option) any later version. +// +//This program is distributed in the hope that it will be useful, +//but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//GNU General Public License for more details. +// +//You should have received a copy of the GNU General Public License +//along with this program; if not, write to the Free Software +//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +import org.apache.commons.codec.binary.Base64; +import java.util.zip.*; +import java.util.*; +import java.text.*; +import java.io.*; + +class zipB64 { + + protected static String encodeMessage(String messageStr) { + try { + ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); + Deflater deflater = new Deflater(Deflater.DEFLATED); + DeflaterOutputStream deflaterStream = new DeflaterOutputStream(bytesOut, deflater); + deflaterStream.write(messageStr.getBytes("UTF-8")); + deflaterStream.finish(); + + Base64 b = new Base64(-1); + return new String(b.encode(bytesOut.toByteArray())); + } catch (Exception e) { + return "crotte"; + } + } + + protected static String decodeMessage(String encodedMessage) { + try { + Base64 b = new Base64(); + byte[] decodedBase64 = b.decode(encodedMessage.getBytes()); + + // Decompress the bytes + + ByteArrayInputStream bytesIn = new ByteArrayInputStream(decodedBase64); + InflaterInputStream inflater = new InflaterInputStream(bytesIn); + + int nbRead = 0; + StringBuilder sb = new StringBuilder(); + while (nbRead >= 0) { + byte[] result = new byte[500]; + nbRead = inflater.read(result,0,result.length); + if (nbRead > 0) { + sb.append(new String(result, 0, nbRead, "UTF-8")); + } + } + return sb.toString(); + } catch (Exception e) { + return "zut"; + } + } + + public static void main (String args[]) { + if (args.length != 2 || (args[0].compareTo("-zip") != 0 && args[0].compareTo("-unzip") != 0)) + { + System.out.println("java zipB64 <-zip|-unzip> \"message\""); + return; + } + boolean doZip = args[0].compareTo("-zip") == 0; + if (doZip) + System.out.println(encodeMessage(args[1])); + else + System.out.println(decodeMessage(args[1])); + } +} diff --git a/PowerEditor/Test/FunctionList/java/unitTest.expected.result b/PowerEditor/Test/FunctionList/java/unitTest.expected.result new file mode 100644 index 00000000..bf7abafb --- /dev/null +++ b/PowerEditor/Test/FunctionList/java/unitTest.expected.result @@ -0,0 +1 @@ +{"nodes":[{"leaves":["encodeMessage","decodeMessage"],"name":"zipB64"}],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/javascript/unitTest b/PowerEditor/Test/FunctionList/javascript/unitTest new file mode 100644 index 00000000..e1b3d341 --- /dev/null +++ b/PowerEditor/Test/FunctionList/javascript/unitTest @@ -0,0 +1,364 @@ +var crypto = require('crypto'), + Friends, + User, + Post, + WallPost, + Comment, + LoginToken; + +function extractKeywords(text) { + if (!text) return []; + + return text. + split(/\s+/). + filter(function(v) { return v.length > 2; }). + filter(function(v, i, a) { return a.lastIndexOf(v) === i; }); +} + + +function convertBasicMarkup(input, allowHtml) { + var strongRe = /[*]{2}([^*]+)[*]{2}/gm; + var emRe = /[*]{1}([^*]+)[*]{1}/gm; + var linkRe = /\[([^\]]*)\]\(([^\)]*?)\)/gm; + var nlRe = /\r\n/gm; + var crRe = /\r/gm; + + // special re's to revert linebreaks from
+ var codeRe = /(]*>(.*?)<\/code>)/gm; + + // cleanup newlines + input = input.replace(nlRe, "\n"); + input = input.replace(crRe, "\n"); + + // strip existing html before inserting breaks/markup + if (!allowHtml) { + // strip html + input = input + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + } + + // convert newlines to breaks + input = input.replace(/\n/gm, '
'); + + // replace basic markup + input = input.replace(strongRe, function(whole, m1, m2, m3) { + return '' + m1 + ''; + }); + + input = input.replace(emRe, function(whole, m1, m2, m3) { + return '' + m1 + ''; + }); + + input = input.replace(linkRe, function(whole, m1, m2) { + // fix up protocol + if (!m2.match(/(http(s?)|ftp(s?)):\/\//gm)) + // prepend http as default + m2 = 'http://' + m2; + return '' + m1 + ''; + }); + + // revert code blocks + input = input.replace(codeRe, function(whole, m1) { + return m1.replace(/
/gm, '\n'); + }); + + return input; +} + + + + +function defineModels(mongoose, fn) { + var Schema = mongoose.Schema, + ObjectId = Schema.ObjectId; + + + /** + * Comment model + * + * Used for persisting user comments + */ + var Comment = new Schema({ + user_id: ObjectId, + //photo:String, + date: Date, + body: String, + post_id:ObjectId, + }); + + // register virtual members + Comment.virtual('readableday') + .get(function() { + var day = this.date.getDate(); + return (day < 10 ? '0' + day : day); + }); + + Comment.virtual('readablemonth') + .get(function() { + return monthNamesShort[this.date.getMonth()]; + }); + + Comment.virtual('readabletime') + .get(function() { + var hour = this.date.getHours(); + var minute = this.date.getMinutes(); + return (hour < 10 ? '0' + hour : hour) + ':' + (minute < 10 ? '0' + minute : minute); + }); + + Comment.virtual('bodyParsed') + .get(function() { + return convertBasicMarkup(this.body, false); + }); + + // register validators + /*Comment.path('author').validate(function(val) { + return val.length > 0; + }, 'AUTHOR_MISSING');*/ + + Comment.path('body').validate(function(val) { + return val.length > 0; + }, 'BODY_MISSING'); + + +/** + * Model: WallPost + */ + + +var WallPost = new Schema({ + friend_id: String, + preview: String, + body: String, + //rsstext: String, + slug: String, + created: Date, + modified: Date, + //tags: [String], + user_id:ObjectId, + posted_on_user_id : ObjectId, + //comments: [Comment] + }); + + var monthNames = [ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', + 'August', 'September', 'Oktober', 'November', 'Dezember' ]; + var monthNamesShort = [ 'Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', + 'Aug', 'Sep', 'Okt', 'Nov', 'Dez' ]; + + // define virtual getter method for id (readable string) + WallPost.virtual('id') + .get(function() { + return this._id.toHexString(); + }); + + WallPost.virtual('url') + .get(function() { + // build url for current post + var year = this.created.getFullYear(); + var month = this.created.getMonth() + 1; + var day = this.created.getDate(); + return '/' + year + '/' + (month < 10 ? '0' + month : month) + '/' + (day < 10 ? '0' + day : day) + '/' + this.slug + '/'; + }); + + WallPost.virtual('rfc822created') + .get(function() { + return this.created.toGMTString(); + }); + + WallPost.virtual('readabledate') + .get(function() { + var year = this.created.getFullYear(); + var month = monthNames[this.created.getMonth()]; + var day = this.created.getDate(); + return (day < 10 ? '0' + day : day) + '. ' + month + ' ' + year; + }); + + WallPost.virtual('readableday') + .get(function() { + var day = this.created.getDate(); + return (day < 10 ? '0' + day : day); + }); + + WallPost.virtual('readablemonth') + .get(function() { + return monthNamesShort[this.created.getMonth()]; + }); + + WallPost.virtual('previewParsed') + .get(function() { + return convertBasicMarkup(this.preview, true); + }); + + WallPost.virtual('bodyParsed') + .get(function() { + return convertBasicMarkup(this.body, true); + }); + + // register validators + /*WallPost.path('title').validate(function(val) { + return val.length > 0; + }, 'TITLE_MISSING'); + + WallPost.path('preview').validate(function(val) { + return val.length > 0; + }, 'PREVIEW_MISSING'); + + WallPost.path('rsstext').validate(function(val) { + return val.length > 0; + }, 'RSSTEXT_MISSING');*/ + + WallPost.path('body').validate(function(val) { + return val.length > 0; + }, 'BODY_MISSING'); + + // generate a proper slug value for Wallpost + function slugGenerator (options){ + options = options || {}; + var key = options.key || 'body'; + return function slugGenerator(schema){ + schema.path(key).set(function(v){ + this.slug = v.toLowerCase().replace(/[^a-z0-9]/g, '-').replace(/\++/g, ''); + return v; + }); + }; + }; + + // attach slugGenerator plugin to Wallpost schema + WallPost.plugin(slugGenerator()); + + + +/** + * Model: User + */ +function validatePresenceOf(value) { + return value && value.length; +} +var User = new Schema({ + 'first_name': { type: String, validate: /[a-z]/ }, + 'last_name':{ type: String, validate: /[a-z]/ }, + 'age':Number, + 'sex':{ type: String}, + 'photo':String, + 'location':{ type: String, validate: /[a-z]/ }, + 'latitude' : String, + 'longitude' : String, + 'keywords': [String], + 'username':String, + 'email': { type: String, validate: [validatePresenceOf, 'an email is required'], index: { unique: true }, required:true }, + 'hashed_password': { type: String}, + 'salt': String, + }); + + User.virtual('id') + .get(function() { + return this._id.toHexString(); + }); + + User.virtual('password') + .set(function(password) { + this._password = password; + this.salt = this.makeSalt(); + this.hashed_password = this.encryptPassword(password); + }) + .get(function() { return this._password; }); + + User.method('authenticate', function(plainText) { + return this.encryptPassword(plainText) === this.hashed_password; + }); + + User.method('makeSalt', function() { + return Math.round((new Date().valueOf() * Math.random())) + ''; + }); + + User.method('encryptPassword', function(password) { + return crypto.createHmac('sha1', this.salt).update(password).digest('hex'); + }); + + User.pre('save', function(next) { + this.keywords = extractKeywords(this.first_name); + next(); + if (!validatePresenceOf(this.password)) { + next(new Error('Invalid password')); + } else { + next(); + } + + }); + + +var Friends = new Schema({ + requestor : String + , acceptor : String + , date_requested : Date + , status:Number +}); + +Friends.virtual('id') + .get(function() { + return this._id.toHexString(); + }); + +var Post = new Schema({ + filename : { type: String, index: true } + , file : String + , created_at : Date + , user_id: ObjectId +}); + +Post.virtual('id') + .get(function() { + return this._id.toHexString(); + }); + +/** + * Model: LoginToken + * + * Used for session persistence. + */ +var LoginToken = new Schema({ + email: { type: String, index: true }, + series: { type: String, index: true }, + token: { type: String, index: true } + }); + + LoginToken.method('randomToken', function() { + return Math.round((new Date().valueOf() * Math.random())) + ''; + }); + + LoginToken.pre('save', function(next) { + // Automatically create the tokens + this.token = this.randomToken(); + + if (this.isNew) + this.series = this.randomToken(); + + next(); + }); + + LoginToken.virtual('id') + .get(function() { + return this._id.toHexString(); + }); + + LoginToken.virtual('cookieValue') + .get(function() { + return JSON.stringify({ email: this.email, token: this.token, series: this.series }); + }); + + + + mongoose.model('User', User); + mongoose.model('Post', Post); + mongoose.model('Friends', Friends); + mongoose.model('LoginToken', LoginToken); + mongoose.model('WallPost', WallPost); + mongoose.model('Comment', Comment); + fn(); +} + +exports.defineModels = defineModels; + \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/javascript/unitTest.expected.result b/PowerEditor/Test/FunctionList/javascript/unitTest.expected.result new file mode 100644 index 00000000..297c70ad --- /dev/null +++ b/PowerEditor/Test/FunctionList/javascript/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["extractKeywords","convertBasicMarkup","function","function","function","function","defineModels","slugGenerator","slugGenerator","validatePresenceOf","function","function","function","function","function","function"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/nsis/unitTest b/PowerEditor/Test/FunctionList/nsis/unitTest new file mode 100644 index 00000000..e543b784 --- /dev/null +++ b/PowerEditor/Test/FunctionList/nsis/unitTest @@ -0,0 +1,2014 @@ +; this file is part of installer for Notepad++ +; Copyright (C)2006 Don HO +; +; This program is free software; you can redistribute it and/or +; modify it under the terms of the GNU General Public License +; as published by the Free Software Foundation; either +; version 2 of the License, or (at your option) any later version. +; +; Note that the GPL places important restrictions on "derived works", yet +; it does not provide a detailed definition of that term. To avoid +; misunderstandings, we consider an application to constitute a +; "derivative work" for the purpose of this license if it does any of the +; following: +; 1. Integrates source code from Notepad++. +; 2. Integrates/includes/aggregates Notepad++ into a proprietary executable +; installer, such as those produced by InstallShield. +; 3. Links to a library or executes a program that does any of the above. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +; NSIS includes +!include "x64.nsh" ; a few simple macros to handle installations on x64 machines +!include "MUI.nsh" ; Modern UI +!include "nsDialogs.nsh" ; allows creation of custom pages in the installer +!include "Memento.nsh" ; remember user selections in the installer across runs + + +; Define the application name +!define APPNAME "Notepad++" + +!define APPVERSION "6.9" +!define APPNAMEANDVERSION "${APPNAME} v${APPVERSION}" +!define VERSION_MAJOR 6 +!define VERSION_MINOR 9 + +!define APPWEBSITE "http://notepad-plus-plus.org/" + +!define UNINSTALL_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" +!define MEMENTO_REGISTRY_ROOT HKLM +!define MEMENTO_REGISTRY_KEY ${UNINSTALL_REG_KEY} + +; Main Install settings +Name "${APPNAMEANDVERSION}" +InstallDir "$PROGRAMFILES\${APPNAME}" +InstallDirRegKey HKLM "Software\${APPNAME}" "" +OutFile ".\build\npp.${APPVERSION}.Installer.exe" + +; http://nsis.sourceforge.net/Get_Windows_version + +; GetWindowsVersion 4.1.1 (2015-06-22) +; +; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ +; Update by Joost Verburg +; Update (Macro, Define, Windows 7 detection) - John T. Haller of PortableApps.com - 2008-01-07 +; Update (Windows 8 detection) - Marek Mizanin (Zanir) - 2013-02-07 +; Update (Windows 8.1 detection) - John T. Haller of PortableApps.com - 2014-04-04 +; Update (Windows 10 TP detection) - John T. Haller of PortableApps.com - 2014-10-01 +; Update (Windows 10 TP4 detection, and added include guards) - Kairu - 2015-06-22 +; +; Usage: ${GetWindowsVersion} $R0 +; +; $R0 contains: 95, 98, ME, NT x.x, 2000, XP, 2003, Vista, 7, 8, 8.1, 10.0 or '' (for unknown) + +!ifndef __GET_WINDOWS_VERSION_NSH +!define __GET_WINDOWS_VERSION_NSH + +Function GetWindowsVersion + + Push $R0 + Push $R1 + + ClearErrors + + ; check if Windows NT family + ReadRegStr $R0 HKLM \ + "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + + IfErrors 0 lbl_winnt + + ; we are not NT + ReadRegStr $R0 HKLM \ + "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber + + StrCpy $R1 $R0 1 + StrCmp $R1 '4' 0 lbl_error + + StrCpy $R1 $R0 3 + + StrCmp $R1 '4.0' lbl_win32_95 + StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 + + lbl_win32_95: + StrCpy $R0 '95' + Goto lbl_done + + lbl_win32_98: + StrCpy $R0 '98' + Goto lbl_done + + lbl_win32_ME: + StrCpy $R0 'ME' + Goto lbl_done + + lbl_winnt: + + StrCpy $R1 $R0 1 + + StrCmp $R1 '3' lbl_winnt_x + StrCmp $R1 '4' lbl_winnt_x + + StrCpy $R1 $R0 3 + + StrCmp $R1 '5.0' lbl_winnt_2000 + StrCmp $R1 '5.1' lbl_winnt_XP + StrCmp $R1 '5.2' lbl_winnt_2003 + StrCmp $R1 '6.0' lbl_winnt_vista + StrCmp $R1 '6.1' lbl_winnt_7 + StrCmp $R1 '6.2' lbl_winnt_8 + StrCmp $R1 '6.3' lbl_winnt_81 + StrCmp $R1 '6.4' lbl_winnt_10 ; the early Windows 10 tech previews used version 6.4 + + StrCpy $R1 $R0 4 + + StrCmp $R1 '10.0' lbl_winnt_10 + Goto lbl_error + + lbl_winnt_x: + StrCpy $R0 "NT $R0" 6 + Goto lbl_done + + lbl_winnt_2000: + Strcpy $R0 '2000' + Goto lbl_done + + lbl_winnt_XP: + Strcpy $R0 'XP' + Goto lbl_done + + lbl_winnt_2003: + Strcpy $R0 '2003' + Goto lbl_done + + lbl_winnt_vista: + Strcpy $R0 'Vista' + Goto lbl_done + + lbl_winnt_7: + Strcpy $R0 '7' + Goto lbl_done + + lbl_winnt_8: + Strcpy $R0 '8' + Goto lbl_done + + lbl_winnt_81: + Strcpy $R0 '8.1' + Goto lbl_done + + lbl_winnt_10: + Strcpy $R0 '10.0' + Goto lbl_done + + lbl_error: + Strcpy $R0 '' + lbl_done: + + Pop $R1 + Exch $R0 + +FunctionEnd + +!macro GetWindowsVersion OUTPUT_VALUE + Call GetWindowsVersion + Pop `${OUTPUT_VALUE}` +!macroend + +!define GetWindowsVersion '!insertmacro "GetWindowsVersion"' + +!endif + + +Function LaunchNpp + Exec '"$INSTDIR\notepad++.exe" "$INSTDIR\change.log" ' +FunctionEnd + +; Modern interface settings +!define MUI_ICON ".\images\npp_inst.ico" + +!define MUI_WELCOMEFINISHPAGE_BITMAP ".\images\wizard.bmp" +!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH + +!define MUI_HEADERIMAGE +;!define MUI_HEADERIMAGE_RIGHT +;!define MUI_HEADERIMAGE_BITMAP ".\images\headerRight.bmp" ; optional +!define MUI_HEADERIMAGE_BITMAP ".\images\headerLeft.bmp" ; optional +!define MUI_ABORTWARNING + + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE" +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_COMPONENTS +page Custom ExtraOptions +!insertmacro MUI_PAGE_INSTFILES + + +!define MUI_FINISHPAGE_RUN +;!define MUI_FINISHPAGE_RUN_TEXT "Run Npp" +!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchNpp" +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +; TODO for optional arg +;!insertmacro GetParameters + +; Set languages (first is default language) +;!insertmacro MUI_LANGUAGE "English" +!define MUI_LANGDLL_ALLLANGUAGES +;Languages + + !insertmacro MUI_LANGUAGE "English" + !insertmacro MUI_LANGUAGE "French" + !insertmacro MUI_LANGUAGE "TradChinese" + !insertmacro MUI_LANGUAGE "Spanish" + !insertmacro MUI_LANGUAGE "Hungarian" + !insertmacro MUI_LANGUAGE "Russian" + !insertmacro MUI_LANGUAGE "German" + !insertmacro MUI_LANGUAGE "Dutch" + !insertmacro MUI_LANGUAGE "SimpChinese" + !insertmacro MUI_LANGUAGE "Italian" + !insertmacro MUI_LANGUAGE "Danish" + !insertmacro MUI_LANGUAGE "Polish" + !insertmacro MUI_LANGUAGE "Czech" + !insertmacro MUI_LANGUAGE "Slovenian" + !insertmacro MUI_LANGUAGE "Slovak" + !insertmacro MUI_LANGUAGE "Swedish" + !insertmacro MUI_LANGUAGE "Norwegian" + !insertmacro MUI_LANGUAGE "PortugueseBR" + !insertmacro MUI_LANGUAGE "Ukrainian" + !insertmacro MUI_LANGUAGE "Turkish" + !insertmacro MUI_LANGUAGE "Catalan" + !insertmacro MUI_LANGUAGE "Arabic" + !insertmacro MUI_LANGUAGE "Lithuanian" + !insertmacro MUI_LANGUAGE "Finnish" + !insertmacro MUI_LANGUAGE "Greek" + !insertmacro MUI_LANGUAGE "Romanian" + !insertmacro MUI_LANGUAGE "Korean" + !insertmacro MUI_LANGUAGE "Hebrew" + !insertmacro MUI_LANGUAGE "Portuguese" + !insertmacro MUI_LANGUAGE "Farsi" + !insertmacro MUI_LANGUAGE "Bulgarian" + !insertmacro MUI_LANGUAGE "Indonesian" + !insertmacro MUI_LANGUAGE "Japanese" + !insertmacro MUI_LANGUAGE "Croatian" + !insertmacro MUI_LANGUAGE "Serbian" + !insertmacro MUI_LANGUAGE "Thai" + !insertmacro MUI_LANGUAGE "NorwegianNynorsk" + !insertmacro MUI_LANGUAGE "Belarusian" + !insertmacro MUI_LANGUAGE "Albanian" + !insertmacro MUI_LANGUAGE "Malay" + !insertmacro MUI_LANGUAGE "Galician" + !insertmacro MUI_LANGUAGE "Basque" + !insertmacro MUI_LANGUAGE "Luxembourgish" + !insertmacro MUI_LANGUAGE "Afrikaans" + !insertmacro MUI_LANGUAGE "Uzbek" + !insertmacro MUI_LANGUAGE "Macedonian" + !insertmacro MUI_LANGUAGE "Latvian" + !insertmacro MUI_LANGUAGE "Bosnian" + !insertmacro MUI_LANGUAGE "Mongolian" + !insertmacro MUI_LANGUAGE "Estonian" + + ;!insertmacro MUI_LANGUAGE "Breton" + ;!insertmacro MUI_LANGUAGE "Icelandic" + ;!insertmacro MUI_LANGUAGE "Kurdish" + ;!insertmacro MUI_LANGUAGE "Irish" + +!insertmacro MUI_RESERVEFILE_LANGDLL + +;Installer Functions +Var Dialog +Var NoUserDataCheckboxHandle +Var OldIconCheckboxHandle +Var ShortcutCheckboxHandle +Var PluginLoadFromUserDataCheckboxHandle +Var WinVer + +Function ExtraOptions + nsDialogs::Create 1018 + Pop $Dialog + + ${If} $Dialog == error + Abort + ${EndIf} + + ${NSD_CreateCheckbox} 0 0 100% 30u "Don't use %APPDATA%$\nEnable this option to make Notepad++ load/write the configuration files from/to its install directory. Check it if you use Notepad++ in an USB device." + Pop $NoUserDataCheckboxHandle + ${NSD_OnClick} $NoUserDataCheckboxHandle OnChange_NoUserDataCheckBox + + ${NSD_CreateCheckbox} 0 50 100% 30u "Allow plugins to be loaded from %APPDATA%\notepad++\plugins$\nIt could cause a security issue. Turn it on if you know what you are doing." + Pop $PluginLoadFromUserDataCheckboxHandle + ${NSD_OnClick} $PluginLoadFromUserDataCheckboxHandle OnChange_PluginLoadFromUserDataCheckBox + + ${NSD_CreateCheckbox} 0 110 100% 30u "Create Shortcut on Desktop" + Pop $ShortcutCheckboxHandle + StrCmp $WinVer "8" 0 +2 + ${NSD_Check} $ShortcutCheckboxHandle + ${NSD_OnClick} $ShortcutCheckboxHandle OnChange_ShortcutCheckBox + + ${NSD_CreateCheckbox} 0 170 100% 30u "Use the old, obsolete and monstrous icon$\nI won't blame you if you want to get the old icon back :)" + Pop $OldIconCheckboxHandle + ${NSD_OnClick} $OldIconCheckboxHandle OnChange_OldIconCheckBox + + nsDialogs::Show +FunctionEnd + +Var noUserDataChecked +Var allowPluginLoadFromUserDataChecked +Var createShortcutChecked +Var isOldIconChecked + +; TODO for optional arg +;Var params + +; The definition of "OnChange" event for checkbox +Function OnChange_NoUserDataCheckBox + ${NSD_GetState} $NoUserDataCheckboxHandle $noUserDataChecked +FunctionEnd + +Function OnChange_PluginLoadFromUserDataCheckBox + ${NSD_GetState} $PluginLoadFromUserDataCheckboxHandle $allowPluginLoadFromUserDataChecked +FunctionEnd + +Function OnChange_ShortcutCheckBox + ${NSD_GetState} $ShortcutCheckboxHandle $createShortcutChecked +FunctionEnd + +Function OnChange_OldIconCheckBox + ${NSD_GetState} $OldIconCheckboxHandle $isOldIconChecked +FunctionEnd + + +Function .onInit + + ;Test if window9x + ${GetWindowsVersion} $WinVer + + StrCmp $WinVer "95" 0 +3 + MessageBox MB_OK "This version of Notepad++ does not support your OS.$\nPlease download zipped package of version 5.9 and use ANSI version. You can find v5.9 here:$\nhttp://notepad-plus-plus.org/release/5.9" + Abort + + StrCmp $WinVer "98" 0 +3 + MessageBox MB_OK "This version of Notepad++ does not support your OS.$\nPlease download zipped package of version 5.9 and use ANSI version. You can find v5.9 here:$\nhttp://notepad-plus-plus.org/release/5.9" + Abort + + StrCmp $WinVer "ME" 0 +3 + MessageBox MB_OK "This version of Notepad++ does not support your OS.$\nPlease download zipped package of version 5.9 and use ANSI version. You can find v5.9 here:$\nhttp://notepad-plus-plus.org/release/5.9" + Abort + + !insertmacro MUI_LANGDLL_DISPLAY + # the plugins dir is automatically deleted when the installer exits + ;InitPluginsDir + ;File /oname=$PLUGINSDIR\splash.bmp ".\images\splash.bmp" + #optional + #File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav" + + ;splash::show 1000 $PLUGINSDIR\splash + + ;Pop $0 ; $0 has '1' if the user closed the splash screen early, + ; '0' if everything closed normally, and '-1' if some error occurred. + + ${MementoSectionRestore} + +FunctionEnd + +Function .onInstSuccess + ${MementoSectionSave} +FunctionEnd + + +LangString langFileName ${LANG_ENGLISH} "english.xml" +LangString langFileName ${LANG_FRENCH} "french.xml" +LangString langFileName ${LANG_TRADCHINESE} "chinese.xml" +LangString langFileName ${LANG_SIMPCHINESE} "chineseSimplified.xml" +LangString langFileName ${LANG_KOREAN} "korean.xml" +LangString langFileName ${LANG_JAPANESE} "japanese.xml" +LangString langFileName ${LANG_GERMAN} "german.xml" +LangString langFileName ${LANG_SPANISH} "spanish.xml" +LangString langFileName ${LANG_ITALIAN} "italian.xml" +LangString langFileName ${LANG_PORTUGUESE} "portuguese.xml" +LangString langFileName ${LANG_PORTUGUESEBR} "brazilian_portuguese.xml" +LangString langFileName ${LANG_DUTCH} "dutch.xml" +LangString langFileName ${LANG_RUSSIAN} "russian.xml" +LangString langFileName ${LANG_POLISH} "polish.xml" +LangString langFileName ${LANG_CATALAN} "catalan.xml" +LangString langFileName ${LANG_CZECH} "czech.xml" +LangString langFileName ${LANG_HUNGARIAN} "hungarian.xml" +LangString langFileName ${LANG_ROMANIAN} "romanian.xml" +LangString langFileName ${LANG_TURKISH} "turkish.xml" +LangString langFileName ${LANG_FARSI} "farsi.xml" +LangString langFileName ${LANG_UKRAINIAN} "ukrainian.xml" +LangString langFileName ${LANG_HEBREW} "hebrew.xml" +LangString langFileName ${LANG_NORWEGIANNYNORSK} "nynorsk.xml" +LangString langFileName ${LANG_NORWEGIAN} "norwegian.xml" +LangString langFileName ${LANG_THAI} "thai.xml" +LangString langFileName ${LANG_ARABIC} "arabic.xml" +LangString langFileName ${LANG_FINNISH} "finnish.xml" +LangString langFileName ${LANG_LITHUANIAN} "lithuanian.xml" +LangString langFileName ${LANG_GREEK} "greek.xml" +LangString langFileName ${LANG_SWEDISH} "swedish.xml" +LangString langFileName ${LANG_GALICIAN} "galician.xml" +LangString langFileName ${LANG_SLOVENIAN} "slovenian.xml" +LangString langFileName ${LANG_SLOVAK} "slovak.xml" +LangString langFileName ${LANG_DANISH} "danish.xml" +LangString langFileName ${LANG_BULGARIAN} "bulgarian.xml" +LangString langFileName ${LANG_INDONESIAN} "indonesian.xml" +LangString langFileName ${LANG_ALBANIAN} "albanian.xml" +LangString langFileName ${LANG_CROATIAN} "croatian.xml" +LangString langFileName ${LANG_BASQUE} "basque.xml" +LangString langFileName ${LANG_BELARUSIAN} "belarusian.xml" +LangString langFileName ${LANG_SERBIAN} "serbian.xml" +LangString langFileName ${LANG_MALAY} "malay.xml" +LangString langFileName ${LANG_LUXEMBOURGISH} "luxembourgish.xml" +LangString langFileName ${LANG_AFRIKAANS} "afrikaans.xml" +LangString langFileName ${LANG_UZBEK} "uzbek.xml" +LangString langFileName ${LANG_MACEDONIAN} "macedonian.xml" +LangString langFileName ${LANG_LATVIAN} "Latvian.xml" +LangString langFileName ${LANG_BOSNIAN} "bosnian.xml" +LangString langFileName ${LANG_MONGOLIAN} "mongolian.xml" +LangString langFileName ${LANG_ESTONIAN} "estonian.xml" + + +Var UPDATE_PATH + +Section -"Notepad++" mainSection + + ; Set Section properties + SetOverwrite on + + StrCpy $UPDATE_PATH $INSTDIR + + File /oname=$TEMP\xmlUpdater.exe ".\bin\xmlUpdater.exe" + + SetOutPath "$INSTDIR\" + + ${If} $noUserDataChecked == ${BST_CHECKED} + File "..\bin\doLocalConf.xml" + ${ELSE} + IfFileExists $INSTDIR\doLocalConf.xml 0 +2 + Delete $INSTDIR\doLocalConf.xml + StrCpy $UPDATE_PATH "$APPDATA\Notepad++" + CreateDirectory $UPDATE_PATH\plugins\config + ${EndIf} + + ${If} $allowPluginLoadFromUserDataChecked == ${BST_CHECKED} + File "..\bin\allowAppDataPlugins.xml" + ${ELSE} + IfFileExists $INSTDIR\allowAppDataPlugins.xml 0 +2 + Delete $INSTDIR\allowAppDataPlugins.xml + ${EndIf} + + + ; TODO for optional arg + ;${GetParameters} $params + ;${GetOptions} $params "/noEasterEggs" $R0 + + ;IfErrors 0 +2 + ;MessageBox MB_OK "Not found /noEasterEggs" IDOK +2 + ;MessageBox MB_OK "Found /noEasterEggs" + + + + SetOutPath "$TEMP\" + File "langsModel.xml" + File "configModel.xml" + File "stylesGlobalModel.xml" + File "stylesLexerModel.xml" + File "stylers_remove.xml" + + File "..\bin\langs.model.xml" + File "..\bin\config.model.xml" + File "..\bin\stylers.model.xml" + + nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\langsModel.xml" "$TEMP\langs.model.xml" "$UPDATE_PATH\langs.xml"' + nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\configModel.xml" "$TEMP\config.model.xml" "$UPDATE_PATH\config.xml"' + + nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesGlobalModel.xml" "$TEMP\stylers.model.xml" "$UPDATE_PATH\stylers.xml"' + nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesLexerModel.xml" "$TEMP\stylers_remove.xml" "$UPDATE_PATH\stylers.xml"' + nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesLexerModel.xml" "$TEMP\stylers.model.xml" "$UPDATE_PATH\stylers.xml"' + + ; This line is added due to the bug of xmlUpdater, to be removed in the future + nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesLexerModel.xml" "$TEMP\stylers.model.xml" "$UPDATE_PATH\stylers.xml"' + + SetOverwrite off + SetOutPath "$UPDATE_PATH\" + File "..\bin\contextMenu.xml" + File "..\bin\functionList.xml" + + SetOverwrite on + SetOutPath "$INSTDIR\" + File "..\bin\langs.model.xml" + File "..\bin\config.model.xml" + File "..\bin\stylers.model.xml" + File "..\bin\contextMenu.xml" + File "..\bin\functionList.xml" + + SetOverwrite off + File "..\bin\shortcuts.xml" + + + ; Set Section Files and Shortcuts + SetOverwrite on + File "..\..\LICENSE" + File "..\bin\SciLexer.dll" + File "..\bin\change.log" + File "..\bin\notepad++.exe" + File "..\bin\readme.txt" + + ; Localization + ; Default language English + SetOutPath "$INSTDIR\localization\" + File ".\nativeLang\english.xml" + + ; Copy all the language files to the temp directory + ; than make them installed via option + SetOutPath "$TEMP\nppLocalization\" + File ".\nativeLang\" + + IfFileExists "$UPDATE_PATH\nativeLang.xml" 0 +2 + Delete "$UPDATE_PATH\nativeLang.xml" + + IfFileExists "$INSTDIR\nativeLang.xml" 0 +2 + Delete "$INSTDIR\nativeLang.xml" + + StrCmp $LANGUAGE ${LANG_ENGLISH} +3 0 + CopyFiles "$TEMP\nppLocalization\$(langFileName)" "$UPDATE_PATH\nativeLang.xml" + CopyFiles "$TEMP\nppLocalization\$(langFileName)" "$INSTDIR\localization\$(langFileName)" + + ; remove all the npp shortcuts from current user + Delete "$DESKTOP\Notepad++.lnk" + Delete "$SMPROGRAMS\Notepad++\Notepad++.lnk" + Delete "$SMPROGRAMS\Notepad++\readme.lnk" + Delete "$SMPROGRAMS\Notepad++\Uninstall.lnk" + RMDir "$SMPROGRAMS\Notepad++" + + ; remove unstable plugins + CreateDirectory "$INSTDIR\plugins\disabled" + + IfFileExists "$INSTDIR\plugins\HexEditorPlugin.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nHexEditorPlugin.dll is about to be deleted." /SD IDOK + Rename "$INSTDIR\plugins\HexEditorPlugin.dll" "$INSTDIR\plugins\disabled\HexEditorPlugin.dll" + Delete "$INSTDIR\plugins\HexEditorPlugin.dll" + + IfFileExists "$INSTDIR\plugins\HexEditor.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nHexEditor.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\HexEditor.dll" "$INSTDIR\plugins\disabled\HexEditor.dll" + Delete "$INSTDIR\plugins\HexEditor.dll" + + IfFileExists "$INSTDIR\plugins\MultiClipboard.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nMultiClipboard.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\MultiClipboard.dll" "$INSTDIR\plugins\disabled\MultiClipboard.dll" + Delete "$INSTDIR\plugins\MultiClipboard.dll" + + Delete "$INSTDIR\plugins\NppDocShare.dll" + + IfFileExists "$INSTDIR\plugins\FunctionList.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nFunctionList.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\FunctionList.dll" "$INSTDIR\plugins\disabled\FunctionList.dll" + Delete "$INSTDIR\plugins\FunctionList.dll" + + IfFileExists "$INSTDIR\plugins\docMonitor.unicode.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\ndocMonitor.unicode.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\docMonitor.unicode.dll" "$INSTDIR\plugins\disabled\docMonitor.unicode.dll" + Delete "$INSTDIR\plugins\docMonitor.unicode.dll" + + IfFileExists "$INSTDIR\plugins\NPPTextFX.ini" 0 +1 + Delete "$INSTDIR\plugins\NPPTextFX.ini" + + IfFileExists "$INSTDIR\plugins\NppAutoIndent.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nNppAutoIndent.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\NppAutoIndent.dll" "$INSTDIR\plugins\disabled\NppAutoIndent.dll" + Delete "$INSTDIR\plugins\NppAutoIndent.dll" + + IfFileExists "$INSTDIR\plugins\FTP_synchronize.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nFTP_synchronize.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\FTP_synchronize.dll" "$INSTDIR\plugins\disabled\FTP_synchronize.dll" + Delete "$INSTDIR\plugins\FTP_synchronize.dll" + + IfFileExists "$INSTDIR\plugins\NppPlugin_ChangeMarker.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nNppPlugin_ChangeMarker.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\NppPlugin_ChangeMarker.dll" "$INSTDIR\plugins\disabled\NppPlugin_ChangeMarker.dll" + Delete "$INSTDIR\plugins\NppPlugin_ChangeMarker.dll" + + IfFileExists "$INSTDIR\plugins\QuickText.UNI.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nQuickText.UNI.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\QuickText.UNI.dll" "$INSTDIR\plugins\disabled\QuickText.UNI.dll" + Delete "$INSTDIR\plugins\QuickText.UNI.dll" + + IfFileExists "$INSTDIR\plugins\AHKExternalLexer.dll" 0 +4 + MessageBox MB_OK "Due to the compability issue,$\nAHKExternalLexer.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\AHKExternalLexer.dll" "$INSTDIR\plugins\disabled\AHKExternalLexer.dll" + Delete "$INSTDIR\plugins\AHKExternalLexer.dll" + + IfFileExists "$INSTDIR\plugins\NppExternalLexers.dll" 0 +4 + MessageBox MB_OK "Due to the compability issue,$\n\NppExternalLexers.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\NppExternalLexers.dll" "$INSTDIR\plugins\disabled\NppExternalLexers.dll" + Delete "$INSTDIR\plugins\NppExternalLexers.dll" + + IfFileExists "$INSTDIR\plugins\ExternalLexerKVS.dll" 0 +4 + MessageBox MB_OK "Due to the compability issue,$\n\ExternalLexerKVS.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\ExternalLexerKVS.dll" "$INSTDIR\plugins\disabled\ExternalLexerKVS.dll" + Delete "$INSTDIR\plugins\ExternalLexerKVS.dll" + + IfFileExists "$INSTDIR\plugins\Oberon2LexerU.dll" 0 +4 + MessageBox MB_OK "Due to the compability issue,$\n\Oberon2LexerU.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\Oberon2LexerU.dll" "$INSTDIR\plugins\disabled\Oberon2LexerU.dll" + Delete "$INSTDIR\plugins\Oberon2LexerU.dll" + + + IfFileExists "$INSTDIR\plugins\NotepadSharp.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\n\NotepadSharp.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\NotepadSharp.dll" "$INSTDIR\plugins\disabled\NotepadSharp.dll" + Delete "$INSTDIR\plugins\NotepadSharp.dll" + + IfFileExists "$INSTDIR\plugins\PreviewHTML.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nPreviewHTML.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\PreviewHTML.dll" "$INSTDIR\plugins\disabled\PreviewHTML.dll" + Delete "$INSTDIR\plugins\PreviewHTML.dll" + + IfFileExists "$INSTDIR\plugins\nppRegEx.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nnppRegEx.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\nppRegEx.dll" "$INSTDIR\plugins\disabled\nppRegEx.dll" + Delete "$INSTDIR\plugins\nppRegEx.dll" + + IfFileExists "$INSTDIR\plugins\AutoSaveU.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nAutoSaveU.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\AutoSaveU.dll" "$INSTDIR\plugins\disabled\AutoSaveU.dll" + Delete "$INSTDIR\plugins\AutoSaveU.dll" + + IfFileExists "$INSTDIR\plugins\NppQCP.dll" 0 +4 + MessageBox MB_OK "Due to the stability issue,$\nNppQCP.dll will be moved to the directory $\"disabled$\"" /SD IDOK + Rename "$INSTDIR\plugins\NppQCP.dll" "$INSTDIR\plugins\disabled\NppQCP.dll" + Delete "$INSTDIR\plugins\NppQCP.dll" + + IfFileExists "$INSTDIR\plugins\DSpellCheck.dll" 0 +11 + MessageBox MB_YESNOCANCEL "Due to the stability issue, DSpellCheck.dll will be moved to the directory $\"disabled$\".$\nChoose Cancel to keep it this installation.$\nChoose No to keep it forever." /SD IDYES IDNO never IDCANCEL donothing ;IDYES remove + Rename "$INSTDIR\plugins\DSpellCheck.dll" "$INSTDIR\plugins\disabled\DSpellCheck.dll" + Delete "$INSTDIR\plugins\DSpellCheck.dll" + Goto donothing + never: + Rename "$INSTDIR\plugins\DSpellCheck.dll" "$INSTDIR\plugins\DSpellCheck2.dll" + Goto donothing + donothing: + + ; Context Menu Management : removing old version of Context Menu module + IfFileExists "$INSTDIR\nppcm.dll" 0 +3 + Exec 'regsvr32 /u /s "$INSTDIR\nppcm.dll"' + Delete "$INSTDIR\nppcm.dll" + + IfFileExists "$INSTDIR\NppShell.dll" 0 +3 + Exec 'regsvr32 /u /s "$INSTDIR\NppShell.dll"' + Delete "$INSTDIR\NppShell.dll" + + IfFileExists "$INSTDIR\NppShell_01.dll" 0 +3 + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_01.dll"' + Delete "$INSTDIR\NppShell_01.dll" + + IfFileExists "$INSTDIR\NppShell_02.dll" 0 +3 + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_02.dll"' + Delete "$INSTDIR\NppShell_02.dll" + + IfFileExists "$INSTDIR\NppShell_03.dll" 0 +3 + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_03.dll"' + Delete "$INSTDIR\NppShell_03.dll" + + IfFileExists "$INSTDIR\NppShell_04.dll" 0 +3 + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_04.dll"' + Delete "$INSTDIR\NppShell_04.dll" + + IfFileExists "$INSTDIR\NppShell_05.dll" 0 +3 + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_05.dll"' + Delete "$INSTDIR\NppShell_05.dll" + + ; detect the right of + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" 0 +2 + SetShellVarContext all + + ; set the shortcuts working directory + ; http://nsis.sourceforge.net/Docs/Chapter4.html#createshortcut + SetOutPath "$INSTDIR\" + + ; add all the npp shortcuts for all user or current user + CreateDirectory "$SMPROGRAMS\Notepad++" + CreateShortCut "$SMPROGRAMS\Notepad++\Notepad++.lnk" "$INSTDIR\notepad++.exe" + ${If} $createShortcutChecked == ${BST_CHECKED} + CreateShortCut "$DESKTOP\Notepad++.lnk" "$INSTDIR\notepad++.exe" + ${EndIf} + + SetShellVarContext current + + ${If} $isOldIconChecked == ${BST_CHECKED} + SetOutPath "$TEMP\" + File "..\misc\vistaIconTool\changeIcon.exe" + File "..\src\icons\npp.ico" + nsExec::ExecToStack '"$TEMP\changeIcon.exe" "$TEMP\npp.ico" "$INSTDIR\notepad++.exe" 100 1033' + ${EndIf} + + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\notepad++.exe" "" "$INSTDIR\notepad++.exe" +SectionEnd + +${MementoSection} "Context Menu Entry" explorerContextMenu + SetOverwrite try + SetOutPath "$INSTDIR\" + ${If} ${RunningX64} + File /oname=$INSTDIR\NppShell_06.dll "..\bin\NppShell64_06.dll" + ${Else} + File "..\bin\NppShell_06.dll" + ${EndIf} + + Exec 'regsvr32 /s "$INSTDIR\NppShell_06.dll"' +${MementoSectionEnd} + +SectionGroup "Auto-completion Files" autoCompletionComponent + SetOverwrite off + + ${MementoSection} "C" C + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\c.xml" + ${MementoSectionEnd} + + ${MementoSection} "C++" C++ + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\cpp.xml" + ${MementoSectionEnd} + + ${MementoSection} "Java" Java + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\java.xml" + ${MementoSectionEnd} + + ${MementoSection} "C#" C# + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\cs.xml" + ${MementoSectionEnd} + + ${MementoSection} "HTML" HTML + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\html.xml" + ${MementoSectionEnd} + + ${MementoSection} "RC" RC + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\rc.xml" + ${MementoSectionEnd} + + ${MementoSection} "SQL" SQL + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\sql.xml" + ${MementoSectionEnd} + + ${MementoSection} "PHP" PHP + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\php.xml" + ${MementoSectionEnd} + + ${MementoSection} "CSS" CSS + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\css.xml" + ${MementoSectionEnd} + + ${MementoSection} "VB" VB + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\vb.xml" + ${MementoSectionEnd} + + ${MementoSection} "Perl" Perl + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\perl.xml" + ${MementoSectionEnd} + + ${MementoSection} "JavaScript" JavaScript + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\javascript.xml" + ${MementoSectionEnd} + + ${MementoSection} "Python" Python + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\python.xml" + ${MementoSectionEnd} + + ${MementoSection} "ActionScript" ActionScript + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\actionscript.xml" + ${MementoSectionEnd} + + ${MementoSection} "LISP" LISP + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\lisp.xml" + ${MementoSectionEnd} + + ${MementoSection} "VHDL" VHDL + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\vhdl.xml" + ${MementoSectionEnd} + + ${MementoSection} "TeX" TeX + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\tex.xml" + ${MementoSectionEnd} + + ${MementoSection} "DocBook" DocBook + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\xml.xml" + ${MementoSectionEnd} + + ${MementoSection} "NSIS" NSIS + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\nsis.xml" + ${MementoSectionEnd} + + ${MementoSection} "CMAKE" CMAKE + SetOutPath "$INSTDIR\plugins\APIs" + File ".\APIs\cmake.xml" + ${MementoSectionEnd} +SectionGroupEnd + +SectionGroup "Plugins" Plugins + SetOverwrite on + + + ${MementoSection} "NppExport" NppExport + Delete "$INSTDIR\plugins\NppExport.dll" + SetOutPath "$INSTDIR\plugins" + File "..\bin\plugins\NppExport.dll" + ${MementoSectionEnd} + + ${MementoSection} "Plugin Manager" PluginManager + Delete "$INSTDIR\plugins\PluginManager.dll" + SetOutPath "$INSTDIR\plugins" + File "..\bin\plugins\PluginManager.dll" + SetOutPath "$INSTDIR\updater" + File "..\bin\updater\gpup.exe" + ${MementoSectionEnd} + + ${MementoSection} "Mime Tools" MimeTools + Delete "$INSTDIR\plugins\mimeTools.dll" + SetOutPath "$INSTDIR\plugins" + File "..\bin\plugins\mimeTools.dll" + ${MementoSectionEnd} + + ${MementoSection} "Converter" Converter + Delete "$INSTDIR\plugins\NppConverter.dll" + SetOutPath "$INSTDIR\plugins" + File "..\bin\plugins\NppConverter.dll" + ${MementoSectionEnd} +SectionGroupEnd + +SectionGroup "Localization" localization + SetOverwrite on + ${MementoUnselectedSection} "Afrikaans" afrikaans + CopyFiles "$TEMP\nppLocalization\afrikaans.xml" "$INSTDIR\localization\afrikaans.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Albanian" albanian + CopyFiles "$TEMP\nppLocalization\albanian.xml" "$INSTDIR\localization\albanian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Arabic" arabic + CopyFiles "$TEMP\nppLocalization\arabic.xml" "$INSTDIR\localization\arabic.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Aragonese" aragonese + CopyFiles "$TEMP\nppLocalization\aragonese.xml" "$INSTDIR\localization\aragonese.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Aranese" aranese + CopyFiles "$TEMP\nppLocalization\aranese.xml" "$INSTDIR\localization\aranese.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Azerbaijani" azerbaijani + CopyFiles "$TEMP\nppLocalization\azerbaijani.xml" "$INSTDIR\localization\azerbaijani.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Basque" basque + CopyFiles "$TEMP\nppLocalization\basque.xml" "$INSTDIR\localization\basque.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Belarusian" belarusian + CopyFiles "$TEMP\nppLocalization\belarusian.xml" "$INSTDIR\localization\belarusian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Bengali" bengali + CopyFiles "$TEMP\nppLocalization\bengali.xml" "$INSTDIR\localization\bengali.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Bosnian" bosnian + CopyFiles "$TEMP\nppLocalization\bosnian.xml" "$INSTDIR\localization\bosnian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Brazilian Portuguese" brazilian_portuguese + CopyFiles "$TEMP\nppLocalization\brazilian_portuguese.xml" "$INSTDIR\localization\brazilian_portuguese.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Bulgarian" bulgarian + CopyFiles "$TEMP\nppLocalization\bulgarian.xml" "$INSTDIR\localization\bulgarian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Catalan" catalan + CopyFiles "$TEMP\nppLocalization\catalan.xml" "$INSTDIR\localization\catalan.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Chinese (Traditional)" chineseTraditional + CopyFiles "$TEMP\nppLocalization\chinese.xml" "$INSTDIR\localization\chinese.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Chinese (Simplified)" chineseSimplified + CopyFiles "$TEMP\nppLocalization\chineseSimplified.xml" "$INSTDIR\localization\chineseSimplified.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Croatian" croatian + CopyFiles "$TEMP\nppLocalization\croatian.xml" "$INSTDIR\localization\croatian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Czech" czech + CopyFiles "$TEMP\nppLocalization\czech.xml" "$INSTDIR\localization\czech.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Danish" danish + CopyFiles "$TEMP\nppLocalization\danish.xml" "$INSTDIR\localization\danish.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Dutch" dutch + CopyFiles "$TEMP\nppLocalization\dutch.xml" "$INSTDIR\localization\dutch.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "English (Customizable)" english_customizable + CopyFiles "$TEMP\nppLocalization\english_customizable.xml" "$INSTDIR\localization\english_customizable.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Esperanto" esperanto + CopyFiles "$TEMP\nppLocalization\esperanto.xml" "$INSTDIR\localization\esperanto.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Estonian" estonian + CopyFiles "$TEMP\nppLocalization\estonian.xml" "$INSTDIR\localization\estonian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Extremaduran" extremaduran + CopyFiles "$TEMP\nppLocalization\extremaduran.xml" "$INSTDIR\localization\extremaduran.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Farsi" farsi + CopyFiles "$TEMP\nppLocalization\farsi.xml" "$INSTDIR\localization\farsi.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Finnish" finnish + CopyFiles "$TEMP\nppLocalization\finnish.xml" "$INSTDIR\localization\finnish.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Friulian" friulian + CopyFiles "$TEMP\nppLocalization\friulian.xml" "$INSTDIR\localization\friulian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "French" french + CopyFiles "$TEMP\nppLocalization\french.xml" "$INSTDIR\localization\french.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Galician" galician + CopyFiles "$TEMP\nppLocalization\galician.xml" "$INSTDIR\localization\galician.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Georgian" georgian + CopyFiles "$TEMP\nppLocalization\georgian.xml" "$INSTDIR\localization\georgian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "German" german + CopyFiles "$TEMP\nppLocalization\german.xml" "$INSTDIR\localization\german.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Greek" greek + CopyFiles "$TEMP\nppLocalization\greek.xml" "$INSTDIR\localization\greek.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Gujarati" gujarati + CopyFiles "$TEMP\nppLocalization\gujarati.xml" "$INSTDIR\localization\gujarati.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Hebrew" hebrew + CopyFiles "$TEMP\nppLocalization\hebrew.xml" "$INSTDIR\localization\hebrew.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Hindi" hindi + CopyFiles "$TEMP\nppLocalization\hindi.xml" "$INSTDIR\localization\hindi.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Hungarian" hungarian + CopyFiles "$TEMP\nppLocalization\hungarian.xml" "$INSTDIR\localization\hungarian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Hungarian (ANSI)" hungarianA + CopyFiles "$TEMP\nppLocalization\hungarianA.xml" "$INSTDIR\localization\hungarianA.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Indonesian" indonesian + CopyFiles "$TEMP\nppLocalization\indonesian.xml" "$INSTDIR\localization\indonesian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Italian" italian + CopyFiles "$TEMP\nppLocalization\italian.xml" "$INSTDIR\localization\italian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Japanese" japanese + CopyFiles "$TEMP\nppLocalization\japanese.xml" "$INSTDIR\localization\japanese.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Kazakh" kazakh + CopyFiles "$TEMP\nppLocalization\kazakh.xml" "$INSTDIR\localization\kazakh.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Korean" korean + CopyFiles "$TEMP\nppLocalization\korean.xml" "$INSTDIR\localization\korean.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Kyrgyz" kyrgyz + CopyFiles "$TEMP\nppLocalization\kyrgyz.xml" "$INSTDIR\localization\kyrgyz.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Latvian" latvian + CopyFiles "$TEMP\nppLocalization\latvian.xml" "$INSTDIR\localization\latvian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Ligurian" ligurian + CopyFiles "$TEMP\nppLocalization\ligurian.xml" "$INSTDIR\localization\ligurian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Lithuanian" lithuanian + CopyFiles "$TEMP\nppLocalization\lithuanian.xml" "$INSTDIR\localization\lithuanian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Luxembourgish" luxembourgish + CopyFiles "$TEMP\nppLocalization\luxembourgish.xml" "$INSTDIR\localization\luxembourgish.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Macedonian" macedonian + CopyFiles "$TEMP\nppLocalization\macedonian.xml" "$INSTDIR\localization\macedonian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Malay" malay + CopyFiles "$TEMP\nppLocalization\malay.xml" "$INSTDIR\localization\malay.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Marathi" marathi + CopyFiles "$TEMP\nppLocalization\marathi.xml" "$INSTDIR\localization\marathi.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Mongolian" mongolian + CopyFiles "$TEMP\nppLocalization\mongolian.xml" "$INSTDIR\localization\mongolian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Norwegian" norwegian + CopyFiles "$TEMP\nppLocalization\norwegian.xml" "$INSTDIR\localization\norwegian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Nynorsk" nynorsk + CopyFiles "$TEMP\nppLocalization\nynorsk.xml" "$INSTDIR\localization\nynorsk.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Occitan" occitan + CopyFiles "$TEMP\nppLocalization\occitan.xml" "$INSTDIR\localization\occitan.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Polish" polish + CopyFiles "$TEMP\nppLocalization\polish.xml" "$INSTDIR\localization\polish.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Portuguese" portuguese + CopyFiles "$TEMP\nppLocalization\portuguese.xml" "$INSTDIR\localization\portuguese.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Punjabi" punjabi + CopyFiles "$TEMP\nppLocalization\punjabi.xml" "$INSTDIR\localization\punjabi.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Kannada" kannada + CopyFiles "$TEMP\nppLocalization\kannada.xml" "$INSTDIR\localization\kannada.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Romanian" romanian + CopyFiles "$TEMP\nppLocalization\romanian.xml" "$INSTDIR\localization\romanian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Russian" russian + CopyFiles "$TEMP\nppLocalization\russian.xml" "$INSTDIR\localization\russian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Samogitian" samogitian + CopyFiles "$TEMP\nppLocalization\samogitian.xml" "$INSTDIR\localization\samogitian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Sardinian" sardinian + CopyFiles "$TEMP\nppLocalization\sardinian.xml" "$INSTDIR\localization\sardinian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Serbian" serbian + CopyFiles "$TEMP\nppLocalization\serbian.xml" "$INSTDIR\localization\serbian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Serbian (Cyrillic)" serbianCyrillic + CopyFiles "$TEMP\nppLocalization\serbianCyrillic.xml" "$INSTDIR\localization\serbianCyrillic.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Sinhala" sinhala + CopyFiles "$TEMP\nppLocalization\sinhala.xml" "$INSTDIR\localization\sinhala.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Slovak" slovak + CopyFiles "$TEMP\nppLocalization\slovak.xml" "$INSTDIR\localization\slovak.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Slovak (ANSI)" slovakA + CopyFiles "$TEMP\nppLocalization\slovakA.xml" "$INSTDIR\localization\slovakA.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Slovenian" slovenian + CopyFiles "$TEMP\nppLocalization\slovenian.xml" "$INSTDIR\localization\slovenian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Spanish" spanish + CopyFiles "$TEMP\nppLocalization\spanish.xml" "$INSTDIR\localization\spanish.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Spanish_ar" spanish_ar + CopyFiles "$TEMP\nppLocalization\spanish_ar.xml" "$INSTDIR\localization\spanish_ar.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Swedish" swedish + CopyFiles "$TEMP\nppLocalization\swedish.xml" "$INSTDIR\localization\swedish.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Tagalog" tagalog + CopyFiles "$TEMP\nppLocalization\tagalog.xml" "$INSTDIR\localization\tagalog.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Tajik" tajik + CopyFiles "$TEMP\nppLocalization\tajikCyrillic.xml" "$INSTDIR\localization\tajikCyrillic.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Tamil" tamil + CopyFiles "$TEMP\nppLocalization\tamil.xml" "$INSTDIR\localization\tamil.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Tatar" tatar + CopyFiles "$TEMP\nppLocalization\tatar.xml" "$INSTDIR\localization\tatar.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Telugu" telugu + CopyFiles "$TEMP\nppLocalization\telugu.xml" "$INSTDIR\localization\telugu.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Thai" thai + CopyFiles "$TEMP\nppLocalization\thai.xml" "$INSTDIR\localization\thai.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Turkish" turkish + CopyFiles "$TEMP\nppLocalization\turkish.xml" "$INSTDIR\localization\turkish.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Ukrainian" ukrainian + CopyFiles "$TEMP\nppLocalization\ukrainian.xml" "$INSTDIR\localization\ukrainian.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Urdu" urdu + CopyFiles "$TEMP\nppLocalization\urdu.xml" "$INSTDIR\localization\urdu.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Uyghur" uyghur + CopyFiles "$TEMP\nppLocalization\uyghur.xml" "$INSTDIR\localization\uyghur.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Uzbek" uzbek + CopyFiles "$TEMP\nppLocalization\uzbek.xml" "$INSTDIR\localization\uzbek.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Uzbek (Cyrillic)" uzbekCyrillic + CopyFiles "$TEMP\nppLocalization\uzbekCyrillic.xml" "$INSTDIR\localization\uzbekCyrillic.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Vietnamese" vietnamese + CopyFiles "$TEMP\nppLocalization\vietnamese.xml" "$INSTDIR\localization\vietnamese.xml" + ${MementoSectionEnd} + ${MementoUnselectedSection} "Welsh" welsh + CopyFiles "$TEMP\nppLocalization\welsh.xml" "$INSTDIR\localization\welsh.xml" + ${MementoSectionEnd} +SectionGroupEnd + +SectionGroup "Themes" Themes + SetOverwrite off + ${MementoSection} "Black Board" BlackBoard + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Black board.xml" + ${MementoSectionEnd} + + ${MementoSection} "Choco" Choco + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Choco.xml" + ${MementoSectionEnd} + + ${MementoSection} "Hello Kitty" HelloKitty + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Hello Kitty.xml" + ${MementoSectionEnd} + + ${MementoSection} "Mono Industrial" MonoIndustrial + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Mono Industrial.xml" + ${MementoSectionEnd} + + ${MementoSection} "Monokai" Monokai + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Monokai.xml" + ${MementoSectionEnd} + + ${MementoSection} "Obsidian" Obsidian + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\obsidian.xml" + ${MementoSectionEnd} + + ${MementoSection} "Plastic Code Wrap" PlasticCodeWrap + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Plastic Code Wrap.xml" + ${MementoSectionEnd} + + ${MementoSection} "Ruby Blue" RubyBlue + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Ruby Blue.xml" + ${MementoSectionEnd} + + ${MementoSection} "Twilight" Twilight + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Twilight.xml" + ${MementoSectionEnd} + + ${MementoSection} "Vibrant Ink" VibrantInk + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Vibrant Ink.xml" + ${MementoSectionEnd} + + ${MementoSection} "Deep Black" DeepBlack + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Deep Black.xml" + ${MementoSectionEnd} + + ${MementoSection} "vim Dark Blue" vimDarkBlue + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\vim Dark Blue.xml" + ${MementoSectionEnd} + + ${MementoSection} "Bespin" Bespin + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Bespin.xml" + ${MementoSectionEnd} + + ${MementoSection} "Zenburn" Zenburn + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Zenburn.xml" + ${MementoSectionEnd} + + ${MementoSection} "Solarized" Solarized + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Solarized.xml" + ${MementoSectionEnd} + + ${MementoSection} "Solarized Light" Solarized-light + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Solarized-light.xml" + ${MementoSectionEnd} + + ${MementoSection} "Hot Fudge Sundae" HotFudgeSundae + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\HotFudgeSundae.xml" + ${MementoSectionEnd} + + ${MementoSection} "khaki" khaki + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\khaki.xml" + ${MementoSectionEnd} + + ${MementoSection} "Mossy Lawn" MossyLawn + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\MossyLawn.xml" + ${MementoSectionEnd} + + ${MementoSection} "Navajo" Navajo + SetOutPath "$UPDATE_PATH\themes" + File ".\themes\Navajo.xml" + ${MementoSectionEnd} +SectionGroupEnd + +InstType "Minimalist" + +${MementoSection} "Auto-Updater" AutoUpdater + SetOverwrite on + SetOutPath "$INSTDIR\updater" + File "..\bin\updater\GUP.exe" + File "..\bin\updater\libcurl.dll" + File "..\bin\updater\gup.xml" + File "..\bin\updater\LICENSE" + File "..\bin\updater\gpl.txt" + File "..\bin\updater\README.md" +${MementoSectionEnd} + + +${MementoSectionDone} + +;-------------------------------- +;Descriptions + + ;Language strings + + ;Assign language strings to sections + !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + ;!insertmacro MUI_DESCRIPTION_TEXT ${makeLocal} 'Enable this option to make Notepad++ load/write the configuration files from/to its install directory. Check it if you use Notepad++ in an USB device.' + !insertmacro MUI_DESCRIPTION_TEXT ${explorerContextMenu} 'Explorer context menu entry for Notepad++ : Open whatever you want in Notepad++ from Windows Explorer.' + !insertmacro MUI_DESCRIPTION_TEXT ${autoCompletionComponent} 'Install the API files you need for the auto-completion feature (Ctrl+Space).' + !insertmacro MUI_DESCRIPTION_TEXT ${Plugins} 'You may need those plugins to extend the capacity of Notepad++.' + !insertmacro MUI_DESCRIPTION_TEXT ${Themes} 'The eye-candy to change visual effects. Use Theme selector to switch among them.' + !insertmacro MUI_DESCRIPTION_TEXT ${AutoUpdater} 'Keep your Notepad++ update: Check this option to install an update module which searches Notepad++ update on Internet and install it for you.' + ;!insertmacro MUI_DESCRIPTION_TEXT ${UserManual} 'Here you can get all the secrets of Notepad++.' + ;!insertmacro MUI_DESCRIPTION_TEXT ${shortcutOnDesktop} 'Check this option to add Notepad++ shortcut on your desktop.' + ;!insertmacro MUI_DESCRIPTION_TEXT ${getOldIcon} "I won't blame you if you want to get the old icon back." + !insertmacro MUI_FUNCTION_DESCRIPTION_END + +;-------------------------------- + +Section -FinishSection + + WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "DisplayName" "${APPNAME}" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "Publisher" "Notepad++ Team" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "VersionMajor" "${VERSION_MAJOR}" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "VersionMinor" "${VERSION_MINOR}" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "MajorVersion" "${VERSION_MAJOR}" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "MinorVersion" "${VERSION_MINOR}" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "UninstallString" "$INSTDIR\uninstall.exe" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "DisplayIcon" "$INSTDIR\notepad++.exe" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "DisplayVersion" "${APPVERSION}" + WriteRegStr HKLM "${UNINSTALL_REG_KEY}" "URLInfoAbout" "${APPWEBSITE}" + WriteUninstaller "$INSTDIR\uninstall.exe" + +SectionEnd + + +;Uninstall section + +SectionGroup un.autoCompletionComponent + Section un.PHP + Delete "$INSTDIR\plugins\APIs\php.xml" + SectionEnd + + Section un.CSS + Delete "$INSTDIR\plugins\APIs\css.xml" + SectionEnd + + Section un.HTML + Delete "$INSTDIR\plugins\APIs\html.xml" + SectionEnd + + Section un.SQL + Delete "$INSTDIR\plugins\APIs\sql.xml" + SectionEnd + + Section un.RC + Delete "$INSTDIR\plugins\APIs\rc.xml" + SectionEnd + + Section un.VB + Delete "$INSTDIR\plugins\APIs\vb.xml" + SectionEnd + + Section un.Perl + Delete "$INSTDIR\plugins\APIs\perl.xml" + SectionEnd + + Section un.C + Delete "$INSTDIR\plugins\APIs\c.xml" + SectionEnd + + Section un.C++ + Delete "$INSTDIR\plugins\APIs\cpp.xml" + SectionEnd + + Section un.Java + Delete "$INSTDIR\plugins\APIs\java.xml" + SectionEnd + + Section un.C# + Delete "$INSTDIR\plugins\APIs\cs.xml" + SectionEnd + + Section un.JavaScript + Delete "$INSTDIR\plugins\APIs\javascript.xml" + SectionEnd + + Section un.Python + Delete "$INSTDIR\plugins\APIs\python.xml" + SectionEnd + + Section un.ActionScript + Delete "$INSTDIR\plugins\APIs\actionscript.xml" + SectionEnd + + Section un.LISP + Delete "$INSTDIR\plugins\APIs\lisp.xml" + SectionEnd + + Section un.VHDL + Delete "$INSTDIR\plugins\APIs\vhdl.xml" + SectionEnd + + Section un.TeX + Delete "$INSTDIR\plugins\APIs\tex.xml" + SectionEnd + + Section un.DocBook + Delete "$INSTDIR\plugins\APIs\xml.xml" + SectionEnd + + Section un.NSIS + Delete "$INSTDIR\plugins\APIs\nsis.xml" + SectionEnd + + Section un.AWK + Delete "$INSTDIR\plugins\APIs\awk.xml" + SectionEnd + + Section un.CMAKE + Delete "$INSTDIR\plugins\APIs\cmake.xml" + SectionEnd +SectionGroupEnd + +SectionGroup un.Plugins + Section un.NPPTextFX + Delete "$INSTDIR\plugins\NPPTextFX.dll" + Delete "$INSTDIR\plugins\NPPTextFX.ini" + Delete "$APPDATA\Notepad++\NPPTextFX.ini" + Delete "$INSTDIR\plugins\doc\NPPTextFXdemo.TXT" + Delete "$INSTDIR\plugins\Config\tidy\AsciiToEBCDIC.bin" + Delete "$INSTDIR\plugins\Config\tidy\libTidy.dll" + Delete "$INSTDIR\plugins\Config\tidy\TIDYCFG.INI" + Delete "$INSTDIR\plugins\Config\tidy\W3C-CSSValidator.htm" + Delete "$INSTDIR\plugins\Config\tidy\W3C-HTMLValidator.htm" + RMDir "$INSTDIR\plugins\tidy\" + SectionEnd + + Section un.NppNetNote + Delete "$INSTDIR\plugins\NppNetNote.dll" + Delete "$INSTDIR\plugins\Config\NppNetNote.ini" + SectionEnd + + Section un.NppAutoIndent + Delete "$INSTDIR\plugins\NppAutoIndent.dll" + Delete "$INSTDIR\plugins\Config\NppAutoIndent.ini" + SectionEnd + + Section un.MIMETools + Delete "$INSTDIR\plugins\NppTools.dll" + Delete "$INSTDIR\plugins\mimeTools.dll" + SectionEnd + + Section un.FTP_synchronize + Delete "$INSTDIR\plugins\FTP_synchronize.dll" + Delete "$INSTDIR\plugins\Config\FTP_synchronize.ini" + Delete "$INSTDIR\plugins\doc\FTP_synchonize.ReadMe.txt" + SectionEnd + + Section un.NppFTP + Delete "$INSTDIR\plugins\NppFTP.dll" + + Delete "$INSTDIR\plugins\doc\NppFTP\license_NppFTP.txt" + Delete "$INSTDIR\plugins\doc\NppFTP\license_libssh.txt" + Delete "$INSTDIR\plugins\doc\NppFTP\license_OpenSSL.txt" + Delete "$INSTDIR\plugins\doc\NppFTP\license_TiXML.txt" + Delete "$INSTDIR\plugins\doc\NppFTP\license_ZLIB.txt" + Delete "$INSTDIR\plugins\doc\NppFTP\license_UTCP.htm" + Delete "$INSTDIR\plugins\doc\NppFTP\Readme.txt" + + SectionEnd + + Section un.NppExport + Delete "$INSTDIR\plugins\NppExport.dll" + SectionEnd + + Section un.SelectNLaunch + Delete "$INSTDIR\plugins\SelectNLaunch.dll" + SectionEnd + + Section un.DocMonitor + Delete "$INSTDIR\plugins\docMonitor.dll" + Delete "$INSTDIR\plugins\Config\docMonitor.ini" + SectionEnd + + + Section un.LightExplorer + Delete "$INSTDIR\plugins\LightExplorer.dll" + Delete "$INSTDIR\lightExplorer.ini" + SectionEnd + Section un.HexEditor + Delete "$INSTDIR\plugins\HexEditor.dll" + SectionEnd + Section un.ConvertExt + Delete "$INSTDIR\plugins\ConvertExt.dll" + Delete "$APPDATA\Notepad++\ConvertExt.ini" + Delete "$APPDATA\Notepad++\ConvertExt.enc" + Delete "$APPDATA\Notepad++\ConvertExt.lng" + Delete "$INSTDIR\ConvertExt.ini" + Delete "$INSTDIR\ConvertExt.enc" + Delete "$INSTDIR\ConvertExt.lng" + SectionEnd + Section un.SpellChecker + Delete "$INSTDIR\plugins\SpellChecker.dll" + SectionEnd + Section un.DSpellCheck + Delete "$INSTDIR\plugins\DSpellCheck.dll" + Delete "$UPDATE_PATH\plugins\Config\DSpellCheck.ini" + Delete "$INSTDIR\plugins\Config\Hunspell\dictionary.lst" + Delete "$INSTDIR\plugins\Config\Hunspell\en_GB.aff" + Delete "$INSTDIR\plugins\Config\Hunspell\en_GB.dic" + Delete "$INSTDIR\plugins\Config\Hunspell\README_en_GB.txt" + Delete "$INSTDIR\plugins\Config\Hunspell\en_US.aff" + Delete "$INSTDIR\plugins\Config\Hunspell\en_US.dic" + Delete "$INSTDIR\plugins\Config\Hunspell\README_en_US.txt" + SectionEnd + Section un.NppExec + Delete "$INSTDIR\plugins\NppExec.dll" + Delete "$INSTDIR\plugins\doc\NppExec.txt" + Delete "$INSTDIR\plugins\doc\NppExec_TechInfo.txt" + Delete "$INSTDIR\plugins\Config\NppExec.ini" + Delete "$INSTDIR\plugins\Config\NppExec_Manual.chm" + Delete "$INSTDIR\plugins\Config\NppExec.ini" + RMDir "$INSTDIR\plugins\doc\" + SectionEnd + Section un.QuickText + Delete "$INSTDIR\plugins\QuickText.dll" + Delete "$INSTDIR\QuickText.ini" + Delete "$INSTDIR\plugins\doc\quickText_README.txt" + SectionEnd + Section un.ComparePlugin + Delete "$INSTDIR\plugins\ComparePlugin.dll" + SectionEnd + Section un.Converter + Delete "$INSTDIR\plugins\NppConverter.dll" + SectionEnd + Section un.MimeTools + Delete "$INSTDIR\plugins\mimeTools.dll" + SectionEnd + Section un.PluginManager + Delete "$INSTDIR\plugins\PluginManager.dll" + Delete "$INSTDIR\updater\gpup.exe" + RMDir "$INSTDIR\updater\" + SectionEnd + Section un.ChangeMarkers + Delete "$INSTDIR\plugins\NppPlugin_ChangeMarker.dll" + SectionEnd +SectionGroupEnd + +SectionGroup un.Themes + Section un.BlackBoard + Delete "$UPDATE_PATH\themes\Black board.xml" + SectionEnd + + Section un.Choco + Delete "$UPDATE_PATH\themes\Choco.xml" + SectionEnd + + Section un.HelloKitty + Delete "$UPDATE_PATH\themes\Hello Kitty.xml" + SectionEnd + + Section un.MonoIndustrial + Delete "$UPDATE_PATH\themes\Mono Industrial.xml" + SectionEnd + + Section un.Monokai + Delete "$UPDATE_PATH\themes\Monokai.xml" + SectionEnd + + Section un.Obsidian + Delete "$UPDATE_PATH\themes/obsidian.xml" + SectionEnd + + Section un.PlasticCodeWrap + Delete "$UPDATE_PATH\themes\Plastic Code Wrap.xml" + SectionEnd + + Section un.RubyBlue + Delete "$UPDATE_PATH\themes\Ruby Blue.xml" + SectionEnd + + Section un.Twilight + Delete "$UPDATE_PATH\themes\Twilight.xml" + SectionEnd + + Section un.VibrantInk + Delete "$UPDATE_PATH\themes\Vibrant Ink.xml" + SectionEnd + + Section un.DeepBlack + Delete "$UPDATE_PATH\themes\Deep Black.xml" + SectionEnd + + Section un.vimDarkBlue + Delete "$UPDATE_PATH\themes\vim Dark Blue.xml" + SectionEnd + + Section un.Bespin + Delete "$UPDATE_PATH\themes\Bespin.xml" + SectionEnd + + Section un.Zenburn + Delete "$UPDATE_PATH\themes\Zenburn.xml" + SectionEnd + + Section un.Solarized + Delete "$UPDATE_PATH\themes\Solarized.xml" + SectionEnd + + Section un.Solarized-light + Delete "$UPDATE_PATH\themes\Solarized-light.xml" + SectionEnd + + Section un.HotFudgeSundae + Delete "$UPDATE_PATH\themes\HotFudgeSundae.xml" + SectionEnd + + Section un.khaki + Delete "$UPDATE_PATH\themes\khaki.xml" + SectionEnd + + Section un.MossyLawn + Delete "$UPDATE_PATH\themes\MossyLawn.xml" + SectionEnd + + Section un.Navajo + Delete "$UPDATE_PATH\themes\Navajo.xml" + SectionEnd + +SectionGroupEnd + +SectionGroup un.localization + SetOverwrite on + Section un.afrikaans + Delete "$INSTDIR\localization\afrikaans.xml" + SectionEnd + Section un.albanian + Delete "$INSTDIR\localization\albanian.xml" + SectionEnd + Section un.arabic + Delete "$INSTDIR\localization\arabic.xml" + SectionEnd + Section un.aragonese + Delete "$INSTDIR\localization\aragonese.xml" + SectionEnd + Section un.aranese + Delete "$INSTDIR\localization\aranese.xml" + SectionEnd + Section un.azerbaijani + Delete "$INSTDIR\localization\azerbaijani.xml" + SectionEnd + Section un.basque + Delete "$INSTDIR\localization\basque.xml" + SectionEnd + Section un.belarusian + Delete "$INSTDIR\localization\belarusian.xml" + SectionEnd + Section un.bengali + Delete "$INSTDIR\localization\bengali.xml" + SectionEnd + Section un.bosnian + Delete "$INSTDIR\localization\bosnian.xml" + SectionEnd + Section un.brazilian_portuguese + Delete "$INSTDIR\localization\brazilian_portuguese.xml" + SectionEnd + Section un.bulgarian + Delete "$INSTDIR\localization\bulgarian.xml" + SectionEnd + Section un.catalan + Delete "$INSTDIR\localization\catalan.xml" + SectionEnd + Section un.chineseTraditional + Delete "$INSTDIR\localization\chinese.xml" + SectionEnd + Section un.chineseSimplified + Delete "$INSTDIR\localization\chineseSimplified.xml" + SectionEnd + Section un.croatian + Delete "$INSTDIR\localization\croatian.xml" + SectionEnd + Section un.czech + Delete "$INSTDIR\localization\czech.xml" + SectionEnd + Section un.danish + Delete "$INSTDIR\localization\danish.xml" + SectionEnd + Section un.dutch + Delete "$INSTDIR\localization\dutch.xml" + SectionEnd + Section un.english_customizable + Delete "$INSTDIR\localization\english_customizable.xml" + SectionEnd + Section un.esperanto + Delete "$INSTDIR\localization\esperanto.xml" + SectionEnd + Section un.estonian + Delete "$INSTDIR\localization\estonian.xml" + SectionEnd + Section un.extremaduran + Delete "$INSTDIR\localization\extremaduran.xml" + SectionEnd + Section un.farsi + Delete "$INSTDIR\localization\farsi.xml" + SectionEnd + Section un.finnish + Delete "$INSTDIR\localization\finnish.xml" + SectionEnd + Section un.friulian + Delete "$INSTDIR\localization\friulian.xml" + SectionEnd + Section un.french + Delete "$INSTDIR\localization\french.xml" + SectionEnd + Section un.galician + Delete "$INSTDIR\localization\galician.xml" + SectionEnd + Section un.georgian + Delete "$INSTDIR\localization\georgian.xml" + SectionEnd + Section un.german + Delete "$INSTDIR\localization\german.xml" + SectionEnd + Section un.greek + Delete "$INSTDIR\localization\greek.xml" + SectionEnd + Section un.gujarati + Delete "$INSTDIR\localization\gujarati.xml" + SectionEnd + Section un.hebrew + Delete "$INSTDIR\localization\hebrew.xml" + SectionEnd + Section un.hindi + Delete "$INSTDIR\localization\hindi.xml" + SectionEnd + Section un.hungarian + Delete "$INSTDIR\localization\hungarian.xml" + SectionEnd + Section un.hungarianA + Delete "$INSTDIR\localization\hungarianA.xml" + SectionEnd + Section un.indonesian + Delete "$INSTDIR\localization\indonesian.xml" + SectionEnd + Section un.italian + Delete "$INSTDIR\localization\italian.xml" + SectionEnd + Section un.japanese + Delete "$INSTDIR\localization\japanese.xml" + SectionEnd + Section un.kazakh + Delete "$INSTDIR\localization\kazakh.xml" + SectionEnd + Section un.korean + Delete "$INSTDIR\localization\korean.xml" + SectionEnd + Section un.kyrgyz + Delete "$INSTDIR\localization\kyrgyz.xml" + SectionEnd + Section un.latvian + Delete "$INSTDIR\localization\latvian.xml" + SectionEnd + Section un.ligurian + Delete "$INSTDIR\localization\ligurian.xml" + SectionEnd + Section un.lithuanian + Delete "$INSTDIR\localization\lithuanian.xml" + SectionEnd + Section un.luxembourgish + Delete "$INSTDIR\localization\luxembourgish.xml" + SectionEnd + Section un.macedonian + Delete "$INSTDIR\localization\macedonian.xml" + SectionEnd + Section un.malay + Delete "$INSTDIR\localization\malay.xml" + SectionEnd + Section un.marathi + Delete "$INSTDIR\localization\marathi.xml" + SectionEnd + Section un.mongolian + Delete "$INSTDIR\localization\mongolian.xml" + SectionEnd + Section un.norwegian + Delete "$INSTDIR\localization\norwegian.xml" + SectionEnd + Section un.nynorsk + Delete "$INSTDIR\localization\nynorsk.xml" + SectionEnd + Section un.occitan + Delete "$INSTDIR\localization\occitan.xml" + SectionEnd + Section un.polish + Delete "$INSTDIR\localization\polish.xml" + SectionEnd + Section un.kannada + Delete "$INSTDIR\localization\kannada.xml" + SectionEnd + Section un.portuguese + Delete "$INSTDIR\localization\portuguese.xml" + SectionEnd + Section un.punjabi + Delete "$INSTDIR\localization\punjabi.xml" + SectionEnd + Section un.romanian + Delete "$INSTDIR\localization\romanian.xml" + SectionEnd + Section un.russian + Delete "$INSTDIR\localization\russian.xml" + SectionEnd + Section un.samogitian + Delete "$INSTDIR\localization\samogitian.xml" + SectionEnd + Section un.sardinian + Delete "$INSTDIR\localization\sardinian.xml" + SectionEnd + Section un.serbian + Delete "$INSTDIR\localization\serbian.xml" + SectionEnd + Section un.serbianCyrillic + Delete "$INSTDIR\localization\serbianCyrillic.xml" + SectionEnd + Section un.sinhala + Delete "$INSTDIR\localization\sinhala.xml" + SectionEnd + Section un.slovak + Delete "$INSTDIR\localization\slovak.xml" + SectionEnd + Section un.slovakA + Delete "$INSTDIR\localization\slovakA.xml" + SectionEnd + Section un.slovenian + Delete "$INSTDIR\localization\slovenian.xml" + SectionEnd + Section un.spanish + Delete "$INSTDIR\localization\spanish.xml" + SectionEnd + Section un.spanish_ar + Delete "$INSTDIR\localization\spanish_ar.xml" + SectionEnd + Section un.swedish + Delete "$INSTDIR\localization\swedish.xml" + SectionEnd + Section un.tagalog + Delete "$INSTDIR\localization\tagalog.xml" + SectionEnd + Section un.tajik + Delete "$INSTDIR\localization\tajikCyrillic.xml" + SectionEnd + Section un.tamil + Delete "$INSTDIR\localization\tamil.xml" + SectionEnd + Section un.tatar + Delete "$INSTDIR\localization\tatar.xml" + SectionEnd + Section un.telugu + Delete "$INSTDIR\localization\telugu.xml" + SectionEnd + Section un.thai + Delete "$INSTDIR\localization\thai.xml" + SectionEnd + Section un.turkish + Delete "$INSTDIR\localization\turkish.xml" + SectionEnd + Section un.ukrainian + Delete "$INSTDIR\localization\ukrainian.xml" + SectionEnd + Section un.urdu + Delete "$INSTDIR\localization\urdu.xml" + SectionEnd + Section un.uyghur + Delete "$INSTDIR\localization\uyghur.xml" + SectionEnd + Section un.uzbek + Delete "$INSTDIR\localization\uzbek.xml" + SectionEnd + Section un.uzbekCyrillic + Delete "$INSTDIR\localization\uzbekCyrillic.xml" + SectionEnd + Section un.vietnamese + Delete "$INSTDIR\localization\vietnamese.xml" + SectionEnd + Section un.welsh + Delete "$INSTDIR\localization\welsh.xml" + SectionEnd +SectionGroupEnd + + +Section un.htmlViewer + DeleteRegKey HKLM "SOFTWARE\Microsoft\Internet Explorer\View Source Editor" + Delete "$INSTDIR\nppIExplorerShell.exe" +SectionEnd + +Section un.AutoUpdater + Delete "$INSTDIR\updater\GUP.exe" + Delete "$INSTDIR\updater\libcurl.dll" + Delete "$INSTDIR\updater\gup.xml" + Delete "$INSTDIR\updater\License.txt" + Delete "$INSTDIR\updater\LICENSE" + Delete "$INSTDIR\updater\gpl.txt" + Delete "$INSTDIR\updater\readme.txt" + Delete "$INSTDIR\updater\README.md" + Delete "$INSTDIR\updater\getDownLoadUrl.php" + RMDir "$INSTDIR\updater\" +SectionEnd + +Section un.explorerContextMenu + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_01.dll"' + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_02.dll"' + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_03.dll"' + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_04.dll"' + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_05.dll"' + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_06.dll"' + Delete "$INSTDIR\NppShell_01.dll" + Delete "$INSTDIR\NppShell_02.dll" + Delete "$INSTDIR\NppShell_03.dll" + Delete "$INSTDIR\NppShell_04.dll" + Delete "$INSTDIR\NppShell_05.dll" + Delete "$INSTDIR\NppShell_06.dll" +SectionEnd + +Section un.UnregisterFileExt + ; Remove references to "Notepad++_file" + IntOp $1 0 + 0 ; subkey index + StrCpy $2 "" ; subkey name +Enum_HKCR_Loop: + EnumRegKey $2 HKCR "" $1 + StrCmp $2 "" Enum_HKCR_Done + ReadRegStr $0 HKCR $2 "" ; Read the default value + ${If} $0 == "Notepad++_file" + ReadRegStr $3 HKCR $2 "Notepad++_backup" + ; Recover (some of) the lost original file types + ${If} $3 == "Notepad++_file" + ${If} $2 == ".ini" + StrCpy $3 "inifile" + ${ElseIf} $2 == ".inf" + StrCpy $3 "inffile" + ${ElseIf} $2 == ".nfo" + StrCpy $3 "MSInfoFile" + ${ElseIf} $2 == ".txt" + StrCpy $3 "txtfile" + ${ElseIf} $2 == ".log" + StrCpy $3 "txtfile" + ${ElseIf} $2 == ".xml" + StrCpy $3 "xmlfile" + ${EndIf} + ${EndIf} + ${If} $3 == "Notepad++_file" + ; File type recovering has failed. Just discard the current file extension + DeleteRegKey HKCR $2 + ${Else} + ; Restore the original file type + WriteRegStr HKCR $2 "" $3 + DeleteRegValue HKCR $2 "Notepad++_backup" + IntOp $1 $1 + 1 + ${EndIf} + ${Else} + IntOp $1 $1 + 1 + ${EndIf} + Goto Enum_HKCR_Loop +Enum_HKCR_Done: + + ; Remove references to "Notepad++_file" from "Open with..." + IntOp $1 0 + 0 ; subkey index + StrCpy $2 "" ; subkey name +Enum_FileExts_Loop: + EnumRegKey $2 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts" $1 + StrCmp $2 "" Enum_FileExts_Done + DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$2\OpenWithProgids" "Notepad++_file" + IntOp $1 $1 + 1 + Goto Enum_FileExts_Loop +Enum_FileExts_Done: + + ; Remove "Notepad++_file" file type + DeleteRegKey HKCR "Notepad++_file" +SectionEnd + +Section un.UserManual + RMDir /r "$INSTDIR\user.manual" +SectionEnd + +Section Uninstall + ;Remove from registry... + DeleteRegKey HKLM "${UNINSTALL_REG_KEY}" + DeleteRegKey HKLM "SOFTWARE\${APPNAME}" + DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\notepad++.exe" + + ; Delete self + Delete "$INSTDIR\uninstall.exe" + + ; Delete Shortcuts + Delete "$SMPROGRAMS\Notepad++\Uninstall.lnk" + RMDir "$SMPROGRAMS\Notepad++" + + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" 0 +2 + SetShellVarContext all + + Delete "$DESKTOP\Notepad++.lnk" + Delete "$SMPROGRAMS\Notepad++\Notepad++.lnk" + Delete "$SMPROGRAMS\Notepad++\readme.lnk" + + + ; Clean up Notepad++ + Delete "$INSTDIR\LINEDRAW.TTF" + Delete "$INSTDIR\SciLexer.dll" + Delete "$INSTDIR\change.log" + Delete "$INSTDIR\LICENSE" + + Delete "$INSTDIR\notepad++.exe" + Delete "$INSTDIR\readme.txt" + + Delete "$INSTDIR\config.xml" + Delete "$INSTDIR\config.model.xml" + Delete "$INSTDIR\langs.xml" + Delete "$INSTDIR\langs.model.xml" + Delete "$INSTDIR\stylers.xml" + Delete "$INSTDIR\stylers.model.xml" + Delete "$INSTDIR\stylers_remove.xml" + Delete "$INSTDIR\contextMenu.xml" + Delete "$INSTDIR\shortcuts.xml" + Delete "$INSTDIR\functionList.xml" + Delete "$INSTDIR\nativeLang.xml" + Delete "$INSTDIR\session.xml" + Delete "$INSTDIR\localization\english.xml" + Delete "$INSTDIR\SourceCodePro-Regular.ttf" + Delete "$INSTDIR\SourceCodePro-Bold.ttf" + Delete "$INSTDIR\SourceCodePro-It.ttf" + Delete "$INSTDIR\SourceCodePro-BoldIt.ttf" + + SetShellVarContext current + Delete "$APPDATA\Notepad++\langs.xml" + Delete "$APPDATA\Notepad++\config.xml" + Delete "$APPDATA\Notepad++\stylers.xml" + Delete "$APPDATA\Notepad++\contextMenu.xml" + Delete "$APPDATA\Notepad++\shortcuts.xml" + Delete "$APPDATA\Notepad++\functionList.xml" + Delete "$APPDATA\Notepad++\nativeLang.xml" + Delete "$APPDATA\Notepad++\session.xml" + Delete "$APPDATA\Notepad++\insertExt.ini" + IfFileExists "$INSTDIR\NppHelp.chm" 0 +2 + Delete "$INSTDIR\NppHelp.chm" + + RMDir "$APPDATA\Notepad++" + + StrCmp $1 "Admin" 0 +2 + SetShellVarContext all + + ; Remove remaining directories + RMDir /r "$INSTDIR\plugins\disabled\" + RMDir "$INSTDIR\plugins\APIs\" + RMDir "$INSTDIR\plugins\" + RMDir "$INSTDIR\themes\" + RMDir "$INSTDIR\localization\" + RMDir "$INSTDIR\" + RMDir "$SMPROGRAMS\Notepad++" + RMDir "$APPDATA\Notepad++" + +SectionEnd + +Function un.onInit + !insertmacro MUI_UNGETLANGUAGE +FunctionEnd + +BrandingText "Don HO" + +; eof diff --git a/PowerEditor/Test/FunctionList/nsis/unitTest.expected.result b/PowerEditor/Test/FunctionList/nsis/unitTest.expected.result new file mode 100644 index 00000000..40fc3183 --- /dev/null +++ b/PowerEditor/Test/FunctionList/nsis/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["GetWindowsVersion","GetWindowsVersion OUTPUT_VALUE","LaunchNpp","ExtraOptions","OnChange_NoUserDataCheckBox","OnChange_PluginLoadFromUserDataCheckBox","OnChange_ShortcutCheckBox","OnChange_OldIconCheckBox",".onInit",".onInstSuccess","-\"Notepad++\" mainSection","\"Context Menu Entry\" explorerContextMenu","\"Auto-Updater\" AutoUpdater","-FinishSection","un.htmlViewer","un.AutoUpdater","un.explorerContextMenu","un.UnregisterFileExt","un.UserManual","Uninstall","un.onInit"],"nodes":[{"leaves":["\"C\" C","\"C++\" C++","\"Java\" Java","\"C","\"HTML\" HTML","\"RC\" RC","\"SQL\" SQL","\"PHP\" PHP","\"CSS\" CSS","\"VB\" VB","\"Perl\" Perl","\"JavaScript\" JavaScript","\"Python\" Python","\"ActionScript\" ActionScript","\"LISP\" LISP","\"VHDL\" VHDL","\"TeX\" TeX","\"DocBook\" DocBook","\"NSIS\" NSIS","\"CMAKE\" CMAKE"],"name":"Auto-completion Files"},{"leaves":["\"NppExport\" NppExport","\"Plugin Manager\" PluginManager","\"Mime Tools\" MimeTools","\"Converter\" Converter"],"name":"Plugins"},{"leaves":["\"Black Board\" BlackBoard","\"Choco\" Choco","\"Hello Kitty\" HelloKitty","\"Mono Industrial\" MonoIndustrial","\"Monokai\" Monokai","\"Obsidian\" Obsidian","\"Plastic Code Wrap\" PlasticCodeWrap","\"Ruby Blue\" RubyBlue","\"Twilight\" Twilight","\"Vibrant Ink\" VibrantInk","\"Deep Black\" DeepBlack","\"vim Dark Blue\" vimDarkBlue","\"Bespin\" Bespin","\"Zenburn\" Zenburn","\"Solarized\" Solarized","\"Solarized Light\" Solarized-light","\"Hot Fudge Sundae\" HotFudgeSundae","\"khaki\" khaki","\"Mossy Lawn\" MossyLawn","\"Navajo\" Navajo"],"name":"Themes"},{"leaves":["un.PHP","un.CSS","un.HTML","un.SQL","un.RC","un.VB","un.Perl","un.C","un.C++","un.Java","un.C","un.JavaScript","un.Python","un.ActionScript","un.LISP","un.VHDL","un.TeX","un.DocBook","un.NSIS","un.AWK","un.CMAKE"],"name":"un.autoCompletionComponent"},{"leaves":["un.NPPTextFX","un.NppAutoIndent","un.MIMETools","un.FTP_synchronize","un.NppFTP","un.NppExport","un.SelectNLaunch","un.DocMonitor","un.LightExplorer","un.HexEditor","un.ConvertExt","un.SpellChecker","un.DSpellCheck","un.NppExec","un.QuickText","un.ComparePlugin","un.Converter","un.MimeTools","un.PluginManager","un.ChangeMarkers"],"name":"un.Plugins"},{"leaves":["un.BlackBoard","un.Choco","un.HelloKitty","un.MonoIndustrial","un.Monokai","un.Obsidian","un.PlasticCodeWrap","un.RubyBlue","un.Twilight","un.VibrantInk","un.DeepBlack","un.vimDarkBlue","un.Bespin","un.Zenburn","un.Solarized","un.Solarized-light","un.HotFudgeSundae","un.khaki","un.MossyLawn","un.Navajo"],"name":"un.Themes"},{"leaves":["un.afrikaans","un.albanian","un.arabic","un.aragonese","un.aranese","un.azerbaijani","un.basque","un.belarusian","un.bengali","un.bosnian","un.brazilian_portuguese","un.bulgarian","un.catalan","un.chineseTraditional","un.chineseSimplified","un.croatian","un.czech","un.danish","un.dutch","un.english_customizable","un.esperanto","un.estonian","un.extremaduran","un.farsi","un.finnish","un.friulian","un.french","un.galician","un.georgian","un.german","un.greek","un.gujarati","un.hebrew","un.hungarian","un.hungarianA","un.indonesian","un.italian","un.japanese","un.kazakh","un.korean","un.kyrgyz","un.latvian","un.ligurian","un.lithuanian","un.luxembourgish","un.macedonian","un.malay","un.marathi","un.mongolian","un.norwegian","un.nynorsk","un.occitan","un.polish","un.kannada","un.portuguese","un.punjabi","un.romanian","un.russian","un.samogitian","un.sardinian","un.serbian","un.serbianCyrillic","un.sinhala","un.slovak","un.slovakA","un.slovenian","un.spanish","un.spanish_ar","un.swedish","un.tagalog","un.tajik","un.tamil","un.tatar","un.telugu","un.thai","un.turkish","un.ukrainian","un.urdu","un.uyghur","un.uzbek","un.uzbekCyrillic","un.vietnamese","un.welsh"],"name":"un.localization"}],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/perl/unitTest b/PowerEditor/Test/FunctionList/perl/unitTest new file mode 100644 index 00000000..6fe49bbc --- /dev/null +++ b/PowerEditor/Test/FunctionList/perl/unitTest @@ -0,0 +1,89 @@ +getTypeFromValue(); + switch ($strType) { + case 'TRANSACTION': + self::transactionNotification($code); + break; + case 'APPLICATION_AUTHORIZATION': + self::authorizationNotification($code); + break; + case 'PRE_APPROVAL': + self::preApprovalNotification($code); + break; + default: + LogPagSeguro::error("Unknown notification type [" . $notificationType->getValue() . "]"); + } + self::printLog($strType); + } else { + LogPagSeguro::error("Invalid notification parameters."); + self::printLog(); + } + } + private static function transactionNotification($notificationCode) + { + $credentials = PagSeguroConfig::getAccountCredentials(); + try { + $transaction = PagSeguroNotificationService::checkTransaction($credentials, $notificationCode); + // Do something with $transaction + } catch (PagSeguroServiceException $e) { + die($e->getMessage()); + } + } + private static function authorizationNotification($notificationCode) + { + $credentials = PagSeguroConfig::getApplicationCredentials(); + try { + $authorization = PagSeguroNotificationService::checkAuthorization($credentials, $notificationCode); + // Do something with $authorization + } catch (PagSeguroServiceException $e) { + die($e->getMessage()); + } + } + private static function preApprovalNotification($preApprovalCode) + { + $credentials = PagSeguroConfig::getAccountCredentials(); + try { + $preApproval = PagSeguroNotificationService::checkPreApproval($credentials, $preApprovalCode); + // Do something with $preApproval + + } catch (PagSeguroServiceException $e) { + die($e->getMessage()); + } + } + private static function printLog($strType = null) + { + $count = 4; + echo "

Receive notifications

"; + if ($strType) { + echo "

notifcationType: $strType

"; + } + echo "

Last $count items in log file:


"; + echo LogPagSeguro::getHtml($count); + } +} +NotificationListener::main(); \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/perl/unitTest.expected.result b/PowerEditor/Test/FunctionList/perl/unitTest.expected.result new file mode 100644 index 00000000..a576e185 --- /dev/null +++ b/PowerEditor/Test/FunctionList/perl/unitTest.expected.result @@ -0,0 +1 @@ +{"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/php/unitTest b/PowerEditor/Test/FunctionList/php/unitTest new file mode 100644 index 00000000..6fe49bbc --- /dev/null +++ b/PowerEditor/Test/FunctionList/php/unitTest @@ -0,0 +1,89 @@ +getTypeFromValue(); + switch ($strType) { + case 'TRANSACTION': + self::transactionNotification($code); + break; + case 'APPLICATION_AUTHORIZATION': + self::authorizationNotification($code); + break; + case 'PRE_APPROVAL': + self::preApprovalNotification($code); + break; + default: + LogPagSeguro::error("Unknown notification type [" . $notificationType->getValue() . "]"); + } + self::printLog($strType); + } else { + LogPagSeguro::error("Invalid notification parameters."); + self::printLog(); + } + } + private static function transactionNotification($notificationCode) + { + $credentials = PagSeguroConfig::getAccountCredentials(); + try { + $transaction = PagSeguroNotificationService::checkTransaction($credentials, $notificationCode); + // Do something with $transaction + } catch (PagSeguroServiceException $e) { + die($e->getMessage()); + } + } + private static function authorizationNotification($notificationCode) + { + $credentials = PagSeguroConfig::getApplicationCredentials(); + try { + $authorization = PagSeguroNotificationService::checkAuthorization($credentials, $notificationCode); + // Do something with $authorization + } catch (PagSeguroServiceException $e) { + die($e->getMessage()); + } + } + private static function preApprovalNotification($preApprovalCode) + { + $credentials = PagSeguroConfig::getAccountCredentials(); + try { + $preApproval = PagSeguroNotificationService::checkPreApproval($credentials, $preApprovalCode); + // Do something with $preApproval + + } catch (PagSeguroServiceException $e) { + die($e->getMessage()); + } + } + private static function printLog($strType = null) + { + $count = 4; + echo "

Receive notifications

"; + if ($strType) { + echo "

notifcationType: $strType

"; + } + echo "

Last $count items in log file:


"; + echo LogPagSeguro::getHtml($count); + } +} +NotificationListener::main(); \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/php/unitTest.expected.result b/PowerEditor/Test/FunctionList/php/unitTest.expected.result new file mode 100644 index 00000000..76a5e174 --- /dev/null +++ b/PowerEditor/Test/FunctionList/php/unitTest.expected.result @@ -0,0 +1 @@ +{"nodes":[{"leaves":["main","transactionNotification","authorizationNotification","preApprovalNotification","printLog"],"name":"NotificationListener"}],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/powershell/unitTest b/PowerEditor/Test/FunctionList/powershell/unitTest new file mode 100644 index 00000000..f2f960b4 --- /dev/null +++ b/PowerEditor/Test/FunctionList/powershell/unitTest @@ -0,0 +1,321 @@ +# +# PowerConsole profile +# + +<# +.SYNOPSIS + Clear the host content. + +.DESCRIPTION + This function replaces the standard Clear-Host and is aliased by "cls". +#> +function Clear-Host +{ + $host.PrivateData.ClearHost() +} + +<# +.SYNOPSIS + Simple path completion function for PowerConsole. +#> +function _TabExpansionPath($line) +{ + function UnquoteString($s) { + if ($s.StartsWith('"') -or $s.StartsWith("'")) { + $s = $s.Substring(1) + } + if ($s.EndsWith('"') -or $s.EndsWith("'")) { + $s = $s.Substring(0, $s.Length - 1) + } + return $s + } + + $e = $null + $tokens = @([System.Management.Automation.PSParser]::Tokenize($line, [ref]$e)) + $lastToken = $tokens | Select-Object -Last 1 + + $replaceStart = -1 + $lastWord = $null + + if ($lastToken -and ($lastToken.EndColumn -gt $line.Length)) { + #Last token is terminated + + if ($tokens.Length -gt 1) { + $prevToken = $tokens[$tokens.Length - 2] + if ($prevToken.EndColumn -eq $lastToken.StartColumn) { + $replaceStart = $prevToken.StartColumn - 1 + $lastWord = (UnquoteString $prevToken.Content) + (UnquoteString $lastToken.Content) + } + } + + if ($replaceStart -lt 0) { + $replaceStart = $lastToken.StartColumn - 1 + $lastWord = UnquoteString $lastToken.Content + } + } else { + #There is unrecognized/unterminated words + + if(!$lastToken) { + $lastWord = $line + } else { + $lastWord = $line.Substring($lastToken.EndColumn - 1).TrimStart() + } + $replaceStart = $line.Length - $lastWord.Length + $lastWord = UnquoteString $lastWord + } + + # If previously unquoted, put back quote in results + $unquoted = ($replaceStart -lt ($line.Length - $lastWord.Length)) + $relative = !(($lastWord.IndexOf(':') -ge 0) -or $lastWord.StartsWith('/') -or $lastWord.StartsWith('\')) + + $result = "" | select ReplaceStart, Paths + $result.ReplaceStart = $replaceStart + $result.Paths = @(Resolve-Path ${lastWord}* -ErrorAction SilentlyContinue -Relative:$relative | %{ + + # Resolve-Path may return PathInfo or String (e.g. when passing different -Relative) + $path = $_.ToString() + + if ($unquoted -or ($path.IndexOf(' ') -ge 0)) { + "'$path'" + } else { + $path + } + }) + + $result +} + +<# +.SYNOPSIS + Get an explict interface on an object so that you can invoke the interface members. + +.DESCRIPTION + PowerShell object adapter does not provide explict interface members. For COM objects + it only makes IDispatch members available. + + This function helps access interface members on an object through reflection. A new + object is returned with the interface members as ScriptProperties and ScriptMethods. + +.EXAMPLE + $dte2 = Get-Interface $dte ([EnvDTE80.DTE2]) +#> +function Get-Interface +{ + Param( + $Object, + [type]$InterfaceType + ) + + [NuGetConsole.Host.PowerShell.Implementation.PSTypeWrapper]::GetInterface($Object, $InterfaceType) +} + +<# +.SYNOPSIS + Get a VS service. + +.EXAMPLE + Get-VSService ([Microsoft.VisualStudio.Shell.Interop.SVsShell]) ([Microsoft.VisualStudio.Shell.Interop.IVsShell]) +#> +function Get-VSService +{ + Param( + [type]$ServiceType, + [type]$InterfaceType + ) + + $service = [Microsoft.VisualStudio.Shell.Package]::GetGlobalService($ServiceType) + if ($service -and $InterfaceType) { + $service = Get-Interface $service $InterfaceType + } + + $service +} + +<# +.SYNOPSIS + Get VS IComponentModel service to access VS MEF hosting. +#> +function Get-VSComponentModel +{ + Get-VSService ([Microsoft.VisualStudio.ComponentModelHost.SComponentModel]) ([Microsoft.VisualStudio.ComponentModelHost.IComponentModel]) +} + +# Set initial directory +Set-Location "$env:USERPROFILE" + +# For PowerShell v2, we need to create a reference to the default TabExpansion function +# so we can delegate back to it in our custom function. This isn't needed in PowerShell v3, +# as omitting output in a custom TabExpansion function signals to TabExpansion2 that it +# should use its own completion list. +if ((Test-Path Function:\DefaultTabExpansion) -eq $false -and (Test-Path Function:\TabExpansion)) { + Rename-Item Function:\TabExpansion DefaultTabExpansion +} + +function TabExpansion([string]$line, [string]$lastWord) { + $nugetSuggestions = & (Get-Module NuGet) NuGetTabExpansion $line $lastWord + + if ($nugetSuggestions.NoResult) { + # We only want to delegate back to the default tab completion in PowerShell v2. + # PowerShell v3's TabExpansion2 will use its own command completion list if the + # custom TabExpansion doesn't return anything. + if (Test-Path Function:\DefaultTabExpansion) { + $line = $line.ToUpperInvariant() + $lastWord = $lastWord.ToUpperInvariant() + return DefaultTabExpansion $line $lastWord + } + } + else { + return $nugetSuggestions + } +} + +# default prompt +function prompt { + "PM>" +} + +# SIG # Begin signature block +# MIIavQYJKoZIhvcNAQcCoIIarjCCGqoCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB +# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR +# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUzrybryeGjFQ1ndAZPspjCdvf +# ahSgghWCMIIEwzCCA6ugAwIBAgITMwAAAG9lLVhtBxFGKAAAAAAAbzANBgkqhkiG +# 9w0BAQUFADB3MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G +# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSEw +# HwYDVQQDExhNaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EwHhcNMTUwMzIwMTczMjAy +# WhcNMTYwNjIwMTczMjAyWjCBszELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hp +# bmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jw +# b3JhdGlvbjENMAsGA1UECxMETU9QUjEnMCUGA1UECxMebkNpcGhlciBEU0UgRVNO +# OkMwRjQtMzA4Ni1ERUY4MSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFtcCBT +# ZXJ2aWNlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+ZtzcEqza6o +# XtiVTy0DQ0dzO7hC0tBXmt32UzZ31YhFJGrIq9Bm6YvFqg+e8oNGtirJ2DbG9KD/ +# EW9m8F4UGbKxZ/jxXpSGqo4lr/g1E/2CL8c4XlPAdhzF03k7sGPrT5OaBfCiF3Hc +# xgyW0wAFLkxtWLN/tCwkcHuWaSxsingJbUmZjjo+ZpWPT394G2B7V8lR9EttUcM0 +# t/g6CtYR38M6pR6gONzrrar4Q8SDmo2XNAM0BBrvrVQ2pNQaLP3DbvB45ynxuUTA +# cbQvxBCLDPc2Ynn9B1d96gV8TJ9OMD8nUDhmBrtdqD7FkNvfPHZWrZUgNFNy7WlZ +# bvBUH0DVOQIDAQABo4IBCTCCAQUwHQYDVR0OBBYEFPKmSSl4fFdwUmLP7ay3eyA0 +# R9z9MB8GA1UdIwQYMBaAFCM0+NlSRnAK7UD7dvuzK7DDNbMPMFQGA1UdHwRNMEsw +# SaBHoEWGQ2h0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1Y3Rz +# L01pY3Jvc29mdFRpbWVTdGFtcFBDQS5jcmwwWAYIKwYBBQUHAQEETDBKMEgGCCsG +# AQUFBzAChjxodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY3Jv +# c29mdFRpbWVTdGFtcFBDQS5jcnQwEwYDVR0lBAwwCgYIKwYBBQUHAwgwDQYJKoZI +# hvcNAQEFBQADggEBAI2zTLbY7A2Hhhle5ADnl7jVz0wKPL33VdP08KCvVXKcI5e5 +# girHFgrFJxNZ0NowK4hCulID5l7JJWgnJ41kp235t5pqqz6sQtAeJCbMVK/2kIFr +# Hq1Dnxt7EFdqMjYxokRoAZhaKxK0iTH2TAyuFTy3JCRdu/98U0yExA3NRnd+Kcqf +# skZigrQ0x/USaVytec0x7ulHjvj8U/PkApBRa876neOFv1mAWRDVZ6NMpvLkoLTY +# wTqhakimiM5w9qmc3vNTkz1wcQD/vut8/P8IYw9LUVmrFRmQdB7/u72qNZs9nvMQ +# FNV69h/W4nXzknQNrRbZEs+hm63SEuoAOyMVDM8wggTsMIID1KADAgECAhMzAAAB +# Cix5rtd5e6asAAEAAAEKMA0GCSqGSIb3DQEBBQUAMHkxCzAJBgNVBAYTAlVTMRMw +# EQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVN +# aWNyb3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBDb2RlIFNp +# Z25pbmcgUENBMB4XDTE1MDYwNDE3NDI0NVoXDTE2MDkwNDE3NDI0NVowgYMxCzAJ +# BgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k +# MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xDTALBgNVBAsTBE1PUFIx +# HjAcBgNVBAMTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjCCASIwDQYJKoZIhvcNAQEB +# BQADggEPADCCAQoCggEBAJL8bza74QO5KNZG0aJhuqVG+2MWPi75R9LH7O3HmbEm +# UXW92swPBhQRpGwZnsBfTVSJ5E1Q2I3NoWGldxOaHKftDXT3p1Z56Cj3U9KxemPg +# 9ZSXt+zZR/hsPfMliLO8CsUEp458hUh2HGFGqhnEemKLwcI1qvtYb8VjC5NJMIEb +# e99/fE+0R21feByvtveWE1LvudFNOeVz3khOPBSqlw05zItR4VzRO/COZ+owYKlN +# Wp1DvdsjusAP10sQnZxN8FGihKrknKc91qPvChhIqPqxTqWYDku/8BTzAMiwSNZb +# /jjXiREtBbpDAk8iAJYlrX01boRoqyAYOCj+HKIQsaUCAwEAAaOCAWAwggFcMBMG +# A1UdJQQMMAoGCCsGAQUFBwMDMB0GA1UdDgQWBBSJ/gox6ibN5m3HkZG5lIyiGGE3 +# NDBRBgNVHREESjBIpEYwRDENMAsGA1UECxMETU9QUjEzMDEGA1UEBRMqMzE1OTUr +# MDQwNzkzNTAtMTZmYS00YzYwLWI2YmYtOWQyYjFjZDA1OTg0MB8GA1UdIwQYMBaA +# FMsR6MrStBZYAck3LjMWFrlMmgofMFYGA1UdHwRPME0wS6BJoEeGRWh0dHA6Ly9j +# cmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY0NvZFNpZ1BDQV8w +# OC0zMS0yMDEwLmNybDBaBggrBgEFBQcBAQROMEwwSgYIKwYBBQUHMAKGPmh0dHA6 +# Ly93d3cubWljcm9zb2Z0LmNvbS9wa2kvY2VydHMvTWljQ29kU2lnUENBXzA4LTMx +# LTIwMTAuY3J0MA0GCSqGSIb3DQEBBQUAA4IBAQCmqFOR3zsB/mFdBlrrZvAM2PfZ +# hNMAUQ4Q0aTRFyjnjDM4K9hDxgOLdeszkvSp4mf9AtulHU5DRV0bSePgTxbwfo/w +# iBHKgq2k+6apX/WXYMh7xL98m2ntH4LB8c2OeEti9dcNHNdTEtaWUu81vRmOoECT +# oQqlLRacwkZ0COvb9NilSTZUEhFVA7N7FvtH/vto/MBFXOI/Enkzou+Cxd5AGQfu +# FcUKm1kFQanQl56BngNb/ErjGi4FrFBHL4z6edgeIPgF+ylrGBT6cgS3C6eaZOwR +# XU9FSY0pGi370LYJU180lOAWxLnqczXoV+/h6xbDGMcGszvPYYTitkSJlKOGMIIF +# vDCCA6SgAwIBAgIKYTMmGgAAAAAAMTANBgkqhkiG9w0BAQUFADBfMRMwEQYKCZIm +# iZPyLGQBGRYDY29tMRkwFwYKCZImiZPyLGQBGRYJbWljcm9zb2Z0MS0wKwYDVQQD +# EyRNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTAwODMx +# MjIxOTMyWhcNMjAwODMxMjIyOTMyWjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMK +# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 +# IENvcnBvcmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQgQ29kZSBTaWduaW5nIFBD +# QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJyWVwZMGS/HZpgICBC +# mXZTbD4b1m/My/Hqa/6XFhDg3zp0gxq3L6Ay7P/ewkJOI9VyANs1VwqJyq4gSfTw +# aKxNS42lvXlLcZtHB9r9Jd+ddYjPqnNEf9eB2/O98jakyVxF3K+tPeAoaJcap6Vy +# c1bxF5Tk/TWUcqDWdl8ed0WDhTgW0HNbBbpnUo2lsmkv2hkL/pJ0KeJ2L1TdFDBZ +# +NKNYv3LyV9GMVC5JxPkQDDPcikQKCLHN049oDI9kM2hOAaFXE5WgigqBTK3S9dP +# Y+fSLWLxRT3nrAgA9kahntFbjCZT6HqqSvJGzzc8OJ60d1ylF56NyxGPVjzBrAlf +# A9MCAwEAAaOCAV4wggFaMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMsR6MrS +# tBZYAck3LjMWFrlMmgofMAsGA1UdDwQEAwIBhjASBgkrBgEEAYI3FQEEBQIDAQAB +# MCMGCSsGAQQBgjcVAgQWBBT90TFO0yaKleGYYDuoMW+mPLzYLTAZBgkrBgEEAYI3 +# FAIEDB4KAFMAdQBiAEMAQTAfBgNVHSMEGDAWgBQOrIJgQFYnl+UlE/wq4QpTlVnk +# pDBQBgNVHR8ESTBHMEWgQ6BBhj9odHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtp +# L2NybC9wcm9kdWN0cy9taWNyb3NvZnRyb290Y2VydC5jcmwwVAYIKwYBBQUHAQEE +# SDBGMEQGCCsGAQUFBzAChjhodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2Nl +# cnRzL01pY3Jvc29mdFJvb3RDZXJ0LmNydDANBgkqhkiG9w0BAQUFAAOCAgEAWTk+ +# fyZGr+tvQLEytWrrDi9uqEn361917Uw7LddDrQv+y+ktMaMjzHxQmIAhXaw9L0y6 +# oqhWnONwu7i0+Hm1SXL3PupBf8rhDBdpy6WcIC36C1DEVs0t40rSvHDnqA2iA6VW +# 4LiKS1fylUKc8fPv7uOGHzQ8uFaa8FMjhSqkghyT4pQHHfLiTviMocroE6WRTsgb +# 0o9ylSpxbZsa+BzwU9ZnzCL/XB3Nooy9J7J5Y1ZEolHN+emjWFbdmwJFRC9f9Nqu +# 1IIybvyklRPk62nnqaIsvsgrEA5ljpnb9aL6EiYJZTiU8XofSrvR4Vbo0HiWGFzJ +# NRZf3ZMdSY4tvq00RBzuEBUaAF3dNVshzpjHCe6FDoxPbQ4TTj18KUicctHzbMrB +# 7HCjV5JXfZSNoBtIA1r3z6NnCnSlNu0tLxfI5nI3EvRvsTxngvlSso0zFmUeDord +# EN5k9G/ORtTTF+l5xAS00/ss3x+KnqwK+xMnQK3k+eGpf0a7B2BHZWBATrBC7E7t +# s3Z52Ao0CW0cgDEf4g5U3eWh++VHEK1kmP9QFi58vwUheuKVQSdpw5OPlcmN2Jsh +# rg1cnPCiroZogwxqLbt2awAdlq3yFnv2FoMkuYjPaqhHMS+a3ONxPdcAfmJH0c6I +# ybgY+g5yjcGjPa8CQGr/aZuW4hCoELQ3UAjWwz0wggYHMIID76ADAgECAgphFmg0 +# AAAAAAAcMA0GCSqGSIb3DQEBBQUAMF8xEzARBgoJkiaJk/IsZAEZFgNjb20xGTAX +# BgoJkiaJk/IsZAEZFgltaWNyb3NvZnQxLTArBgNVBAMTJE1pY3Jvc29mdCBSb290 +# IENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0wNzA0MDMxMjUzMDlaFw0yMTA0MDMx +# MzAzMDlaMHcxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYD +# VQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xITAf +# BgNVBAMTGE1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQTCCASIwDQYJKoZIhvcNAQEB +# BQADggEPADCCAQoCggEBAJ+hbLHf20iSKnxrLhnhveLjxZlRI1Ctzt0YTiQP7tGn +# 0UytdDAgEesH1VSVFUmUG0KSrphcMCbaAGvoe73siQcP9w4EmPCJzB/LMySHnfL0 +# Zxws/HvniB3q506jocEjU8qN+kXPCdBer9CwQgSi+aZsk2fXKNxGU7CG0OUoRi4n +# rIZPVVIM5AMs+2qQkDBuh/NZMJ36ftaXs+ghl3740hPzCLdTbVK0RZCfSABKR2YR +# JylmqJfk0waBSqL5hKcRRxQJgp+E7VV4/gGaHVAIhQAQMEbtt94jRrvELVSfrx54 +# QTF3zJvfO4OToWECtR0Nsfz3m7IBziJLVP/5BcPCIAsCAwEAAaOCAaswggGnMA8G +# A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFCM0+NlSRnAK7UD7dvuzK7DDNbMPMAsG +# A1UdDwQEAwIBhjAQBgkrBgEEAYI3FQEEAwIBADCBmAYDVR0jBIGQMIGNgBQOrIJg +# QFYnl+UlE/wq4QpTlVnkpKFjpGEwXzETMBEGCgmSJomT8ixkARkWA2NvbTEZMBcG +# CgmSJomT8ixkARkWCW1pY3Jvc29mdDEtMCsGA1UEAxMkTWljcm9zb2Z0IFJvb3Qg +# Q2VydGlmaWNhdGUgQXV0aG9yaXR5ghB5rRahSqClrUxzWPQHEy5lMFAGA1UdHwRJ +# MEcwRaBDoEGGP2h0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1 +# Y3RzL21pY3Jvc29mdHJvb3RjZXJ0LmNybDBUBggrBgEFBQcBAQRIMEYwRAYIKwYB +# BQUHMAKGOGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2kvY2VydHMvTWljcm9z +# b2Z0Um9vdENlcnQuY3J0MBMGA1UdJQQMMAoGCCsGAQUFBwMIMA0GCSqGSIb3DQEB +# BQUAA4ICAQAQl4rDXANENt3ptK132855UU0BsS50cVttDBOrzr57j7gu1BKijG1i +# uFcCy04gE1CZ3XpA4le7r1iaHOEdAYasu3jyi9DsOwHu4r6PCgXIjUji8FMV3U+r +# kuTnjWrVgMHmlPIGL4UD6ZEqJCJw+/b85HiZLg33B+JwvBhOnY5rCnKVuKE5nGct +# xVEO6mJcPxaYiyA/4gcaMvnMMUp2MT0rcgvI6nA9/4UKE9/CCmGO8Ne4F+tOi3/F +# NSteo7/rvH0LQnvUU3Ih7jDKu3hlXFsBFwoUDtLaFJj1PLlmWLMtL+f5hYbMUVbo +# nXCUbKw5TNT2eb+qGHpiKe+imyk0BncaYsk9Hm0fgvALxyy7z0Oz5fnsfbXjpKh0 +# NbhOxXEjEiZ2CzxSjHFaRkMUvLOzsE1nyJ9C/4B5IYCeFTBm6EISXhrIniIh0EPp +# K+m79EjMLNTYMoBMJipIJF9a6lbvpt6Znco6b72BJ3QGEe52Ib+bgsEnVLaxaj2J +# oXZhtG6hE6a/qkfwEm/9ijJssv7fUciMI8lmvZ0dhxJkAj0tr1mPuOQh5bWwymO0 +# eFQF1EEuUKyUsKV4q7OglnUa2ZKHE3UiLzKoCG6gW4wlv6DvhMoh1useT8ma7kng +# 9wFlb4kLfchpyOZu6qeXzjEp/w7FW1zYTRuh2Povnj8uVRZryROj/TGCBKUwggSh +# AgEBMIGQMHkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYD +# VQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xIzAh +# BgNVBAMTGk1pY3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBAhMzAAABCix5rtd5e6as +# AAEAAAEKMAkGBSsOAwIaBQCggb4wGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQw +# HAYKKwYBBAGCNwIBCzEOMAwGCisGAQQBgjcCARUwIwYJKoZIhvcNAQkEMRYEFMuf +# sd32QCBuLAAV0rkqW6bKVWYSMF4GCisGAQQBgjcCAQwxUDBOoDSAMgBNAGkAYwBy +# AG8AcwBvAGYAdAAgAFAAYQBjAGsAYQBnAGUAIABNAGEAbgBhAGcAZQByoRaAFGh0 +# dHA6Ly93d3cuYXNwLm5ldC8gMA0GCSqGSIb3DQEBAQUABIIBAHRB+qXSplgnW2vY +# I0FrM1HeCaNpmZW0Y8ogeq+udpcfvuY5ma2j7aCZEd7ZX8CrEsSWnfFMSBMg6ThO +# oUxRbEDV46WIbWC3sm9IKFQyHZ+JOyTPlYPDHyCl8xldPE2Vm50ZWMFifP9lo3Cd +# 05gM21MP5jsNnWlU0SpHMgEup+2y7kf/7vyqVQD/hJzAt0M8R3eeFbANCbnGtShK +# xgXt5oZaL37x1QqBcrYGlUKZ/T3fVhMSq0Azsjz4MKgpsDyNt6dKHwuBHqrpeG5Q +# 2zMlAU1KT4ychtzPoIEyg7mDZBXFSebYD3FRGNr40QQP5ssZNp4aYkPc+OBbhZVN +# qECrNN6hggIoMIICJAYJKoZIhvcNAQkGMYICFTCCAhECAQEwgY4wdzELMAkGA1UE +# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc +# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8GA1UEAxMYTWljcm9zb2Z0 +# IFRpbWUtU3RhbXAgUENBAhMzAAAAb2UtWG0HEUYoAAAAAABvMAkGBSsOAwIaBQCg +# XTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xNTA2 +# MjQyMjUwNThaMCMGCSqGSIb3DQEJBDEWBBS3xuq3t+Yhu0yNOu+21zKtvYUE7DAN +# BgkqhkiG9w0BAQUFAASCAQCMFelTEi4zOXfdU6BBbGdP9O3MhBsgOrzG7cTJuZnG +# EYy9vvEafoyPg7hI07CXBRxkqOzo6YAYw3OiX7NuGYXb6wpfK38c6ub9UB2+MNay +# 6BbOyNIkFCqdGycIpyfWZgGNGjLVtZ/uAx0pCis6dSVFor+e+rVemjkeDyS4r9Jd +# XThMKXiuAljaQwWJGSRpwxHaBfa9bS4RV5PU0GvR6WGi+fEGZ9w8ujW2kW7/kH0e +# i2Gxzsgjd9yxw04IDt6swr2/iXw7TTU1RU1Wwb/BPlVMfW4oxvzJtDQUAVI2KsBL +# +dMO7jCcLk5rnY66+3WrxXsLmudCDm54BbOPn/mmZO1P +# SIG # End signature block diff --git a/PowerEditor/Test/FunctionList/powershell/unitTest.expected.result b/PowerEditor/Test/FunctionList/powershell/unitTest.expected.result new file mode 100644 index 00000000..f8d19112 --- /dev/null +++ b/PowerEditor/Test/FunctionList/powershell/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["Clear-Host","_TabExpansionPath","UnquoteString","Get-Interface","Get-VSService","Get-VSComponentModel","TabExpansion","prompt"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/python/unitTest b/PowerEditor/Test/FunctionList/python/unitTest new file mode 100644 index 00000000..1fd6e5ce --- /dev/null +++ b/PowerEditor/Test/FunctionList/python/unitTest @@ -0,0 +1,280 @@ +from __future__ import print_function + +try: + raw_input # Python 2 +except NameError: + raw_input = input # Python 3 + +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 + +# Accept No. of Nodes and edges +n, m = map(int, raw_input().split(" ")) + +# Initialising Dictionary of edges +g = {} +for i in xrange(n): + g[i + 1] = [] + +""" +-------------------------------------------------------------------------------- + Accepting edges of Unweighted Directed Graphs +-------------------------------------------------------------------------------- +""" +for _ in xrange(m): + x, y = map(int, raw_input().split(" ")) + g[x].append(y) + +""" +-------------------------------------------------------------------------------- + Accepting edges of Unweighted Undirected Graphs +-------------------------------------------------------------------------------- +""" +for _ in xrange(m): + x, y = map(int, raw_input().split(" ")) + g[x].append(y) + g[y].append(x) + +""" +-------------------------------------------------------------------------------- + Accepting edges of Weighted Undirected Graphs +-------------------------------------------------------------------------------- +""" +for _ in xrange(m): + x, y, r = map(int, raw_input().split(" ")) + g[x].append([y, r]) + g[y].append([x, r]) + +""" +-------------------------------------------------------------------------------- + Depth First Search. + Args : G - Dictionary of edges + s - Starting Node + Vars : vis - Set of visited nodes + S - Traversal Stack +-------------------------------------------------------------------------------- +""" + + +def dfs(G, s): + vis, S = set([s]), [s] + print(s) + while S: + flag = 0 + for i in G[S[-1]]: + if i not in vis: + S.append(i) + vis.add(i) + flag = 1 + print(i) + break + if not flag: + S.pop() + + +""" +-------------------------------------------------------------------------------- + Breadth First Search. + Args : G - Dictionary of edges + s - Starting Node + Vars : vis - Set of visited nodes + Q - Traveral Stack +-------------------------------------------------------------------------------- +""" +from collections import deque + + +def bfs(G, s): + vis, Q = set([s]), deque([s]) + print(s) + while Q: + u = Q.popleft() + for v in G[u]: + if v not in vis: + vis.add(v) + Q.append(v) + print(v) + + +""" +-------------------------------------------------------------------------------- + Dijkstra's shortest path Algorithm + Args : G - Dictionary of edges + s - Starting Node + Vars : dist - Dictionary storing shortest distance from s to every other node + known - Set of knows nodes + path - Preceding node in path +-------------------------------------------------------------------------------- +""" + + +def dijk(G, s): + dist, known, path = {s: 0}, set(), {s: 0} + while True: + if len(known) == len(G) - 1: + break + mini = 100000 + for i in dist: + if i not in known and dist[i] < mini: + mini = dist[i] + u = i + known.add(u) + for v in G[u]: + if v[0] not in known: + if dist[u] + v[1] < dist.get(v[0], 100000): + dist[v[0]] = dist[u] + v[1] + path[v[0]] = u + for i in dist: + if i != s: + print(dist[i]) + + +""" +-------------------------------------------------------------------------------- + Topological Sort +-------------------------------------------------------------------------------- +""" +from collections import deque + + +def topo(G, ind=None, Q=[1]): + if ind == None: + ind = [0] * (len(G) + 1) # SInce oth Index is ignored + for u in G: + for v in G[u]: + ind[v] += 1 + Q = deque() + for i in G: + if ind[i] == 0: + Q.append(i) + if len(Q) == 0: + return + v = Q.popleft() + print(v) + for w in G[v]: + ind[w] -= 1 + if ind[w] == 0: + Q.append(w) + topo(G, ind, Q) + + +""" +-------------------------------------------------------------------------------- + Reading an Adjacency matrix +-------------------------------------------------------------------------------- +""" + + +def adjm(): + n, a = input(), [] + for i in xrange(n): + a.append(map(int, raw_input().split())) + return a, n + + +""" +-------------------------------------------------------------------------------- + Floyd Warshall's algorithm + Args : G - Dictionary of edges + s - Starting Node + Vars : dist - Dictionary storing shortest distance from s to every other node + known - Set of knows nodes + path - Preceding node in path +-------------------------------------------------------------------------------- +""" + + +def floy(A_and_n): + (A, n) = A_and_n + dist = list(A) + path = [[0] * n for i in xrange(n)] + for k in xrange(n): + for i in xrange(n): + for j in xrange(n): + if dist[i][j] > dist[i][k] + dist[k][j]: + dist[i][j] = dist[i][k] + dist[k][j] + path[i][k] = k + print(dist) + + +""" +-------------------------------------------------------------------------------- + Prim's MST Algorithm + Args : G - Dictionary of edges + s - Starting Node + Vars : dist - Dictionary storing shortest distance from s to nearest node + known - Set of knows nodes + path - Preceding node in path +-------------------------------------------------------------------------------- +""" + + +def prim(G, s): + dist, known, path = {s: 0}, set(), {s: 0} + while True: + if len(known) == len(G) - 1: + break + mini = 100000 + for i in dist: + if i not in known and dist[i] < mini: + mini = dist[i] + u = i + known.add(u) + for v in G[u]: + if v[0] not in known: + if v[1] < dist.get(v[0], 100000): + dist[v[0]] = v[1] + path[v[0]] = u + + +""" +-------------------------------------------------------------------------------- + Accepting Edge list + Vars : n - Number of nodes + m - Number of edges + Returns : l - Edge list + n - Number of Nodes +-------------------------------------------------------------------------------- +""" + + +def edglist(): + n, m = map(int, raw_input().split(" ")) + l = [] + for i in xrange(m): + l.append(map(int, raw_input().split(' '))) + return l, n + + +""" +-------------------------------------------------------------------------------- + Kruskal's MST Algorithm + Args : E - Edge list + n - Number of Nodes + Vars : s - Set of all nodes as unique disjoint sets (initially) +-------------------------------------------------------------------------------- +""" + + +def krusk(E_and_n): + # Sort edges on the basis of distance + (E, n) = E_and_n + E.sort(reverse=True, key=lambda x: x[2]) + s = [set([i]) for i in range(1, n + 1)] + while True: + if len(s) == 1: + break + print(s) + x = E.pop() + for i in xrange(len(s)): + if x[0] in s[i]: + break + for j in xrange(len(s)): + if x[1] in s[j]: + if i == j: + break + s[j].update(s[i]) + s.pop(i) + break \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/python/unitTest.expected.result b/PowerEditor/Test/FunctionList/python/unitTest.expected.result new file mode 100644 index 00000000..6e1c5822 --- /dev/null +++ b/PowerEditor/Test/FunctionList/python/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["dfs(G, s)","bfs(G, s)","dijk(G, s)","topo(G, ind=None, Q=[1])","adjm()","floy(A_and_n)","prim(G, s)","edglist()","krusk(E_and_n)"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/ruby/unitTest b/PowerEditor/Test/FunctionList/ruby/unitTest new file mode 100644 index 00000000..4839e6c2 --- /dev/null +++ b/PowerEditor/Test/FunctionList/ruby/unitTest @@ -0,0 +1,124 @@ +#!/usr/local/bin/ruby +# +# biorhythm.rb - +# $Release Version: $ +# $Revision$ +# by Yasuo OHBA(STAFS Development Room) +# +# -- +# +# +# + +# probably based on: +# +# Newsgroups: comp.sources.misc,de.comp.sources.os9 +# From: fkk@stasys.sta.sub.org (Frank Kaefer) +# Subject: v41i126: br - Biorhythm v3.0, Part01/01 +# Message-ID: <1994Feb1.070616.15982@sparky.sterling.com> +# Sender: kent@sparky.sterling.com (Kent Landfield) +# Organization: Sterling Software +# Date: Tue, 1 Feb 1994 07:06:16 GMT +# +# Posting-number: Volume 41, Issue 126 +# Archive-name: br/part01 +# Environment: basic, dos, os9 + +include Math +require "date.rb" +require "optparse" +require "optparse/date" + +def print_header(y, m, d, p, w) + print "\n>>> Biorhythm <<<\n" + printf "The birthday %04d.%02d.%02d is a %s\n", y, m, d, w + printf "Age in days: [%d]\n\n", p +end + +def get_position(z) + pi = Math::PI + z = Integer(z) + phys = (50.0 * (1.0 + sin((z / 23.0 - (z / 23)) * 360.0 * pi / 180.0))).to_i + emot = (50.0 * (1.0 + sin((z / 28.0 - (z / 28)) * 360.0 * pi / 180.0))).to_i + geist =(50.0 * (1.0 + sin((z / 33.0 - (z / 33)) * 360.0 * pi / 180.0))).to_i + return phys, emot, geist +end + +def prompt(msg) + $stderr.print msg + return gets.chomp +end + +# +# main program +# +options = { + :graph => true, + :date => Date.today, + :days => 9, +} +ARGV.options do |opts| + opts.on("-b", "--birthday=DATE", Date, "specify your birthday"){|v| + options[:birthday] = v + } + opts.on("--date=DATE", Date, "specify date to show"){|v| + options[:date] = v + } + opts.on("-g", "--show-graph", TrueClass, "show graph (default)"){|v| + options[:graph] = v + } + opts.on("-v", "--show-values", TrueClass, "show values"){|v| + options[:graph] = !v + } + opts.on("--days=DAYS", Integer, "graph range (only in effect for graph)"){|v| + options[:days] = v - 1 + } + opts.on_tail("-h", "--help", "show this message"){puts opts; exit} + begin + opts.parse! + rescue => ex + puts "Error: #{ex.message}" + puts opts + exit + end +end + +bd = options[:birthday] || Date.parse(prompt("Your birthday (YYYYMMDD): ")) +dd = options[:date] || Date.today +ausgabeart = options[:graph] ? "g" : "v" +display_period = options[:days] + +if ausgabeart == "v" + print_header(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a")) + print "\n" + + phys, emot, geist = get_position(dd - bd) + printf "Biorhythm: %04d.%02d.%02d\n", dd.year, dd.month, dd.day + printf "Physical: %d%%\n", phys + printf "Emotional: %d%%\n", emot + printf "Mental: %d%%\n", geist + print "\n" +else + print_header(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a")) + print " P=physical, E=emotional, M=mental\n" + print " -------------------------+-------------------------\n" + print " Bad Condition | Good Condition\n" + print " -------------------------+-------------------------\n" + + (dd - bd).step(dd - bd + display_period) do |z| + phys, emot, geist = get_position(z) + + printf "%04d.%02d.%02d : ", dd.year, dd.month, dd.day + p = (phys / 2.0 + 0.5).to_i + e = (emot / 2.0 + 0.5).to_i + g = (geist / 2.0 + 0.5).to_i + graph = "." * 51 + graph[25] = ?| + graph[p] = ?P + graph[e] = ?E + graph[g] = ?M + print graph, "\n" + dd = dd + 1 + end + print " -------------------------+-------------------------\n\n" +end \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/ruby/unitTest.expected.result b/PowerEditor/Test/FunctionList/ruby/unitTest.expected.result new file mode 100644 index 00000000..7fc1994e --- /dev/null +++ b/PowerEditor/Test/FunctionList/ruby/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["print_header","get_position","prompt"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 b/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 new file mode 100644 index 00000000..7298f009 --- /dev/null +++ b/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 @@ -0,0 +1,46 @@ +..\..\bin\notepad++.exe -export=functionList -lasm .\asm\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lautoit .\autoit\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lbash .\bash\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lbatch .\batch\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lc .\c\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lcpp .\cpp\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lcs .\cs\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lini .\ini\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -linno .\inno\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -ljava .\java\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -ljavascript .\javascript\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lnsis .\nsis\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lperl .\perl\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lphp .\php\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lpowershell .\powershell\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lpython .\python\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lruby .\ruby\unitTest | Out-Null +..\..\bin\notepad++.exe -export=functionList -lxml .\xml\unitTest | Out-Null + + +$testRoot = ".\" + +Get-ChildItem $testRoot -Filter *.* | +Foreach-Object { + if ((Get-Item $testRoot$_) -is [System.IO.DirectoryInfo]) + { + $expectedRes = Get-Content $testRoot$_\unitTest.expected.result + $generatedRes = Get-Content $testRoot$_\unitTest.result.json + + if ($generatedRes -eq $expectedRes) + { + Remove-Item $testRoot$_\unitTest.result.json + "" + "OK" + } + else + { + "$generatedRes" + exit -1 + } + + } +} + +exit 0 + diff --git a/PowerEditor/Test/FunctionList/xml/unitTest b/PowerEditor/Test/FunctionList/xml/unitTest new file mode 100644 index 00000000..074381c7 --- /dev/null +++ b/PowerEditor/Test/FunctionList/xml/unitTest @@ -0,0 +1,58 @@ + + + + standard + show + + vertical + hide + + + no + yes + no + no + yes + yes + yes + yes + + + + + yes + yes + 2 + + + + + + show + + + + + + + + + + + yes + + + + + + + + + + + + + + + + diff --git a/PowerEditor/Test/FunctionList/xml/unitTest.expected.result b/PowerEditor/Test/FunctionList/xml/unitTest.expected.result new file mode 100644 index 00000000..402f3c72 --- /dev/null +++ b/PowerEditor/Test/FunctionList/xml/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["GUIConfig name=\"ToolBar\" visible=\"yes\"","GUIConfig name=\"StatusBar\"","GUIConfig name=\"TabBar\" dragAndDrop=\"yes\" drawTopBar=\"yes\" drawInactiveTab=\"yes\" reduce=\"yes\" closeButton=\"yes\" doubleClick2Close=\"no\" vertical=\"no\" multiLine=\"no\" hide=\"no\" quitOnEmpty=\"no\"","GUIConfig name=\"ScintillaViewsSplitter\"","GUIConfig name=\"UserDefineDlg\" position=\"undocked\"","GUIConfig name=\"TabSetting\" replaceBySpace=\"no\" size=\"4\"","GUIConfig name=\"AppPosition\" x=\"0\" y=\"0\" width=\"1100\" height=\"700\" isMaximized=\"no\"","GUIConfig name=\"noUpdate\" intervalDays=\"15\" nextUpdateDate=\"20180427\"","GUIConfig name=\"Auto-detection\"","GUIConfig name=\"CheckHistoryFiles\"","GUIConfig name=\"TrayIcon\"","GUIConfig name=\"MaitainIndent\"","GUIConfig name=\"TagsMatchHighLight\" TagAttrHighLight=\"yes\" HighLightNonHtmlZone=\"no\"","GUIConfig name=\"RememberLastSession\"","GUIConfig name=\"DetectEncoding\"","GUIConfig name=\"NewDocDefaultSettings\" format=\"0\" encoding=\"4\" lang=\"0\" codepage=\"-1\" openAnsiAsUTF8=\"yes\"","GUIConfig name=\"langsExcluded\" gr0=\"0\" gr1=\"0\" gr2=\"0\" gr3=\"0\" gr4=\"0\" gr5=\"0\" gr6=\"0\" gr7=\"0\" gr8=\"0\" gr9=\"0\" gr10=\"0\" gr11=\"0\" gr12=\"0\" langMenuCompact=\"yes\"","GUIConfig name=\"Print\" lineNumber=\"yes\" printOption=\"3\" headerLeft=\"\" headerMiddle=\"\" headerRight=\"\" footerLeft=\"\" footerMiddle=\"\" footerRight=\"\" headerFontName=\"\" headerFontStyle=\"0\" headerFontSize=\"0\" footerFontName=\"\" footerFontStyle=\"0\" footerFontSize=\"0\" margeLeft=\"0\" margeRight=\"0\" margeTop=\"0\" margeBottom=\"0\"","GUIConfig name=\"Backup\" action=\"0\" useCustumDir=\"no\" dir=\"\" isSnapshotMode=\"yes\" snapshotBackupTiming=\"7000\"","GUIConfig name=\"TaskList\"","GUIConfig name=\"MRU\"","GUIConfig name=\"URL\"","GUIConfig name=\"globalOverride\" fg=\"no\" bg=\"no\" font=\"no\" fontSize=\"no\" bold=\"no\" italic=\"no\" underline=\"no\"","GUIConfig name=\"auto-completion\" autoCAction=\"3\" triggerFromNbChar=\"1\" autoCIgnoreNumbers=\"yes\" funcParams=\"yes\"","GUIConfig name=\"auto-insert\" parentheses=\"no\" brackets=\"no\" curlyBrackets=\"no\" quotes=\"no\" doubleQuotes=\"no\" htmlXmlTag=\"no\"","GUIConfig name=\"sessionExt\"","GUIConfig name=\"workspaceExt\"","GUIConfig name=\"MenuBar\"","GUIConfig name=\"Caret\" width=\"1\" blinkRate=\"600\"","GUIConfig name=\"ScintillaGlobalSettings\" enableMultiSelection=\"no\"","GUIConfig name=\"openSaveDir\" value=\"0\" defaultDirPath=\"\"","GUIConfig name=\"titleBar\" short=\"no\"","GUIConfig name=\"stylerTheme\" path=\"C:\\sources\\notepad-plus-plus\\PowerEditor\\bin\\stylers.xml\"","GUIConfig name=\"wordCharList\" useDefault=\"yes\" charsAdded=\"\"","GUIConfig name=\"delimiterSelection\" leftmostDelimiter=\"40\" rightmostDelimiter=\"41\" delimiterSelectionOnEntireDocument=\"no\"","GUIConfig name=\"multiInst\" setting=\"0\"","GUIConfig name=\"MISC\" fileSwitcherWithoutExtColumn=\"no\" backSlashIsEscapeCharacterForSql=\"yes\" newStyleSaveDlg=\"no\" isFolderDroppedOpenFiles=\"no\" docPeekOnTab=\"no\" docPeekOnMap=\"no\"","GUIConfig name=\"searchEngine\" searchEngineChoice=\"2\" searchEngineCustom=\"\"","GUIConfig name=\"SmartHighLight\" matchCase=\"no\" wholeWordOnly=\"yes\" useFindSettings=\"no\" onAnotherView=\"no\"","GUIConfig name=\"ScintillaPrimaryView\" lineNumberMargin=\"show\" bookMarkMargin=\"show\" indentGuideLine=\"show\" folderMarkStyle=\"box\" lineWrapMethod=\"aligned\" currentLineHilitingShow=\"show\" scrollBeyondLastLine=\"no\" disableAdvancedScrolling=\"no\" wrapSymbolShow=\"hide\" Wrap=\"no\" borderEdge=\"yes\" edge=\"no\" edgeNbColumn=\"80\" zoom=\"0\" zoom2=\"0\" whiteSpaceShow=\"hide\" eolShow=\"hide\" borderWidth=\"2\" smoothFont=\"no\"","GUIConfig name=\"DockingManager\" leftWidth=\"200\" rightWidth=\"200\" topHeight=\"200\" bottomHeight=\"200\"","ActiveTabs cont=\"0\" activeTab=\"-1\"","ActiveTabs cont=\"1\" activeTab=\"-1\"","ActiveTabs cont=\"2\" activeTab=\"-1\"","ActiveTabs cont=\"3\" activeTab=\"-1\"","FindHistory nbMaxFindHistoryPath=\"10\" nbMaxFindHistoryFilter=\"10\" nbMaxFindHistoryFind=\"10\" nbMaxFindHistoryReplace=\"10\" matchWord=\"no\" matchCase=\"no\" wrap=\"yes\" directionDown=\"yes\" fifRecuisive=\"yes\" fifInHiddenFolder=\"no\" dlgAlwaysVisible=\"no\" fifFilterFollowsDoc=\"no\" fifFolderFollowsDoc=\"no\" searchMode=\"0\" transparencyMode=\"1\" transparency=\"150\" dotMatchesNewline=\"no\" isSearch2ButtonsMode=\"no\"","History nbMaxFile=\"10\" inSubMenu=\"no\" customLength=\"-1\"","ProjectPanel id=\"0\" workSpaceFile=\"\"","ProjectPanel id=\"1\" workSpaceFile=\"\"","ProjectPanel id=\"2\" workSpaceFile=\"\""],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/src/functionList.xml b/PowerEditor/src/functionList.xml index 93cb451d..abda83a0 100644 --- a/PowerEditor/src/functionList.xml +++ b/PowerEditor/src/functionList.xml @@ -76,7 +76,6 @@ - @@ -89,6 +88,7 @@ + @@ -572,93 +572,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - +