ZVSRus
04-11-2015, 18:34
Вот весь скрипт
#define MyAppName "Almeza MultiSet Professional"
#define MyAppVersion "1.5"
#define MyAppExeName "MyProg.exe"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DirExistsWarning=no
Uninstallable=not PortableCheck
WizardImageFile=1.bmp
WizardSmallImageFile=57x57.bmp
ShowComponentSizes=yes
SetupIconFile=1.ico
OutputBaseFilename=ACDSee5_Setup
;AppSupportPhone=
AppCopyright=Copyright (C) 2003-2015 My Company, Inc.
;AppPublisher=My Company, Inc.
;AppPublisherURL=http://www.example.com/
OutputDir=.
DisableReadyPage=yes
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "english"; MessagesFile: "compiler:Languages\English.isl"
[Files]
Source: rus.bmp; Flags: dontcopy solidbreak
Source: eng.bmp; Flags: dontcopy solidbreak
Source: Installer.bmp; Flags: dontcopy solidbreak
Source: Portable.bmp; Flags: dontcopy solidbreak
Source: "C:\Program Files (x86)\Inno Setup v.5.5.1\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: RusLang and InstallerCheck;
Source: "C:\Program Files (x86)\Inno Setup v.5.5.1\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: EngLang and InstallerCheck;
Source: "C:\Program Files (x86)\Inno Setup v.5.5.1\Examples\MyProg.exe"; DestDir: "{commondesktop}\Portable"; Flags: ignoreversion uninsrestartdelete; Check: RusLang and PortableCheck;
Source: "C:\Program Files (x86)\Inno Setup v.5.5.1\Examples\MyProg.exe"; DestDir: "{commondesktop}\Portable"; Flags: ignoreversion uninsrestartdelete; Check: EngLang and PortableCheck;
Source: {win}\Help\*; DestDir: {app}; Flags: external recursesubdirs; Check: RusLang and InstallerCheck;
Source: {win}\Help\*; DestDir: {app}; Flags: external recursesubdirs; Check: RusLang and PortableCheck;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" ; Check: StartmenuCheck;
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: StartmenuCheck;
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: IconsCheck;
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: RusLang and InstallerCheck;
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: EngLang and InstallerCheck;
Filename: "{commondesktop}\Portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: RusLang and PortableCheck;
Filename: "{commondesktop}\Portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: EngLang and PortableCheck;
[UninstallDelete]
Name: {app}\multiset.ini; Type: filesandordirs
[Code]
var
Component: TWizardPage;
Portable,Installer,LangRus,LangEng: TNewRadioButton;
FlagImage,InstallerImage,PortableImage: TBitmapImage;
Lang,IconsLabel: TLabel;
Icons,Startmenu: TNewCheckBox;
InstallerGroupBox,IconsGroupBox,LanguageGroupBox: TNewGroupBox;
dirBrowseForm: TSetupForm;
dirBrowse, dirOK, dirNO, dirback: TButton;
DirTreeView: TFolderTreeView;
Edit: TNewEdit;
BrowseBevel: TBevel;
BrowsePanel: TPanel;
BrowsePanel2: TPanel;
BrowseBevel2,BrowseBevel3: TBevel;
BrowseForm : TSetupForm;
function InitializeSetup(): Boolean;
begin
if not FileExists(ExpandConstant('{tmp}\rus.bmp')) then ExtractTemporaryFile('rus.bmp');
if not FileExists(ExpandConstant('{tmp}\eng.bmp')) then ExtractTemporaryFile('eng.bmp');
if not FileExists(ExpandConstant('{tmp}\Installer.bmp')) then ExtractTemporaryFile('Installer.bmp');
if not FileExists(ExpandConstant('{tmp}\Portable.bmp')) then ExtractTemporaryFile('Portable.bmp');
Result := True;
end;
function RusLang: Boolean;
begin
Result:= LangRus.Checked;
end;
function EngLang: Boolean;
begin
Result:= LangEng.Checked;
end;
function IconsCheck: Boolean;
begin
Result:= Icons.Checked;
end;
function StartmenuCheck: Boolean;
begin
Result:= Startmenu.Checked;
end;
function InstallerCheck: Boolean;
begin
Result := Installer.Checked;
end;
function PortableCheck: Boolean;
begin
Result := Portable.Checked;
end;
procedure CopmpClick(Sender: TObject);
begin
case TNewRadioButton(Sender) of
Portable:
begin
PortableImage.Show;
Icons.Checked:=False;
Icons.Enabled:= Icons.Checked;
Startmenu.Checked:=False;
Startmenu.Enabled:= Startmenu.Checked;
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + 'Almeza MultiSet Professional Portable';
//wizardform.GroupEdit.enabled:= false;
//wizardform.GroupBrowseButton.enabled:= false;
end;
Installer:
begin
PortableImage.Hide;
Icons.Checked:=True;
Icons.Enabled:= Icons.Checked;
Startmenu.Checked:=True;
Startmenu.Enabled:= Startmenu.Checked;
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{pf}')) + 'Almeza MultiSet Professional';
//wizardform.GroupEdit.enabled:= true;
//wizardform.GroupBrowseButton.enabled:= true;
end;
end;
end;
procedure LangClick(Sender: TObject);
begin
case TNewRadioButton(Sender) of
LangRus:
begin
FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\rus.bmp'));
FlagImage.Width := ScaleX(110);
FlagImage.Height := ScaleY(70);
FlagImage.Left := ScaleX(250);
end;
LangEng:
begin
FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\eng.bmp'));
FlagImage.Width := ScaleX(110);
FlagImage.Height := ScaleY(70);
FlagImage.Left := ScaleX(250);
end;
end;
end;
procedure dirOkclick(Sender: TObject);
begin
dirBrowseForm.Close;
WizardForm.Enabled:=True;
WizardForm.DirEdit.Text:=Edit.Text;
end;
procedure dirBackClick(Sender: TObject);
begin
Edit.Text:=AddBackslash(ExpandConstant('{pf}\')+'{#MyAppName}');
DirTreeView.ChangeDirectory(AddBackslash(ExpandConstant('{pf}\')), True);
end;
procedure dirNOclick(Sender: TObject);
begin
dirBrowseForm.Close;
WizardForm.Enabled:=true;
end;
procedure DirFolderChange(Sender: TObject);
Begin
Edit.Text:=AddBackslash(DirTreeView.Directory) + '{#MyAppName}';
if Portable.Checked then
Edit.Text:=AddBackslash(DirTreeView.Directory) + 'Almeza MultiSet Professional Portable';
end;
procedure FormClosedir(Sender: TObject; var Action: TCloseAction);
begin
WizardForm.Enabled:=true;
end;
procedure BrowseClick(Sender: TObject);
begin
dirBrowseForm := CreateCustomForm();
with dirBrowseForm do begin
ClientWidth := ScaleX(352);
ClientHeight := ScaleY(388);
CenterInsideControl(WizardForm, False);
Caption:='Обзор папок';
onClose:=@FormClosedir;
with tlabel.create(dirBrowseForm) do begin
SetBounds(ScaleX(15),ScaleY(15),ScaleX(350),ScaleY(15));
caption:='Выберите папку из списка и нажмите «ОK».';
parent:=dirBrowseForm;
Font.Color:=clBlack;
Font.Size:=8;
BrowseBevel := TBevel.Create(WizardForm);
BrowseBevel.SetBounds(ScaleX(0),ScaleY(40),ScaleX(352),ScaleY(2));
BrowseBevel.parent:=dirBrowseForm;
BrowseBevel3 := TBevel.Create(WizardForm);
BrowseBevel3.SetBounds(ScaleX(0),ScaleY(342),ScaleX(352),ScaleY(2));
BrowseBevel3.parent:=dirBrowseForm;
BrowsePanel := TPanel.Create(WizardForm);
with BrowsePanel do
begin
parent:=dirBrowseForm;
Left := ScaleX(5);
Top := ScaleY(45);
Width := ScaleX(342);
Height := ScaleY(292);
Caption := '';
end;
BrowsePanel2 := TPanel.Create(WizardForm);
with BrowsePanel2 do
begin
BrowsePanel2.Parent := BrowsePanel;
Left := ScaleX(5);
Top := ScaleY(5);
Width := ScaleX(332);
Height := ScaleY(282);
BevelOuter := bvLowered;
Caption := '';
end;
BrowseBevel2 := TBevel.Create(WizardForm);
with BrowseBevel2 do
begin
BrowseBevel2.Parent := BrowsePanel2;
Left := ScaleX(5);
Top := ScaleY(5);
Width := ScaleX(322);
Height := ScaleY(272);
Style := bsRaised;
end;
Edit:= TNewEdit.Create(dirBrowseForm);
with edit do begin
SetBounds(ScaleX(10),ScaleY(10),ScaleX(311),ScaleY(21));
Text:=WizardForm.DirEdit.text;
Parent:= BrowsePanel2;
Font.Color:=clBlack;
end;
DirTreeView:= TFolderTreeView.Create(dirBrowseForm)
with DirTreeView do begin
SetBounds(ScaleX(10),ScaleY(35),ScaleX(311),ScaleY(235));
OnChange:=@DirFolderChange;
Parent:=BrowsePanel2;
end;
dirback:=tbutton.create(dirBrowseForm)
with dirback do begin
SetBounds(ScaleX(16),ScaleY(351),ScaleX(100),ScaleY(30));
parent:=dirBrowseForm;
Caption:='Сброс';
onclick:=@dirBackClick;
end;
dirok:=tbutton.create(dirBrowseForm)
with dirok do begin
SetBounds(ScaleX(126),ScaleY(351),ScaleX(100),ScaleY(30));
parent:=dirBrowseForm;
Caption:='OK';
onclick:=@dirOKclick;
end;
dirno:=tbutton.create(dirBrowseForm)
with dirno do begin
SetBounds(ScaleX(236),ScaleY(351),ScaleX(100),ScaleY(30));
parent:=dirBrowseForm;
Caption:='Отмена';
onclick:=@dirNOclick;
end;
end;
end;
DirTreeView.ChangeDirectory(AddBackslash(WizardForm.dirEdit.Text), true);
Edit.Text:=(DirTreeView.Directory);
dirBrowseForm.Show;
WizardForm.Enabled:=false;
end;
procedure InitializeWizard();
begin
WizardForm.DirBrowseButton.Visible:=false;
Component := CreateCustomPage(wpInfoBefore, 'Выбор типа и компонентов установки', '...');
FlagImage := TBitmapImage.Create(WizardForm);
with FlagImage do
begin
Name := 'FlagImage';
Parent := Component.Surface;
Left := ScaleX(250);
Top := ScaleY(167);
Width := ScaleX(110);
Height := ScaleY(70);
end;
InstallerImage := TBitmapImage.Create(WizardForm);
with InstallerImage do
begin
Name := 'InstallerImage';
Parent := Component.Surface;
Left := ScaleX(220);
Top := ScaleY(5);
Width := ScaleX(189);
Height := ScaleY(160);
InstallerImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Installer.bmp'));
end;
PortableImage := TBitmapImage.Create(WizardForm);
with PortableImage do
begin
Name := 'PortableImage';
Parent := Component.Surface;
Left := ScaleX(220);
Top := ScaleY(5);
Width := ScaleX(186);
Height := ScaleY(160);
PortableImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Portable.bmp'));
end;
InstallerGroupBox := TNewGroupBox.Create(WizardForm);
with InstallerGroupBox do
begin
Parent := Component.Surface;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(205);
Height := ScaleY(74);
Caption := 'Тип:';
end;
Portable := TNewRadioButton.Create(WizardForm);
with Portable do
begin
Parent := InstallerGroupBox;
Left := ScaleX(5);
Top := ScaleY(47);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Распаковка портативной версии';
OnClick:=@CopmpClick;
end;
IconsGroupBox := TNewGroupBox.Create(WizardForm);
with IconsGroupBox do
begin
Parent := Component.Surface;
Left := ScaleX(0);
Top := ScaleY(80);
Width := ScaleX(205);
Height := ScaleY(74);
Caption := 'Компоненты:';
end;
Icons := TNewCheckBox.Create(WizardForm);
with Icons do
begin
Parent := IconsGroupBox;
Left := ScaleX(5);
Top := ScaleY(20);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Ярлык(и) на «Рабочем столе»';
Checked:=True;
end;
Startmenu := TNewCheckBox.Create(WizardForm);
with Startmenu do
begin
Parent := IconsGroupBox;
Left := ScaleX(5);
Top := ScaleY(47);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Ярлык в меню «Пуск»';
Checked:=True;
end;
Installer := TNewRadioButton.Create(WizardForm);
with Installer do
begin
Parent := InstallerGroupBox;
Left := ScaleX(5);
Top := ScaleY(20);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Установка обычной версии';
OnClick:=@CopmpClick;
Checked:=True;
end;
LanguageGroupBox := TNewGroupBox.Create(WizardForm);
with LanguageGroupBox do
begin
Parent := Component.Surface;
Left := ScaleX(0);
Top := ScaleY(160);
Width := ScaleX(205);
Height := ScaleY(74);
Caption := 'Язык интерфейса:';
end;;
LangRus := TNewRadioButton.Create(WizardForm);
with LangRus do
begin
Parent := LanguageGroupBox;
Left := ScaleX(5);
Top := ScaleY(20);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Язык интерфейса Русский';
OnClick:=@LangClick;
Checked:=True;
end;
LangEng := TNewRadioButton.Create(WizardForm);
with LangEng do
begin
Parent := LanguageGroupBox;
Left := ScaleX(5);
Top := ScaleY(47);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Язык интерфейса Английский';
OnClick:=@LangClick;
end;
dirBrowse:=tbutton.create(WizardForm);
with dirBrowse do begin
Parent := WizardForm.SelectDirPage;
SetBounds(ScaleX(342),ScaleY(80),ScaleX(75),ScaleY(23));
Caption:='Обзор...';
OnClick:=@BrowseClick;
end;
end;
function ShouldSkipPage(PageID: Integer): Boolean; // Должен пропустить страницу
begin
if Portable.Checked then
if (PageID = 8) then
Result:= True;
end;
procedure CurStepChanged(CurStep: TSetupStep); // Измененный шаг
begin
if (CurStep = ssPostInstall) then
if Installer.Checked and RusLang then
SetIniString('general', 'language', 'russian', ExpandConstant('{app}\multiset.ini'));
if Installer.Checked and EngLang then
SetIniString('general', 'language', 'english', ExpandConstant('{app}\multiset.ini'));
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure CurPageChanged(CurPageID: Integer); // Измененная страница
begin
case CurPageID of
wpSelectDir:
if Portable.Checked then
begin
WizardForm.PageNameLabel.Caption:='Выбор папки распаковки';
WizardForm.PageDescriptionLabel.Caption:='В какую папку вы хотите распаковать {#SetupSetting("AppName")}?';
WizardForm.SelectDirLabel.Caption:='Программа распакует {#SetupSetting("AppName")} в следующую папку.';
WizardForm.SelectDirBrowseLabel.Caption:='Нажмите «Распаковать» чтобы начать распаковку. Если вы хотите выбрать другую папку, нажмите «Обзор».';
WizardForm.NextButton.Caption:='Распаковать';
WizardForm.Caption:= 'Распаковка — {#SetupSetting("AppName")}'
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + 'Almeza MultiSet Professional Portable';
end else begin
WizardForm.NextButton.Caption:= 'Далее';
WizardForm.PageNameLabel.Caption:= 'Выбор папки установки';
WizardForm.Caption:= 'Установка — {#SetupSetting("AppName")}';
WizardForm.PageDescriptionLabel.Caption:= 'В какую папку вы хотите установить {#SetupSetting("AppName")}?';
WizardForm.SelectDirLabel.Caption:= 'Программа установит {#SetupSetting("AppName")} в следующую папку.';
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{pf}')) + '{#SetupSetting("AppName")}';
WizardForm.SelectDirBrowseLabel.Caption:='Нажмите «Далее» чтобы продолжить. Если вы хотите выбрать другую папку, нажмите «Обзор».';
end;
//wpInstalling:
//begin
//WizardForm.PageNameLabel.Caption:='Распаковка';
//WizardForm.PageDescriptionLabel.Caption:='Пожалуйста, подождите, пока Almeza MultiSet Professional Portable распакуется на ваш компьютер.';
//end else begin
//WizardForm.PageNameLabel.Caption:='Установка';
//WizardForm.PageDescriptionLabel.Caption:='Пожалуйста, подождите, пока Almeza MultiSet Professional установится на ваш компьютер.';
//end;
//end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
wpSelectProgramGroup:
if Installer.Checked then
begin
WizardForm.NextButton.Caption:= 'Установить';
WizardForm.SelectStartMenuFolderBrowseLabel.Caption:= 'Нажмите «Установить», чтобы начать установку. Если вы хотите выбрать другую папку, нажмите «Обзор».';
end;
wpInstalling:
if Installer.Checked then
begin
WizardForm.PageNameLabel.Caption:='Установка';
WizardForm.PageDescriptionLabel.Caption:='Пожалуйста, подождите, пока Almeza MultiSet Professional установится на ваш компьютер.';
end else begin
WizardForm.PageNameLabel.Caption:='Распаковка';
WizardForm.PageDescriptionLabel.Caption:='Пожалуйста, подождите, пока Almeza MultiSet Professional Portable распакуется на ваш компьютер.';
end;
end;
end;
#define MyAppName "Almeza MultiSet Professional"
#define MyAppVersion "1.5"
#define MyAppExeName "MyProg.exe"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DirExistsWarning=no
Uninstallable=not PortableCheck
WizardImageFile=1.bmp
WizardSmallImageFile=57x57.bmp
ShowComponentSizes=yes
SetupIconFile=1.ico
OutputBaseFilename=ACDSee5_Setup
;AppSupportPhone=
AppCopyright=Copyright (C) 2003-2015 My Company, Inc.
;AppPublisher=My Company, Inc.
;AppPublisherURL=http://www.example.com/
OutputDir=.
DisableReadyPage=yes
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "english"; MessagesFile: "compiler:Languages\English.isl"
[Files]
Source: rus.bmp; Flags: dontcopy solidbreak
Source: eng.bmp; Flags: dontcopy solidbreak
Source: Installer.bmp; Flags: dontcopy solidbreak
Source: Portable.bmp; Flags: dontcopy solidbreak
Source: "C:\Program Files (x86)\Inno Setup v.5.5.1\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: RusLang and InstallerCheck;
Source: "C:\Program Files (x86)\Inno Setup v.5.5.1\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: EngLang and InstallerCheck;
Source: "C:\Program Files (x86)\Inno Setup v.5.5.1\Examples\MyProg.exe"; DestDir: "{commondesktop}\Portable"; Flags: ignoreversion uninsrestartdelete; Check: RusLang and PortableCheck;
Source: "C:\Program Files (x86)\Inno Setup v.5.5.1\Examples\MyProg.exe"; DestDir: "{commondesktop}\Portable"; Flags: ignoreversion uninsrestartdelete; Check: EngLang and PortableCheck;
Source: {win}\Help\*; DestDir: {app}; Flags: external recursesubdirs; Check: RusLang and InstallerCheck;
Source: {win}\Help\*; DestDir: {app}; Flags: external recursesubdirs; Check: RusLang and PortableCheck;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" ; Check: StartmenuCheck;
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: StartmenuCheck;
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: IconsCheck;
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: RusLang and InstallerCheck;
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: EngLang and InstallerCheck;
Filename: "{commondesktop}\Portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: RusLang and PortableCheck;
Filename: "{commondesktop}\Portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: EngLang and PortableCheck;
[UninstallDelete]
Name: {app}\multiset.ini; Type: filesandordirs
[Code]
var
Component: TWizardPage;
Portable,Installer,LangRus,LangEng: TNewRadioButton;
FlagImage,InstallerImage,PortableImage: TBitmapImage;
Lang,IconsLabel: TLabel;
Icons,Startmenu: TNewCheckBox;
InstallerGroupBox,IconsGroupBox,LanguageGroupBox: TNewGroupBox;
dirBrowseForm: TSetupForm;
dirBrowse, dirOK, dirNO, dirback: TButton;
DirTreeView: TFolderTreeView;
Edit: TNewEdit;
BrowseBevel: TBevel;
BrowsePanel: TPanel;
BrowsePanel2: TPanel;
BrowseBevel2,BrowseBevel3: TBevel;
BrowseForm : TSetupForm;
function InitializeSetup(): Boolean;
begin
if not FileExists(ExpandConstant('{tmp}\rus.bmp')) then ExtractTemporaryFile('rus.bmp');
if not FileExists(ExpandConstant('{tmp}\eng.bmp')) then ExtractTemporaryFile('eng.bmp');
if not FileExists(ExpandConstant('{tmp}\Installer.bmp')) then ExtractTemporaryFile('Installer.bmp');
if not FileExists(ExpandConstant('{tmp}\Portable.bmp')) then ExtractTemporaryFile('Portable.bmp');
Result := True;
end;
function RusLang: Boolean;
begin
Result:= LangRus.Checked;
end;
function EngLang: Boolean;
begin
Result:= LangEng.Checked;
end;
function IconsCheck: Boolean;
begin
Result:= Icons.Checked;
end;
function StartmenuCheck: Boolean;
begin
Result:= Startmenu.Checked;
end;
function InstallerCheck: Boolean;
begin
Result := Installer.Checked;
end;
function PortableCheck: Boolean;
begin
Result := Portable.Checked;
end;
procedure CopmpClick(Sender: TObject);
begin
case TNewRadioButton(Sender) of
Portable:
begin
PortableImage.Show;
Icons.Checked:=False;
Icons.Enabled:= Icons.Checked;
Startmenu.Checked:=False;
Startmenu.Enabled:= Startmenu.Checked;
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + 'Almeza MultiSet Professional Portable';
//wizardform.GroupEdit.enabled:= false;
//wizardform.GroupBrowseButton.enabled:= false;
end;
Installer:
begin
PortableImage.Hide;
Icons.Checked:=True;
Icons.Enabled:= Icons.Checked;
Startmenu.Checked:=True;
Startmenu.Enabled:= Startmenu.Checked;
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{pf}')) + 'Almeza MultiSet Professional';
//wizardform.GroupEdit.enabled:= true;
//wizardform.GroupBrowseButton.enabled:= true;
end;
end;
end;
procedure LangClick(Sender: TObject);
begin
case TNewRadioButton(Sender) of
LangRus:
begin
FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\rus.bmp'));
FlagImage.Width := ScaleX(110);
FlagImage.Height := ScaleY(70);
FlagImage.Left := ScaleX(250);
end;
LangEng:
begin
FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\eng.bmp'));
FlagImage.Width := ScaleX(110);
FlagImage.Height := ScaleY(70);
FlagImage.Left := ScaleX(250);
end;
end;
end;
procedure dirOkclick(Sender: TObject);
begin
dirBrowseForm.Close;
WizardForm.Enabled:=True;
WizardForm.DirEdit.Text:=Edit.Text;
end;
procedure dirBackClick(Sender: TObject);
begin
Edit.Text:=AddBackslash(ExpandConstant('{pf}\')+'{#MyAppName}');
DirTreeView.ChangeDirectory(AddBackslash(ExpandConstant('{pf}\')), True);
end;
procedure dirNOclick(Sender: TObject);
begin
dirBrowseForm.Close;
WizardForm.Enabled:=true;
end;
procedure DirFolderChange(Sender: TObject);
Begin
Edit.Text:=AddBackslash(DirTreeView.Directory) + '{#MyAppName}';
if Portable.Checked then
Edit.Text:=AddBackslash(DirTreeView.Directory) + 'Almeza MultiSet Professional Portable';
end;
procedure FormClosedir(Sender: TObject; var Action: TCloseAction);
begin
WizardForm.Enabled:=true;
end;
procedure BrowseClick(Sender: TObject);
begin
dirBrowseForm := CreateCustomForm();
with dirBrowseForm do begin
ClientWidth := ScaleX(352);
ClientHeight := ScaleY(388);
CenterInsideControl(WizardForm, False);
Caption:='Обзор папок';
onClose:=@FormClosedir;
with tlabel.create(dirBrowseForm) do begin
SetBounds(ScaleX(15),ScaleY(15),ScaleX(350),ScaleY(15));
caption:='Выберите папку из списка и нажмите «ОK».';
parent:=dirBrowseForm;
Font.Color:=clBlack;
Font.Size:=8;
BrowseBevel := TBevel.Create(WizardForm);
BrowseBevel.SetBounds(ScaleX(0),ScaleY(40),ScaleX(352),ScaleY(2));
BrowseBevel.parent:=dirBrowseForm;
BrowseBevel3 := TBevel.Create(WizardForm);
BrowseBevel3.SetBounds(ScaleX(0),ScaleY(342),ScaleX(352),ScaleY(2));
BrowseBevel3.parent:=dirBrowseForm;
BrowsePanel := TPanel.Create(WizardForm);
with BrowsePanel do
begin
parent:=dirBrowseForm;
Left := ScaleX(5);
Top := ScaleY(45);
Width := ScaleX(342);
Height := ScaleY(292);
Caption := '';
end;
BrowsePanel2 := TPanel.Create(WizardForm);
with BrowsePanel2 do
begin
BrowsePanel2.Parent := BrowsePanel;
Left := ScaleX(5);
Top := ScaleY(5);
Width := ScaleX(332);
Height := ScaleY(282);
BevelOuter := bvLowered;
Caption := '';
end;
BrowseBevel2 := TBevel.Create(WizardForm);
with BrowseBevel2 do
begin
BrowseBevel2.Parent := BrowsePanel2;
Left := ScaleX(5);
Top := ScaleY(5);
Width := ScaleX(322);
Height := ScaleY(272);
Style := bsRaised;
end;
Edit:= TNewEdit.Create(dirBrowseForm);
with edit do begin
SetBounds(ScaleX(10),ScaleY(10),ScaleX(311),ScaleY(21));
Text:=WizardForm.DirEdit.text;
Parent:= BrowsePanel2;
Font.Color:=clBlack;
end;
DirTreeView:= TFolderTreeView.Create(dirBrowseForm)
with DirTreeView do begin
SetBounds(ScaleX(10),ScaleY(35),ScaleX(311),ScaleY(235));
OnChange:=@DirFolderChange;
Parent:=BrowsePanel2;
end;
dirback:=tbutton.create(dirBrowseForm)
with dirback do begin
SetBounds(ScaleX(16),ScaleY(351),ScaleX(100),ScaleY(30));
parent:=dirBrowseForm;
Caption:='Сброс';
onclick:=@dirBackClick;
end;
dirok:=tbutton.create(dirBrowseForm)
with dirok do begin
SetBounds(ScaleX(126),ScaleY(351),ScaleX(100),ScaleY(30));
parent:=dirBrowseForm;
Caption:='OK';
onclick:=@dirOKclick;
end;
dirno:=tbutton.create(dirBrowseForm)
with dirno do begin
SetBounds(ScaleX(236),ScaleY(351),ScaleX(100),ScaleY(30));
parent:=dirBrowseForm;
Caption:='Отмена';
onclick:=@dirNOclick;
end;
end;
end;
DirTreeView.ChangeDirectory(AddBackslash(WizardForm.dirEdit.Text), true);
Edit.Text:=(DirTreeView.Directory);
dirBrowseForm.Show;
WizardForm.Enabled:=false;
end;
procedure InitializeWizard();
begin
WizardForm.DirBrowseButton.Visible:=false;
Component := CreateCustomPage(wpInfoBefore, 'Выбор типа и компонентов установки', '...');
FlagImage := TBitmapImage.Create(WizardForm);
with FlagImage do
begin
Name := 'FlagImage';
Parent := Component.Surface;
Left := ScaleX(250);
Top := ScaleY(167);
Width := ScaleX(110);
Height := ScaleY(70);
end;
InstallerImage := TBitmapImage.Create(WizardForm);
with InstallerImage do
begin
Name := 'InstallerImage';
Parent := Component.Surface;
Left := ScaleX(220);
Top := ScaleY(5);
Width := ScaleX(189);
Height := ScaleY(160);
InstallerImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Installer.bmp'));
end;
PortableImage := TBitmapImage.Create(WizardForm);
with PortableImage do
begin
Name := 'PortableImage';
Parent := Component.Surface;
Left := ScaleX(220);
Top := ScaleY(5);
Width := ScaleX(186);
Height := ScaleY(160);
PortableImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Portable.bmp'));
end;
InstallerGroupBox := TNewGroupBox.Create(WizardForm);
with InstallerGroupBox do
begin
Parent := Component.Surface;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(205);
Height := ScaleY(74);
Caption := 'Тип:';
end;
Portable := TNewRadioButton.Create(WizardForm);
with Portable do
begin
Parent := InstallerGroupBox;
Left := ScaleX(5);
Top := ScaleY(47);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Распаковка портативной версии';
OnClick:=@CopmpClick;
end;
IconsGroupBox := TNewGroupBox.Create(WizardForm);
with IconsGroupBox do
begin
Parent := Component.Surface;
Left := ScaleX(0);
Top := ScaleY(80);
Width := ScaleX(205);
Height := ScaleY(74);
Caption := 'Компоненты:';
end;
Icons := TNewCheckBox.Create(WizardForm);
with Icons do
begin
Parent := IconsGroupBox;
Left := ScaleX(5);
Top := ScaleY(20);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Ярлык(и) на «Рабочем столе»';
Checked:=True;
end;
Startmenu := TNewCheckBox.Create(WizardForm);
with Startmenu do
begin
Parent := IconsGroupBox;
Left := ScaleX(5);
Top := ScaleY(47);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Ярлык в меню «Пуск»';
Checked:=True;
end;
Installer := TNewRadioButton.Create(WizardForm);
with Installer do
begin
Parent := InstallerGroupBox;
Left := ScaleX(5);
Top := ScaleY(20);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Установка обычной версии';
OnClick:=@CopmpClick;
Checked:=True;
end;
LanguageGroupBox := TNewGroupBox.Create(WizardForm);
with LanguageGroupBox do
begin
Parent := Component.Surface;
Left := ScaleX(0);
Top := ScaleY(160);
Width := ScaleX(205);
Height := ScaleY(74);
Caption := 'Язык интерфейса:';
end;;
LangRus := TNewRadioButton.Create(WizardForm);
with LangRus do
begin
Parent := LanguageGroupBox;
Left := ScaleX(5);
Top := ScaleY(20);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Язык интерфейса Русский';
OnClick:=@LangClick;
Checked:=True;
end;
LangEng := TNewRadioButton.Create(WizardForm);
with LangEng do
begin
Parent := LanguageGroupBox;
Left := ScaleX(5);
Top := ScaleY(47);
Width := ScaleX(190);
Height := ScaleY(17);
Caption := 'Язык интерфейса Английский';
OnClick:=@LangClick;
end;
dirBrowse:=tbutton.create(WizardForm);
with dirBrowse do begin
Parent := WizardForm.SelectDirPage;
SetBounds(ScaleX(342),ScaleY(80),ScaleX(75),ScaleY(23));
Caption:='Обзор...';
OnClick:=@BrowseClick;
end;
end;
function ShouldSkipPage(PageID: Integer): Boolean; // Должен пропустить страницу
begin
if Portable.Checked then
if (PageID = 8) then
Result:= True;
end;
procedure CurStepChanged(CurStep: TSetupStep); // Измененный шаг
begin
if (CurStep = ssPostInstall) then
if Installer.Checked and RusLang then
SetIniString('general', 'language', 'russian', ExpandConstant('{app}\multiset.ini'));
if Installer.Checked and EngLang then
SetIniString('general', 'language', 'english', ExpandConstant('{app}\multiset.ini'));
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure CurPageChanged(CurPageID: Integer); // Измененная страница
begin
case CurPageID of
wpSelectDir:
if Portable.Checked then
begin
WizardForm.PageNameLabel.Caption:='Выбор папки распаковки';
WizardForm.PageDescriptionLabel.Caption:='В какую папку вы хотите распаковать {#SetupSetting("AppName")}?';
WizardForm.SelectDirLabel.Caption:='Программа распакует {#SetupSetting("AppName")} в следующую папку.';
WizardForm.SelectDirBrowseLabel.Caption:='Нажмите «Распаковать» чтобы начать распаковку. Если вы хотите выбрать другую папку, нажмите «Обзор».';
WizardForm.NextButton.Caption:='Распаковать';
WizardForm.Caption:= 'Распаковка — {#SetupSetting("AppName")}'
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + 'Almeza MultiSet Professional Portable';
end else begin
WizardForm.NextButton.Caption:= 'Далее';
WizardForm.PageNameLabel.Caption:= 'Выбор папки установки';
WizardForm.Caption:= 'Установка — {#SetupSetting("AppName")}';
WizardForm.PageDescriptionLabel.Caption:= 'В какую папку вы хотите установить {#SetupSetting("AppName")}?';
WizardForm.SelectDirLabel.Caption:= 'Программа установит {#SetupSetting("AppName")} в следующую папку.';
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{pf}')) + '{#SetupSetting("AppName")}';
WizardForm.SelectDirBrowseLabel.Caption:='Нажмите «Далее» чтобы продолжить. Если вы хотите выбрать другую папку, нажмите «Обзор».';
end;
//wpInstalling:
//begin
//WizardForm.PageNameLabel.Caption:='Распаковка';
//WizardForm.PageDescriptionLabel.Caption:='Пожалуйста, подождите, пока Almeza MultiSet Professional Portable распакуется на ваш компьютер.';
//end else begin
//WizardForm.PageNameLabel.Caption:='Установка';
//WizardForm.PageDescriptionLabel.Caption:='Пожалуйста, подождите, пока Almeza MultiSet Professional установится на ваш компьютер.';
//end;
//end;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
wpSelectProgramGroup:
if Installer.Checked then
begin
WizardForm.NextButton.Caption:= 'Установить';
WizardForm.SelectStartMenuFolderBrowseLabel.Caption:= 'Нажмите «Установить», чтобы начать установку. Если вы хотите выбрать другую папку, нажмите «Обзор».';
end;
wpInstalling:
if Installer.Checked then
begin
WizardForm.PageNameLabel.Caption:='Установка';
WizardForm.PageDescriptionLabel.Caption:='Пожалуйста, подождите, пока Almeza MultiSet Professional установится на ваш компьютер.';
end else begin
WizardForm.PageNameLabel.Caption:='Распаковка';
WizardForm.PageDescriptionLabel.Caption:='Пожалуйста, подождите, пока Almeza MultiSet Professional Portable распакуется на ваш компьютер.';
end;
end;
end;