diff --git a/Build/notepad3_setup.iss.bak b/Build/Backup/notepad3_setup.iss
similarity index 98%
rename from Build/notepad3_setup.iss.bak
rename to Build/Backup/notepad3_setup.iss
index dfd6fbe3c..8c0871705 100644
--- a/Build/notepad3_setup.iss.bak
+++ b/Build/Backup/notepad3_setup.iss
@@ -108,8 +108,6 @@ en.tsk_Other =Other tasks:
en.tsk_ResetSettings =Reset {#app_name}'s settings
en.tsk_RemoveDefault =Restore Windows notepad
en.tsk_StartMenuIcon =Create a Start Menu shortcut
-en.tsk_LaunchWelcomePage =Visit Rizonesoft for more downloads
-
[Tasks]
@@ -152,7 +150,6 @@ Filename: {userappdata}\Rizonesoft\Notepad3\Notepad3.ini; Section: Settings; Key
[Run]
Filename: {app}\Notepad3.exe; Description: {cm:LaunchProgram,{#app_name}}; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked
-Filename: "http://www.rizonesoft.com/downloads/"; Description: {cm:tsk_LaunchWelcomePage}; Flags: nowait postinstall shellexec skipifsilent
[InstallDelete]
@@ -174,7 +171,7 @@ Type: dirifempty; Name: {app}
const
IFEO = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe';
VersionURL = 'https://www.rizonesoft.com/update/Notepad3.rus';
- UpdateURL = 'https://www.rizonesoft.com/downloads/notepad3/update/';
+ UpdateURL = 'https://goo.gl/y6CGMM';
type
TIntegerArray = array of Integer;
diff --git a/Build/Changes.txt b/Build/Changes.txt
index 59fec5858..d6b0a5d38 100644
--- a/Build/Changes.txt
+++ b/Build/Changes.txt
@@ -2,6 +2,66 @@
Rizonesoft Notepad3 CHANGES
==================================================
+--------------------------------------------------
+Version 3.18.113.828 (13 January 2018)
+--------------------------------------------------
+- Performance: Redraw indicator ranges (Mark Occurrences) only if needed - avoiding recursive SCN_UPDATEUI notifications.
+- Mark Occurrences: force position progress in case of zero-length matches.
+- Performance: Mark Occurrence triggers enhancements.
+- Convenience: Re-introduce "max mark occurrence counter" to avoid lazy UI.
+ (Set .ini section [Settings2] MarkOccurrencesMaxCount=-1 for unlimited (MAX_INT)).
+- Fix: Correct counting of found matches.
+- Fix: Broken find/replace (regex) on groups.
+- Performance: Tuning delay parameter of "Mark Occurrences" (instantly).
+- Performance: Remove test for set already, if indicator does not change.
+- Fixing several Mark Occurrences (instantly) issues.
+- Fix: Some customizing scheme issues (relative font size hierarchy).
+- Fix: Document modified flag not set properly (title, toolbar & statusbar only).
+- Fix: Renaming menu entries Edit: "Clear" -> "Delete"
+- Enhancement: structured "Mark Occurrences" menu hierarchy.
+- Fix: Menu "Mark Occurrences" whole word matching: add check indicator if one of word matching options (selected/current) is used.
+- Change: Menu "Mark Occurrences" whole word matching: radio button behavior.
+- Fixes Regarding Scheme customizing (rel. size) and View Menu (Mark Occ.).
+- Fix: Regex replacement on look-ahead assertion.
+- Fix: relative font sizing of non-default-style entries in custom schemes.
+- Fix: Font selection box title display.
+- Fix: clean coding for "relative sizing hierarchy".
+- Feature: "Customize Schemes..." UI change to represent "relative sizing hierarchy".
+- Fix: Update view on style change in "Customize schemes..."
+- Fix: Bug regarding "Reset" button in "Customizing Schemes..." dialog.
+- Fix: Bug in detect and style Hyperlink Hotspot.
+- Feature: Initial version of Nim Lexer. Added Scintilla project and header for Nim lexer.
+- Performance: Non visible styling during idle time.
+- Performance: Cache page instead of line only.
+- Change: Option "after visible" for styling in background (idle time).
+- Update: Compiler version 191225834 (VS2017 V.15.5.3).
+- Fix: Loosing state of "Transform Backslashes" while switching regex/wildcard search.
+- Fix: Block "mark occurrences" event on transaction pair: (SCI_TARGETFROMSELECTIO, SCI_REPLACETARGET).
+- Fix: protect SCI target transactions by a guard to break recursion of Mark Occurrences caused by ChangeNotification() events.
+- Fix: Handle "2nd Default Styles" as separate standard (2nd) lexer module.
+- Fix: Handling initial 1st or 2nd default style in case of "Default Text", shown on int "Customize Schemes...".
+- Fix: Crash on navigation between schemes beyond start/end of tree view.
+- Fix: Disable (using 1st Default Style) "Associated filename extensions" for "2nd Default Style".
+- Fix: Clone associated filename extension list of Default Style (for 2nd Default Style).
+- Enhancement: status bar information about usage of 2nd Default Style.
+- Change: View "2nd Default Style" as (dbl-clickable) status bar item.
+- Cleanup: NimLexer = NimrodLexer -> rely on Scintilla distribution for Nim(rod) lexer.
+- Change: Word Wrap mode from WORD to SPACE to avoid wrapping at style change edges.
+- Fix: move word wrap start symbol to margin (new WW mode SPACE (instead of WORD))".
+- Fix: Mark Occurrences timeout on Find/Replace.
+- Fix: Optimized status bar partitioning.
+- Fix: Revert naming for "2nd Default Text".
+- Clean Code: Reasonable assumption for memory allocation of style handling (backup, save, load).
+- Tuning: Statusbar Partitioning.
+- Fix: Bug on switching between 1st and 2nd standard lexers.
+- Fix: Selection of 1st or 2nd standard lexer (Default Text) based on Use2ndStandard flag.
+- Change: Onigmo RegEx syntax dialect.
+- Change: Onigmo regex engine: use PERL 5.10 syntax + enable "\<" and "\>" word boundary matching.
+- Fix: Onigmo regex engine PERL syntax: supporting named groups referencing in replacement text.
+- Enhancement: Statusbar: Count number of bytes in current encoding.
+- Change: Replace Windows Notepad Installer version only.
+- Change: Executables not compressed with UPX.
+
--------------------------------------------------
Version 3.18.105.802 (5 January 2018)
--------------------------------------------------
diff --git a/Build/notepad3_setup.iss b/Build/notepad3_setup.iss
index 8c0871705..d05c74c8d 100644
--- a/Build/notepad3_setup.iss
+++ b/Build/notepad3_setup.iss
@@ -1,518 +1,529 @@
-;* Notepad3 - Installer script
-;*
-;* Copyright (C) 2008-2016 Rizonesoft
-
-; Requirements:
-; Inno Setup: http://www.jrsoftware.org/isdl.php
-
-; Preprocessor related stuff
-#if VER < EncodeVer(5,5,9)
- #error Update your Inno Setup version (5.5.9 or newer)
-#endif
-
-#define bindir "..\Bin"
-
-#ifnexist bindir + "\Release_x86_v141\Notepad3.exe"
- #error Compile Notepad3 x86 first
-#endif
-
-#ifnexist bindir + "\Release_x86_v141\minipath.exe"
- #error Compile MiniPath x86 first
-#endif
-
-#ifnexist bindir + "\Release_x86_v141\np3encrypt.exe"
- #error Compile np3encrypt.exe x86 first
-#endif
-
-#ifnexist bindir + "\Release_x64_v141\Notepad3.exe"
- #error Compile Notepad3 x64 first
-#endif
-
-#ifnexist bindir + "\Release_x64_v141\minipath.exe"
- #error Compile MiniPath x64 first
-#endif
-
-#ifnexist bindir + "\Release_x64_v141\np3encrypt.exe"
- #error Compile np3encrypt.exe x64 first
-#endif
-
-#define app_version GetFileVersion(bindir + "\Release_x86_v141\Notepad3.exe")
-#define app_name "Notepad3"
-#define app_copyright "Copyright © 2008-2016, Rizonesoft."
-#define quick_launch "{userappdata}\Microsoft\Internet Explorer\Quick Launch"
-
-[Setup]
-AppId={#app_name}
-AppName={#app_name}
-AppVersion={#app_version}
-AppVerName={#app_name} {#app_version}
-AppPublisher=Rizonesoft
-AppPublisherURL=https://rizonesoft.com
-AppSupportURL=https://rizonesoft.com
-AppUpdatesURL=https://rizonesoft.com
-AppContact=https://rizonesoft.com
-AppCopyright={#app_copyright}
-;VersionInfoVersion={#app_version}
-UninstallDisplayIcon={app}\Notepad3.exe
-UninstallDisplayName={#app_name} {#app_version}
-DefaultDirName={pf}\Notepad3
-LicenseFile=License.txt
-OutputDir=.\Packages
-OutputBaseFilename={#app_name}_{#app_version}
-SetupIconFile=.\Resources\Setup.ico
-WizardImageFile=compiler:WizModernImage-IS.bmp
-WizardSmallImageFile=.\Resources\WizardSmallImageFile.bmp
-Compression=lzma2/max
-InternalCompressLevel=max
-SolidCompression=yes
-EnableDirDoesntExistWarning=no
-AllowNoIcons=yes
-ShowTasksTreeLines=yes
-DisableDirPage=yes
-DisableProgramGroupPage=yes
-DisableReadyPage=yes
-DisableWelcomePage=yes
-AllowCancelDuringInstall=no
-MinVersion=5.1sp3
-ArchitecturesAllowed=x86 x64
-ArchitecturesInstallIn64BitMode=x64
-#ifexist "..\signinfo_notepad3.txt"
-SignTool=MySignTool
-#endif
-CloseApplications=true
-SetupMutex='{#app_name}' + '_setup_mutex'
-
-
-[Languages]
-Name: en; MessagesFile: compiler:Default.isl
-
-
-[Messages]
-;BeveledLabel ={#app_name} {#app_version} - Compiled with VC2015
-SetupAppTitle =Setup - {#app_name}
-SetupWindowTitle =Setup - {#app_name}
-
-
-[CustomMessages]
-en.msg_AppIsRunning =Setup has detected that {#app_name} is currently running.%n%nPlease close all instances of it now, then click OK to continue, or Cancel to exit.
-en.msg_AppIsRunningUninstall =Uninstall has detected that {#app_name} is currently running.%n%nPlease close all instances of it now, then click OK to continue, or Cancel to exit.
-en.msg_DeleteSettings =Do you also want to delete {#app_name}'s settings?%n%nIf you plan on installing {#app_name} again then you do not have to delete them.
-#if defined(sse_required)
-en.msg_simd_sse =This build of {#app_name} requires a CPU with SSE extension support.%n%nYour CPU does not have those capabilities.
-#elif defined(sse2_required)
-en.msg_simd_sse2 =This build of {#app_name} requires a CPU with SSE2 extension support.%n%nYour CPU does not have those capabilities.
-#endif
-en.tsk_AllUsers =For all users
-en.tsk_CurrentUser =For the current user only
-en.tsk_Other =Other tasks:
-en.tsk_ResetSettings =Reset {#app_name}'s settings
-en.tsk_RemoveDefault =Restore Windows notepad
-en.tsk_StartMenuIcon =Create a Start Menu shortcut
-
-
-[Tasks]
-Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
-Name: desktopicon\user; Description: {cm:tsk_CurrentUser}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
-Name: desktopicon\common; Description: {cm:tsk_AllUsers}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
-Name: startup_icon; Description: {cm:tsk_StartMenuIcon}; GroupDescription: {cm:AdditionalIcons}
-Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked; OnlyBelowVersion: 6.01
-Name: reset_settings; Description: {cm:tsk_ResetSettings}; GroupDescription: {cm:tsk_Other}; Flags: checkedonce unchecked; Check: SettingsExistCheck()
-Name: remove_default; Description: {cm:tsk_RemoveDefault}; GroupDescription: {cm:tsk_Other}; Flags: checkedonce unchecked; Check: DefaulNotepadCheck()
-
-[Files]
-Source: {#bindir}\Release_x64_v141\Notepad3.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
-Source: {#bindir}\Release_x86_v141\Notepad3.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
-Source: License.txt; DestDir: {app}; Flags: ignoreversion
-Source: Readme.txt; DestDir: {app}; Flags: ignoreversion
-Source: Notepad3.ini; DestDir: {userappdata}\Rizonesoft\Notepad3; Flags: onlyifdoesntexist uninsneveruninstall
-Source: {#bindir}\Release_x64_v141\minipath.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
-Source: {#bindir}\Release_x86_v141\minipath.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
-Source: minipath.ini; DestDir: {userappdata}\Rizonesoft\Notepad3; Flags: onlyifdoesntexist uninsneveruninstall
-Source: {#bindir}\Release_x64_v141\np3encrypt.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
-Source: {#bindir}\Release_x86_v141\np3encrypt.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
-
-[Dirs]
-Name: "{userappdata}\Rizonesoft\Notepad3\Favorites"
-
-[Icons]
-Name: {commondesktop}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: desktopicon\common; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-Name: {userdesktop}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: desktopicon\user; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-Name: {userstartmenu}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: startup_icon; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-Name: {#quick_launch}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: quicklaunchicon; Comment: {#app_name} {#app_version}; WorkingDir: {app}; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-
-
-[INI]
-Filename: {app}\Notepad3.ini; Section: Notepad3; Key: Notepad3.ini; String: %APPDATA%\Rizonesoft\Notepad3\Notepad3.ini
-Filename: {app}\minipath.ini; Section: minipath; Key: minipath.ini; String: %APPDATA%\Rizonesoft\Notepad3\minipath.ini
-
-Filename: {userappdata}\Rizonesoft\Notepad3\Notepad3.ini; Section: Settings; Key: Favorites; String: %APPDATA%\Rizonesoft\Notepad3\Favorites\
-
-
-[Run]
-Filename: {app}\Notepad3.exe; Description: {cm:LaunchProgram,{#app_name}}; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked
-
-
-[InstallDelete]
-Type: files; Name: {userdesktop}\{#app_name}.lnk; Check: not IsTaskSelected('desktopicon\user') and IsUpgrade()
-Type: files; Name: {commondesktop}\{#app_name}.lnk; Check: not IsTaskSelected('desktopicon\common') and IsUpgrade()
-Type: files; Name: {userstartmenu}\{#app_name}.lnk; Check: not IsTaskSelected('startup_icon') and IsUpgrade()
-Type: files; Name: {#quick_launch}\{#app_name}.lnk; Check: not IsTaskSelected('quicklaunchicon') and IsUpgrade(); OnlyBelowVersion: 6.01
-Type: files; Name: {app}\Notepad3.ini
-Type: files; Name: {app}\Readme.txt
-Type: files; Name: {app}\minipath.ini
-
-
-[UninstallDelete]
-Type: files; Name: {app}\Notepad3.ini
-Type: files; Name: {app}\minipath.ini
-Type: dirifempty; Name: {app}
-
-[Code]
-const
- IFEO = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe';
- VersionURL = 'https://www.rizonesoft.com/update/Notepad3.rus';
- UpdateURL = 'https://goo.gl/y6CGMM';
-
-type
- TIntegerArray = array of Integer;
- TCompareResult = (
- crLesser,
- crEquals,
- crGreater
- );
-
-function Max(A, B: Integer): Integer;
-begin
- if A > B then Result := A else Result := B;
-end;
-
-function CompareValue(A, B: Integer): TCompareResult;
-begin
- if A = B then
- Result := crEquals
- else
- if A < B then
- Result := crLesser
- else
- Result := crGreater;
-end;
-
-function AddVersionChunk(const S: string; var A: TIntegerArray): Integer;
-var
- Chunk: Integer;
-begin
- Chunk := StrToIntDef(S, -1);
- if Chunk <> -1 then
- begin
- Result := GetArrayLength(A) + 1;
- SetArrayLength(A, Result);
- A[Result - 1] := Chunk;
- end
- else
- RaiseException('Invalid format of version string');
-end;
-
-function ParseVersionStr(const S: string; var A: TIntegerArray): Integer;
-var
- I: Integer;
- Count: Integer;
- Index: Integer;
-begin
- Count := 0;
- Index := 1;
-
- for I := 1 to Length(S) do
- begin
- case S[I] of
- '.':
- begin
- AddVersionChunk(Copy(S, Index, Count), A);
- Count := 0;
- Index := I + 1;
- end;
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- begin
- Count := Count + 1;
- end;
- else
- RaiseException('Invalid char in version string');
- end;
- end;
- Result := AddVersionChunk(Copy(S, Index, Count), A);
-end;
-
-function GetVersionValue(const A: TIntegerArray; Index,
- Length: Integer): Integer;
-begin
- Result := 0;
- if (Index >= 0) and (Index < Length) then
- Result := A[Index];
-end;
-
-function CompareVersionStr(const A, B: string): TCompareResult;
-var
- I: Integer;
- VerLenA, VerLenB: Integer;
- VerIntA, VerIntB: TIntegerArray;
-begin
- Result := crEquals;
-
- VerLenA := ParseVersionStr(A, VerIntA);
- VerLenB := ParseVersionStr(B, VerIntB);
-
- for I := 0 to Max(VerLenA, VerLenB) - 1 do
- begin
- Result := CompareValue(GetVersionValue(VerIntA, I, VerLenA),
- GetVersionValue(VerIntB, I, VerLenB));
- if Result <> crEquals then
- Exit;
- end;
-end;
-
-function DownloadFile(const URL: string; var Response: string): Boolean;
-var
- WinHttpRequest: Variant;
-begin
- Result := True;
- try
- WinHttpRequest := CreateOleObject('WinHttp.WinHttpRequest.5.1');
- WinHttpRequest.Open('GET', URL, False);
- WinHttpRequest.Send;
- Response := WinHttpRequest.ResponseText;
- except
- Result := False;
- Response := GetExceptionMessage;
- end;
-end;
-
-function InitializeSetup: Boolean;
-var
- ErrorCode: Integer;
- SetupVersion: string;
- LatestVersion: string;
-
-begin
- Result := True;
-
- //Check for Processor SSE2 support.
- #if defined(sse2_required)
- if not IsSSE2Supported() then begin
- SuppressibleMsgBox(CustomMessage('msg_simd_sse2'), mbCriticalError, MB_OK, MB_OK);
- Result := False;
- end;
- #elif defined(sse_required)
- if not IsSSESupported() then begin
- SuppressibleMsgBox(CustomMessage('msg_simd_sse'), mbCriticalError, MB_OK, MB_OK);
- Result := False;
- end;
- #endif
-
- if DownloadFile(VersionURL, LatestVersion) then
- begin
- SetupVersion := '{#SetupSetting('AppVersion')}';
- if CompareVersionStr(LatestVersion, SetupVersion) = crGreater then
- begin
- if MsgBox('There is a newer version of {#SetupSetting('AppName')} available. Do ' +
- 'you want to visit the site?', mbConfirmation, MB_YESNO) = IDYES then
- begin
- Result := not ShellExec('', UpdateURL, '', '', SW_SHOW, ewNoWait,
- ErrorCode);
- end;
- end;
- end;
-
-end;
-
-// Check if Notepad3 has replaced Windows Notepad
-function DefaulNotepadCheck(): Boolean;
-var
- sDebugger: String;
-begin
- if RegQueryStringValue(HKLM, IFEO, 'Debugger', sDebugger) and
- (sDebugger = (ExpandConstant('"{app}\Notepad3.exe" /z'))) then begin
- Log('Custom Code: {#app_name} is set as the default notepad');
- Result := True;
- end
- else begin
- Log('Custom Code: {#app_name} is NOT set as the default notepad');
- Result := False;
- end;
-end;
-
-#if defined(sse_required) || defined(sse2_required)
-function IsProcessorFeaturePresent(Feature: Integer): Boolean;
-external 'IsProcessorFeaturePresent@kernel32.dll stdcall';
-#endif
-
-#if defined(sse_required)
-function IsSSESupported(): Boolean;
-begin
- // PF_XMMI_INSTRUCTIONS_AVAILABLE
- Result := IsProcessorFeaturePresent(6);
-end;
-
-#elif defined(sse2_required)
-
-function IsSSE2Supported(): Boolean;
-begin
- // PF_XMMI64_INSTRUCTIONS_AVAILABLE
- Result := IsProcessorFeaturePresent(10);
-end;
-
-#endif
-
-
-function IsOldBuildInstalled(sInfFile: String): Boolean;
-begin
- if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Notepad2') and
- FileExists(ExpandConstant('{pf}\Notepad2\' + sInfFile)) then
- Result := True
- else
- Result := False;
-end;
-
-
-function IsUpgrade(): Boolean;
-var
- sPrevPath: String;
-begin
- sPrevPath := WizardForm.PrevAppDir;
- Result := (sPrevPath <> '');
-end;
-
-
-// Check if Notepad3's settings exist
-function SettingsExistCheck(): Boolean;
-begin
- if FileExists(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\Notepad3.ini')) then begin
- Log('Custom Code: Settings are present');
- Result := True;
- end
- else begin
- Log('Custom Code: Settings are NOT present');
- Result := False;
- end;
-end;
-
-
-function UninstallOldVersion(sInfFile: String): Integer;
-var
- iResultCode: Integer;
-begin
- // Return Values:
- // 0 - no idea
- // 1 - error executing the command
- // 2 - successfully executed the command
-
- // default return value
- Result := 0;
- // TODO: use RegQueryStringValue
- if not Exec('rundll32.exe', ExpandConstant('advpack.dll,LaunchINFSectionEx ' + '"{pf}\Notepad2\' + sInfFile +'",DefaultUninstall,,8,N'), '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
- Result := 1;
- end
- else begin
- Result := 2;
- Sleep(200);
- end;
-end;
-
-
-function ShouldSkipPage(PageID: Integer): Boolean;
-begin
- // Hide the license page if IsUpgrade()
- if IsUpgrade() and (PageID = wpLicense) then
- Result := True;
-end;
-
-
-procedure AddReg();
-begin
- RegWriteStringValue(HKCR, 'Applications\notepad3.exe', 'AppUserModelID', 'Notepad3');
- RegWriteStringValue(HKCR, 'Applications\notepad3.exe\shell\open\command', '', ExpandConstant('"{app}\Notepad3.exe" %1'));
- RegWriteStringValue(HKCR, '*\OpenWithList\notepad3.exe', '', '');
-end;
-
-
-procedure CleanUpSettings();
-begin
- DeleteFile(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\Notepad3.ini'));
- DeleteFile(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\minipath.ini'));
- RemoveDir(ExpandConstant('{userappdata}\Rizonesoft\Notepad3'));
-end;
-
-
-procedure RemoveReg();
-begin
- RegDeleteKeyIncludingSubkeys(HKCR, 'Applications\notepad3.exe');
- RegDeleteKeyIncludingSubkeys(HKCR, '*\OpenWithList\notepad3.exe');
-end;
-
-
-procedure CurPageChanged(CurPageID: Integer);
-begin
- if CurPageID = wpSelectTasks then
- WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall)
- else if CurPageID = wpFinished then
- WizardForm.NextButton.Caption := SetupMessage(msgButtonFinish);
-end;
-
-
-procedure CurStepChanged(CurStep: TSetupStep);
-begin
- if CurStep = ssInstall then begin
- if IsTaskSelected('reset_settings') then
- CleanUpSettings();
-
- if IsOldBuildInstalled('Uninstall.inf') or IsOldBuildInstalled('Notepad2.inf') then begin
- if IsOldBuildInstalled('Uninstall.inf') then begin
- Log('Custom Code: The old build is installed, will try to uninstall it');
- if UninstallOldVersion('Uninstall.inf') = 2 then
- Log('Custom Code: The old build was successfully uninstalled')
- else
- Log('Custom Code: Something went wrong when uninstalling the old build');
- end;
-
- if IsOldBuildInstalled('Notepad2.inf') then begin
- Log('Custom Code: The official Notepad2 build is installed, will try to uninstall it');
- if UninstallOldVersion('Notepad2.inf') = 2 then
- Log('Custom Code: The official Notepad2 build was successfully uninstalled')
- else
- Log('Custom Code: Something went wrong when uninstalling the official Notepad2 build');
- end;
- end;
- end;
-
- if CurStep = ssPostInstall then begin
- if IsTaskSelected('remove_default') then begin
- RegDeleteValue(HKLM, IFEO, 'Debugger');
- RegDeleteKeyIfEmpty(HKLM, IFEO);
- end;
- // Always add Notepad3's AppUserModelID and the rest registry values
- AddReg();
- end;
-
-end;
-
-
-procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
-begin
- // When uninstalling, ask the user to delete Notepad3's settings
- if CurUninstallStep = usUninstall then begin
- if SettingsExistCheck() then begin
- if SuppressibleMsgBox(CustomMessage('msg_DeleteSettings'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2, IDNO) = IDYES then
- CleanUpSettings();
- end;
- if DefaulNotepadCheck() then
- RegDeleteValue(HKLM, IFEO, 'Debugger');
- RegDeleteKeyIfEmpty(HKLM, IFEO);
- RemoveReg();
- end;
-end;
-
-
-procedure InitializeWizard();
-begin
- WizardForm.SelectTasksLabel.Hide;
- WizardForm.TasksList.Top := 0;
- WizardForm.TasksList.Height := PageFromID(wpSelectTasks).SurfaceHeight;
-end;
+;* Notepad3 - Installer script
+;*
+;* Copyright (C) 2008-2016 Rizonesoft
+
+; Requirements:
+; Inno Setup: http://www.jrsoftware.org/isdl.php
+
+; Preprocessor related stuff
+#if VER < EncodeVer(5,5,9)
+ #error Update your Inno Setup version (5.5.9 or newer)
+#endif
+
+#define bindir "..\Bin"
+
+#ifnexist bindir + "\Release_x86_v141\Notepad3.exe"
+ #error Compile Notepad3 x86 first
+#endif
+
+#ifnexist bindir + "\Release_x86_v141\minipath.exe"
+ #error Compile MiniPath x86 first
+#endif
+
+#ifnexist bindir + "\Release_x86_v141\np3encrypt.exe"
+ #error Compile np3encrypt.exe x86 first
+#endif
+
+#ifnexist bindir + "\Release_x64_v141\Notepad3.exe"
+ #error Compile Notepad3 x64 first
+#endif
+
+#ifnexist bindir + "\Release_x64_v141\minipath.exe"
+ #error Compile MiniPath x64 first
+#endif
+
#ifnexist bindir + "\Release_x64_v141\np3encrypt.exe"
+ #error Compile np3encrypt.exe x64 first
+#endif
+
+#define app_version GetFileVersion(bindir + "\Release_x86_v141\Notepad3.exe")
+#define app_name "Notepad3"
+#define app_copyright "Copyright © 2008-2016, Rizonesoft."
+#define quick_launch "{userappdata}\Microsoft\Internet Explorer\Quick Launch"
+
+[Setup]
+AppId={#app_name}
+AppName={#app_name}
+AppVersion={#app_version}
+AppVerName={#app_name} {#app_version}
+AppPublisher=Rizonesoft
+AppPublisherURL=https://rizonesoft.com
+AppSupportURL=https://rizonesoft.com
+AppUpdatesURL=https://rizonesoft.com
+AppContact=https://rizonesoft.com
+AppCopyright={#app_copyright}
+;VersionInfoVersion={#app_version}
+UninstallDisplayIcon={app}\Notepad3.exe
+UninstallDisplayName={#app_name} {#app_version}
+DefaultDirName={pf}\Notepad3
+LicenseFile=License.txt
+OutputDir=.\Packages
+OutputBaseFilename={#app_name}_{#app_version}
+SetupIconFile=.\Resources\Setup.ico
+WizardImageFile=compiler:WizModernImage-IS.bmp
+WizardSmallImageFile=.\Resources\WizardSmallImageFile.bmp
+Compression=lzma2/max
+InternalCompressLevel=max
+SolidCompression=yes
+EnableDirDoesntExistWarning=no
+AllowNoIcons=yes
+ShowTasksTreeLines=yes
+DisableDirPage=yes
+DisableProgramGroupPage=yes
+DisableReadyPage=yes
+DisableWelcomePage=yes
+AllowCancelDuringInstall=no
+MinVersion=5.1sp3
+ArchitecturesAllowed=x86 x64
+ArchitecturesInstallIn64BitMode=x64
+#ifexist "..\signinfo_notepad3.txt"
+SignTool=MySignTool
+#endif
+CloseApplications=true
+SetupMutex='{#app_name}' + '_setup_mutex'
+
+
+[Languages]
+Name: en; MessagesFile: compiler:Default.isl
+
+
+[Messages]
+;BeveledLabel ={#app_name} {#app_version} - Compiled with VC2015
+SetupAppTitle =Setup - {#app_name}
+SetupWindowTitle =Setup - {#app_name}
+
+
+[CustomMessages]
+en.msg_AppIsRunning =Setup has detected that {#app_name} is currently running.%n%nPlease close all instances of it now, then click OK to continue, or Cancel to exit.
+en.msg_AppIsRunningUninstall =Uninstall has detected that {#app_name} is currently running.%n%nPlease close all instances of it now, then click OK to continue, or Cancel to exit.
+en.msg_DeleteSettings =Do you also want to delete {#app_name}'s settings?%n%nIf you plan on installing {#app_name} again then you do not have to delete them.
+#if defined(sse_required)
+en.msg_simd_sse =This build of {#app_name} requires a CPU with SSE extension support.%n%nYour CPU does not have those capabilities.
+#elif defined(sse2_required)
+en.msg_simd_sse2 =This build of {#app_name} requires a CPU with SSE2 extension support.%n%nYour CPU does not have those capabilities.
+#endif
+en.tsk_AllUsers =For all users
+en.tsk_CurrentUser =For the current user only
+en.tsk_Other =Other tasks:
+en.tsk_ResetSettings =Reset {#app_name}'s settings
+en.tsk_RemoveDefault =Restore Windows notepad
+en.tsk_SetDefault =Replace Windows notepad with {#app_name}
+en.tsk_StartMenuIcon =Create a Start Menu shortcut
+en.tsk_LaunchWelcomePage =Get more from Rizonesoft
+
+
+[Tasks]
+Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
+Name: desktopicon\user; Description: {cm:tsk_CurrentUser}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
+Name: desktopicon\common; Description: {cm:tsk_AllUsers}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
+Name: startup_icon; Description: {cm:tsk_StartMenuIcon}; GroupDescription: {cm:AdditionalIcons}
+Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked; OnlyBelowVersion: 6.01
+Name: reset_settings; Description: {cm:tsk_ResetSettings}; GroupDescription: {cm:tsk_Other}; Flags: checkedonce unchecked; Check: SettingsExistCheck()
+Name: set_default; Description: {cm:tsk_SetDefault}; GroupDescription: {cm:tsk_Other}; Check: not DefaulNotepadCheck()
+Name: remove_default; Description: {cm:tsk_RemoveDefault}; GroupDescription: {cm:tsk_Other}; Flags: checkedonce unchecked; Check: DefaulNotepadCheck()
+
+
+[Files]
+Source: {#bindir}\Release_x64_v141\Notepad3.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
+Source: {#bindir}\Release_x86_v141\Notepad3.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
+Source: License.txt; DestDir: {app}; Flags: ignoreversion
+Source: Readme.txt; DestDir: {app}; Flags: ignoreversion
+Source: Notepad3.ini; DestDir: {userappdata}\Rizonesoft\Notepad3; Flags: onlyifdoesntexist uninsneveruninstall
+Source: {#bindir}\Release_x64_v141\minipath.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
+Source: {#bindir}\Release_x86_v141\minipath.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
+Source: minipath.ini; DestDir: {userappdata}\Rizonesoft\Notepad3; Flags: onlyifdoesntexist uninsneveruninstall
+Source: {#bindir}\Release_x64_v141\np3encrypt.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
+Source: {#bindir}\Release_x86_v141\np3encrypt.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
+
+[Dirs]
+Name: "{userappdata}\Rizonesoft\Notepad3\Favorites"
+
+[Icons]
+Name: {commondesktop}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: desktopicon\common; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
+Name: {userdesktop}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: desktopicon\user; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
+Name: {userstartmenu}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: startup_icon; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
+Name: {#quick_launch}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: quicklaunchicon; Comment: {#app_name} {#app_version}; WorkingDir: {app}; IconFilename: {app}\Notepad3.exe; IconIndex: 0
+
+
+[INI]
+Filename: {app}\Notepad3.ini; Section: Notepad3; Key: Notepad3.ini; String: %APPDATA%\Rizonesoft\Notepad3\Notepad3.ini
+Filename: {app}\minipath.ini; Section: minipath; Key: minipath.ini; String: %APPDATA%\Rizonesoft\Notepad3\minipath.ini
+Filename: {userappdata}\Rizonesoft\Notepad3\Notepad3.ini; Section: Settings; Key: Favorites; String: %APPDATA%\Rizonesoft\Notepad3\Favorites\
+
+
+[Run]
+Filename: {app}\Notepad3.exe; Description: {cm:LaunchProgram,{#app_name}}; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked
+Filename: https://goo.gl/tGtJ6a; Description: {cm:tsk_LaunchWelcomePage}; Flags: nowait postinstall shellexec skipifsilent
+
+
+[InstallDelete]
+Type: files; Name: {userdesktop}\{#app_name}.lnk; Check: not IsTaskSelected('desktopicon\user') and IsUpgrade()
+Type: files; Name: {commondesktop}\{#app_name}.lnk; Check: not IsTaskSelected('desktopicon\common') and IsUpgrade()
+Type: files; Name: {userstartmenu}\{#app_name}.lnk; Check: not IsTaskSelected('startup_icon') and IsUpgrade()
+Type: files; Name: {#quick_launch}\{#app_name}.lnk; Check: not IsTaskSelected('quicklaunchicon') and IsUpgrade(); OnlyBelowVersion: 6.01
+Type: files; Name: {app}\Notepad3.ini
+Type: files; Name: {app}\Readme.txt
+Type: files; Name: {app}\minipath.ini
+
+
+[UninstallDelete]
+Type: files; Name: {app}\Notepad3.ini
+Type: files; Name: {app}\minipath.ini
+Type: dirifempty; Name: {app}
+
+[Code]
+const
+ IFEO = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe';
+ VersionURL = 'https://www.rizonesoft.com/update/Notepad3.rus';
+ UpdateURL = 'https://goo.gl/y6CGMM';
+
+type
+ TIntegerArray = array of Integer;
+ TCompareResult = (
+ crLesser,
+ crEquals,
+ crGreater
+ );
+
+function Max(A, B: Integer): Integer;
+begin
+ if A > B then Result := A else Result := B;
+end;
+
+function CompareValue(A, B: Integer): TCompareResult;
+begin
+ if A = B then
+ Result := crEquals
+ else
+ if A < B then
+ Result := crLesser
+ else
+ Result := crGreater;
+end;
+
+function AddVersionChunk(const S: string; var A: TIntegerArray): Integer;
+var
+ Chunk: Integer;
+begin
+ Chunk := StrToIntDef(S, -1);
+ if Chunk <> -1 then
+ begin
+ Result := GetArrayLength(A) + 1;
+ SetArrayLength(A, Result);
+ A[Result - 1] := Chunk;
+ end
+ else
+ RaiseException('Invalid format of version string');
+end;
+
+function ParseVersionStr(const S: string; var A: TIntegerArray): Integer;
+var
+ I: Integer;
+ Count: Integer;
+ Index: Integer;
+begin
+ Count := 0;
+ Index := 1;
+
+ for I := 1 to Length(S) do
+ begin
+ case S[I] of
+ '.':
+ begin
+ AddVersionChunk(Copy(S, Index, Count), A);
+ Count := 0;
+ Index := I + 1;
+ end;
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
+ begin
+ Count := Count + 1;
+ end;
+ else
+ RaiseException('Invalid char in version string');
+ end;
+ end;
+ Result := AddVersionChunk(Copy(S, Index, Count), A);
+end;
+
+function GetVersionValue(const A: TIntegerArray; Index,
+ Length: Integer): Integer;
+begin
+ Result := 0;
+ if (Index >= 0) and (Index < Length) then
+ Result := A[Index];
+end;
+
+function CompareVersionStr(const A, B: string): TCompareResult;
+var
+ I: Integer;
+ VerLenA, VerLenB: Integer;
+ VerIntA, VerIntB: TIntegerArray;
+begin
+ Result := crEquals;
+
+ VerLenA := ParseVersionStr(A, VerIntA);
+ VerLenB := ParseVersionStr(B, VerIntB);
+
+ for I := 0 to Max(VerLenA, VerLenB) - 1 do
+ begin
+ Result := CompareValue(GetVersionValue(VerIntA, I, VerLenA),
+ GetVersionValue(VerIntB, I, VerLenB));
+ if Result <> crEquals then
+ Exit;
+ end;
+end;
+
+function DownloadFile(const URL: string; var Response: string): Boolean;
+var
+ WinHttpRequest: Variant;
+begin
+ Result := True;
+ try
+ WinHttpRequest := CreateOleObject('WinHttp.WinHttpRequest.5.1');
+ WinHttpRequest.Open('GET', URL, False);
+ WinHttpRequest.Send;
+ Response := WinHttpRequest.ResponseText;
+ except
+ Result := False;
+ Response := GetExceptionMessage;
+ end;
+end;
+
+function InitializeSetup: Boolean;
+var
+ ErrorCode: Integer;
+ SetupVersion: string;
+ LatestVersion: string;
+
+begin
+ Result := True;
+
+ //Check for Processor SSE2 support.
+ #if defined(sse2_required)
+ if not IsSSE2Supported() then begin
+ SuppressibleMsgBox(CustomMessage('msg_simd_sse2'), mbCriticalError, MB_OK, MB_OK);
+ Result := False;
+ end;
+ #elif defined(sse_required)
+ if not IsSSESupported() then begin
+ SuppressibleMsgBox(CustomMessage('msg_simd_sse'), mbCriticalError, MB_OK, MB_OK);
+ Result := False;
+ end;
+ #endif
+
+ if DownloadFile(VersionURL, LatestVersion) then
+ begin
+ SetupVersion := '{#SetupSetting('AppVersion')}';
+ if CompareVersionStr(LatestVersion, SetupVersion) = crGreater then
+ begin
+ if MsgBox('There is a newer version of {#SetupSetting('AppName')} available. Do ' +
+ 'you want to visit the site?', mbConfirmation, MB_YESNO) = IDYES then
+ begin
+ Result := not ShellExec('', UpdateURL, '', '', SW_SHOW, ewNoWait,
+ ErrorCode);
+ end;
+ end;
+ end;
+
+end;
+
+// Check if Notepad3 has replaced Windows Notepad
+function DefaulNotepadCheck(): Boolean;
+var
+ sDebugger: String;
+begin
+ if RegQueryStringValue(HKLM, IFEO, 'Debugger', sDebugger) and
+ (sDebugger = (ExpandConstant('"{app}\Notepad3.exe" /z'))) then begin
+ Log('Custom Code: {#app_name} is set as the default notepad');
+ Result := True;
+ end
+ else begin
+ Log('Custom Code: {#app_name} is NOT set as the default notepad');
+ Result := False;
+ end;
+end;
+
+#if defined(sse_required) || defined(sse2_required)
+function IsProcessorFeaturePresent(Feature: Integer): Boolean;
+external 'IsProcessorFeaturePresent@kernel32.dll stdcall';
+#endif
+
+#if defined(sse_required)
+function IsSSESupported(): Boolean;
+begin
+ // PF_XMMI_INSTRUCTIONS_AVAILABLE
+ Result := IsProcessorFeaturePresent(6);
+end;
+
+#elif defined(sse2_required)
+
+function IsSSE2Supported(): Boolean;
+begin
+ // PF_XMMI64_INSTRUCTIONS_AVAILABLE
+ Result := IsProcessorFeaturePresent(10);
+end;
+
+#endif
+
+
+function IsOldBuildInstalled(sInfFile: String): Boolean;
+begin
+ if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Notepad2') and
+ FileExists(ExpandConstant('{pf}\Notepad2\' + sInfFile)) then
+ Result := True
+ else
+ Result := False;
+end;
+
+
+function IsUpgrade(): Boolean;
+var
+ sPrevPath: String;
+begin
+ sPrevPath := WizardForm.PrevAppDir;
+ Result := (sPrevPath <> '');
+end;
+
+
+// Check if Notepad3's settings exist
+function SettingsExistCheck(): Boolean;
+begin
+ if FileExists(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\Notepad3.ini')) then begin
+ Log('Custom Code: Settings are present');
+ Result := True;
+ end
+ else begin
+ Log('Custom Code: Settings are NOT present');
+ Result := False;
+ end;
+end;
+
+
+function UninstallOldVersion(sInfFile: String): Integer;
+var
+ iResultCode: Integer;
+begin
+ // Return Values:
+ // 0 - no idea
+ // 1 - error executing the command
+ // 2 - successfully executed the command
+
+ // default return value
+ Result := 0;
+ // TODO: use RegQueryStringValue
+ if not Exec('rundll32.exe', ExpandConstant('advpack.dll,LaunchINFSectionEx ' + '"{pf}\Notepad2\' + sInfFile +'",DefaultUninstall,,8,N'), '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
+ Result := 1;
+ end
+ else begin
+ Result := 2;
+ Sleep(200);
+ end;
+end;
+
+
+function ShouldSkipPage(PageID: Integer): Boolean;
+begin
+ // Hide the license page if IsUpgrade()
+ if IsUpgrade() and (PageID = wpLicense) then
+ Result := True;
+end;
+
+
+procedure AddReg();
+begin
+ RegWriteStringValue(HKCR, 'Applications\notepad3.exe', 'AppUserModelID', 'Notepad3');
+ RegWriteStringValue(HKCR, 'Applications\notepad3.exe\shell\open\command', '', ExpandConstant('"{app}\Notepad3.exe" %1'));
+ RegWriteStringValue(HKCR, '*\OpenWithList\notepad3.exe', '', '');
+end;
+
+
+procedure CleanUpSettings();
+begin
+ DeleteFile(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\Notepad3.ini'));
+ DeleteFile(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\minipath.ini'));
+ RemoveDir(ExpandConstant('{userappdata}\Rizonesoft\Notepad3'));
+end;
+
+
+procedure RemoveReg();
+begin
+ RegDeleteKeyIncludingSubkeys(HKCR, 'Applications\notepad3.exe');
+ RegDeleteKeyIncludingSubkeys(HKCR, '*\OpenWithList\notepad3.exe');
+end;
+
+
+procedure CurPageChanged(CurPageID: Integer);
+begin
+ if CurPageID = wpSelectTasks then
+ WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall)
+ else if CurPageID = wpFinished then
+ WizardForm.NextButton.Caption := SetupMessage(msgButtonFinish);
+end;
+
+
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+ if CurStep = ssInstall then begin
+ if IsTaskSelected('reset_settings') then
+ CleanUpSettings();
+
+ if IsOldBuildInstalled('Uninstall.inf') or IsOldBuildInstalled('Notepad2.inf') then begin
+ if IsOldBuildInstalled('Uninstall.inf') then begin
+ Log('Custom Code: The old build is installed, will try to uninstall it');
+ if UninstallOldVersion('Uninstall.inf') = 2 then
+ Log('Custom Code: The old build was successfully uninstalled')
+ else
+ Log('Custom Code: Something went wrong when uninstalling the old build');
+ end;
+
+ if IsOldBuildInstalled('Notepad2.inf') then begin
+ Log('Custom Code: The official Notepad2 build is installed, will try to uninstall it');
+ if UninstallOldVersion('Notepad2.inf') = 2 then
+ Log('Custom Code: The official Notepad2 build was successfully uninstalled')
+ else
+ Log('Custom Code: Something went wrong when uninstalling the official Notepad2 build');
+ end;
+
+ // This is the case where the old build is installed; the DefaulNotepadCheck() returns true
+ // and the set_default task isn't selected
+ if not IsTaskSelected('remove_default') then
+ RegWriteStringValue(HKLM, IFEO, 'Debugger', ExpandConstant('"{app}\Notepad3.exe" /z'));
+
+ end;
+ end;
+
+ if CurStep = ssPostInstall then begin
+ if IsTaskSelected('set_default') then
+ RegWriteStringValue(HKLM, IFEO, 'Debugger', ExpandConstant('"{app}\Notepad3.exe" /z'));
+ if IsTaskSelected('remove_default') then begin
+ RegDeleteValue(HKLM, IFEO, 'Debugger');
+ RegDeleteKeyIfEmpty(HKLM, IFEO);
+ end;
+ // Always add Notepad3's AppUserModelID and the rest registry values
+ AddReg();
+ end;
+
+end;
+
+
+procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
+begin
+ // When uninstalling, ask the user to delete Notepad3's settings
+ if CurUninstallStep = usUninstall then begin
+ if SettingsExistCheck() then begin
+ if SuppressibleMsgBox(CustomMessage('msg_DeleteSettings'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2, IDNO) = IDYES then
+ CleanUpSettings();
+ end;
+ if DefaulNotepadCheck() then
+ RegDeleteValue(HKLM, IFEO, 'Debugger');
+ RegDeleteKeyIfEmpty(HKLM, IFEO);
+ RemoveReg();
+ end;
+end;
+
+
+procedure InitializeWizard();
+begin
+ WizardForm.SelectTasksLabel.Hide;
+ WizardForm.TasksList.Top := 0;
+ WizardForm.TasksList.Height := PageFromID(wpSelectTasks).SurfaceHeight;
+end;
diff --git a/Build/notepad3_setup_replace.iss b/Build/notepad3_setup_replace.iss
deleted file mode 100644
index 71aa10528..000000000
--- a/Build/notepad3_setup_replace.iss
+++ /dev/null
@@ -1,529 +0,0 @@
-;* Notepad3 - Installer script
-;*
-;* Copyright (C) 2008-2016 Rizonesoft
-
-; Requirements:
-; Inno Setup: http://www.jrsoftware.org/isdl.php
-
-; Preprocessor related stuff
-#if VER < EncodeVer(5,5,9)
- #error Update your Inno Setup version (5.5.9 or newer)
-#endif
-
-#define bindir "..\Bin"
-
-#ifnexist bindir + "\Release_x86_v141\Notepad3.exe"
- #error Compile Notepad3 x86 first
-#endif
-
-#ifnexist bindir + "\Release_x86_v141\minipath.exe"
- #error Compile MiniPath x86 first
-#endif
-
-#ifnexist bindir + "\Release_x86_v141\np3encrypt.exe"
- #error Compile np3encrypt.exe x86 first
-#endif
-
-#ifnexist bindir + "\Release_x64_v141\Notepad3.exe"
- #error Compile Notepad3 x64 first
-#endif
-
-#ifnexist bindir + "\Release_x64_v141\minipath.exe"
- #error Compile MiniPath x64 first
-#endif
-
#ifnexist bindir + "\Release_x64_v141\np3encrypt.exe"
- #error Compile np3encrypt.exe x64 first
-#endif
-
-#define app_version GetFileVersion(bindir + "\Release_x86_v141\Notepad3.exe")
-#define app_name "Notepad3"
-#define app_copyright "Copyright © 2008-2016, Rizonesoft."
-#define quick_launch "{userappdata}\Microsoft\Internet Explorer\Quick Launch"
-
-[Setup]
-AppId={#app_name}
-AppName={#app_name}
-AppVersion={#app_version}
-AppVerName={#app_name} {#app_version}
-AppPublisher=Rizonesoft
-AppPublisherURL=https://rizonesoft.com
-AppSupportURL=https://rizonesoft.com
-AppUpdatesURL=https://rizonesoft.com
-AppContact=https://rizonesoft.com
-AppCopyright={#app_copyright}
-;VersionInfoVersion={#app_version}
-UninstallDisplayIcon={app}\Notepad3.exe
-UninstallDisplayName={#app_name} {#app_version}
-DefaultDirName={pf}\Notepad3
-LicenseFile=License.txt
-OutputDir=.\Packages
-OutputBaseFilename={#app_name}_x_{#app_version}
-SetupIconFile=.\Resources\Setup.ico
-WizardImageFile=compiler:WizModernImage-IS.bmp
-WizardSmallImageFile=.\Resources\WizardSmallImageFile.bmp
-Compression=lzma2/max
-InternalCompressLevel=max
-SolidCompression=yes
-EnableDirDoesntExistWarning=no
-AllowNoIcons=yes
-ShowTasksTreeLines=yes
-DisableDirPage=yes
-DisableProgramGroupPage=yes
-DisableReadyPage=yes
-DisableWelcomePage=yes
-AllowCancelDuringInstall=no
-MinVersion=5.1sp3
-ArchitecturesAllowed=x86 x64
-ArchitecturesInstallIn64BitMode=x64
-#ifexist "..\signinfo_notepad3.txt"
-SignTool=MySignTool
-#endif
-CloseApplications=true
-SetupMutex='{#app_name}' + '_setup_mutex'
-
-
-[Languages]
-Name: en; MessagesFile: compiler:Default.isl
-
-
-[Messages]
-;BeveledLabel ={#app_name} {#app_version} - Compiled with VC2015
-SetupAppTitle =Setup - {#app_name}
-SetupWindowTitle =Setup - {#app_name}
-
-
-[CustomMessages]
-en.msg_AppIsRunning =Setup has detected that {#app_name} is currently running.%n%nPlease close all instances of it now, then click OK to continue, or Cancel to exit.
-en.msg_AppIsRunningUninstall =Uninstall has detected that {#app_name} is currently running.%n%nPlease close all instances of it now, then click OK to continue, or Cancel to exit.
-en.msg_DeleteSettings =Do you also want to delete {#app_name}'s settings?%n%nIf you plan on installing {#app_name} again then you do not have to delete them.
-#if defined(sse_required)
-en.msg_simd_sse =This build of {#app_name} requires a CPU with SSE extension support.%n%nYour CPU does not have those capabilities.
-#elif defined(sse2_required)
-en.msg_simd_sse2 =This build of {#app_name} requires a CPU with SSE2 extension support.%n%nYour CPU does not have those capabilities.
-#endif
-en.tsk_AllUsers =For all users
-en.tsk_CurrentUser =For the current user only
-en.tsk_Other =Other tasks:
-en.tsk_ResetSettings =Reset {#app_name}'s settings
-en.tsk_RemoveDefault =Restore Windows notepad
-en.tsk_SetDefault =Replace Windows notepad with {#app_name}
-en.tsk_StartMenuIcon =Create a Start Menu shortcut
-en.tsk_LaunchWelcomePage =Get more from Rizonesoft
-
-
-[Tasks]
-Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
-Name: desktopicon\user; Description: {cm:tsk_CurrentUser}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
-Name: desktopicon\common; Description: {cm:tsk_AllUsers}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
-Name: startup_icon; Description: {cm:tsk_StartMenuIcon}; GroupDescription: {cm:AdditionalIcons}
-Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked; OnlyBelowVersion: 6.01
-Name: reset_settings; Description: {cm:tsk_ResetSettings}; GroupDescription: {cm:tsk_Other}; Flags: checkedonce unchecked; Check: SettingsExistCheck()
-Name: set_default; Description: {cm:tsk_SetDefault}; GroupDescription: {cm:tsk_Other}; Check: not DefaulNotepadCheck()
-Name: remove_default; Description: {cm:tsk_RemoveDefault}; GroupDescription: {cm:tsk_Other}; Flags: checkedonce unchecked; Check: DefaulNotepadCheck()
-
-
-[Files]
-Source: {#bindir}\Release_x64_v141\Notepad3.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
-Source: {#bindir}\Release_x86_v141\Notepad3.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
-Source: License.txt; DestDir: {app}; Flags: ignoreversion
-Source: Readme.txt; DestDir: {app}; Flags: ignoreversion
-Source: Notepad3.ini; DestDir: {userappdata}\Rizonesoft\Notepad3; Flags: onlyifdoesntexist uninsneveruninstall
-Source: {#bindir}\Release_x64_v141\minipath.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
-Source: {#bindir}\Release_x86_v141\minipath.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
-Source: minipath.ini; DestDir: {userappdata}\Rizonesoft\Notepad3; Flags: onlyifdoesntexist uninsneveruninstall
-Source: {#bindir}\Release_x64_v141\np3encrypt.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
-Source: {#bindir}\Release_x86_v141\np3encrypt.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
-
-[Dirs]
-Name: "{userappdata}\Rizonesoft\Notepad3\Favorites"
-
-[Icons]
-Name: {commondesktop}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: desktopicon\common; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-Name: {userdesktop}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: desktopicon\user; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-Name: {userstartmenu}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: startup_icon; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-Name: {#quick_launch}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: quicklaunchicon; Comment: {#app_name} {#app_version}; WorkingDir: {app}; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-
-
-[INI]
-Filename: {app}\Notepad3.ini; Section: Notepad3; Key: Notepad3.ini; String: %APPDATA%\Rizonesoft\Notepad3\Notepad3.ini
-Filename: {app}\minipath.ini; Section: minipath; Key: minipath.ini; String: %APPDATA%\Rizonesoft\Notepad3\minipath.ini
-Filename: {userappdata}\Rizonesoft\Notepad3\Notepad3.ini; Section: Settings; Key: Favorites; String: %APPDATA%\Rizonesoft\Notepad3\Favorites\
-
-
-[Run]
-Filename: {app}\Notepad3.exe; Description: {cm:LaunchProgram,{#app_name}}; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked
-Filename: https://goo.gl/tGtJ6a; Description: {cm:tsk_LaunchWelcomePage}; Flags: nowait postinstall shellexec skipifsilent
-
-
-[InstallDelete]
-Type: files; Name: {userdesktop}\{#app_name}.lnk; Check: not IsTaskSelected('desktopicon\user') and IsUpgrade()
-Type: files; Name: {commondesktop}\{#app_name}.lnk; Check: not IsTaskSelected('desktopicon\common') and IsUpgrade()
-Type: files; Name: {userstartmenu}\{#app_name}.lnk; Check: not IsTaskSelected('startup_icon') and IsUpgrade()
-Type: files; Name: {#quick_launch}\{#app_name}.lnk; Check: not IsTaskSelected('quicklaunchicon') and IsUpgrade(); OnlyBelowVersion: 6.01
-Type: files; Name: {app}\Notepad3.ini
-Type: files; Name: {app}\Readme.txt
-Type: files; Name: {app}\minipath.ini
-
-
-[UninstallDelete]
-Type: files; Name: {app}\Notepad3.ini
-Type: files; Name: {app}\minipath.ini
-Type: dirifempty; Name: {app}
-
-[Code]
-const
- IFEO = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe';
- VersionURL = 'https://www.rizonesoft.com/update/Notepad3.rus';
- UpdateURL = 'https://goo.gl/y6CGMM';
-
-type
- TIntegerArray = array of Integer;
- TCompareResult = (
- crLesser,
- crEquals,
- crGreater
- );
-
-function Max(A, B: Integer): Integer;
-begin
- if A > B then Result := A else Result := B;
-end;
-
-function CompareValue(A, B: Integer): TCompareResult;
-begin
- if A = B then
- Result := crEquals
- else
- if A < B then
- Result := crLesser
- else
- Result := crGreater;
-end;
-
-function AddVersionChunk(const S: string; var A: TIntegerArray): Integer;
-var
- Chunk: Integer;
-begin
- Chunk := StrToIntDef(S, -1);
- if Chunk <> -1 then
- begin
- Result := GetArrayLength(A) + 1;
- SetArrayLength(A, Result);
- A[Result - 1] := Chunk;
- end
- else
- RaiseException('Invalid format of version string');
-end;
-
-function ParseVersionStr(const S: string; var A: TIntegerArray): Integer;
-var
- I: Integer;
- Count: Integer;
- Index: Integer;
-begin
- Count := 0;
- Index := 1;
-
- for I := 1 to Length(S) do
- begin
- case S[I] of
- '.':
- begin
- AddVersionChunk(Copy(S, Index, Count), A);
- Count := 0;
- Index := I + 1;
- end;
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- begin
- Count := Count + 1;
- end;
- else
- RaiseException('Invalid char in version string');
- end;
- end;
- Result := AddVersionChunk(Copy(S, Index, Count), A);
-end;
-
-function GetVersionValue(const A: TIntegerArray; Index,
- Length: Integer): Integer;
-begin
- Result := 0;
- if (Index >= 0) and (Index < Length) then
- Result := A[Index];
-end;
-
-function CompareVersionStr(const A, B: string): TCompareResult;
-var
- I: Integer;
- VerLenA, VerLenB: Integer;
- VerIntA, VerIntB: TIntegerArray;
-begin
- Result := crEquals;
-
- VerLenA := ParseVersionStr(A, VerIntA);
- VerLenB := ParseVersionStr(B, VerIntB);
-
- for I := 0 to Max(VerLenA, VerLenB) - 1 do
- begin
- Result := CompareValue(GetVersionValue(VerIntA, I, VerLenA),
- GetVersionValue(VerIntB, I, VerLenB));
- if Result <> crEquals then
- Exit;
- end;
-end;
-
-function DownloadFile(const URL: string; var Response: string): Boolean;
-var
- WinHttpRequest: Variant;
-begin
- Result := True;
- try
- WinHttpRequest := CreateOleObject('WinHttp.WinHttpRequest.5.1');
- WinHttpRequest.Open('GET', URL, False);
- WinHttpRequest.Send;
- Response := WinHttpRequest.ResponseText;
- except
- Result := False;
- Response := GetExceptionMessage;
- end;
-end;
-
-function InitializeSetup: Boolean;
-var
- ErrorCode: Integer;
- SetupVersion: string;
- LatestVersion: string;
-
-begin
- Result := True;
-
- //Check for Processor SSE2 support.
- #if defined(sse2_required)
- if not IsSSE2Supported() then begin
- SuppressibleMsgBox(CustomMessage('msg_simd_sse2'), mbCriticalError, MB_OK, MB_OK);
- Result := False;
- end;
- #elif defined(sse_required)
- if not IsSSESupported() then begin
- SuppressibleMsgBox(CustomMessage('msg_simd_sse'), mbCriticalError, MB_OK, MB_OK);
- Result := False;
- end;
- #endif
-
- if DownloadFile(VersionURL, LatestVersion) then
- begin
- SetupVersion := '{#SetupSetting('AppVersion')}';
- if CompareVersionStr(LatestVersion, SetupVersion) = crGreater then
- begin
- if MsgBox('There is a newer version of {#SetupSetting('AppName')} available. Do ' +
- 'you want to visit the site?', mbConfirmation, MB_YESNO) = IDYES then
- begin
- Result := not ShellExec('', UpdateURL, '', '', SW_SHOW, ewNoWait,
- ErrorCode);
- end;
- end;
- end;
-
-end;
-
-// Check if Notepad3 has replaced Windows Notepad
-function DefaulNotepadCheck(): Boolean;
-var
- sDebugger: String;
-begin
- if RegQueryStringValue(HKLM, IFEO, 'Debugger', sDebugger) and
- (sDebugger = (ExpandConstant('"{app}\Notepad3.exe" /z'))) then begin
- Log('Custom Code: {#app_name} is set as the default notepad');
- Result := True;
- end
- else begin
- Log('Custom Code: {#app_name} is NOT set as the default notepad');
- Result := False;
- end;
-end;
-
-#if defined(sse_required) || defined(sse2_required)
-function IsProcessorFeaturePresent(Feature: Integer): Boolean;
-external 'IsProcessorFeaturePresent@kernel32.dll stdcall';
-#endif
-
-#if defined(sse_required)
-function IsSSESupported(): Boolean;
-begin
- // PF_XMMI_INSTRUCTIONS_AVAILABLE
- Result := IsProcessorFeaturePresent(6);
-end;
-
-#elif defined(sse2_required)
-
-function IsSSE2Supported(): Boolean;
-begin
- // PF_XMMI64_INSTRUCTIONS_AVAILABLE
- Result := IsProcessorFeaturePresent(10);
-end;
-
-#endif
-
-
-function IsOldBuildInstalled(sInfFile: String): Boolean;
-begin
- if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Notepad2') and
- FileExists(ExpandConstant('{pf}\Notepad2\' + sInfFile)) then
- Result := True
- else
- Result := False;
-end;
-
-
-function IsUpgrade(): Boolean;
-var
- sPrevPath: String;
-begin
- sPrevPath := WizardForm.PrevAppDir;
- Result := (sPrevPath <> '');
-end;
-
-
-// Check if Notepad3's settings exist
-function SettingsExistCheck(): Boolean;
-begin
- if FileExists(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\Notepad3.ini')) then begin
- Log('Custom Code: Settings are present');
- Result := True;
- end
- else begin
- Log('Custom Code: Settings are NOT present');
- Result := False;
- end;
-end;
-
-
-function UninstallOldVersion(sInfFile: String): Integer;
-var
- iResultCode: Integer;
-begin
- // Return Values:
- // 0 - no idea
- // 1 - error executing the command
- // 2 - successfully executed the command
-
- // default return value
- Result := 0;
- // TODO: use RegQueryStringValue
- if not Exec('rundll32.exe', ExpandConstant('advpack.dll,LaunchINFSectionEx ' + '"{pf}\Notepad2\' + sInfFile +'",DefaultUninstall,,8,N'), '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
- Result := 1;
- end
- else begin
- Result := 2;
- Sleep(200);
- end;
-end;
-
-
-function ShouldSkipPage(PageID: Integer): Boolean;
-begin
- // Hide the license page if IsUpgrade()
- if IsUpgrade() and (PageID = wpLicense) then
- Result := True;
-end;
-
-
-procedure AddReg();
-begin
- RegWriteStringValue(HKCR, 'Applications\notepad3.exe', 'AppUserModelID', 'Notepad3');
- RegWriteStringValue(HKCR, 'Applications\notepad3.exe\shell\open\command', '', ExpandConstant('"{app}\Notepad3.exe" %1'));
- RegWriteStringValue(HKCR, '*\OpenWithList\notepad3.exe', '', '');
-end;
-
-
-procedure CleanUpSettings();
-begin
- DeleteFile(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\Notepad3.ini'));
- DeleteFile(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\minipath.ini'));
- RemoveDir(ExpandConstant('{userappdata}\Rizonesoft\Notepad3'));
-end;
-
-
-procedure RemoveReg();
-begin
- RegDeleteKeyIncludingSubkeys(HKCR, 'Applications\notepad3.exe');
- RegDeleteKeyIncludingSubkeys(HKCR, '*\OpenWithList\notepad3.exe');
-end;
-
-
-procedure CurPageChanged(CurPageID: Integer);
-begin
- if CurPageID = wpSelectTasks then
- WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall)
- else if CurPageID = wpFinished then
- WizardForm.NextButton.Caption := SetupMessage(msgButtonFinish);
-end;
-
-
-procedure CurStepChanged(CurStep: TSetupStep);
-begin
- if CurStep = ssInstall then begin
- if IsTaskSelected('reset_settings') then
- CleanUpSettings();
-
- if IsOldBuildInstalled('Uninstall.inf') or IsOldBuildInstalled('Notepad2.inf') then begin
- if IsOldBuildInstalled('Uninstall.inf') then begin
- Log('Custom Code: The old build is installed, will try to uninstall it');
- if UninstallOldVersion('Uninstall.inf') = 2 then
- Log('Custom Code: The old build was successfully uninstalled')
- else
- Log('Custom Code: Something went wrong when uninstalling the old build');
- end;
-
- if IsOldBuildInstalled('Notepad2.inf') then begin
- Log('Custom Code: The official Notepad2 build is installed, will try to uninstall it');
- if UninstallOldVersion('Notepad2.inf') = 2 then
- Log('Custom Code: The official Notepad2 build was successfully uninstalled')
- else
- Log('Custom Code: Something went wrong when uninstalling the official Notepad2 build');
- end;
-
- // This is the case where the old build is installed; the DefaulNotepadCheck() returns true
- // and the set_default task isn't selected
- if not IsTaskSelected('remove_default') then
- RegWriteStringValue(HKLM, IFEO, 'Debugger', ExpandConstant('"{app}\Notepad3.exe" /z'));
-
- end;
- end;
-
- if CurStep = ssPostInstall then begin
- if IsTaskSelected('set_default') then
- RegWriteStringValue(HKLM, IFEO, 'Debugger', ExpandConstant('"{app}\Notepad3.exe" /z'));
- if IsTaskSelected('remove_default') then begin
- RegDeleteValue(HKLM, IFEO, 'Debugger');
- RegDeleteKeyIfEmpty(HKLM, IFEO);
- end;
- // Always add Notepad3's AppUserModelID and the rest registry values
- AddReg();
- end;
-
-end;
-
-
-procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
-begin
- // When uninstalling, ask the user to delete Notepad3's settings
- if CurUninstallStep = usUninstall then begin
- if SettingsExistCheck() then begin
- if SuppressibleMsgBox(CustomMessage('msg_DeleteSettings'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2, IDNO) = IDYES then
- CleanUpSettings();
- end;
- if DefaulNotepadCheck() then
- RegDeleteValue(HKLM, IFEO, 'Debugger');
- RegDeleteKeyIfEmpty(HKLM, IFEO);
- RemoveReg();
- end;
-end;
-
-
-procedure InitializeWizard();
-begin
- WizardForm.SelectTasksLabel.Hide;
- WizardForm.TasksList.Top := 0;
- WizardForm.TasksList.Height := PageFromID(wpSelectTasks).SurfaceHeight;
-end;
diff --git a/Build/notepad3_setup_replace.iss.bak b/Build/notepad3_setup_replace.iss.bak
deleted file mode 100644
index 2ebaa5abe..000000000
--- a/Build/notepad3_setup_replace.iss.bak
+++ /dev/null
@@ -1,549 +0,0 @@
-;* Notepad3 - Installer script
-;*
-;* Copyright (C) 2008-2016 Rizonesoft
-
-; Requirements:
-; Inno Setup: http://www.jrsoftware.org/isdl.php
-
-; Preprocessor related stuff
-#if VER < EncodeVer(5,5,9)
- #error Update your Inno Setup version (5.5.9 or newer)
-#endif
-
-#define bindir "..\Bin"
-
-#ifnexist bindir + "\Release_x86_v141\Notepad3.exe"
- #error Compile Notepad3 x86 first
-#endif
-
-#ifnexist bindir + "\Release_x86_v141\minipath.exe"
- #error Compile MiniPath x86 first
-#endif
-
-#ifnexist bindir + "\Release_x86_v141\np3encrypt.exe"
- #error Compile np3encrypt.exe x86 first
-#endif
-
-#ifnexist bindir + "\Release_x64_v141\Notepad3.exe"
- #error Compile Notepad3 x64 first
-#endif
-
-#ifnexist bindir + "\Release_x64_v141\minipath.exe"
- #error Compile MiniPath x64 first
-#endif
-
#ifnexist bindir + "\Release_x64_v141\np3encrypt.exe"
- #error Compile np3encrypt.exe x64 first
-#endif
-
-#define app_version GetFileVersion(bindir + "\Release_x86_v141\Notepad3.exe")
-#define app_name "Notepad3"
-#define app_copyright "Copyright © 2008-2016, Rizonesoft."
-#define quick_launch "{userappdata}\Microsoft\Internet Explorer\Quick Launch"
-
-[Setup]
-AppId={#app_name}
-AppName={#app_name}
-AppVersion={#app_version}
-AppVerName={#app_name} {#app_version}
-AppPublisher=Rizonesoft
-AppPublisherURL=https://rizonesoft.com
-AppSupportURL=https://rizonesoft.com
-AppUpdatesURL=https://rizonesoft.com
-AppContact=https://rizonesoft.com
-AppCopyright={#app_copyright}
-;VersionInfoVersion={#app_version}
-UninstallDisplayIcon={app}\Notepad3.exe
-UninstallDisplayName={#app_name} {#app_version}
-DefaultDirName={pf}\Notepad3
-LicenseFile=License.txt
-OutputDir=.\Packages
-OutputBaseFilename={#app_name}_x_{#app_version}
-SetupIconFile=.\Resources\Setup.ico
-WizardImageFile=compiler:WizModernImage-IS.bmp
-WizardSmallImageFile=.\Resources\WizardSmallImageFile.bmp
-Compression=lzma2/max
-InternalCompressLevel=max
-SolidCompression=yes
-EnableDirDoesntExistWarning=no
-AllowNoIcons=yes
-ShowTasksTreeLines=yes
-DisableDirPage=yes
-DisableProgramGroupPage=yes
-DisableReadyPage=yes
-DisableWelcomePage=yes
-AllowCancelDuringInstall=no
-MinVersion=5.1sp3
-ArchitecturesAllowed=x86 x64
-ArchitecturesInstallIn64BitMode=x64
-#ifexist "..\signinfo_notepad3.txt"
-SignTool=MySignTool
-#endif
-CloseApplications=true
-SetupMutex='{#app_name}' + '_setup_mutex'
-
-
-[Languages]
-Name: en; MessagesFile: compiler:Default.isl
-
-
-[Messages]
-;BeveledLabel ={#app_name} {#app_version} - Compiled with VC2015
-SetupAppTitle =Setup - {#app_name}
-SetupWindowTitle =Setup - {#app_name}
-
-
-[CustomMessages]
-en.msg_AppIsRunning =Setup has detected that {#app_name} is currently running.%n%nPlease close all instances of it now, then click OK to continue, or Cancel to exit.
-en.msg_AppIsRunningUninstall =Uninstall has detected that {#app_name} is currently running.%n%nPlease close all instances of it now, then click OK to continue, or Cancel to exit.
-en.msg_DeleteSettings =Do you also want to delete {#app_name}'s settings?%n%nIf you plan on installing {#app_name} again then you do not have to delete them.
-#if defined(sse_required)
-en.msg_simd_sse =This build of {#app_name} requires a CPU with SSE extension support.%n%nYour CPU does not have those capabilities.
-#elif defined(sse2_required)
-en.msg_simd_sse2 =This build of {#app_name} requires a CPU with SSE2 extension support.%n%nYour CPU does not have those capabilities.
-#endif
-en.tsk_AllUsers =For all users
-en.tsk_CurrentUser =For the current user only
-en.tsk_Other =Other tasks:
-en.tsk_ResetSettings =Reset {#app_name}'s settings
-en.tsk_RemoveDefault =Restore Windows notepad
-en.tsk_SetDefault =Replace Windows notepad with {#app_name}
-en.tsk_StartMenuIcon =Create a Start Menu shortcut
-en.tsk_LaunchWelcomePage =Visit Rizonesoft for more downloads
-
-
-[Tasks]
-Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
-Name: desktopicon\user; Description: {cm:tsk_CurrentUser}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
-Name: desktopicon\common; Description: {cm:tsk_AllUsers}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
-Name: startup_icon; Description: {cm:tsk_StartMenuIcon}; GroupDescription: {cm:AdditionalIcons}
-Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked; OnlyBelowVersion: 6.01
-Name: reset_settings; Description: {cm:tsk_ResetSettings}; GroupDescription: {cm:tsk_Other}; Flags: checkedonce unchecked; Check: SettingsExistCheck()
-Name: set_default; Description: {cm:tsk_SetDefault}; GroupDescription: {cm:tsk_Other}; Check: not DefaulNotepadCheck()
-Name: remove_default; Description: {cm:tsk_RemoveDefault}; GroupDescription: {cm:tsk_Other}; Flags: checkedonce unchecked; Check: DefaulNotepadCheck()
-
-
-[Files]
-Source: {#bindir}\Release_x64_v141\Notepad3.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
-Source: {#bindir}\Release_x86_v141\Notepad3.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
-Source: License.txt; DestDir: {app}; Flags: ignoreversion
-Source: Readme.txt; DestDir: {app}; Flags: ignoreversion
-Source: Notepad3.ini; DestDir: {userappdata}\Rizonesoft\Notepad3; Flags: onlyifdoesntexist uninsneveruninstall
-Source: {#bindir}\Release_x64_v141\minipath.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
-Source: {#bindir}\Release_x86_v141\minipath.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
-Source: minipath.ini; DestDir: {userappdata}\Rizonesoft\Notepad3; Flags: onlyifdoesntexist uninsneveruninstall
-Source: {#bindir}\Release_x64_v141\np3encrypt.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode()
-Source: {#bindir}\Release_x86_v141\np3encrypt.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode()
-
-[Dirs]
-Name: "{userappdata}\Rizonesoft\Notepad3\Favorites"
-
-[Icons]
-Name: {commondesktop}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: desktopicon\common; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-Name: {userdesktop}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: desktopicon\user; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-Name: {userstartmenu}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: startup_icon; Comment: {#app_name} {#app_version}; WorkingDir: {app}; AppUserModelID: Notepad3; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-Name: {#quick_launch}\{#app_name}; Filename: {app}\Notepad3.exe; Tasks: quicklaunchicon; Comment: {#app_name} {#app_version}; WorkingDir: {app}; IconFilename: {app}\Notepad3.exe; IconIndex: 0
-
-
-[INI]
-Filename: {app}\Notepad3.ini; Section: Notepad3; Key: Notepad3.ini; String: %APPDATA%\Rizonesoft\Notepad3\Notepad3.ini
-Filename: {app}\minipath.ini; Section: minipath; Key: minipath.ini; String: %APPDATA%\Rizonesoft\Notepad3\minipath.ini
-
-Filename: {userappdata}\Rizonesoft\Notepad3\Notepad3.ini; Section: Settings; Key: Favorites; String: %APPDATA%\Rizonesoft\Notepad3\Favorites\
-
-
-[Run]
-Filename: {app}\Notepad3.exe; Description: {cm:LaunchProgram,{#app_name}}; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked
-Filename: "http://www.rizonesoft.com/downloads/"; Description: {cm:tsk_LaunchWelcomePage}; Flags: nowait postinstall shellexec skipifsilent
-
-
-[InstallDelete]
-Type: files; Name: {userdesktop}\{#app_name}.lnk; Check: not IsTaskSelected('desktopicon\user') and IsUpgrade()
-Type: files; Name: {commondesktop}\{#app_name}.lnk; Check: not IsTaskSelected('desktopicon\common') and IsUpgrade()
-Type: files; Name: {userstartmenu}\{#app_name}.lnk; Check: not IsTaskSelected('startup_icon') and IsUpgrade()
-Type: files; Name: {#quick_launch}\{#app_name}.lnk; Check: not IsTaskSelected('quicklaunchicon') and IsUpgrade(); OnlyBelowVersion: 6.01
-Type: files; Name: {app}\Notepad3.ini
-Type: files; Name: {app}\Readme.txt
-Type: files; Name: {app}\minipath.ini
-
-
-[UninstallDelete]
-Type: files; Name: {app}\Notepad3.ini
-Type: files; Name: {app}\minipath.ini
-Type: dirifempty; Name: {app}
-
-[Code]
-const
- IFEO = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe';
- VersionURL = 'https://www.rizonesoft.com/update/Notepad3.rus';
- UpdateURL = 'https://www.rizonesoft.com/downloads/notepad3/update/';
-
-type
- TIntegerArray = array of Integer;
- TCompareResult = (
- crLesser,
- crEquals,
- crGreater
- );
-
-function Max(A, B: Integer): Integer;
-begin
- if A > B then Result := A else Result := B;
-end;
-
-function CompareValue(A, B: Integer): TCompareResult;
-begin
- if A = B then
- Result := crEquals
- else
- if A < B then
- Result := crLesser
- else
- Result := crGreater;
-end;
-
-function AddVersionChunk(const S: string; var A: TIntegerArray): Integer;
-var
- Chunk: Integer;
-begin
- Chunk := StrToIntDef(S, -1);
- if Chunk <> -1 then
- begin
- Result := GetArrayLength(A) + 1;
- SetArrayLength(A, Result);
- A[Result - 1] := Chunk;
- end
- else
- RaiseException('Invalid format of version string');
-end;
-
-function ParseVersionStr(const S: string; var A: TIntegerArray): Integer;
-var
- I: Integer;
- Count: Integer;
- Index: Integer;
-begin
- Count := 0;
- Index := 1;
-
- for I := 1 to Length(S) do
- begin
- case S[I] of
- '.':
- begin
- AddVersionChunk(Copy(S, Index, Count), A);
- Count := 0;
- Index := I + 1;
- end;
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- begin
- Count := Count + 1;
- end;
- else
- RaiseException('Invalid char in version string');
- end;
- end;
- Result := AddVersionChunk(Copy(S, Index, Count), A);
-end;
-
-function GetVersionValue(const A: TIntegerArray; Index,
- Length: Integer): Integer;
-begin
- Result := 0;
- if (Index >= 0) and (Index < Length) then
- Result := A[Index];
-end;
-
-function CompareVersionStr(const A, B: string): TCompareResult;
-var
- I: Integer;
- VerLenA, VerLenB: Integer;
- VerIntA, VerIntB: TIntegerArray;
-begin
- Result := crEquals;
-
- VerLenA := ParseVersionStr(A, VerIntA);
- VerLenB := ParseVersionStr(B, VerIntB);
-
- for I := 0 to Max(VerLenA, VerLenB) - 1 do
- begin
- Result := CompareValue(GetVersionValue(VerIntA, I, VerLenA),
- GetVersionValue(VerIntB, I, VerLenB));
- if Result <> crEquals then
- Exit;
- end;
-end;
-
-function DownloadFile(const URL: string; var Response: string): Boolean;
-var
- WinHttpRequest: Variant;
-begin
- Result := True;
- try
- WinHttpRequest := CreateOleObject('WinHttp.WinHttpRequest.5.1');
- WinHttpRequest.Open('GET', URL, False);
- WinHttpRequest.Send;
- Response := WinHttpRequest.ResponseText;
- except
- Result := False;
- Response := GetExceptionMessage;
- end;
-end;
-
-function InitializeSetup: Boolean;
-var
- ErrorCode: Integer;
- SetupVersion: string;
- LatestVersion: string;
-
-begin
- Result := True;
-
- //Check for Processor SSE2 support.
- #if defined(sse2_required)
- if not IsSSE2Supported() then begin
- SuppressibleMsgBox(CustomMessage('msg_simd_sse2'), mbCriticalError, MB_OK, MB_OK);
- Result := False;
- end;
- #elif defined(sse_required)
- if not IsSSESupported() then begin
- SuppressibleMsgBox(CustomMessage('msg_simd_sse'), mbCriticalError, MB_OK, MB_OK);
- Result := False;
- end;
- #endif
-
- if DownloadFile(VersionURL, LatestVersion) then
- begin
- SetupVersion := '{#SetupSetting('AppVersion')}';
- if CompareVersionStr(LatestVersion, SetupVersion) = crGreater then
- begin
- if MsgBox('There is a newer version of {#SetupSetting('AppName')} available. Do ' +
- 'you want to visit the site?', mbConfirmation, MB_YESNO) = IDYES then
- begin
- Result := not ShellExec('', UpdateURL, '', '', SW_SHOW, ewNoWait,
- ErrorCode);
- end;
- end;
- end;
-
-end;
-
-// Check if Notepad3 has replaced Windows Notepad
-function DefaulNotepadCheck(): Boolean;
-var
- sDebugger: String;
-begin
- if RegQueryStringValue(HKLM, IFEO, 'Debugger', sDebugger) and
- (sDebugger = (ExpandConstant('"{app}\Notepad3.exe" /z'))) then begin
- Log('Custom Code: {#app_name} is set as the default notepad');
- Result := True;
- end
- else begin
- Log('Custom Code: {#app_name} is NOT set as the default notepad');
- Result := False;
- end;
-end;
-
-#if defined(sse_required) || defined(sse2_required)
-function IsProcessorFeaturePresent(Feature: Integer): Boolean;
-external 'IsProcessorFeaturePresent@kernel32.dll stdcall';
-#endif
-
-#if defined(sse_required)
-function IsSSESupported(): Boolean;
-begin
- // PF_XMMI_INSTRUCTIONS_AVAILABLE
- Result := IsProcessorFeaturePresent(6);
-end;
-
-#elif defined(sse2_required)
-
-function IsSSE2Supported(): Boolean;
-begin
- // PF_XMMI64_INSTRUCTIONS_AVAILABLE
- Result := IsProcessorFeaturePresent(10);
-end;
-
-#endif
-
-
-function IsOldBuildInstalled(sInfFile: String): Boolean;
-begin
- if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Notepad2') and
- FileExists(ExpandConstant('{pf}\Notepad2\' + sInfFile)) then
- Result := True
- else
- Result := False;
-end;
-
-
-function IsUpgrade(): Boolean;
-var
- sPrevPath: String;
-begin
- sPrevPath := WizardForm.PrevAppDir;
- Result := (sPrevPath <> '');
-end;
-
-
-// Check if Notepad3's settings exist
-function SettingsExistCheck(): Boolean;
-begin
- if FileExists(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\Notepad3.ini')) then begin
- Log('Custom Code: Settings are present');
- Result := True;
- end
- else begin
- Log('Custom Code: Settings are NOT present');
- Result := False;
- end;
-end;
-
-
-function UninstallOldVersion(sInfFile: String): Integer;
-var
- iResultCode: Integer;
-begin
- // Return Values:
- // 0 - no idea
- // 1 - error executing the command
- // 2 - successfully executed the command
-
- // default return value
- Result := 0;
- // TODO: use RegQueryStringValue
- if not Exec('rundll32.exe', ExpandConstant('advpack.dll,LaunchINFSectionEx ' + '"{pf}\Notepad2\' + sInfFile +'",DefaultUninstall,,8,N'), '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
- Result := 1;
- end
- else begin
- Result := 2;
- Sleep(200);
- end;
-end;
-
-
-function ShouldSkipPage(PageID: Integer): Boolean;
-begin
- // Hide the license page if IsUpgrade()
- if IsUpgrade() and (PageID = wpLicense) then
- Result := True;
-end;
-
-
-procedure AddReg();
-begin
- RegWriteStringValue(HKCR, 'Applications\notepad3.exe', 'AppUserModelID', 'Notepad3');
- RegWriteStringValue(HKCR, 'Applications\notepad3.exe\shell\open\command', '', ExpandConstant('"{app}\Notepad3.exe" %1'));
- RegWriteStringValue(HKCR, '*\OpenWithList\notepad3.exe', '', '');
-end;
-
-
-procedure CleanUpSettings();
-begin
- DeleteFile(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\Notepad3.ini'));
- DeleteFile(ExpandConstant('{userappdata}\Rizonesoft\Notepad3\minipath.ini'));
- RemoveDir(ExpandConstant('{userappdata}\Rizonesoft\Notepad3'));
-end;
-
-
-procedure RemoveReg();
-begin
- RegDeleteKeyIncludingSubkeys(HKCR, 'Applications\notepad3.exe');
- RegDeleteKeyIncludingSubkeys(HKCR, '*\OpenWithList\notepad3.exe');
-end;
-
-
-procedure CurPageChanged(CurPageID: Integer);
-begin
- if CurPageID = wpSelectTasks then
- WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall)
- else if CurPageID = wpFinished then
- WizardForm.NextButton.Caption := SetupMessage(msgButtonFinish);
-end;
-
-
-procedure CurStepChanged(CurStep: TSetupStep);
-begin
- if CurStep = ssInstall then begin
- if IsTaskSelected('reset_settings') then
- CleanUpSettings();
-
- if IsOldBuildInstalled('Uninstall.inf') or IsOldBuildInstalled('Notepad2.inf') then begin
- if IsOldBuildInstalled('Uninstall.inf') then begin
- Log('Custom Code: The old build is installed, will try to uninstall it');
- if UninstallOldVersion('Uninstall.inf') = 2 then
- Log('Custom Code: The old build was successfully uninstalled')
- else
- Log('Custom Code: Something went wrong when uninstalling the old build');
- end;
-
- if IsOldBuildInstalled('Notepad2.inf') then begin
- Log('Custom Code: The official Notepad2 build is installed, will try to uninstall it');
- if UninstallOldVersion('Notepad2.inf') = 2 then
- Log('Custom Code: The official Notepad2 build was successfully uninstalled')
- else
- Log('Custom Code: Something went wrong when uninstalling the official Notepad2 build');
- end;
-
- // This is the case where the old build is installed; the DefaulNotepadCheck() returns true
- // and the set_default task isn't selected
- if not IsTaskSelected('remove_default') then
- RegWriteStringValue(HKLM, IFEO, 'Debugger', ExpandConstant('"{app}\Notepad3.exe" /z'));
-
- end;
- end;
-
- if CurStep = ssPostInstall then begin
- if IsTaskSelected('set_default') then
- RegWriteStringValue(HKLM, IFEO, 'Debugger', ExpandConstant('"{app}\Notepad3.exe" /z'));
- if IsTaskSelected('remove_default') then begin
- RegDeleteValue(HKLM, IFEO, 'Debugger');
- RegDeleteKeyIfEmpty(HKLM, IFEO);
- end;
- // Always add Notepad3's AppUserModelID and the rest registry values
- AddReg();
- end;
-
-end;
-
-
-procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
-begin
- // When uninstalling, ask the user to delete Notepad3's settings
- if CurUninstallStep = usUninstall then begin
- if SettingsExistCheck() then begin
- if SuppressibleMsgBox(CustomMessage('msg_DeleteSettings'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2, IDNO) = IDYES then
- CleanUpSettings();
- end;
- if DefaulNotepadCheck() then
- RegDeleteValue(HKLM, IFEO, 'Debugger');
- RegDeleteKeyIfEmpty(HKLM, IFEO);
- RemoveReg();
- end;
-end;
-
-
-procedure InitializeWizard();
-begin
- WizardForm.SelectTasksLabel.Hide;
- WizardForm.TasksList.Top := 0;
- WizardForm.TasksList.Height := PageFromID(wpSelectTasks).SurfaceHeight;
-end;
-
-
-function InitializeSetup(): Boolean;
-begin
- Result := True;
-
-#if defined(sse2_required)
- if not IsSSE2Supported() then begin
- SuppressibleMsgBox(CustomMessage('msg_simd_sse2'), mbCriticalError, MB_OK, MB_OK);
- Result := False;
- end;
-#elif defined(sse_required)
- if not IsSSESupported() then begin
- SuppressibleMsgBox(CustomMessage('msg_simd_sse'), mbCriticalError, MB_OK, MB_OK);
- Result := False;
- end;
-#endif
-
-end;
diff --git a/Readme.md b/Readme.md
index 26aef9b90..588c4f691 100644
--- a/Readme.md
+++ b/Readme.md
@@ -8,6 +8,12 @@ Notepad3 is a fast and light-weight Scintilla-based text editor with syntax high
> *Notepad3 is based on code from Florian Balmer's Notepad2 and XhmikosR's Notepad2-mod. MiniPath is based on code from Florian Balmer's metapath.*
+## Important links!
+* Notepad3 download page - https://www.rizonesoft.com/downloads/notepad3/
+* Latest changelog (release notes) - https://www.rizonesoft.com/downloads/notepad3/update/
+* Notepad3 Documentation - https://www.rizonesoft.com/documents/notepad3/
+* User Testimonials - https://www.rizonesoft.com/testimonials/
+
## Changes compared to Flo's official [Notepad2](http://www.flos-freeware.ch/notepad2.html) (made in [Notepad2-mod](https://xhmikosr.github.io/notepad2-mod/)):
* Code folding
diff --git a/Versions/build.txt b/Versions/build.txt
index 227b54a06..9babd2833 100644
--- a/Versions/build.txt
+++ b/Versions/build.txt
@@ -1 +1 @@
-802
+828
diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf
index 067b6aea3..728bafc7c 100644
--- a/res/Notepad3.exe.manifest.conf
+++ b/res/Notepad3.exe.manifest.conf
@@ -3,7 +3,7 @@
Notepad3
diff --git a/src/VersionEx.h b/src/VersionEx.h
index 96e0da613..5cc2f112e 100644
--- a/src/VersionEx.h
+++ b/src/VersionEx.h
@@ -5,7 +5,7 @@
// //////////////////////////////////////////////////////////
#define VERSION_MAJOR 3
#define VERSION_MINOR 18
-#define VERSION_REV 106
-#define VERSION_BUILD 808
+#define VERSION_REV 113
+#define VERSION_BUILD 828
#define SCINTILLA_VER 402
#define ONIGMO_REGEX_VER 6.1.3
diff --git a/themes/professional/Toolbar.bmp b/themes/professional/Toolbar.bmp
new file mode 100644
index 000000000..1f7321339
Binary files /dev/null and b/themes/professional/Toolbar.bmp differ