Skip to content

Commit

Permalink
fMain: allow fullscreen. Close #48.
Browse files Browse the repository at this point in the history
  • Loading branch information
horacekj committed Jan 1, 2024
1 parent da4a3a2 commit 4d7e08c
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 59 deletions.
Binary file added icons/fullscreen.bmp
Binary file not shown.
3 changes: 3 additions & 0 deletions src/GlobalConfig.pas
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ TuLIConfig = record
TFormConfig = record
fMainPos: TPoint;
fMainMaximized: Boolean;
fMainFullScreen: Boolean;
fMainShowSB: Boolean;
fPotvrSekv: TPoint;
end;
Expand Down Expand Up @@ -193,6 +194,7 @@ procedure TGlobConfig.LoadFile(const filename: string = _DEFAULT_FN);
Self.data.forms.fMainPos.Y := ini.ReadInteger('F_Main', 'Y', 0);
Self.data.forms.fMainMaximized := ini.ReadBool('F_Main', 'maximized', False);
Self.data.forms.fMainShowSB := ini.ReadBool('F_Main', 'showStatusBar', True);
Self.data.forms.fMainFullScreen := ini.ReadBool('F_Main', 'fullScreen', False);

Self.data.forms.fPotvrSekv.X := ini.ReadInteger('F_PotvrSekv', 'X', 0);
Self.data.forms.fPotvrSekv.Y := ini.ReadInteger('F_PotvrSekv', 'Y', 0);
Expand Down Expand Up @@ -261,6 +263,7 @@ procedure TGlobConfig.SaveFile(const filename: string);
ini.WriteInteger('F_Main', 'Y', Self.data.forms.fMainPos.Y);
ini.WriteBool('F_Main', 'maximized', Self.data.forms.fMainMaximized);
ini.WriteBool('F_Main', 'showStatusBar', Self.data.forms.fMainShowSB);
ini.WriteBool('F_Main', 'fullScreen', Self.data.forms.fMainFullScreen);

