Skip to content

Commit

Permalink
Improvements: new window options
Browse files Browse the repository at this point in the history
  • Loading branch information
r57zone committed Aug 2, 2022
1 parent 9e04e56 commit 99a3ddc
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
3 changes: 2 additions & 1 deletion README.RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

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

## Загрузка
>Версия для Windows 10.<br>
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![EN](https://user-images.githubusercontent.com/9499881/33184537-7be87e86-d096-11e7-89bb-f3286f752bc6.png)](https://github.com/r57zone/ProtonShell/blob/master/README.md)
[![RU](https://user-images.githubusercontent.com/9499881/27683795-5b0fbac6-5cd8-11e7-929c-057833e01fb1.png)](https://github.com/r57zone/ProtonShell/blob/master/README.RU.md)
&#8211; Other languages / Другие языки

# ProtonShell
Lightweight shell for simple JS applications, based on Microsoft Edge system browser.

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

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

## Download
>Version for Windows 10.<br>
Expand Down
44 changes: 33 additions & 11 deletions Source/Unit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ TMain = class(TForm)

var
Main: TMain;
OldWidth, OldHeight: integer;
WinOldWidth, WinOldHeight: integer;
WinSaveSize: boolean;

implementation

Expand All @@ -29,11 +30,11 @@ procedure TMain.FormClose(Sender: TObject; var Action: TCloseAction);
var
Ini: TIniFile;
begin
if (Main.WindowState <> wsMaximized) then
if (OldWidth <> Width) or (OldHeight <> Height) then begin
if (WinSaveSize) and (WindowState <> wsMaximized) then
if (WinOldWidth <> Width) or (WinOldHeight <> Height) then begin
Ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Config.ini');
Ini.WriteInteger('Main', 'Width', Width);
Ini.WriteInteger('Main', 'Height', Height);
Ini.WriteInteger('Window', 'Width', Width);
Ini.WriteInteger('Window', 'Height', Height);
Ini.Free;
end;
end;
Expand All @@ -45,10 +46,7 @@ procedure TMain.FormCreate(Sender: TObject);
EdgeBrowser.SetUserDataFolder(ExtractFilePath(ParamStr(0)) + 'Data');

Ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Config.ini');
Width:=Ini.ReadInteger('Main', 'Width', Width);
Height:=Ini.ReadInteger('Main', 'Height', Height);
Main.Caption:=Ini.ReadString('Main', 'Caption', '');

Main.Caption:=Ini.ReadString('Main', 'Title', '');
LocalFile:=Ini.ReadString('Main', 'File', '');
LocalFile:=StringReplace(LocalFile, '%FULLPATH%/', ExtractFilePath(ParamStr(0)), []);
LocalFile:=StringReplace(LocalFile, '\', '/', [rfReplaceAll]);
Expand All @@ -60,9 +58,33 @@ procedure TMain.FormCreate(Sender: TObject);

EdgeBrowser.Navigate(URL);

Width:=Ini.ReadInteger('Window', 'Width', Width);
Height:=Ini.ReadInteger('Window', 'Height', Height);
WinSaveSize:=Ini.ReadBool('Window', 'SaveSize', false);

if Ini.ReadBool('Window', 'HideMaximize', false) then
BorderIcons:=Main.BorderIcons-[biMaximize];

if Ini.ReadBool('Window', 'HideMinimize', false) then
BorderIcons:=Main.BorderIcons-[biMinimize];

case Ini.ReadInteger('Window', 'BorderStyle', 0) of
0: BorderStyle:=bsSizeable;
1: BorderStyle:=bsSingle;
2: BorderStyle:=bsDialog;
3: BorderStyle:=bsSizeToolWin;
4: BorderStyle:=bsToolWindow;
end;

case Ini.ReadInteger('Window', 'WindowState', 0) of
1: WindowState:=wsMaximized;
2: begin BorderStyle:=bsNone; WindowState:=wsMaximized; end;
//3: WindowState:=wsMinimized;
end;

Ini.Free;
OldWidth:=Width;
OldHeight:=Height;
WinOldWidth:=Width;
WinOldHeight:=Height;
end;

end.

0 comments on commit 99a3ddc

Please sign in to comment.