-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuappstate.pas
More file actions
78 lines (61 loc) · 1.29 KB
/
uappstate.pas
File metadata and controls
78 lines (61 loc) · 1.29 KB
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
unit UAppState;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls;
type
TFileState = (fisNotSaved, fisSaved);
TTwoDStrArr = array of array of String;
procedure SetFileStateSaved;
procedure SetFileStateNotSaved;
procedure UpdateCaption(AIsModified: Boolean);
procedure InitAppState(AForm: TForm);
function GetFileState: TFileState;
function GetFilePath: String;
procedure SetFilePath(APath: String);
implementation
var
AppForm: TForm;
AppName: String;
FilePath: String;
FileState: TFileState;
procedure SetAppStateNewFile;
begin
FilePath := 'New Image';
FileState := fisNotSaved;
end;
procedure SetFileStateSaved;
begin
FileState := fisSaved;
end;
procedure SetFileStateNotSaved;
begin
FileState := fisNotSaved;
end;
procedure UpdateCaption(AIsModified: Boolean);
var
LCaption: String;
begin
LCaption := FilePath + ' - ' + AppName;;
If AIsModified then LCaption := '*' + LCaption;
AppForm.Caption := LCaption;
end;
procedure InitAppState(AForm: TForm);
begin
AppForm := AForm;
AppName := AForm.Caption;
SetAppStateNewFile;
end;
function GetFileState: TFileState;
begin
Result := FileState;
end;
function GetFilePath: String;
begin
Result := FilePath;
end;
procedure SetFilePath(APath: String);
begin
FilePath := APath;
end;
end.