ini.WriteInteger('F_PotvrSekv', 'X', Self.data.forms.fPotvrSekv.X);
ini.WriteInteger('F_PotvrSekv', 'Y', Self.data.forms.fPotvrSekv.Y);
Expand Down
150 changes: 104 additions & 46 deletions src/forms/fMain.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -3552,10 +3552,10 @@ object F_Main: TF_Main
OnClick = SB_DCC_StopClick
end
end
object Panel2: TPanel
Left = 202
object P_Other: TPanel
Left = 258
Top = 4
Width = 126
Width = 102
Height = 25
Margins.Left = 2
Margins.Top = 2
Expand All @@ -3566,7 +3566,7 @@ object F_Main: TF_Main
ParentBackground = False
TabOrder = 5
object SB_Soupravy: TSpeedButton
Left = 50
Left = 26
Top = 1
Width = 24
Height = 22
Expand Down Expand Up @@ -3650,7 +3650,7 @@ object F_Main: TF_Main
ShowHint = True
end
object SB_uLIdaemon: TSpeedButton
Left = 98
Left = 74
Top = 1
Width = 24
Height = 22
Expand Down Expand Up @@ -3692,13 +3692,13 @@ object F_Main: TF_Main
OnClick = SB_uLIdaemonClick
end
object SB_Details: TSpeedButton
Left = 74
Left = 50
Top = 1
Width = 24
Height = 22
Hint = 'Zobrazit/skr'#253't popisky blok'#367
AllowAllUp = True
GroupIndex = 2
GroupIndex = 4
Glyph.Data = {
36030000424D3603000000000000360000002800000010000000100000000100
18000000000000030000C40E0000C40E00000000000000000000FFFFFFFFFFFF
Expand Down Expand Up @@ -3730,47 +3730,9 @@ object F_Main: TF_Main
ShowHint = True
OnClick = SB_DetailsClick
end
object SB_HideStatusBar: TSpeedButton
Left = 26
Top = 1
Width = 24
Height = 22
Hint = 'Skr'#253't stavov'#253' '#345#225'dek'
GroupIndex = 1
Glyph.Data = {
36030000424D3603000000000000360000002800000010000000100000000100
18000000000000030000C40E0000C40E00000000000000000000FFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFF7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F
7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7FFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFF00000000000000
0000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFF
FFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFF000000FFFF
FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFF
FFFF000000FFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFF
FFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFF
FFFF000000FFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFF
FFFFFF000000FFFFFF000000000000000000FFFFFFFFFFFFFFFFFF000000FFFF
FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFF
FFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFF000000
FFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFF
FF000000FFFFFF000000FFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFF
FFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFF
FFFFFF000000FFFFFF000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F7F7F7F7F7F
7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F
7F7F7F7F7F7F7F7F7F7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
ParentShowHint = False
ShowHint = True
OnClick = SB_HideStatusBarClick
end
end
object P_Login: TPanel
Left = 332
Left = 364
Top = 4
Width = 200
Height = 25
Expand Down Expand Up @@ -3861,6 +3823,102 @@ object F_Main: TF_Main
ShowHint = True
TabOrder = 8
end
object P_Form: TPanel
Left = 202
Top = 4
Width = 52
Height = 25
Margins.Left = 2
Margins.Top = 2
Margins.Right = 2
Margins.Bottom = 2
BevelOuter = bvNone
Color = clWhite
ParentBackground = False
TabOrder = 9
object SB_HideStatusBar: TSpeedButton
Left = 26
Top = 1
Width = 24
Height = 22
Hint = 'Skr'#253't stavov'#253' '#345#225'dek'
AllowAllUp = True
GroupIndex = 3
Glyph.Data = {
36030000424D3603000000000000360000002800000010000000100000000100
18000000000000030000C40E0000C40E00000000000000000000FFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFF7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F
7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7FFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFF00000000000000
0000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFF
FFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFF000000FFFF
FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFF
FFFF000000FFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFF
FFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFF
FFFF000000FFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFF
FFFFFF000000FFFFFF000000000000000000FFFFFFFFFFFFFFFFFF000000FFFF
FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFF
FFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFF000000
FFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFF
FF000000FFFFFF000000FFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFF
FFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFF
FFFFFF000000FFFFFF000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F7F7F7F7F7F
7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F
7F7F7F7F7F7F7F7F7F7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
ParentShowHint = False
ShowHint = True
OnClick = SB_HideStatusBarClick
end
object SB_FullScreen: TSpeedButton
Left = 2
Top = 1
Width = 24
Height = 22
Hint = 'Fullscreen re'#382'im (F11)'
AllowAllUp = True
GroupIndex = 2
Glyph.Data = {
B6030000424DB603000000000000360000002800000012000000100000000100
18000000000080030000130B0000130B00000000000000000000FFFFFF000000
000000000000000000000000000000000000FFFFFFFFFFFF0000000000000000
00000000000000000000000000FFFFFF0000FFFFFF0000000000000000000000
00000000000000000000FFFFFFFFFFFF00000000000000000000000000000000
0000000000FFFFFF0000FFFFFF000000000000000000000000FFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000FFFFFF
0000FFFFFF000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFF000000000000000000000000000000FFFFFF0000FFFFFF000000
000000FFFFFF000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF0000000000
00000000FFFFFF000000000000FFFFFF0000FFFFFF000000000000FFFFFFFFFF
FF000000000000000000FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF00
0000000000FFFFFF0000FFFFFF000000000000FFFFFFFFFFFFFFFFFF00000000
0000FFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFF000000000000FFFFFF
0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFF000000000000FFFFFFFFFF
FFFFFFFF000000000000FFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFF00
0000000000FFFFFF0000FFFFFF000000000000FFFFFFFFFFFF00000000000000
0000FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF000000000000FFFFFF
0000FFFFFF000000000000FFFFFF000000000000000000FFFFFFFFFFFFFFFFFF
FFFFFF000000000000000000FFFFFF000000000000FFFFFF0000FFFFFF000000
000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000
00000000000000000000000000FFFFFF0000FFFFFF0000000000000000000000
00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000
0000000000FFFFFF0000FFFFFF00000000000000000000000000000000000000
0000FFFFFFFFFFFF000000000000000000000000000000000000000000FFFFFF
0000FFFFFF000000000000000000000000000000000000000000FFFFFFFFFFFF
000000000000000000000000000000000000000000FFFFFF0000}
ParentShowHint = False
ShowHint = True
OnClick = SB_FullScreenClick
end
end
end
object SB_Main: TStatusBar
Left = 0
Expand Down
42 changes: 29 additions & 13 deletions src/forms/fMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TF_Main = class(TForm)
P_DCC: TPanel;
SB_DCC_Go: TSpeedButton;
SB_DCC_Stop: TSpeedButton;
Panel2: TPanel;
P_Other: TPanel;
SB_Soupravy: TSpeedButton;
A_Settings: TAction;
A_Mute: TAction;
Expand All @@ -52,7 +52,9 @@ TF_Main = class(TForm)
P_Time_modelovy: TPanel;
P_Zrychleni: TPanel;
SB_Details: TSpeedButton;
P_Form: TPanel;
SB_HideStatusBar: TSpeedButton;
SB_FullScreen: TSpeedButton;
procedure FormDestroy(Sender: TObject);
procedure T_MainTimer(Sender: TObject);
procedure AE_MainMessage(var Msg: tagMSG; var Handled: Boolean);
Expand All @@ -74,6 +76,7 @@ TF_Main = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure SB_DetailsClick(Sender: TObject);
procedure SB_HideStatusBarClick(Sender: TObject);
procedure SB_FullScreenClick(Sender: TObject);
private

mute_time: TDateTime;
Expand Down Expand Up @@ -135,6 +138,10 @@ procedure TF_Main.AE_MainMessage(var Msg: tagMSG; var Handled: Boolean);
F_Debug.Show();
VK_F3:
Self.ShowAboutDialog();
VK_F11: begin
Self.SB_FullScreen.Down := not Self.SB_FullScreen.Down;
Self.SB_FullScreenClick(Self.SB_FullScreen);
end;
end; // case
end else if (Msg.Message = WM_MOUSELEAVE) then
begin
Expand Down Expand Up @@ -259,10 +266,12 @@ procedure TF_Main.FormDestroy(Sender: TObject);

if (Assigned(GlobConfig)) then
begin
GlobConfig.data.forms.fMainFullScreen := (Self.BorderStyle = TFormBorderStyle.bsNone);
GlobConfig.data.forms.fMainShowSB := Self.SB_Main.Visible;
GlobConfig.data.forms.fMainMaximized := (Self.WindowState = TWindowState.wsMaximized);
if (Self.WindowState <> TWindowState.wsMaximized) then
GlobConfig.data.forms.fMainPos := Point(Self.Left, Self.Top);

try
GlobConfig.SaveFile();
except
Expand Down Expand Up @@ -338,7 +347,6 @@ procedure TF_Main.Init(config_fn: string);

Self.SB_Main.Visible := GlobConfig.data.forms.fMainShowSB;
Self.SB_HideStatusBar.Down := not GlobConfig.data.forms.fMainShowSB;
Self.SB_HideStatusBar.AllowAllUp := GlobConfig.data.forms.fMainShowSB;

F_splash.ShowState('Vytvářím plátno...');

Expand Down Expand Up @@ -434,7 +442,10 @@ procedure TF_Main.Init(config_fn: string);

F_splash.ShowState('Hotovo');

if (GlobConfig.data.forms.fMainMaximized) then
Self.SB_FullScreen.Down := GlobConfig.data.forms.fMainFullScreen;
if (GlobConfig.data.forms.fMainFullScreen) then
Self.BorderStyle := TFormBorderStyle.bsNone;
if ((GlobConfig.data.forms.fMainMaximized) or (GlobConfig.data.forms.fMainFullScreen)) then
Self.WindowState := TWindowState.wsMaximized;

Self.UpdateuLIIcon();
Expand Down Expand Up @@ -471,25 +482,31 @@ procedure TF_Main.SB_DCC_StopClick(Sender: TObject);

procedure TF_Main.SB_DetailsClick(Sender: TObject);
begin
Self.SB_Details.AllowAllUp := not Self.SB_Details.AllowAllUp;
Self.SB_Details.Down := not Self.SB_Details.Down;
Relief.ShowDetails := Self.SB_Details.Down;
end;

procedure TF_Main.SB_FullScreenClick(Sender: TObject);
begin
if (Self.SB_FullScreen.Down) then
begin
Self.WindowState := TWindowState.wsMaximized;
Self.BorderStyle := TFormBorderStyle.bsNone;
Self.Align := alClient;
end else begin
Self.BorderStyle := TFormBorderStyle.bsSizeable;
Self.Align := alNone;
end;
end;

procedure TF_Main.SB_HideStatusBarClick(Sender: TObject);
begin
Self.SB_HideStatusBar.AllowAllUp := not Self.SB_HideStatusBar.AllowAllUp;
Self.SB_HideStatusBar.Down := not Self.SB_HideStatusBar.Down;
Self.SB_Main.Visible := not Self.SB_HideStatusBar.Down;
Self.UpdateFormConstraints();
Self.Resize();
end;

procedure TF_Main.SB_MuteClick(Sender: TObject);
begin
Self.SB_Mute.AllowAllUp := not Self.SB_Mute.AllowAllUp;
Self.SB_Mute.Down := not Self.SB_Mute.Down;

if (Self.SB_Mute.Down) then
begin
Self.mute_time := Now;
Expand Down Expand Up @@ -559,9 +576,8 @@ procedure TF_Main.T_MainTimer(Sender: TObject);

if ((SoundsPlay.muted) and (Self.mute_time + EncodeTime(0, _MUTE_MIN, 0, 0) <= Now)) then
begin
Self.SB_Mute.AllowAllUp := not Self.SB_Mute.AllowAllUp;
Self.SB_Mute.Down := not Self.SB_Mute.Down;
SoundsPlay.muted := false;
Self.SB_Mute.Down := False;
SoundsPlay.muted := False;
end;
end;

Expand Down

0 comments on commit 4d7e08c

Please sign in to comment.