📄 nppsetup.nsi.svn-base
字号:
;this file is part of installer for Notepad++
;Copyright (C)2006 Don HO <don.h@free.fr>
;
;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.
; Define the application name
!define APPNAME "Notepad++"
!define APPNAMEANDVERSION "Notepad++ v4.2"
; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Notepad++"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "..\bin\npp.4.2.Installer.exe"
; GetWindowsVersion
;
; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
; Updated by Joost Verburg
;
; Returns on top of stack
;
; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista)
; or
; '' (Unknown Windows Version)
;
; Usage:
; Call GetWindowsVersion
; Pop $R0
; ; at this point $R0 is "NT 4.0" or whatnot
Function GetWindowsVersion
Push $R0
Push $R1
ClearErrors
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 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_error:
Strcpy $R0 ''
lbl_done:
Pop $R1
Exch $R0
FunctionEnd
; Modern interface settings
!include "MUI.nsh"
!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
!define MUI_FINISHPAGE_RUN "$INSTDIR\notepad++.exe"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\license.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Set languages (first is default language)
;!insertmacro MUI_LANGUAGE "English"
;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 "Thai"
;!insertmacro MUI_LANGUAGE "Latvian"
;!insertmacro MUI_LANGUAGE "Macedonian"
;!insertmacro MUI_LANGUAGE "Estonian"
;!insertmacro MUI_LANGUAGE "Serbian"
;
!insertmacro MUI_RESERVEFILE_LANGDLL
;Installer Functions
Function .onInit
!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.
FunctionEnd
LangString langFileName ${LANG_ENGLISH} "english.xml"
LangString langFileName ${LANG_FRENCH} "french.xml"
LangString langFileName ${LANG_TRADCHINESE} "chinese.xml"
LangString langFileName ${LANG_GERMAN} "german.xml"
LangString langFileName ${LANG_SPANISH} "spanish.xml"
LangString langFileName ${LANG_HUNGARIAN} "hungarian.xml"
LangString langFileName ${LANG_RUSSIAN} "russian.xml"
LangString langFileName ${LANG_DUTCH} "dutch.xml"
LangString langFileName ${LANG_SIMPCHINESE} "chineseSimplified.xml"
LangString langFileName ${LANG_ITALIAN} "italian.xml"
LangString langFileName ${LANG_DANISH} "danish.xml"
LangString langFileName ${LANG_POLISH} "polish.xml"
LangString langFileName ${LANG_CZECH} "czech.xml"
LangString langFileName ${LANG_SLOVENIAN} "slovenian.xml"
LangString langFileName ${LANG_SLOVAK} "slovak.xml"
LangString langFileName ${LANG_SWEDISH} "swedish.xml"
LangString langFileName ${LANG_NORWEGIAN} "norwegian.xml"
LangString langFileName ${LANG_PORTUGUESEBR} "brazilian_portuguese.xml"
LangString langFileName ${LANG_UKRAINIAN} "ukrainian.xml"
LangString langFileName ${LANG_TURKISH} "turkish.xml"
LangString langFileName ${LANG_CATALAN} "catalan.xml"
LangString langFileName ${LANG_ARABIC} "arabic.xml"
LangString langFileName ${LANG_LITHUANIAN} "lithuanian.xml"
LangString langFileName ${LANG_FINNISH} "finnish.xml"
LangString langFileName ${LANG_GREEK} "greek.xml"
LangString langFileName ${LANG_ROMANIAN} "romanian.xml"
LangString langFileName ${LANG_KOREAN} "korean.xml"
LangString langFileName ${LANG_HEBREW} "hebrew.xml"
LangString langFileName ${LANG_PORTUGUESE} "portuguese.xml"
LangString langFileName ${LANG_FARSI} "farsi.xml"
LangString langFileName ${LANG_BULGARIAN} "bulgarian.xml"
LangString langFileName ${LANG_INDONESIAN} "indonesian.xml"
LangString langFileName ${LANG_JAPANESE} "japanese.xml"
LangString langFileName ${LANG_CROATIAN} "croatian.xml"
;--------------------------------
;Variables
Var IS_LOCAL
;--------------------------------
Section /o "Don't use %APPDATA%" makeLocal
StrCpy $IS_LOCAL "1"
SectionEnd
Var UPDATE_PATH
Section -"Notepad++" mainSection
; Set Section properties
SetOverwrite on
StrCpy $UPDATE_PATH $INSTDIR
;SetOutPath "$TEMP\"
File /oname=$TEMP\xmlUpdater.exe ".\bin\xmlUpdater.exe"
SetOutPath "$INSTDIR\"
;Test if window9x
Call GetWindowsVersion
Pop $R0
StrCmp $R0 "95" 0 +2
StrCpy $IS_LOCAL "1"
StrCmp $R0 "98" 0 +2
StrCpy $IS_LOCAL "1"
StrCmp $R0 "ME" 0 +2
StrCpy $IS_LOCAL "1"
; if isLocal -> copy file "doLocalConf.xml"
StrCmp $IS_LOCAL "1" 0 IS_NOT_LOCAL
File "..\bin\doLocalConf.xml"
goto LANGS_XML
IS_NOT_LOCAL:
IfFileExists $INSTDIR\doLocalConf.xml 0 +2
Delete $INSTDIR\doLocalConf.xml
StrCpy $UPDATE_PATH "$APPDATA\Notepad++"
CreateDirectory $UPDATE_PATH\plugins\config
LANGS_XML:
IfFileExists $INSTDIR\langs.xml 0 COPY_LANGS_XML
SetOutPath "$TEMP\"
File "langsModel.xml"
File "..\bin\langs.xml"
;UPGRATE $INSTDIR\langs.xml
nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\langsModel.xml" "$TEMP\langs.xml" "$INSTDIR\langs.xml"'
Pop $0
;MessageBox MB_OK "$0"
StrCmp $0 "0" 0 COPY_LANGS_XML
goto CONFIG_XML
COPY_LANGS_XML:
;SetOutPath "$INSTDIR\"
File /oname=$INSTDIR\langs.xml "..\bin\langs.xml"
CONFIG_XML:
StrCmp $UPDATE_PATH "$APPDATA\Notepad++" 0 +2
File /oname=$INSTDIR\config.xml "..\bin\config.xml"
IfFileExists $UPDATE_PATH\config.xml 0 COPY_CONFIG_XML
SetOutPath "$TEMP\"
File "configModel.xml"
File "..\bin\config.xml"
nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\configModel.xml" "$TEMP\config.xml" "$UPDATE_PATH\config.xml"'
Pop $0
;MessageBox MB_OK "$0"
StrCmp $0 "0" 0 COPY_CONFIG_XML
goto STYLES_XML
COPY_CONFIG_XML:
;SetOutPath "$INSTDIR\"
File /oname=$INSTDIR\config.xml "..\bin\config.xml"
STYLES_XML:
StrCmp $UPDATE_PATH "$APPDATA\Notepad++" 0 +2
File /oname=$INSTDIR\stylers.xml "..\bin\stylers.xml"
IfFileExists $UPDATE_PATH\stylers.xml 0 COPY_STYLERS_XML
SetOutPath "$TEMP\"
File "stylesLexerModel.xml"
File "stylesGlobalModel.xml"
File "..\bin\stylers.xml"
nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesLexerModel.xml" "$TEMP\stylers.xml" "$UPDATE_PATH\stylers.xml"'
Pop $0
;MessageBox MB_OK "$0"
StrCmp $0 "0" 0 COPY_STYLERS_XML
nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesGlobalModel.xml" "$TEMP\stylers.xml" "$UPDATE_PATH\stylers.xml"'
Pop $0
;MessageBox MB_OK "$0"
StrCmp $0 "0" 0 COPY_STYLERS_XML
goto ALL_XML
COPY_STYLERS_XML:
;SetOutPath "$INSTDIR\"
File /oname=$INSTDIR\stylers.xml "..\bin\stylers.xml"
ALL_XML:
SetOutPath "$INSTDIR\"
SetOverwrite off
File "..\bin\contextMenu.xml"
File "..\bin\shortcuts.xml"
; Set Section Files and Shortcuts
SetOverwrite on
File "..\license.txt"
File "..\bin\LINEDRAW.TTF"
File "..\bin\SciLexer.dll"
File "..\bin\change.log"
File "..\bin\notepad++.exe"
File "..\bin\readme.txt"
StrCmp $LANGUAGE ${LANG_ENGLISH} noLang 0
StrCmp $LANGUAGE ${LANG_FRENCH} 0 +3
File ".\nativeLang\french.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_TRADCHINESE} 0 +3
File ".\nativeLang\chinese.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +3
File ".\nativeLang\spanish.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_HUNGARIAN} 0 +3
File ".\nativeLang\hungarian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_RUSSIAN} 0 +3
File ".\nativeLang\russian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_GERMAN} 0 +3
File ".\nativeLang\german.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_DUTCH} 0 +3
File ".\nativeLang\dutch.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_SIMPCHINESE} 0 +3
File ".\nativeLang\chineseSimplified.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_ITALIAN} 0 +3
File ".\nativeLang\italian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_DANISH} 0 +3
File ".\nativeLang\danish.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_POLISH} 0 +3
File ".\nativeLang\polish.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_CZECH} 0 +3
File ".\nativeLang\czech.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_SLOVENIAN} 0 +3
File ".\nativeLang\slovenian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_SLOVAK} 0 +3
File ".\nativeLang\slovak.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_SWEDISH} 0 +3
File ".\nativeLang\swedish.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_NORWEGIAN} 0 +3
File ".\nativeLang\norwegian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} 0 +3
File ".\nativeLang\brazilian_portuguese.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_UKRAINIAN} 0 +3
File ".\nativeLang\ukrainian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_TURKISH} 0 +3
File ".\nativeLang\turkish.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_CATALAN} 0 +3
File ".\nativeLang\catalan.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_ARABIC} 0 +3
File ".\nativeLang\arabic.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_LITHUANIAN} 0 +3
File ".\nativeLang\lithuanian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_FINNISH} 0 +3
File ".\nativeLang\finnish.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_GREEK} 0 +3
File ".\nativeLang\greek.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_ROMANIAN} 0 +3
File ".\nativeLang\romanian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_KOREAN} 0 +3
File ".\nativeLang\korean.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_HEBREW} 0 +3
File ".\nativeLang\hebrew.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_PORTUGUESE} 0 +3
File ".\nativeLang\portuguese.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_FARSI} 0 +3
File ".\nativeLang\farsi.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_BULGARIAN} 0 +3
File ".\nativeLang\bulgarian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_INDONESIAN} 0 +3
File ".\nativeLang\indonesian.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_JAPANESE} 0 +3
File ".\nativeLang\japanese.xml"
Goto finLang
StrCmp $LANGUAGE ${LANG_CROATIAN} 0 +3
File ".\nativeLang\croatian.xml"
Goto finLang
finLang:
IfFileExists "$UPDATE_PATH\nativeLang.xml" 0 +2
Delete "$UPDATE_PATH\nativeLang.xml"
IfFileExists "$INSTDIR\nativeLang.xml" 0 +2
Delete "$INSTDIR\nativeLang.xml"
Rename "$INSTDIR\$(langFileName)" "$INSTDIR\nativeLang.xml"
Goto commun
noLang:
IfFileExists "$UPDATE_PATH\nativeLang.xml" 0 +2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -