-
Notifications
You must be signed in to change notification settings - Fork 0
/
tournamentform.pas
110 lines (92 loc) · 2.75 KB
/
tournamentform.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
unit tournamentform;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, RxDBGrid,
RxDBGridExportSpreadSheet, DBGrids, ComCtrls, DBCtrls, ExtCtrls, Menus, ActnList, IniPropStorage, frmtournamentform,
PropertyStorage
;
type
{ TFrm }
TFrm = class(TForm)
ActnScreen2: TAction;
ActnScreen1: TAction;
ActnSwitchFullScreen: TAction;
ActnLst: TActionList;
FrmTrnmnt: TFrameTournament;
IniPrpStrg: TIniPropStorage;
miFullScreen: TMenuItem;
miScreen1: TMenuItem;
miScreen2: TMenuItem;
PppMnTray: TPopupMenu;
TbShtOptions: TTabSheet;
TryIcn: TTrayIcon;
procedure ActnScreen1Execute({%H-}Sender: TObject);
procedure ActnSwitchFullScreenExecute({%H-}Sender: TObject);
procedure FormClose({%H-}Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormCreate({%H-}Sender: TObject);
procedure IniPrpStrgRestoringProperties(Sender: TObject);
procedure IniPrpStrgSavingProperties(Sender: TObject);
private
FOriginalBounds: TRect;
FOriginalWindowState: TWindowState;
procedure SwitchFullScreen(aMonitor: SmallInt = -1);
public
end;
var
Frm: TFrm;
implementation
{$R *.lfm}
procedure TFrm.SwitchFullScreen(aMonitor: SmallInt);
begin
if Visible=False then
Show;
if BorderStyle <> bsNone then begin
// To full screen
FOriginalWindowState := WindowState;
FOriginalBounds := BoundsRect;
FrmTrnmnt.ToolBarVisible:=False;
BorderStyle := bsNone;
if (Screen.MonitorCount=1) or (aMonitor=-1) then
BoundsRect := Screen.MonitorFromWindow(Handle, mdNearest).BoundsRect
else
BoundsRect:=Screen.Monitors[aMonitor].BoundsRect;
end
else begin
// From full screen
BorderStyle := bsSizeable;
if FOriginalWindowState = wsMaximized then
WindowState := wsMaximized
else
BoundsRect := FOriginalBounds;
FrmTrnmnt.ToolBarVisible:=True;
end;
end;
procedure TFrm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
FrmTrnmnt.ApplyDB;
end;
procedure TFrm.FormCreate(Sender: TObject);
begin
FrmTrnmnt.InitDB;
FrmTrnmnt.QInRound:=10;
end;
procedure TFrm.IniPrpStrgRestoringProperties(Sender: TObject);
begin
FrmTrnmnt.QInRound:= TIniPropStorage(Sender).ReadInteger('QInRound', 11);
FrmTrnmnt.QuestionWithBet:=TIniPropStorage(Sender).ReadInteger('QWithBet', 0);
end;
procedure TFrm.IniPrpStrgSavingProperties(Sender: TObject);
begin
TIniPropStorage(Sender).WriteInteger('QInRound', FrmTrnmnt.QInRound);
TIniPropStorage(Sender).WriteInteger('QWithBet', FrmTrnmnt.QuestionWithBet);
end;
procedure TFrm.ActnSwitchFullScreenExecute(Sender: TObject);
begin
SwitchFullScreen();
end;
procedure TFrm.ActnScreen1Execute(Sender: TObject);
begin
SwitchFullScreen(0);
end;
end.