You've already forked lazarus-ccr
jvcllaz: Add code to create an empty database in JvTimeFrame demo.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7138 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -18,13 +18,14 @@ var
|
|||||||
begin
|
begin
|
||||||
Application.Scaled:=True;
|
Application.Scaled:=True;
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
|
(*
|
||||||
fn := Application.Location + 'data.sqlite';
|
fn := Application.Location + 'data.sqlite';
|
||||||
if not FileExists(fn) then begin
|
if not FileExists(fn) then begin
|
||||||
MessageDlg('Database file "' + fn + '" not found. Copy it from the source directory to here.',
|
MessageDlg('Database file "' + fn + '" not found. Copy it from the source directory to here.',
|
||||||
mtError, [mbOK], 0);
|
mtError, [mbOK], 0);
|
||||||
Halt;
|
Halt;
|
||||||
end;
|
end; *)
|
||||||
|
|
||||||
Application.CreateForm(TMainForm, MainForm);
|
Application.CreateForm(TMainForm, MainForm);
|
||||||
Application.CreateForm(TVisibleResources, VisibleResources);
|
Application.CreateForm(TVisibleResources, VisibleResources);
|
||||||
Application.CreateForm(TShare, Share);
|
Application.CreateForm(TShare, Share);
|
||||||
|
@ -134,6 +134,8 @@ type
|
|||||||
procedure utfScheduleManager1PostAppt(Sender: TObject; Appt: TJvTFAppt);
|
procedure utfScheduleManager1PostAppt(Sender: TObject; Appt: TJvTFAppt);
|
||||||
procedure utfScheduleManager1RefreshAppt(Sender: TObject; Appt: TJvTFAppt);
|
procedure utfScheduleManager1RefreshAppt(Sender: TObject; Appt: TJvTFAppt);
|
||||||
|
|
||||||
|
procedure CreateDatabase(const AFileName: String);
|
||||||
|
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
@ -142,6 +144,8 @@ type
|
|||||||
procedure WeeksComboChange(Sender: TObject);
|
procedure WeeksComboChange(Sender: TObject);
|
||||||
|
|
||||||
private
|
private
|
||||||
|
FNewDatabase: Boolean;
|
||||||
|
|
||||||
{ Private declarations }
|
{ Private declarations }
|
||||||
procedure ApplySettings;
|
procedure ApplySettings;
|
||||||
procedure ReadIni;
|
procedure ReadIni;
|
||||||
@ -193,6 +197,12 @@ begin
|
|||||||
ShareButton.Images := images[IconSet];
|
ShareButton.Images := images[IconSet];
|
||||||
NewSchedButton.Images := images[IconSet];
|
NewSchedButton.Images := images[IconSet];
|
||||||
utfScheduleManager1.StateImages := images[IconSet];
|
utfScheduleManager1.StateImages := images[IconSet];
|
||||||
|
|
||||||
|
if StartToday then
|
||||||
|
GotoDatePicker.Date := Date()
|
||||||
|
else
|
||||||
|
GotoDatePicker.Date := StartDate;
|
||||||
|
GotoDatePickerChange(nil);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -634,18 +644,12 @@ var
|
|||||||
ResName : String;
|
ResName : String;
|
||||||
begin
|
begin
|
||||||
// Initialize the date
|
// Initialize the date
|
||||||
//GotoDatePicker.Date := Date;
|
|
||||||
GotoDatePicker.Date := EncodeDate(2002, 1, 1);
|
|
||||||
|
|
||||||
ReadIni;
|
ReadIni;
|
||||||
(*
|
|
||||||
// Initialize the granularity
|
|
||||||
TimeIncCombo.ItemIndex := 1; // 30 mins
|
|
||||||
|
|
||||||
// Initialize the mode
|
// GotoDatePicker.Date := EncodeDate(2002, 1, 1);
|
||||||
ModeCombo.ItemIndex := 0; // Single mode
|
|
||||||
DaysCombo.ItemIndex := 0; // One day
|
if FNewDatabase then
|
||||||
*)
|
NewSchedButtonClick(nil);
|
||||||
|
|
||||||
// Populate the resource related controls
|
// Populate the resource related controls
|
||||||
With SchedulesQuery do
|
With SchedulesQuery do
|
||||||
@ -849,6 +853,35 @@ begin
|
|||||||
End;
|
End;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.CreateDatabase(const AFileName: String);
|
||||||
|
var
|
||||||
|
sql: String;
|
||||||
|
begin
|
||||||
|
dbUTF.Open;
|
||||||
|
SQLTransaction.Active := true;
|
||||||
|
|
||||||
|
sql := 'CREATE TABLE "GroupAppt" (' +
|
||||||
|
'"ApptID" STRING PRIMARY KEY,'+
|
||||||
|
'"StartDate" DATE,'+
|
||||||
|
'"StartTime" TIME,'+
|
||||||
|
'"EndDate" DATE,'+
|
||||||
|
'"EndTime" TIME,'+
|
||||||
|
'"Description" TEXT,'+
|
||||||
|
'"AlarmEnabled" BOOL,'+
|
||||||
|
'"AlarmAdvance" REAL);';
|
||||||
|
dbUTF.ExecuteDirect(sql);
|
||||||
|
SQLTransaction.Commit;
|
||||||
|
|
||||||
|
sql := 'CREATE TABLE "GroupLink" ('+
|
||||||
|
'"SchedName" String,'+
|
||||||
|
'"ApptID" String);';
|
||||||
|
dbUTF.ExecuteDirect(sql);
|
||||||
|
SQLTransaction.Commit;
|
||||||
|
|
||||||
|
FNewDatabase := true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TMainForm.FormCreate(Sender: TObject);
|
procedure TMainForm.FormCreate(Sender: TObject);
|
||||||
var
|
var
|
||||||
fn: String;
|
fn: String;
|
||||||
@ -911,7 +944,11 @@ begin
|
|||||||
|
|
||||||
fn := Application.Location + 'data.sqlite';
|
fn := Application.Location + 'data.sqlite';
|
||||||
dbUTF.DatabaseName := fn;
|
dbUTF.DatabaseName := fn;
|
||||||
dbUTF.Connected := FileExists(fn);
|
if FileExists(fn) then begin
|
||||||
|
dbUTF.Open;
|
||||||
|
SQLTransaction.Active := true;
|
||||||
|
end else
|
||||||
|
CreateDatabase(fn);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.FormDestroy(Sender: TObject);
|
procedure TMainForm.FormDestroy(Sender: TObject);
|
||||||
@ -933,6 +970,8 @@ begin
|
|||||||
PageControl1.ActivePageIndex := ini.ReadInteger('MainForm', 'PageIndex', 0);
|
PageControl1.ActivePageIndex := ini.ReadInteger('MainForm', 'PageIndex', 0);
|
||||||
PageControl1Change(nil);
|
PageControl1Change(nil);
|
||||||
|
|
||||||
|
GlobalSettings.StartToday := ini.ReadBool('Settings', 'StartToday', GlobalSettings.StartToday);
|
||||||
|
GlobalSettings.StartDate := ini.ReadDate('Settings', 'StartDate', GlobalSettings.StartDate);
|
||||||
GlobalSettings.Hr2400 := ini.ReadBool('Settings', 'Hr2400', GlobalSettings.Hr2400);
|
GlobalSettings.Hr2400 := ini.ReadBool('Settings', 'Hr2400', GlobalSettings.Hr2400);
|
||||||
GlobalSettings.FirstDayOfWeek := TTFDayofWeek(ini.ReadInteger('Settings', 'FirstDayOfWeek', ord(GlobalSettings.FirstDayOfWeek)));
|
GlobalSettings.FirstDayOfWeek := TTFDayofWeek(ini.ReadInteger('Settings', 'FirstDayOfWeek', ord(GlobalSettings.FirstDayOfWeek)));
|
||||||
GlobalSettings.PrimeTimeStart := ini.ReadTime('Settings', 'PrimeTimeStart', GlobalSettings.PrimeTimeStart);
|
GlobalSettings.PrimeTimeStart := ini.ReadTime('Settings', 'PrimeTimeStart', GlobalSettings.PrimeTimeStart);
|
||||||
@ -958,6 +997,8 @@ begin
|
|||||||
ini.WriteInteger('MainForm', 'DaysCombo', DaysCombo.ItemIndex);
|
ini.WriteInteger('MainForm', 'DaysCombo', DaysCombo.ItemIndex);
|
||||||
ini.WriteInteger('MainForm', 'WeeksCombo', WeeksCombo.ItemIndex);
|
ini.WriteInteger('MainForm', 'WeeksCombo', WeeksCombo.ItemIndex);
|
||||||
|
|
||||||
|
ini.WriteBool('Settings', 'StartToday', GlobalSettings.StartToday);
|
||||||
|
ini.WriteDate('Settings', 'StartDate', GlobalSettings.StartDate);
|
||||||
ini.WriteBool('Settings', 'Hr2400', GlobalSettings.Hr2400);
|
ini.WriteBool('Settings', 'Hr2400', GlobalSettings.Hr2400);
|
||||||
ini.WriteInteger('Settings', 'FirstDayOfWeek', ord(GlobalSettings.FirstDayOfWeek));
|
ini.WriteInteger('Settings', 'FirstDayOfWeek', ord(GlobalSettings.FirstDayOfWeek));
|
||||||
ini.WriteTime('Settings', 'PrimeTimeStart', GlobalSettings.PrimeTimeStart);
|
ini.WriteTime('Settings', 'PrimeTimeStart', GlobalSettings.PrimeTimeStart);
|
||||||
|
@ -46,16 +46,18 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 288
|
Left = 288
|
||||||
Height = 50
|
Height = 50
|
||||||
Top = 62
|
Top = 104
|
||||||
Width = 37
|
Width = 37
|
||||||
Anchors = [akTop, akLeft, akBottom]
|
Anchors = [akTop, akLeft, akBottom]
|
||||||
Shape = bsSpacer
|
Shape = bsSpacer
|
||||||
end
|
end
|
||||||
object cbTimeFormat: TComboBox
|
object cbTimeFormat: TComboBox
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideLeft.Control = StartDatePanel
|
||||||
Left = 132
|
AnchorSideTop.Control = Bevel3
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 134
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 8
|
Top = 50
|
||||||
Width = 124
|
Width = 124
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
ItemHeight = 15
|
ItemHeight = 15
|
||||||
@ -72,9 +74,9 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideTop.Control = cbTimeFormat
|
AnchorSideTop.Control = cbTimeFormat
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = cbTimeFormat
|
AnchorSideRight.Control = cbTimeFormat
|
||||||
Left = 59
|
Left = 61
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 12
|
Top = 54
|
||||||
Width = 65
|
Width = 65
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
@ -87,9 +89,9 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = lblTimeFormat
|
AnchorSideRight.Control = lblTimeFormat
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 36
|
Left = 38
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 39
|
Top = 81
|
||||||
Width = 88
|
Width = 88
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Left = 36
|
BorderSpacing.Left = 36
|
||||||
@ -103,9 +105,9 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = cbTimeFormat
|
AnchorSideRight.Control = cbTimeFormat
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 132
|
Left = 134
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 35
|
Top = 77
|
||||||
Width = 124
|
Width = 124
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
@ -117,9 +119,9 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideLeft.Control = cbTimeFormat
|
AnchorSideLeft.Control = cbTimeFormat
|
||||||
AnchorSideTop.Control = cbFirstDayOfWeek
|
AnchorSideTop.Control = cbFirstDayOfWeek
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 132
|
Left = 134
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 62
|
Top = 104
|
||||||
Width = 103
|
Width = 103
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
@ -132,9 +134,9 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideLeft.Control = cbTimeFormat
|
AnchorSideLeft.Control = cbTimeFormat
|
||||||
AnchorSideTop.Control = edPrimeTimeStart
|
AnchorSideTop.Control = edPrimeTimeStart
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 132
|
Left = 134
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 89
|
Top = 131
|
||||||
Width = 103
|
Width = 103
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
@ -148,9 +150,9 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = lblTimeFormat
|
AnchorSideRight.Control = lblTimeFormat
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 40
|
Left = 42
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 66
|
Top = 108
|
||||||
Width = 84
|
Width = 84
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Prime time start'
|
Caption = 'Prime time start'
|
||||||
@ -161,9 +163,9 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = lblTimeFormat
|
AnchorSideRight.Control = lblTimeFormat
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 43
|
Left = 45
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 93
|
Top = 135
|
||||||
Width = 81
|
Width = 81
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Prime time end'
|
Caption = 'Prime time end'
|
||||||
@ -174,9 +176,9 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = Bevel1
|
AnchorSideTop.Control = Bevel1
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 239
|
Left = 241
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 75
|
Top = 117
|
||||||
Width = 104
|
Width = 104
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 4
|
||||||
BorderSpacing.Right = 36
|
BorderSpacing.Right = 36
|
||||||
@ -195,7 +197,7 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 3
|
Height = 3
|
||||||
Top = 120
|
Top = 162
|
||||||
Width = 387
|
Width = 387
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
@ -205,13 +207,16 @@ object SettingsForm: TSettingsForm
|
|||||||
end
|
end
|
||||||
object cbIconSet: TComboBox
|
object cbIconSet: TComboBox
|
||||||
AnchorSideLeft.Control = edPrimeTimeEnd
|
AnchorSideLeft.Control = edPrimeTimeEnd
|
||||||
|
AnchorSideTop.Control = Bevel2
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = cbTimeFormat
|
AnchorSideRight.Control = cbTimeFormat
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 132
|
Left = 134
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 128
|
Top = 171
|
||||||
Width = 124
|
Width = 124
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 6
|
||||||
ItemHeight = 15
|
ItemHeight = 15
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
@ -227,13 +232,97 @@ object SettingsForm: TSettingsForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = lblTimeFormat
|
AnchorSideRight.Control = lblTimeFormat
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 83
|
Left = 85
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 132
|
Top = 175
|
||||||
Width = 41
|
Width = 41
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Icon set'
|
Caption = 'Icon set'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
|
object Label1: TLabel
|
||||||
|
AnchorSideTop.Control = StartDatePanel
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = StartDatePanel
|
||||||
|
Left = 75
|
||||||
|
Height = 15
|
||||||
|
Top = 12
|
||||||
|
Width = 50
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Right = 9
|
||||||
|
Caption = 'Start date'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object StartDatePanel: TPanel
|
||||||
|
AnchorSideTop.Control = Panel1
|
||||||
|
Left = 134
|
||||||
|
Height = 23
|
||||||
|
Top = 8
|
||||||
|
Width = 183
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 23
|
||||||
|
ClientWidth = 183
|
||||||
|
TabOrder = 5
|
||||||
|
object rbStartToday: TRadioButton
|
||||||
|
AnchorSideLeft.Control = StartDatePanel
|
||||||
|
AnchorSideTop.Control = deStartDate
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 0
|
||||||
|
Height = 19
|
||||||
|
Top = 2
|
||||||
|
Width = 52
|
||||||
|
Caption = 'Today'
|
||||||
|
Checked = True
|
||||||
|
TabOrder = 2
|
||||||
|
TabStop = True
|
||||||
|
end
|
||||||
|
object rbStartDate: TRadioButton
|
||||||
|
AnchorSideLeft.Control = rbStartToday
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = deStartDate
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 60
|
||||||
|
Height = 19
|
||||||
|
Top = 2
|
||||||
|
Width = 20
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object deStartDate: TDateEdit
|
||||||
|
AnchorSideLeft.Control = rbStartDate
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = StartDatePanel
|
||||||
|
Left = 80
|
||||||
|
Height = 23
|
||||||
|
Top = 0
|
||||||
|
Width = 103
|
||||||
|
CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames]
|
||||||
|
OnAcceptDate = deStartDateAcceptDate
|
||||||
|
DefaultToday = True
|
||||||
|
DateOrder = doNone
|
||||||
|
ButtonWidth = 23
|
||||||
|
NumGlyphs = 1
|
||||||
|
MaxLength = 0
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Bevel3: TBevel
|
||||||
|
AnchorSideLeft.Control = Panel1
|
||||||
|
AnchorSideTop.Control = StartDatePanel
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Panel1
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 8
|
||||||
|
Height = 3
|
||||||
|
Top = 39
|
||||||
|
Width = 387
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
Shape = bsTopLine
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -10,6 +10,8 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
TGlobalSettings = record
|
TGlobalSettings = record
|
||||||
|
StartToday: Boolean;
|
||||||
|
StartDate: TDate;
|
||||||
Hr2400: Boolean; // 24 hour or 12 hour AM/PM format
|
Hr2400: Boolean; // 24 hour or 12 hour AM/PM format
|
||||||
FirstDayOfWeek: TTFDayOfWeek;
|
FirstDayOfWeek: TTFDayOfWeek;
|
||||||
PrimeTimeStart: TTime;
|
PrimeTimeStart: TTime;
|
||||||
@ -20,6 +22,8 @@ type
|
|||||||
|
|
||||||
var
|
var
|
||||||
GlobalSettings: TGlobalSettings = (
|
GlobalSettings: TGlobalSettings = (
|
||||||
|
StartToday: true;
|
||||||
|
StartDate: 0;
|
||||||
Hr2400: false;
|
Hr2400: false;
|
||||||
FirstDayOfWeek: dowSunday;
|
FirstDayOfWeek: dowSunday;
|
||||||
PrimeTimeStart: 8 * ONE_HOUR;
|
PrimeTimeStart: 8 * ONE_HOUR;
|
||||||
@ -34,11 +38,14 @@ type
|
|||||||
TSettingsForm = class(TForm)
|
TSettingsForm = class(TForm)
|
||||||
Bevel1: TBevel;
|
Bevel1: TBevel;
|
||||||
Bevel2: TBevel;
|
Bevel2: TBevel;
|
||||||
|
Bevel3: TBevel;
|
||||||
ButtonPanel1: TButtonPanel;
|
ButtonPanel1: TButtonPanel;
|
||||||
cbTimeFormat: TComboBox;
|
cbTimeFormat: TComboBox;
|
||||||
cbFirstDayOfWeek: TComboBox;
|
cbFirstDayOfWeek: TComboBox;
|
||||||
clbPrimeTimeColor: TColorButton;
|
clbPrimeTimeColor: TColorButton;
|
||||||
cbIconSet: TComboBox;
|
cbIconSet: TComboBox;
|
||||||
|
deStartDate: TDateEdit;
|
||||||
|
Label1: TLabel;
|
||||||
lblIconSet: TLabel;
|
lblIconSet: TLabel;
|
||||||
lblPrimeTimeStart: TLabel;
|
lblPrimeTimeStart: TLabel;
|
||||||
lblPrimeTimeEnd: TLabel;
|
lblPrimeTimeEnd: TLabel;
|
||||||
@ -47,6 +54,11 @@ type
|
|||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
edPrimeTimeStart: TTimeEdit;
|
edPrimeTimeStart: TTimeEdit;
|
||||||
edPrimeTimeEnd: TTimeEdit;
|
edPrimeTimeEnd: TTimeEdit;
|
||||||
|
StartDatePanel: TPanel;
|
||||||
|
rbStartDate: TRadioButton;
|
||||||
|
rbStartToday: TRadioButton;
|
||||||
|
procedure deStartDateAcceptDate(Sender: TObject; var ADate: TDateTime;
|
||||||
|
var AcceptDate: Boolean);
|
||||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
@ -67,22 +79,37 @@ implementation
|
|||||||
|
|
||||||
procedure TSettingsForm.ControlsToSettings;
|
procedure TSettingsForm.ControlsToSettings;
|
||||||
begin
|
begin
|
||||||
|
GlobalSettings.StartToday := rbStartToday.Checked;
|
||||||
|
GlobalSettings.StartDate := deStartDate.Date;
|
||||||
|
|
||||||
GlobalSettings.Hr2400 := cbTimeFormat.ItemIndex = 0;
|
GlobalSettings.Hr2400 := cbTimeFormat.ItemIndex = 0;
|
||||||
GlobalSettings.FirstDayOfWeek := TTFDayOfWeek(cbFirstDayOfWeek.ItemIndex);
|
GlobalSettings.FirstDayOfWeek := TTFDayOfWeek(cbFirstDayOfWeek.ItemIndex);
|
||||||
GlobalSettings.PrimeTimeStart := frac(edPrimeTimeStart.Time);
|
GlobalSettings.PrimeTimeStart := frac(edPrimeTimeStart.Time);
|
||||||
GlobalSettings.PrimeTimeEnd := frac(edPrimeTimeEnd.Time);
|
GlobalSettings.PrimeTimeEnd := frac(edPrimeTimeEnd.Time);
|
||||||
GlobalSettings.PrimeTimeColor := clbPrimeTimeColor.ButtonColor;
|
GlobalSettings.PrimeTimeColor := clbPrimeTimeColor.ButtonColor;
|
||||||
|
|
||||||
GlobalSettings.IconSet := cbIconSet.ItemIndex;
|
GlobalSettings.IconSet := cbIconSet.ItemIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSettingsForm.deStartDateAcceptDate(Sender: TObject;
|
||||||
|
var ADate: TDateTime; var AcceptDate: Boolean);
|
||||||
|
begin
|
||||||
|
rbStartDate.Checked := true;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSettingsForm.SettingsToControls;
|
procedure TSettingsForm.SettingsToControls;
|
||||||
begin
|
begin
|
||||||
cbTimeFormat.ItemIndex := ord(not GlobalSettings.Hr2400);
|
rbStartToday.Checked := GlobalSettings.StartToday;
|
||||||
|
deStartDate.Date := GlobalSettings.StartDate;
|
||||||
|
if not rbStartToday.Checked and (deStartDate.Date <> 0) then
|
||||||
|
rbStartDate.Checked := true;
|
||||||
|
|
||||||
|
cbTimeFormat.ItemIndex := ord(not GlobalSettings.Hr2400);
|
||||||
cbFirstDayOfWeek.ItemIndex := ord(GlobalSettings.FirstDayOfWeek);
|
cbFirstDayOfWeek.ItemIndex := ord(GlobalSettings.FirstDayOfWeek);
|
||||||
edPrimeTimeStart.Time := GlobalSettings.PrimeTimeStart;
|
edPrimeTimeStart.Time := GlobalSettings.PrimeTimeStart;
|
||||||
edPrimeTimeEnd.Time := GlobalSettings.PrimeTimeEnd;
|
edPrimeTimeEnd.Time := GlobalSettings.PrimeTimeEnd;
|
||||||
clbPrimeTimeColor.ButtonColor := GlobalSettings.PrimeTimeColor;
|
clbPrimeTimeColor.ButtonColor := GlobalSettings.PrimeTimeColor;
|
||||||
|
|
||||||
cbIconSet.ItemIndex := GlobalSettings.IconSet;
|
cbIconSet.ItemIndex := GlobalSettings.IconSet;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user