Skip to content

Commit 99a3ddc

Browse files
committed
Improvements: new window options
1 parent 9e04e56 commit 99a3ddc

File tree

3 files changed

+39
-13
lines changed

3 files changed

+39
-13
lines changed

README.RU.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
## Настройка
1010
1. Положите "index.html" в папку с приложением или введите URL адрес, в конфигурационный файл.
11-
2. Измените иконку, с помощью [Resource Hacker](http://www.angusj.com/resourcehacker/).
11+
2. Измените параметры окна в конфигурационном файле `Config.ini`.
12+
3. Измените иконку, с помощью [Resource Hacker](http://www.angusj.com/resourcehacker/).
1213

1314
## Загрузка
1415
>Версия для Windows 10.<br>

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[![EN](https://user-images.githubusercontent.com/9499881/33184537-7be87e86-d096-11e7-89bb-f3286f752bc6.png)](https://github.com/r57zone/ProtonShell/blob/master/README.md)
22
[![RU](https://user-images.githubusercontent.com/9499881/27683795-5b0fbac6-5cd8-11e7-929c-057833e01fb1.png)](https://github.com/r57zone/ProtonShell/blob/master/README.RU.md)
3+
&#8211; Other languages / Другие языки
4+
35
# ProtonShell
46
Lightweight shell for simple JS applications, based on Microsoft Edge system browser.
57

@@ -8,7 +10,8 @@ Lightweight shell for simple JS applications, based on Microsoft Edge system bro
810

911
## Setup
1012
1. Put "index.html" in the application folder or enter the URL in the configuration file.
11-
2. Change the icon with [Resource Hacker](http://www.angusj.com/resourcehacker/).
13+
2. Change the window settings in the `Config.ini` configuration file.
14+
3. Change the icon with [Resource Hacker](http://www.angusj.com/resourcehacker/).
1215

1316
## Download
1417
>Version for Windows 10.<br>

Source/Unit1.pas

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ TMain = class(TForm)
1919

2020
var
2121
Main: TMain;
22-
OldWidth, OldHeight: integer;
22+
WinOldWidth, WinOldHeight: integer;
23+
WinSaveSize: boolean;
2324

2425
implementation
2526

@@ -29,11 +30,11 @@ procedure TMain.FormClose(Sender: TObject; var Action: TCloseAction);
2930
var
3031
Ini: TIniFile;
3132
begin
32-
if (Main.WindowState <> wsMaximized) then
33-
if (OldWidth <> Width) or (OldHeight <> Height) then begin
33+
if (WinSaveSize) and (WindowState <> wsMaximized) then
34+
if (WinOldWidth <> Width) or (WinOldHeight <> Height) then begin
3435
Ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Config.ini');
35-
Ini.WriteInteger('Main', 'Width', Width);
36-
Ini.WriteInteger('Main', 'Height', Height);
36+
Ini.WriteInteger('Window', 'Width', Width);
37+
Ini.WriteInteger('Window', 'Height', Height);
3738
Ini.Free;
3839
end;
3940
end;
@@ -45,10 +46,7 @@ procedure TMain.FormCreate(Sender: TObject);
4546
EdgeBrowser.SetUserDataFolder(ExtractFilePath(ParamStr(0)) + 'Data');
4647

4748
Ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Config.ini');
48-
Width:=Ini.ReadInteger('Main', 'Width', Width);
49-
Height:=Ini.ReadInteger('Main', 'Height', Height);
50-
Main.Caption:=Ini.ReadString('Main', 'Caption', '');
51-
49+
Main.Caption:=Ini.ReadString('Main', 'Title', '');
5250
LocalFile:=Ini.ReadString('Main', 'File', '');
5351
LocalFile:=StringReplace(LocalFile, '%FULLPATH%/', ExtractFilePath(ParamStr(0)), []);
5452
LocalFile:=StringReplace(LocalFile, '\', '/', [rfReplaceAll]);
@@ -60,9 +58,33 @@ procedure TMain.FormCreate(Sender: TObject);
6058

6159
EdgeBrowser.Navigate(URL);
6260

61+
Width:=Ini.ReadInteger('Window', 'Width', Width);
62+
Height:=Ini.ReadInteger('Window', 'Height', Height);
63+
WinSaveSize:=Ini.ReadBool('Window', 'SaveSize', false);
64+
65+
if Ini.ReadBool('Window', 'HideMaximize', false) then
66+
BorderIcons:=Main.BorderIcons-[biMaximize];
67+
68+
if Ini.ReadBool('Window', 'HideMinimize', false) then
69+
BorderIcons:=Main.BorderIcons-[biMinimize];
70+
71+
case Ini.ReadInteger('Window', 'BorderStyle', 0) of
72+
0: BorderStyle:=bsSizeable;
73+
1: BorderStyle:=bsSingle;
74+
2: BorderStyle:=bsDialog;
75+
3: BorderStyle:=bsSizeToolWin;
76+
4: BorderStyle:=bsToolWindow;
77+
end;
78+
79+
case Ini.ReadInteger('Window', 'WindowState', 0) of
80+
1: WindowState:=wsMaximized;
81+
2: begin BorderStyle:=bsNone; WindowState:=wsMaximized; end;
82+
//3: WindowState:=wsMinimized;
83+
end;
84+
6385
Ini.Free;
64-
OldWidth:=Width;
65-
OldHeight:=Height;
86+
WinOldWidth:=Width;
87+
WinOldHeight:=Height;
6688
end;
6789

6890
end.

0 commit comments

Comments
 (0)