; Inno Setup file for Tcl
; http://www.jrsoftware.org/ishelp/

#define MyCompression     "@INNO_COMPRESSION@" 
#define MyAppVersion      "@TCL_VERSION@"
#define MyAppId           "BawtTcl"
#define MyAppName         "BawtTcl @TCL_VERSION@ (@TCL_BITS@-bit)"
#define MyPublisher       "Paul Obermeier"
#define MyCompany         "poSoft"
#define MyAppIcon         "poSoft.ico"
#define MyAppURL          "http://www.bawt.tcl3d.org/"

[Setup]
AllowNoIcons                    = yes
AlwaysRestart                   = no
AlwaysShowComponentsList        = yes
AlwaysShowDirOnReadyPage        = yes
AlwaysShowGroupOnReadyPage      = yes
AppCopyright                    = "Copyright © @CURRENT_YEAR@ {#MyPublisher}"
AppId                           = {#MyAppId}
AppName                         = {#MyAppName}
AppVerName                      = {#MyAppName}
AppVersion                      = {#MyAppVersion} 
AppPublisher                    = {#MyCompany}
AppPublisherURL                 = http://www.poSoft.de
AppSupportURL                   = {#MyAppURL}
AppUpdatesURL                   = {#MyAppURL}/download.html
ChangesEnvironment              = yes
ChangesAssociations             = yes
Compression                     = {#MyCompression}
DefaultDirName                  = {sd}\Tcl
DefaultGroupName                = {#MyAppName}
DisableProgramGroupPage         = no
DisableDirPage                  = auto
InfoBeforeFile                  = "Readme-App.txt"
LicenseFile                     = "License.txt"
MinVersion                      = "6.1"
OutputBaseFilename              = "TclSetup"
OutputDir                       = .
PrivilegesRequired              = lowest
SetupIconFile                   = {#MyAppIcon}
UninstallDisplayIcon            = {app}\{#MyAppIcon}
SetupLogging                    = yes
VersionInfoDescription          = {#MyAppName}
VersionInfoVersion              = {#MyAppVersion}
; 164 x 314 pixel
WizardImageFile                 = "TclTkLarge.bmp"
; 55 x 58 pixel
WizardSmallImageFile            = "TclTkSmall.bmp"

[Files]
Source:  "Tcl\*"; \
DestDir: "{app}"; \
Flags:   recursesubdirs skipifsourcedoesntexist

Source: "Readme-App.txt"; \
DestDir: "{app}";

Source:  {#MyAppIcon}; \
DestDir: "{app}";

Source:  "@VC_REDIST_EXE@"; \
DestDir: "{app}"; \
Flags:   skipifsourcedoesntexist

@VC_REDIST_ENABLE@[Run]
@VC_REDIST_ENABLE@Filename:    "{app}\@VC_REDIST_EXE@"; \
@VC_REDIST_ENABLE@Description: "Install VisualStudio redistributables"; \
@VC_REDIST_ENABLE@Parameters:  "/qb"; \
@VC_REDIST_ENABLE@StatusMsg:   "Installing VisualStudio redistributables"; \
@VC_REDIST_ENABLE@Flags:       postinstall skipifdoesntexist skipifsilent unchecked

[Languages]
Name:         "english"; \
MessagesFile: "compiler:Default.isl"

[Icons]
Name:         "{@SENDTO@}\poApps"; \
FileName:     "{app}\bin\poApps.exe"; \
Comment:      "Send to poApps"; \
Flags:        createonlyiffileexists 

Name:         "{group}\tclsh"; \
Filename:     "{app}\bin\tclsh.exe"; \
Comment:      "Start the Tcl shell"; \
Flags:        createonlyiffileexists 

Name:         "{group}\wish"; \
Filename:     "{app}\bin\wish.exe"; \
Comment:      "Start the Tk shell"; \
Flags:        createonlyiffileexists 

Name:         "{group}\Reference Manual"; \
Filename:     "{app}\doc\contents.htm"; \
Flags:        createonlyiffileexists excludefromshowinnewinstall

Name:         "{group}\Applications\BawtLogViewer"; \
Filename:     "{app}\bin\BawtLogViewer.exe"; \
Comment:      "Start the BawtLogViewer application"; \
Flags:        createonlyiffileexists 

Name:         "{group}\Applications\poApps"; \
Filename:     "{app}\bin\poApps.exe"; \
Comment:      "Start the poApps application"; \
Flags:        createonlyiffileexists 

Name:         "{group}\Applications\OglInfo"; \
Filename:     "{app}\bin\OglInfo.exe"; \
Comment:      "Start the OpenGL information application"; \
Flags:        createonlyiffileexists 

Name:         "{group}\Applications\Gorilla"; \
Filename:     "{app}\bin\gorilla.exe"; \
Comment:      "Start the Gorilla password manager"; \
Flags:        createonlyiffileexists 

Name:         "{group}\Applications\TkSqlite"; \
Filename:     "{app}\bin\tksqlite.exe"; \
Comment:      "Start the TkSqlite application"; \
Flags:        createonlyiffileexists 

Name:         "{group}\Applications\TkChat"; \
Filename:     "{app}\bin\tkchat.exe"; \
Comment:      "Start the TkChat application"; \
Flags:        createonlyiffileexists 

Name:         "{group}\{cm:UninstallProgram,{#MyAppName}}"; \
Filename:     "{uninstallexe}"; \
Flags:        excludefromshowinnewinstall

;
; Tasks and Code section taken from http://legroom.net/software/modpath
;

[Tasks]
Name:         modifypath; \
Description:  Add directories to environment variable Path;

[Code]
const
    ModPathName = 'modifypath';
    ModPathType = 'user';

function ModPathDir(): TArrayOfString;
begin
    setArrayLength(Result, 1)
    Result[0] := ExpandConstant('{app}\bin');
end;
#include "modpath.iss"


[Registry]
Root:         HKCR; \
Subkey:       ".tcl"; \
ValueType:    string; \
ValueName:    ""; \
ValueData:    "TclScript"; \
Flags:        uninsdeletevalue; \
Check:        IsAdmin

Root:         HKCR; \
Subkey:       "TclScript"; \
ValueType:    string; \
ValueName:    ""; \
ValueData:    "Tcl script file"; \
Flags:        uninsdeletekey; \
Check:        IsAdmin

Root:         HKCR; \
Subkey:       "TclScript\DefaultIcon"; \
ValueType:    string; \
ValueName:    ""; \
ValueData:    "{app}\bin\tclsh.EXE,0"; \
Check:        IsAdmin

Root:         HKCR; \
Subkey:       "TclScript\shell\open\command"; \
ValueType:    string; \
ValueName:    ""; \
ValueData:    """{app}\bin\wish.EXE"" ""%1"""; \
Check:        IsAdmin

Root:         HKCR; \
Subkey:       "TclScript\shell\edit\command"; \
ValueType:    string; \
ValueName:    ""; \
ValueData:    """{sys}\write.exe"" ""%1"""; \
Check:        IsAdmin

Root:         HKCU; \
Subkey:       "Software\Classes\.tcl"; \
ValueType:    string; \
ValueName:    ""; \
ValueData:    "TclScript"; \
Flags:        uninsdeletevalue; \
Check:        not IsAdmin

Root:         HKCU; \
Subkey:       "Software\Classes\TclScript"; \
ValueType:    string; \
ValueName:    ""; \
ValueData:    "Tcl script file"; \
Flags:        uninsdeletekey; \
Check:        not IsAdmin

Root:         HKCU; \
Subkey:       "Software\Classes\TclScript\DefaultIcon"; \
ValueType:    string; \
ValueName:    ""; \
ValueData:    "{app}\bin\tclsh.EXE,0"; \
Check:        not IsAdmin

Root:         HKCU; \
Subkey:       "Software\Classes\TclScript\shell\open\command"; \
ValueType:    string; \
ValueName:    ""; \
ValueData:    """{app}\wish.EXE"" ""%1"""; \
Check:        not IsAdmin


Root:         HKCU; \
Subkey:       "Software\poSoft"; \
Flags:        uninsdeletekeyifempty

Root:         HKCU; \
Subkey:       "Software\poSoft\BawtTcl"; \
Flags:        uninsdeletekeyifempty
